UseMuffin / Footprint

CakePHP plugin to allow passing currently logged in user to model layer.
MIT License
95 stars 23 forks source link

CakePHP 3.9.7 breaks muffin/footprint plugin #15377 #77

Closed reloxx13 closed 3 years ago

reloxx13 commented 3 years ago

This is a (multiple allowed):

What you did

composer update cakephp updating to 3.9.7

What happened

after updating cakephp, the muffin/footprint (v1.2.2) throws a 500.

What you expected to happen

geting the user from the muffin/footprint plugin

grafik

https://github.com/cakephp/cakephp/issues/15377

reloxx13 commented 3 years ago

The 2.x verion of footprint does not work with cakephp 3.x

AngelGuerra commented 3 years ago

Same problem here.

Footprint version: 1.2.2.

After upgrade CakePHP to 3.9.7 from 3.9.6:

1) App\Test\TestCase\Controller\ActionPrioritiesControllerTest::testIndex with data set #0 ('', 4)
Possibly related to RuntimeException: "Infinite recursion. Cannot call get() on Table that is being constructed." 
#0 /path/to/project/vendor/cakephp/cakephp/src/ORM/TableRegistry.php(148): Cake\ORM\Locator\TableLocator->get('Users', Array)
#1 /path/to/project/vendor/muffin/footprint/src/Auth/FootprintAwareTrait.php(138): Cake\ORM\TableRegistry::get('Users')
#2 /path/to/project/vendor/muffin/footprint/src/Auth/FootprintAwareTrait.php(165): App\Controller\AppController->_circumventEventManager('getEntityClass')
#3 /path/to/project/vendor/muffin/footprint/src/Auth/FootprintAwareTrait.php(120): App\Controller\AppController->_checkUserInstanceOf(Array)
#4 /path/to/project/vendor/muffin/footprint/src/Auth/FootprintAwareTrait.php(107): App\Controller\AppController->_getUserInstance(Array)
#5 /path/to/project/vendor/muffin/footprint/src/Auth/FootprintAwareTrait.php(78): App\Controller\AppController->_setCurrentUser(Array)
#6 /path/to/project/vendor/muffin/footprint/src/Auth/FootprintAwareTrait.php(57): App\Controller\AppController->_getCurrentUser()
#7 /path/to/project/vendor/cakephp/cakephp/src/Event/EventManager.php(351): App\Controller\AppController->footprint(Object(Cake\Event\Event))
#8 /path/to/project/vendor/cakephp/cakephp/src/Event/EventManager.php(328): Cake\Event\EventManager->_callListener(Array, Object(Cake\Event\Event))
#9 /path/to/project/vendor/cakephp/cakephp/src/Event/EventDispatcherTrait.php(112): Cake\Event\EventManager->dispatch(Object(Cake\Event\Event))
#10 /path/to/project/vendor/cakephp/cakephp/src/ORM/Table.php(301): Cake\ORM\Table->dispatchEvent('Model.initializ...')
#11 /path/to/project/vendor/cakephp/cakephp/src/ORM/Locator/TableLocator.php(307): Cake\ORM\Table->__construct(Array)
#12 /path/to/project/vendor/cakephp/cakephp/src/ORM/Locator/TableLocator.php(260): Cake\ORM\Locator\TableLocator->_create(Array)
#13 /path/to/project/vendor/cakephp/cakephp/src/Datasource/ModelAwareTrait.php(127): Cake\ORM\Locator\TableLocator->get('Users', Array)
#14 /path/to/project/src/Controller/AppController.php(108): Cake\Controller\Controller->loadModel('Users')
#15 /path/to/project/src/Controller/AppController.php(95): App\Controller\AppController->checkOwner()
#16 /path/to/project/vendor/cakephp/cakephp/src/Event/EventManager.php(351): App\Controller\AppController->beforeFilter(Object(Cake\Event\Event))
#17 /path/to/project/vendor/cakephp/cakephp/src/Event/EventManager.php(328): Cake\Event\EventManager->_callListener(Array, Object(Cake\Event\Event))
#18 /path/to/project/vendor/cakephp/cakephp/src/Event/EventDispatcherTrait.php(112): Cake\Event\EventManager->dispatch(Object(Cake\Event\Event))
#19 /path/to/project/vendor/cakephp/cakephp/src/Controller/Controller.php(673): Cake\Controller\Controller->dispatchEvent('Controller.init...')
#20 /path/to/project/vendor/cakephp/cakephp/src/Http/ActionDispatcher.php(115): Cake\Controller\Controller->startupProcess()
#21 /path/to/project/vendor/cakephp/cakephp/src/Http/ActionDispatcher.php(94): Cake\Http\ActionDispatcher->_invoke(Object(App\Controller\ActionPrioritiesController))
#22 /path/to/project/vendor/cakephp/cakephp/src/Http/BaseApplication.php(256): Cake\Http\ActionDispatcher->dispatch(Object(Cake\Http\ServerRequest), Object(Cake\Http\Response))
#23 /path/to/project/vendor/cakephp/cakephp/src/Http/Runner.php(65): Cake\Http\BaseApplication->__invoke(Object(Cake\Http\ServerRequest), Object(Cake\Http\Response), Object(Cake\Http\Runner))
#24 /path/to/project/vendor/cakephp/cakephp/src/Routing/Middleware/RoutingMiddleware.php(164): Cake\Http\Runner->__invoke(Object(Cake\Http\ServerRequest), Object(Cake\Http\Response))
#25 /path/to/project/vendor/cakephp/cakephp/src/Http/Runner.php(65): Cake\Routing\Middleware\RoutingMiddleware->__invoke(Object(Cake\Http\ServerRequest), Object(Cake\Http\Response), Object(Cake\Http\Runner))
#26 /path/to/project/vendor/ozee31/cakephp-cors/src/Routing/Middleware/CorsMiddleware.php(32): Cake\Http\Runner->__invoke(Object(Cake\Http\ServerRequest), Object(Cake\Http\Response))
#27 /path/to/project/vendor/cakephp/cakephp/src/Http/Runner.php(65): Cors\Routing\Middleware\CorsMiddleware->__invoke(Object(Cake\Http\ServerRequest), Object(Cake\Http\Response), Object(Cake\Http\Runner))
#28 /path/to/project/vendor/cakephp/cakephp/src/Routing/Middleware/AssetMiddleware.php(88): Cake\Http\Runner->__invoke(Object(Cake\Http\ServerRequest), Object(Cake\Http\Response))
#29 /path/to/project/vendor/cakephp/cakephp/src/Http/Runner.php(65): Cake\Routing\Middleware\AssetMiddleware->__invoke(Object(Cake\Http\ServerRequest), Object(Cake\Http\Response), Object(Cake\Http\Runner))
#30 /path/to/project/vendor/cakephp/cakephp/src/Error/Middleware/ErrorHandlerMiddleware.php(100): Cake\Http\Runner->__invoke(Object(Cake\Http\ServerRequest), Object(Cake\Http\Response))
#31 /path/to/project/vendor/cakephp/cakephp/src/Http/Runner.php(65): Cake\Error\Middleware\ErrorHandlerMiddleware->__invoke(Object(Cake\Http\ServerRequest), Object(Cake\Http\Response), Object(Cake\Http\Runner))
#32 /path/to/project/vendor/cakephp/cakephp/src/Http/Runner.php(51): Cake\Http\Runner->__invoke(Object(Cake\Http\ServerRequest), Object(Cake\Http\Response))
#33 /path/to/project/vendor/cakephp/cakephp/src/Http/Server.php(97): Cake\Http\Runner->run(Object(Cake\Http\MiddlewareQueue), Object(Cake\Http\ServerRequest), Object(Cake\Http\Response))
#34 /path/to/project/vendor/cakephp/cakephp/src/TestSuite/MiddlewareDispatcher.php(201): Cake\Http\Server->run(Object(Cake\Http\ServerRequest))
#35 /path/to/project/vendor/cakephp/cakephp/src/TestSuite/IntegrationTestTrait.php(534): Cake\TestSuite\MiddlewareDispatcher->execute(Array)
#36 /path/to/project/vendor/cakephp/cakephp/src/TestSuite/IntegrationTestTrait.php(414): App\Test\TestCase\Controller\ActionPrioritiesControllerTest->_sendRequest('/v1/action_prio...', 'GET')
#37 /path/to/project/tests/TestCase/Controller/ActionPrioritiesControllerTest.php(53): App\Test\TestCase\Controller\ActionPrioritiesControllerTest->get('/v1/action_prio...')
#38 [internal function]: App\Test\TestCase\Controller\ActionPrioritiesControllerTest->testIndex('', 4)
#39 /path/to/project/vendor/phpunit/phpunit/src/Framework/TestCase.php(1071): ReflectionMethod->invokeArgs(Object(App\Test\TestCase\Controller\ActionPrioritiesControllerTest), Array)
#40 /path/to/project/vendor/phpunit/phpunit/src/Framework/TestCase.php(939): PHPUnit\Framework\TestCase->runTest()
#41 /path/to/project/vendor/phpunit/phpunit/src/Framework/TestResult.php(698): PHPUnit\Framework\TestCase->runBare()
#42 /path/to/project/vendor/phpunit/phpunit/src/Framework/TestCase.php(894): PHPUnit\Framework\TestResult->run(Object(App\Test\TestCase\Controller\ActionPrioritiesControllerTest))
#43 /path/to/project/vendor/phpunit/phpunit/src/Framework/TestSuite.php(755): PHPUnit\Framework\TestCase->run(Object(PHPUnit\Framework\TestResult))
#44 /path/to/project/vendor/phpunit/phpunit/src/Framework/TestSuite.php(755): PHPUnit\Framework\TestSuite->run(Object(PHPUnit\Framework\TestResult))
#45 /path/to/project/vendor/phpunit/phpunit/src/Framework/TestSuite.php(755): PHPUnit\Framework\TestSuite->run(Object(PHPUnit\Framework\TestResult))
#46 /path/to/project/vendor/phpunit/phpunit/src/TextUI/TestRunner.php(545): PHPUnit\Framework\TestSuite->run(Object(PHPUnit\Framework\TestResult))
#47 /path/to/project/vendor/phpunit/phpunit/src/TextUI/Command.php(195): PHPUnit\TextUI\TestRunner->doRun(Object(PHPUnit\Framework\TestSuite), Array, true)
#48 /path/to/project/vendor/phpunit/phpunit/src/TextUI/Command.php(148): PHPUnit\TextUI\Command->run(Array, true)
#49 /path/to/project/vendor/phpunit/phpunit/phpunit(53): PHPUnit\TextUI\Command::main()
#50 {main}
Failed asserting that 500 is between 200 and 204.
ADmad commented 3 years ago

A new core release will be done soon to revert the change which caused this problem. Until then you can pin the core to 3.9.6.

AngelGuerra commented 3 years ago

Perfect @ADmad. I will be waiting for it, thank you!

ADmad commented 3 years ago

New 3.9 release has been done.