@@ -694,8 +694,8 @@ private function registerTranslatorConfiguration(array $config, ContainerBuilder
694694 }
695695$ rootDir =$ container ->getParameter ('kernel.root_dir ' );
696696foreach ($ container ->getParameter ('kernel.bundles ' )as $ bundle =>$ class ) {
697- $ reflection =new \ ReflectionClass ($ class );
698- if (is_dir ($ dir =dirname ( $ reflection -> getFileName ()) .'/Resources/translations ' )) {
697+ $ dirname =$ this -> getBundlePath ($ class );
698+ if (is_dir ($ dir =$ dirname .'/Resources/translations ' )) {
699699$ dirs [] =$ dir ;
700700 }
701701if (is_dir ($ dir =$ rootDir .sprintf ('/Resources/%s/translations ' ,$ bundle ))) {
@@ -808,8 +808,7 @@ private function getValidatorMappingFiles(ContainerBuilder $container)
808808
809809$ bundles =$ container ->getParameter ('kernel.bundles ' );
810810foreach ($ bundlesas $ bundle ) {
811- $ reflection =new \ReflectionClass ($ bundle );
812- $ dirname =dirname ($ reflection ->getFileName ());
811+ $ dirname =$ this ->getBundlePath ($ bundle );
813812
814813if (is_file ($ file =$ dirname .'/Resources/config/validation.xml ' )) {
815814$ files [0 ][] =realpath ($ file );
@@ -923,8 +922,7 @@ private function registerSerializerConfiguration(array $config, ContainerBuilder
923922
924923$ bundles =$ container ->getParameter ('kernel.bundles ' );
925924foreach ($ bundlesas $ bundle ) {
926- $ reflection =new \ReflectionClass ($ bundle );
927- $ dirname =dirname ($ reflection ->getFileName ());
925+ $ dirname =$ this ->getBundlePath ($ bundle );
928926
929927if (is_file ($ file =$ dirname .'/Resources/config/serialization.xml ' )) {
930928$ definition =new Definition ('Symfony\Component\Serializer\Mapping\Loader\XmlFileLoader ' ,array (realpath ($ file )));
@@ -990,6 +988,28 @@ private function getKernelRootHash(ContainerBuilder $container)
990988return $ this ->kernelRootHash ;
991989 }
992990
991+ /**
992+ * Gets the path of a given bundle using Bundle#getPath() when available.
993+ *
994+ * @param string $fqcn The bundle FQCN
995+ *
996+ * @return string
997+ */
998+ private function getBundlePath ($ fqcn )
999+ {
1000+ $ reflection =new \ReflectionClass ($ fqcn );
1001+ $ defaultPath =dirname ($ reflection ->getFilename ());
1002+
1003+ if (PHP_VERSION_ID <50400 ) {
1004+ return $ defaultPath ;
1005+ }
1006+
1007+ $ reflectionInstance =$ reflection ->newInstanceWithoutConstructor ();
1008+ $ reflectedPathGetter =new \ReflectionMethod ($ fqcn ,'getPath ' );
1009+
1010+ return $ reflectedPathGetter ->invoke ($ reflectionInstance ) ?:$ defaultPath ;
1011+ }
1012+
9931013/**
9941014 * Returns the base path for the XSD files.
9951015 *