Hi, Omit the leading backslash when using namespaces in strings. They are always fully qualified.
Thanks, Jon On Apr 15, 4:22 pm, Wrzasq <[email protected]> wrote: > Hello. > > We are working on our new engine in Chillout Development and we choose > to use Symfony 2 for it's base. As a lead programmer i've encountered > a little problem. Not sure if it was somehow discussed here, but i > didn't find any related posts. The case is that sometimes autoloading > handlers recives classnames with leading backslash, which happens > mainly when request comes after calling PHP-level routines (like > call_user_func() etc, that takes place in Dependency Injection > Container). Maybe i just over-thought some things with putting > fully-qualified class names everywhere and leading root backslash, but > preventing from this case isn't a big deal and i believe it won't > break anything. I faced this problem durning developing my Hormon ORM > library so it should also work with Symfony UniversalClassLoader > without any problems with compatibility - i'm attaching patch for such > cases. > > This is the example which brought problems for me: > > <service id="chilldev.hormon" > class="\ChillDev\Framework\ChillDevBundle\Hormon\Loader" > constructor="getMap"> > > The result: > > exception 'ErrorException' with message 'Warning: call_user_func() > expects parameter 1 to be a valid callback, class > '\ChillDev\Framework\ChillDevBundle\Hormon\Loader' not found in > /home/wrzasq/public_html/engine/chillout/projects/application/cache/development/applicationProjectContainer.php > line 515' in > /home/wrzasq/public_html/engine/chillout/library/Symfony/Foundation/Debug/ErrorHandler.php:62 > Stack trace: > #0 [internal function]: > Symfony\Foundation\Debug\ErrorHandler->handle(2, 'call_user_func(...', > '/home/wrzasq/pu...', 515, Array) > #1 > /home/wrzasq/public_html/engine/chillout/projects/application/cache/development/applicationProjectContainer.php(515): > call_user_func(Array, 'config/config.p...') > #2 > /home/wrzasq/public_html/engine/chillout/library/Symfony/Components/DependencyInjection/Container.php(203): > applicationProjectContainer->getChilldev_HormonService() > #3 > /home/wrzasq/public_html/engine/chillout/library/ChillDev/Framework/ChillDevBundle/Bundle.php(49): > Symfony\Components\DependencyInjection\Container->getService('chilldev.hormon') > #4 > /home/wrzasq/public_html/engine/chillout/library/Symfony/Foundation/Kernel.php(119): > ChillDev\Framework\ChillDevBundle\Bundle->boot(Object(applicationProjectContainer)) > #5 > /home/wrzasq/public_html/engine/chillout/library/Symfony/Foundation/Kernel.php(136): > Symfony\Foundation\Kernel->boot() > #6 > /home/wrzasq/public_html/engine/chillout/library/Symfony/Foundation/Kernel.php(129): > Symfony\Foundation\Kernel->handle() > #7 > /home/wrzasq/public_html/engine/chillout/projects/application/public/index.php(27): > Symfony\Foundation\Kernel->run() > #8 {main} > > ( class ChillDev\Framework\ChillDevBundle\Hormon\Loader works fine, > but as i wrote this case applies to all calls that comes from within > PHP ) > > with best regards, > -- > Chillout Development, Rafał Wrzeszcz > > +48 605 071 040 > > http://wrzasq.pl/,http://chilldev.pl/- Tworzenie stron i aplikacji > internetowych. > > patch > < 1KViewDownload -- If you want to report a vulnerability issue on symfony, please send it to security at symfony-project.com You received this message because you are subscribed to the Google Groups "symfony developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/symfony-devs?hl=en
