Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

added a DebuClassLoader::findFile() method to make the wrapping less invasive #7168

Merged
merged 1 commit into from Feb 27, 2013

Conversation

Projects
None yet
6 participants
Contributor

lsmith77 commented Feb 24, 2013

Q A
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets -
License MIT

i have classified it as a bug fix, since due to the wrapping it can break assumptions about the loaded class loader, so implementing this method at least doesnt break the assumption that findFile() is available.

actually i think we should also introduced a loader interface to reduce the duct typing

Member

stof commented Feb 24, 2013

👎 for the interface:

  • it would make the use of the autoloader more difficult (you would have to require the interface before requiring the loader)
  • it would forbid using these wrappers with the composer ClassLoader
Contributor

digitalkaoz commented Feb 24, 2013

mh, i think all autoloaders should follow a common interface, maybe its worth to think about a PSR?

Contributor

lsmith77 commented Feb 24, 2013

ah I see

Member

stof commented Feb 24, 2013

@digitalkaoz Such an interface would have to be in PHP itself, otherwise, you would have to require it first each time (as it cannot be autoloaded before registering the autoloader). And an autoloader in PHP is just a callable.

Contributor

digitalkaoz commented Feb 24, 2013

Yes @stof, i know, but it would be nice if all autoloaders follows a common pattern , call it a convention ;)

@fabpot fabpot added a commit that referenced this pull request Feb 27, 2013

@fabpot fabpot merged branch lsmith77/debugclassloader_findfile_2_1 (PR #7168)
This PR was merged into the 2.1 branch.

Commits
-------

0690709 added a DebuClassLoader::findFile() method to make the wrapping less invasive

Discussion
----------

added a DebuClassLoader::findFile() method to make the wrapping less invasive

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT

i have classified it as a bug fix, since due to the wrapping it can break assumptions about the loaded class loader, so implementing this method at least doesnt break the assumption that ``findFile()`` is available.

actually i think we should also introduced a loader interface to reduce the duct typing

---------------------------------------------------------------------------

by stof at 2013-02-24T16:39:46Z

👎 for the interface:

- it would make the use of the autoloader more difficult (you would have to require the interface before requiring the loader)
- it would forbid using these wrappers with the composer ClassLoader

---------------------------------------------------------------------------

by digitalkaoz at 2013-02-24T19:16:36Z

mh, i think all autoloaders should follow a common interface, maybe its worth to think about a PSR?

---------------------------------------------------------------------------

by lsmith77 at 2013-02-24T19:27:27Z

ah I see

---------------------------------------------------------------------------

by stof at 2013-02-24T20:33:07Z

@digitalkaoz Such an interface would have to be in PHP itself, otherwise, you would have to require it first each time (as it cannot be autoloaded before registering the autoloader). And an autoloader in PHP is just a callable.

---------------------------------------------------------------------------

by digitalkaoz at 2013-02-24T20:47:10Z

Yes @stof, i know, but it would be nice if all autoloaders follows a common pattern , call it a convention ;)
d10ad0f

@fabpot fabpot merged commit 0690709 into symfony:2.1 Feb 27, 2013

1 check failed

default Scrutinizer: Timed out — Travis: Errored
Details

Elexy commented Mar 19, 2013

After upgrading from 2.1.8 and running my tests I get a maximum nesting level error on this exact method. When I echo the $class I see that with every test the search for all required $classes is nested an extra 4 times, resulting in a nesting level limit error at some point. In 2.1.8. I had no problems. If I comment this out all tests pass as well.

I am running functional tests with the crawler on a API.

Fatal error: Maximum function nesting level of '100' reached, aborting! in /home/alex/dev_partition/SGMobile/vendor/symfony/symfony/src/Symfony/Component/ClassLoader/DebugClassLoader.php on line 81

Call Stack:
    0.0005     228504   1. {main}() /usr/bin/phpunit:0
    0.0062     509688   2. PHPUnit_TextUI_Command::main() /usr/bin/phpunit:46
    0.0062     509920   3. PHPUnit_TextUI_Command->run() /usr/share/php/PHPUnit/TextUI/Command.php:129
    0.0841    4830552   4. PHPUnit_TextUI_TestRunner->doRun() /usr/share/php/PHPUnit/TextUI/Command.php:176
    0.0871    5121080   5. PHPUnit_Framework_TestSuite->run() /usr/share/php/PHPUnit/TextUI/TestRunner.php:346
   14.9327   69203968   6. PHPUnit_Framework_TestSuite->run() /usr/share/php/PHPUnit/Framework/TestSuite.php:705
   20.4116   87237944   7. PHPUnit_Framework_TestSuite->runTest() /usr/share/php/PHPUnit/Framework/TestSuite.php:745
   20.4117   87237944   8. PHPUnit_Framework_TestCase->run() /usr/share/php/PHPUnit/Framework/TestSuite.php:775
   20.4117   87237944   9. PHPUnit_Framework_TestResult->run() /usr/share/php/PHPUnit/Framework/TestCase.php:769
   20.4118   87238712  10. PHPUnit_Framework_TestCase->runBare() /usr/share/php/PHPUnit/Framework/TestResult.php:648
   21.2521   83913760  11. PHPUnit_Framework_TestCase->runTest() /usr/share/php/PHPUnit/Framework/TestCase.php:824
   21.2521   83914640  12. ReflectionMethod->invokeArgs() /usr/share/php/PHPUnit/Framework/TestCase.php:969
   21.2521   83914672  13. SGMobile\Bundle\ApiBundle\Tests\Controller\NotificationControllerTest->testUpdateNotification() /usr/share/php/PHPUnit/Framework/TestCase.php:969
   21.6207   87398904  14. Symfony\Component\BrowserKit\Client->request() /home/alex/dev_partition/SGMobile/src/SGMobile/Bundle/ApiBundle/Tests/Controller/NotificationControllerTest.php:167
   21.6210   87410664  15. Symfony\Bundle\FrameworkBundle\Client->doRequest() /home/alex/dev_partition/SGMobile/vendor/symfony/symfony/src/Symfony/Component/BrowserKit/Client.php:264
   21.6211   87410784  16. Symfony\Component\HttpKernel\Client->doRequest() /home/alex/dev_partition/SGMobile/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Client.php:111
   21.6211   87410784  17. Symfony\Component\HttpKernel\Kernel->handle() /home/alex/dev_partition/SGMobile/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Client.php:61
   21.6649   87739880  18. Symfony\Component\HttpKernel\DependencyInjection\ContainerAwareHttpKernel->handle() /home/alex/dev_partition/SGMobile/app/bootstrap.php.cache:411
   21.6649   87741088  19. Symfony\Component\HttpKernel\HttpKernel->handle() /home/alex/dev_partition/SGMobile/app/bootstrap.php.cache:1101
   21.6649   87741088  20. Symfony\Component\HttpKernel\HttpKernel->handleRaw() /home/alex/dev_partition/SGMobile/app/bootstrap.php.cache:975
   21.7007   88156440  21. Symfony\Component\HttpKernel\Debug\TraceableEventDispatcher->dispatch() /home/alex/dev_partition/SGMobile/app/bootstrap.php.cache:998
   21.7013   88168304  22. Symfony\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch() /home/alex/dev_partition/SGMobile/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Debug/TraceableEventDispatcher.php:135
   21.7013   88168304  23. Symfony\Component\EventDispatcher\EventDispatcher->dispatch() /home/alex/dev_partition/SGMobile/vendor/symfony/symfony/src/Symfony/Component/EventDispatcher/ContainerAwareEventDispatcher.php:167
   21.7014   88169160  24. Symfony\Component\EventDispatcher\EventDispatcher->doDispatch() /home/alex/dev_partition/SGMobile/vendor/symfony/symfony/src/Symfony/Component/EventDispatcher/EventDispatcher.php:53
   21.7027   88188184  25. call_user_func() /home/alex/dev_partition/SGMobile/vendor/symfony/symfony/src/Symfony/Component/EventDispatcher/EventDispatcher.php:164
   21.7027   88188216  26. Symfony\Component\HttpKernel\Debug\TraceableEventDispatcher->Symfony\Component\HttpKernel\Debug\{closure}() /home/alex/dev_partition/SGMobile/vendor/symfony/symfony/src/Symfony/Component/EventDispatcher/EventDispatcher.php:164
   21.7030   88193072  27. call_user_func() /home/alex/dev_partition/SGMobile/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Debug/TraceableEventDispatcher.php:447
   21.7030   88193104  28. Sensio\Bundle\FrameworkExtraBundle\EventListener\ParamConverterListener->onKernelController() /home/alex/dev_partition/SGMobile/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Debug/TraceableEventDispatcher.php:447
   21.7031   88194752  29. Sensio\Bundle\FrameworkExtraBundle\Request\ParamConverter\ParamConverterManager->apply() /home/alex/dev_partition/SGMobile/vendor/sensio/framework-extra-bundle/Sensio/Bundle/FrameworkExtraBundle/EventListener/ParamConverterListener.php:85
   21.7031   88195072  30. Sensio\Bundle\FrameworkExtraBundle\Request\ParamConverter\ParamConverterManager->applyConverter() /home/alex/dev_partition/SGMobile/vendor/sensio/framework-extra-bundle/Sensio/Bundle/FrameworkExtraBundle/Request/ParamConverter/ParamConverterManager.php:48
   21.7032   88195512  31. Sensio\Bundle\FrameworkExtraBundle\Request\ParamConverter\DoctrineParamConverter->apply() /home/alex/dev_partition/SGMobile/vendor/sensio/framework-extra-bundle/Sensio/Bundle/FrameworkExtraBundle/Request/ParamConverter/ParamConverterManager.php:93
   21.7032   88196328  32. Sensio\Bundle\FrameworkExtraBundle\Request\ParamConverter\DoctrineParamConverter->find() /home/alex/dev_partition/SGMobile/vendor/sensio/framework-extra-bundle/Sensio/Bundle/FrameworkExtraBundle/Request/ParamConverter/DoctrineParamConverter.php:54
   21.7033   88196376  33. EntityManager51484397e09ed_546a8d27f194334ee012bfe64f629947b07e4919\__CG__\Doctrine\ORM\EntityManager->getRepository() /home/alex/dev_partition/SGMobile/vendor/sensio/framework-extra-bundle/Sensio/Bundle/FrameworkExtraBundle/Request/ParamConverter/DoctrineParamConverter.php:92
   21.7033   88196376  34. Doctrine\ORM\EntityManager->getRepository() /home/alex/dev_partition/SGMobile/app/cache/test/jms_diextra/doctrine/EntityManager_51484397e09ed.php:207
   21.7033   88196944  35. Symfony\Component\ClassLoader\DebugClassLoader->loadClass() /home/alex/dev_partition/SGMobile/app/cache/test/jms_diextra/doctrine/EntityManager_51484397e09ed.php:0
   21.7033   88196944  36. Symfony\Component\ClassLoader\DebugClassLoader->findFile() /home/alex/dev_partition/SGMobile/vendor/symfony/symfony/src/Symfony/Component/ClassLoader/DebugClassLoader.php:95
   21.7033   88196944  37. Symfony\Component\ClassLoader\DebugClassLoader->findFile() /home/alex/dev_partition/SGMobile/vendor/symfony/symfony/src/Symfony/Component/ClassLoader/DebugClassLoader.php:81
--- repeated 100 times ----
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment