{"action":"created","issue":{"url":"https://api.github.com/repos/cakephp/cakephp/issues/5874","labels_url":"https://api.github.com/repos/cakephp/cakephp/issues/5874/labels{/name}","comments_url":"https://api.github.com/repos/cakephp/cakephp/issues/5874/comments","events_url":"https://api.github.com/repos/cakephp/cakephp/issues/5874/events","html_url":"https://github.com/cakephp/cakephp/issues/5874","id":57387642,"number":5874,"title":"3.x: __toString() must not throw an exception","user":{"login":"caBBAlainB","id":9322571,"avatar_url":"https://avatars.githubusercontent.com/u/9322571?v=3","gravatar_id":"","url":"https://api.github.com/users/caBBAlainB","html_url":"https://github.com/caBBAlainB","followers_url":"https://api.github.com/users/caBBAlainB/followers","following_url":"https://api.github.com/users/caBBAlainB/following{/other_user}","gists_url":"https://api.github.com/users/caBBAlainB/gists{/gist_id}","starred_url":"https://api.github.com/users/caBBAlainB/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/caBBAlainB/subscriptions","organizations_url":"https://api.github.com/users/caBBAlainB/orgs","repos_url":"https://api.github.com/users/caBBAlainB/repos","events_url":"https://api.github.com/users/caBBAlainB/events{/privacy}","received_events_url":"https://api.github.com/users/caBBAlainB/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/cakephp/cakephp/labels/Defect","name":"Defect","color":"f7c6c7"},{"url":"https://api.github.com/repos/cakephp/cakephp/labels/On%20hold","name":"On hold","color":"eb6420"},{"url":"https://api.github.com/repos/cakephp/cakephp/labels/ORM","name":"ORM","color":"ffffff"}],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/cakephp/cakephp/milestones/7","labels_url":"https://api.github.com/repos/cakephp/cakephp/milestones/7/labels","id":453043,"number":7,"title":"3.0.0","description":"New major release that breaks compatibility with 2.x\r\n\r\n- PHP5.4.19+\r\n- New ORM & behaviors.\r\n- Improved Routing\r\n- PSR-0 and composer support.\r\n- Simpler configuration and bootstrapping.\r\n- Improved configuration handling.\r\n- Improved bake.\r\n\r\nSee [the roadmap](http://github.com/cakephp/cakephp/wiki/3.0-roadmap) for more details.","creator":{"login":"lh-import","id":5175817,"avatar_url":"https://avatars.githubusercontent.com/u/5175817?v=3","gravatar_id":"","url":"https://api.github.com/users/lh-import","html_url":"https://github.com/lh-import","followers_url":"https://api.github.com/users/lh-import/followers","following_url":"https://api.github.com/users/lh-import/following{/other_user}","gists_url":"https://api.github.com/users/lh-import/gists{/gist_id}","starred_url":"https://api.github.com/users/lh-import/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lh-import/subscriptions","organizations_url":"https://api.github.com/users/lh-import/orgs","repos_url":"https://api.github.com/users/lh-import/repos","events_url":"https://api.github.com/users/lh-import/events{/privacy}","received_events_url":"https://api.github.com/users/lh-import/received_events","type":"User","site_admin":false},"open_issues":23,"closed_issues":2291,"state":"open","created_at":"2013-10-11T20:56:23Z","updated_at":"2015-02-12T00:28:50Z","due_on":null,"closed_at":null},"comments":1,"created_at":"2015-02-11T22:29:11Z","updated_at":"2015-02-12T03:42:56Z","closed_at":null,"body":"Hello,\r\nIt seems this error shouldn't occur but I don't understand why it happens on my hosting and not on my local server.\r\nIt concerns the following query:\r\n\r\n        \t$query = $this->Sites->find()\r\n        \t\t\t\t->contain(\r\n        \t\t\t\t    [\r\n            \t\t\t\t\t'Sitedescriptions' => function ($q) use ($language_request) {\r\n           \t\t\t\t\t\t\treturn $q\r\n    \t\t\t\t\t                             ->where(['country_id' => $language_request])\r\n    \t\t\t\t\t                             ->orWhere(['country_id' => 'en']);\r\n        \t\t\t\t\t\t},\r\n        \t\t\t\t\t\t'Siteopeningdates' => function ($q) use ($language_request) {\r\n           \t\t\t\t\t\t\treturn $q\r\n    \t\t\t\t\t                             ->where(['country_id' => $language_request])\r\n    \t\t\t\t\t                             ->orWhere(['country_id' => 'en'])\r\n           \t\t\t\t\t\t\t     ->contain(['Countries'])\r\n           \t\t\t\t\t\t\t;\r\n        \t\t\t\t\t\t},\r\n        \t\t\t\t\t\t'Siteprices' => function ($q) use ($language_request) {\r\n           \t\t\t\t\t\t\treturn $q\r\n    \t\t\t\t\t                            ->where(['country_id' => $language_request])\r\n    \t\t\t\t\t                            ->orWhere(['country_id' => 'en'])\r\n           \t\t\t\t\t\t\t    ->contain(['Countries'])\r\n           \t\t\t\t\t\t\t;\r\n           \t\t\t\t\t\t},\r\n        \t\t\t\t\t\t'Countries'\r\n        \t\t\t\t\t]\r\n        \t           )\r\n        \t\t\t\t->where(['Sites.id' => $site_id]);\r\n\r\nThe full error message is:\r\nError: Method Cake\\ORM\\Query::__toString() must not throw an exception\r\nFile /home/modulwoo/www/2ndGuide/vendor/cakephp/cakephp/src/Database/Driver/Mysql.php\r\nLine: 193 \r\n\r\nThe error desappears if I remove 'Siteopeningdates' from contain[].\r\n\r\nAny idea on the cause of the problem?\r\n\r\nRegards,\r\nAlain."},"comment":{"url":"https://api.github.com/repos/cakephp/cakephp/issues/comments/74012735","html_url":"https://github.com/cakephp/cakephp/issues/5874#issuecomment-74012735","issue_url":"https://api.github.com/repos/cakephp/cakephp/issues/5874","id":74012735,"user":{"login":"markstory","id":24086,"avatar_url":"https://avatars.githubusercontent.com/u/24086?v=3","gravatar_id":"","url":"https://api.github.com/users/markstory","html_url":"https://github.com/markstory","followers_url":"https://api.github.com/users/markstory/followers","following_url":"https://api.github.com/users/markstory/following{/other_user}","gists_url":"https://api.github.com/users/markstory/gists{/gist_id}","starred_url":"https://api.github.com/users/markstory/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/markstory/subscriptions","organizations_url":"https://api.github.com/users/markstory/orgs","repos_url":"https://api.github.com/users/markstory/repos","events_url":"https://api.github.com/users/markstory/events{/privacy}","received_events_url":"https://api.github.com/users/markstory/received_events","type":"User","site_admin":false},"created_at":"2015-02-12T03:42:56Z","updated_at":"2015-02-12T03:42:56Z","body":"What is different about the two environments? That is probably a good place to start given the code works in one place but not the other."}}