Log message #4219989

# At Username Text
# Dec 25th 2019, 12:31 ndm You need to add the token to either the request data of your AJAX requests, in a field named `_csrfToken`, or send it in a header named `X-CSRF-Token`. You can obtain the curent token from the request object in your view template: `$this->request->getAttribute('_csrfToken')`
# Dec 25th 2019, 12:27 ashesh.social In cakephp4
# Dec 25th 2019, 12:27 ashesh.social During ajax call
# Dec 25th 2019, 12:27 ashesh.social “Missing CSRF token body in /usr/local/myapp/vendor/cakephp/cakephp/src/Http/Middleware/CsrfProtectionMiddleware.php on line 234”
# Dec 25th 2019, 00:01 ricksaccous hmph
# Dec 25th 2019, 00:01 ricksaccous actually even if i access without iframe i still get the issue
# Dec 24th 2019, 23:57 ricksaccous locally i get no issues, only on review do i get issues
# Dec 24th 2019, 23:57 ricksaccous trying to think why that would matter
# Dec 24th 2019, 23:57 ricksaccous I'm actually thinking now that it's because the url is being called via iframe
# Dec 24th 2019, 23:56 ricksaccous Error: [Exception] The request object does not contain the required `authentication` attribute in
# Dec 24th 2019, 23:56 ricksaccous I'm running into a problem
# Dec 24th 2019, 21:32 ndm Mentioning it wouldn't hurt I guess... Not sure though if the errors in the integration test are actually always logged.
# Dec 24th 2019, 21:29 brian.french I'm not sure how official that would be.
# Dec 24th 2019, 21:28 brian.french Maybe that should be mentioned in the book's testing page?
# Dec 24th 2019, 21:28 ndm more like response, but yes :)
# Dec 24th 2019, 21:28 brian.french err $this->_response
# Dec 24th 2019, 21:27 brian.french or $this->_request
# Dec 24th 2019, 21:27 brian.french Thanks @ndm! I wasn't sure if there was an undocumented trick, or way... but I guess _getBodyAsString() is the undocumented way :P
# Dec 24th 2019, 21:26 ndm @brian.french I usually check the logs and inspect the error page via `$this->_getBodyAsString()`
# Dec 24th 2019, 21:25 ndm @hollistergraham123 That example shouldn't be in the docs anymore, as it's wrong / doesn't work, it will limit the overall number of associated records. Looks like it was only removed from the 4.x docs. If you want to limit records per group, then you'll have to do that via for example customized associations: https://stackoverflow.com/questions/30241975/how-to-limit-contained-associations-per-record-group/30270675#30270675
# Dec 24th 2019, 18:47 awk17 restricted to dev builds of CakePHP4). Might anyone suggest the best path forward?
# Dec 24th 2019, 18:47 awk17 Hi all -- I am struggling with the Controller code to process a file upload in CakePHP4. I've tried numerous examples from StackOverflow etc. but they are exclusive to earlier CakePHP versions. Most recent documentation suggests I use the FriendsOfCake/cakephp-upload, but this won't install using Composer into CakePHP4 (even the cake-4.x branch is
# Dec 24th 2019, 18:44 brian.french Your code is out of context, but maybe change `return $q->limit(1);` to `return $q->limit(5);` ?
# Dec 24th 2019, 18:43 brian.french testing?
# Dec 24th 2019, 18:43 brian.french When testing a controller that's returning a 500 on a $this->get(); is there a specific 'cake' way to debug what is causing the 500 in the controller you're test?
# Dec 24th 2019, 18:42 brian.french Your code is out of context, but maybe change `return $q->limit(1);` to `return $q->limit(5);` ?
# Dec 24th 2019, 18:17 hollistergraham123 I looked through the docs and it suggested something like this. But it still limited to 1 blog total being pulled back.
# Dec 24th 2019, 18:15 hollistergraham123 How do I limit associations per row. I.e. I want to pull 5 blogs per category.
# Dec 24th 2019, 17:38 brian.french Thanks @challgren and @john.zwarthoed
# Dec 24th 2019, 15:58 devito seem to be having a bit of a hard time with this. i am making an api and when ever i try to do a post I get a csrf mismatch. in my application.php the csrf middleware is not qued up, instead it is in the routs file. i tried removing it completly from there however i still get csrf token mismatch errors when i try to post. Any ideas?
# Dec 24th 2019, 15:27 loginews I had an issue, which I posted on our in-house internal blog: http://manuals.loginonline.net/badev/2019/12/24/debugging-cakephp-url-issue/ . I am not sure if this can help those who devised the Auth component. I solved my problem. Posting this here just in case.
# Dec 24th 2019, 13:20 maymeow Hi. Wish you all Merry Christmas and many good projects :christmas_tree:
# Dec 24th 2019, 11:30 nuzulfikrie how do i use Http:ParseRequest?
# Dec 24th 2019, 11:29 nuzulfikrie support . I have this `/logout` wanted to form this `Array ( [controller] => Logout [pass] => Array ( ) [action] => index [plugin] => Manage [_matchedRoute] => /{controller} )`
# Dec 24th 2019, 11:29 nuzulfikrie hi,
# Dec 24th 2019, 09:53 challgren But $this->_getBodyAsString() also works too
# Dec 24th 2019, 09:48 challgren Actually its `debug((string)$this->_response->getBody());`
# Dec 24th 2019, 09:46 challgren You can use `$this->_response->getBody->getContents()` in your Integration test file
# Dec 24th 2019, 08:26 john.zwarthoed @brian.french are you looking for: _getBodyAsString( ) ?
# Dec 24th 2019, 07:53 megan Morning :wave:
# Dec 24th 2019, 07:44 kani Hi