{"action":"created","issue":{"url":"https://api.github.com/repos/metaclass-nl/tresholds-governor/issues/6","repository_url":"https://api.github.com/repos/metaclass-nl/tresholds-governor","labels_url":"https://api.github.com/repos/metaclass-nl/tresholds-governor/issues/6/labels{/name}","comments_url":"https://api.github.com/repos/metaclass-nl/tresholds-governor/issues/6/comments","events_url":"https://api.github.com/repos/metaclass-nl/tresholds-governor/issues/6/events","html_url":"https://github.com/metaclass-nl/tresholds-governor/issues/6","id":124776375,"number":6,"title":"crash DBAL < 2.5 on PHP7","user":{"login":"metaclass-nl","id":3610075,"avatar_url":"https://avatars.githubusercontent.com/u/3610075?v=3","gravatar_id":"","url":"https://api.github.com/users/metaclass-nl","html_url":"https://github.com/metaclass-nl","followers_url":"https://api.github.com/users/metaclass-nl/followers","following_url":"https://api.github.com/users/metaclass-nl/following{/other_user}","gists_url":"https://api.github.com/users/metaclass-nl/gists{/gist_id}","starred_url":"https://api.github.com/users/metaclass-nl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/metaclass-nl/subscriptions","organizations_url":"https://api.github.com/users/metaclass-nl/orgs","repos_url":"https://api.github.com/users/metaclass-nl/repos","events_url":"https://api.github.com/users/metaclass-nl/events{/privacy}","received_events_url":"https://api.github.com/users/metaclass-nl/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2016-01-04T15:14:35Z","updated_at":"2016-08-16T10:19:15Z","closed_at":"2016-01-15T13:51:51Z","body":"Doctrine\\DBAL\\Query\\QueryBuilder::andWhere assigns $this->getQueryPart('where') to its first argument variable. On PHP 7 this results in func_get_args(), which is called AFTERWARDS, to return the Doctrine\\DBAL\\Query\\Expression\\CompositeExpression from $this->getQueryPart('where') instead of the (string) argument supplied by \\Metaclass\\TresholdsGovernor\\Gateway\\DbalGateway::countWhereSpecifiedAfter.\r\n\r\nThen the querybuilder adds the 'arguments' as extra AND expressions resulting in self-reference(s) from the CompositeExpression in $this->sqlParts['where'] (which is returned by $this->getQueryPart('where')). When the actual SQL string is being generated $this->sqlParts['where'] is casted to string resulting in an endless recursion. I guess that crashes PHP 7. \r\n\r\nThis behavior is consistent with [a note in the php manual](http://php.net/manual/en/function.func-get-args.php):\r\n```\r\nIf the arguments are passed by reference, any changes to the arguments \r\nwill be reflected in the values returned by this function. \r\nAs of PHP 7 the current values will also be returned if the arguments are passed by value.\"\r\n```\r\nThe problem is solved in [this commit](https://github.com/doctrine/dbal/commit/75402954517d749df3705ef21d53c1e1709a6347#diff-305699f4a9180da213eb29c5671ab925) in dbal v2.5.0-BETA2 with comment:\r\n```\r\nHHVM compatibility: func_get_args\r\n\r\nAll func_get_args() calls have been moved to the top of the methods\r\nbecause HHVM doesn't keep a copy of the original args for performance\r\nreasons.\r\n```\r\n\r\n\r\nTested on PHP7.0.1 windows VC14 x64 Non Thread Safe (2015-Dec-17 00:17:18) with Symfony v2.7.7, doctrine/dbal v2.4.4., metaclass-nl/authentication-guard-bundle  5ca9e55f744ead919ec9e630745010187f037652,  metaclass/tresholds-governor 9a74fae6f4e90c2aee18fcdc1cfa68d9dc6b1980"},"comment":{"url":"https://api.github.com/repos/metaclass-nl/tresholds-governor/issues/comments/240063248","html_url":"https://github.com/metaclass-nl/tresholds-governor/issues/6#issuecomment-240063248","issue_url":"https://api.github.com/repos/metaclass-nl/tresholds-governor/issues/6","id":240063248,"user":{"login":"metaclass-nl","id":3610075,"avatar_url":"https://avatars.githubusercontent.com/u/3610075?v=3","gravatar_id":"","url":"https://api.github.com/users/metaclass-nl","html_url":"https://github.com/metaclass-nl","followers_url":"https://api.github.com/users/metaclass-nl/followers","following_url":"https://api.github.com/users/metaclass-nl/following{/other_user}","gists_url":"https://api.github.com/users/metaclass-nl/gists{/gist_id}","starred_url":"https://api.github.com/users/metaclass-nl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/metaclass-nl/subscriptions","organizations_url":"https://api.github.com/users/metaclass-nl/orgs","repos_url":"https://api.github.com/users/metaclass-nl/repos","events_url":"https://api.github.com/users/metaclass-nl/events{/privacy}","received_events_url":"https://api.github.com/users/metaclass-nl/received_events","type":"User","site_admin":false},"created_at":"2016-08-16T10:19:14Z","updated_at":"2016-08-16T10:19:14Z","body":"Release v0.3 no longer uses DBAL's QueryBuilder, so it should also work on versions of DBAL < 2.5 with PHP 7, but this was not tested."}}
{"actor":{"display_login":"metaclass-nl"}}