# |
May 9th 2021, 14:22 |
kevin.pfeifer |
@cake101 instead of using the upgrade tool I would just stick with setting ```'Error' => [ 'errorLevel' => E_ALL, ]``` then upgrading PHP and cakephp/cakephp package and fix errors, warnings etc. as they occur |
# |
May 9th 2021, 14:20 |
kevin.pfeifer |
thats why this line throws an error https://github.com/cakephp/upgrade/blob/534a15ce655d29b704f2d093fc21a208d3c4a08b/config/rector/cakephp40.php#L15 |
# |
May 9th 2021, 14:20 |
kevin.pfeifer |
seems like rectorphp has removed the CAKEPHP_40 constant in its SetList https://github.com/rectorphp/rector/commit/8f9e234b4a59b4769fb63afc13a9700ec3866052#diff-cc479759f82de6d4aff4f5f31[…]185e285777bfbaa667e9d9c299bfL77 |
# |
May 9th 2021, 13:16 |
cnizzardini |
What command are you running? |
# |
May 8th 2021, 19:40 |
cake101 |
Hi everyone - I am trying to upgrade my CakePHP 3.9 application to CakePHP 4.0 using the upgrade tool, but when I follow the instructions at https://book.cakephp.org/4/en/appendices/4-0-upgrade-guide.html# I get the following error: [ERROR] Undefined class constant 'CAKEPHP_40' |
# |
May 8th 2021, 16:50 |
ndm |
@etibor It would probably help if you show some example code, it's hard to understand what exactly you're doing, and why things are failing. |
# |
May 8th 2021, 16:49 |
slackebot |
calls send the required cookie and header ( https://book.cakephp.org/4/en/controllers/middleware.html#csrf-protection-and-ajax-requests ). |
# |
May 8th 2021, 16:49 |
ndm |
@jigar23121987 If your API is stateless, then disable CSRF protection for it, respectively only enable it where it's actually needed ( https://book.cakephp.org/4/en/controllers/middleware.html#skipping-csrf-checks-for-specific-actions ), as CSRF is only possible with authentication that is being applied automatically by the user agent (like session cookies). If your API has state (for whatever reason), make sure that your AJAX |
# |
May 8th 2021, 13:51 |
cnizzardini |
I was checking out some your libraries on this topic actually. What kind of benchmarks did you get from this: https://github.com/CakeDC/cakephp-phppm |
# |
May 8th 2021, 10:38 |
etibor |
i tried to implement a bulk delete, for duplicated entries, i dont want to delete reecords with associated model the issue is that the bulk delete stop by where is an associated model and dont delete the rest of dupliactes i tried with deleteOrFail but it does not helped |
# |
May 8th 2021, 10:36 |
etibor |
hello everyone |
# |
May 8th 2021, 05:48 |
jigar23121987 |
Missing CSRF token cookie *Error:* The requested address *'/saveeformresponse'* was not found on this server. Back |
# |
May 8th 2021, 05:48 |
jigar23121987 |
Can you please help how to post method use api call in my cakephp source code? |
# |
May 8th 2021, 05:47 |
jigar23121987 |
Hello |
# |
May 8th 2021, 02:43 |
kholby |
I've read the relevant sections of the book several times, and I cannot figure out what I'm missing. |
# |
May 8th 2021, 02:42 |
kholby |
Hello, I have an old CakePHP application (2.6.1) and I am trying to add a new model, ProductDocument, which belongs to a Product. I added both the belongsTo and the hasMany, but the Product is not present when I query ProductDocuments. |
# |
May 7th 2021, 23:37 |
thomas078 |
will try to solve that later |
# |
May 7th 2021, 23:32 |
thomas078 |
For your redirect problem, you can debug if you land here, and if you get a valid redirect url: https://github.com/cakephp/authentication/blob/1.x/src/Middleware/AuthenticationMiddleware.php#L129-L137 Did not land there |
# |
May 7th 2021, 23:30 |
thomas078 |
But something positive as well. Authorization looks great. |
# |
May 7th 2021, 23:30 |
thomas078 |
inside Application.php -> public function getAuthenticationService(ServerRequestInterface $request, ResponseInterface $response) { |
# |
May 7th 2021, 23:27 |
ndm |
I mean... I have no idea where you debugged that :upside_down_face: |
# |
May 7th 2021, 23:14 |
thomas078 |
it is there at middleware level. Just does not work |
# |
May 7th 2021, 23:13 |
slackebot |
"identityAttribute" => "identity" "queryParam" => "redirect" "unauthenticatedRedirect" => "/users/login" ] #_configInitialized: true }``` |
# |
May 7th 2021, 23:13 |
thomas078 |
```^ Authentication\AuthenticationService {#47 ▼ #_authenticators: Authentication\Authenticator\AuthenticatorCollection {#49 ▶} #_identifiers: Authentication\Identifier\IdentifierCollection {#46 ▶} #_successfulAuthenticator: null #_result: null #_defaultConfig: array:6 [▶] #_config: array:6 [▼ "authenticators" => [] "identifiers" => [] "identityClass" => "Authentication\Identity" |
# |
May 7th 2021, 23:06 |
thomas078 |
let me try to debug it properly |
# |
May 7th 2021, 23:06 |
slackebot |
'fields' => [ 'username' => 'username', 'password' => 'password', ] ]); // Load the authenticators $service->loadAuthenticator('Authentication.Session'); $service->loadAuthenticator('Authentication.Form'); return $service; }``` |
# |
May 7th 2021, 23:06 |
thomas078 |
``` public function getAuthenticationService(ServerRequestInterface $request, ResponseInterface $response) { // Instantiate the service $service = new AuthenticationService(); $service->setConfig([ 'unauthenticatedRedirect' => '/users/login', 'queryParam' => 'redirect', ]); // Load identifiers $service->loadIdentifier('Authentication.Password', [ |
# |
May 7th 2021, 23:03 |
ndm |
Don't let the trace fool you, you wouldn't see an entry for the middleware in there, as the exception is being rethrown. Add a debug statement or a breakpoint in the middleware to be sure. |
# |
May 7th 2021, 22:56 |
slackebot |
/home/tomppa/www/gtms/vendor/cakephp/cakephp/src/Http/Server.php(97): Cake\Http\Runner->run() #20 /home/tomppa/www/gtms/webroot/index.php(40): Cake\Http\Server->run() #21 {main} Request URL: /users/index``` |
# |
May 7th 2021, 22:56 |
slackebot |
/home/tomppa/www/gtms/vendor/cakephp/authentication/src/Middleware/AuthenticationMiddleware.php(116): Cake\Http\Runner->__invoke() #17 /home/tomppa/www/gtms/vendor/cakephp/cakephp/src/Http/Runner.php(65): Authentication\Middleware\AuthenticationMiddleware->__invoke() #18 /home/tomppa/www/gtms/vendor/cakephp/cakephp/src/Http/Runner.php(51): Cake\Http\Runner->__invoke() #19 |
# |
May 7th 2021, 22:56 |
slackebot |
/home/tomppa/www/gtms/vendor/cakephp/cakephp/src/Http/Runner.php(65): Cake\Routing\Middleware\AssetMiddleware->__invoke() #14 /home/tomppa/www/gtms/vendor/cakephp/cakephp/src/Error/Middleware/ErrorHandlerMiddleware.php(96): Cake\Http\Runner->__invoke() #15 /home/tomppa/www/gtms/vendor/cakephp/cakephp/src/Http/Runner.php(65): Cake\Error\Middleware\ErrorHandlerMiddleware->__invoke() #16 |
# |
May 7th 2021, 22:56 |
slackebot |
/home/tomppa/www/gtms/vendor/cakephp/cakephp/src/Routing/Middleware/RoutingMiddleware.php(164): Cake\Http\Runner->__invoke() #11 /home/tomppa/www/gtms/vendor/cakephp/cakephp/src/Http/Runner.php(65): Cake\Routing\Middleware\RoutingMiddleware->__invoke() #12 /home/tomppa/www/gtms/vendor/cakephp/cakephp/src/Routing/Middleware/AssetMiddleware.php(88): Cake\Http\Runner->__invoke() #13 |
# |
May 7th 2021, 22:56 |
slackebot |
/home/tomppa/www/gtms/vendor/cakephp/cakephp/src/Http/Runner.php(65): Cake\Http\BaseApplication->__invoke() #8 /home/tomppa/www/gtms/vendor/cakephp/cakephp/src/Http/Middleware/CsrfProtectionMiddleware.php(124): Cake\Http\Runner->__invoke() #9 /home/tomppa/www/gtms/vendor/cakephp/cakephp/src/Http/Runner.php(65): Cake\Http\Middleware\CsrfProtectionMiddleware->__invoke() #10 |
# |
May 7th 2021, 22:56 |
slackebot |
/home/tomppa/www/gtms/vendor/cakephp/cakephp/src/Http/ActionDispatcher.php(115): Cake\Controller\Controller->startupProcess() #5 /home/tomppa/www/gtms/vendor/cakephp/cakephp/src/Http/ActionDispatcher.php(94): Cake\Http\ActionDispatcher->_invoke() #6 /home/tomppa/www/gtms/vendor/cakephp/cakephp/src/Http/BaseApplication.php(234): Cake\Http\ActionDispatcher->dispatch() #7 |
# |
May 7th 2021, 22:56 |
slackebot |
/home/tomppa/www/gtms/vendor/cakephp/cakephp/src/Event/EventManager.php(329): Cake\Event\EventManager->_callListener() #2 /home/tomppa/www/gtms/vendor/cakephp/cakephp/src/Event/EventDispatcherTrait.php(113): Cake\Event\EventManager->dispatch() #3 /home/tomppa/www/gtms/vendor/cakephp/cakephp/src/Controller/Controller.php(680): Cake\Controller\Controller->dispatchEvent() #4 |
# |
May 7th 2021, 22:56 |
thomas078 |
``` Error: [Authentication\Authenticator\UnauthenticatedException] No identity found. You can skip this check by configuring `requireIdentity` to be `false`. (/home/tomppa/www/gtms/vendor/cakephp/authentication/src/Controller/Component/AuthenticationComponent.php:153) #0 /home/tomppa/www/gtms/vendor/cakephp/cakephp/src/Event/EventManager.php(352): Authentication\Controller\Component\AuthenticationComponent->startup() #1 |
# |
May 7th 2021, 22:56 |
thomas078 |
does not land there. |
# |
May 7th 2021, 22:52 |
ndm |
For your redirect problem, you can debug if you land here, and if you get a valid redirect url: https://github.com/cakephp/authentication/blob/1.x/src/Middleware/AuthenticationMiddleware.php#L129-L137 |
# |
May 7th 2021, 22:50 |
ndm |
1.x is for CakePHP 3.x, and 2.x is for CakePHP 4.x, for both authentication and authorization |
# |
May 7th 2021, 22:48 |
thomas078 |
Also found something strange. Method 'App\Application::getAuthorizationService()' is not compatible with method 'Authorization\AuthorizationServiceProviderInterface::getAuthorizationService()' Trying to implement this in cake3.9. had to install composer require "cakephp/authorization:^1.0" instead of 2.0. Maybe this is not compatible with authentication 1.0? |
# |
May 7th 2021, 22:46 |
thomas078 |
strange as authentication middleware works |