func_get_args() call order fix for HHVM bug#1142
Conversation
|
Hello, thank you for creating this pull request. However did not open it on the "master" Please open the pull request again for the "master" branch and close Nevertheless I have opened a Jira ticket for this Pull Request to track this http://www.doctrine-project.org/jira/browse/DDC-3317 We use Jira to track the state of pull requests and the versions they got |
|
Related: facebook/hhvm#3816 |
|
@TwoWholeWorms can you also check if this affects |
|
By the looks of it, it's already been fixed in all these functions in master (which I'd guess is the 2.5.*-dev tree), so I think the 2.4-only fix should suffice. I could back-port it further, but I highly doubt anyone is using anything earlier than 2.4 on HHVM. Actually, TBH, I highly doubt anyone is using 2.4 on HHVM at all, since it's, y'know… b0rked. |
|
Ok, fine with merging then. I'll also tag. |
func_get_args() call order fix for HHVM bug
|
@Ocramius @TwoWholeWorms — Doesn't look like this fixes much? A test case would have been nice. |
ProxyQuery test failed because of bug doctrine/orm#1142
ProxyQuery test failed because of bug doctrine/orm#1142
needed for compatibility with PHP >= 7.0 to fix a bug in andWhere(). it built a query that contains itself, which crashed from infinite recursion when executed. fixed in 2.5: doctrine/orm#1164 different fix in 2.4: doctrine/orm#1142 updating directly to doctrine 2.5 might also work, but it is not 100% backwards compatible. for now i only did the minimum necessary update. maybe later. https://web.archive.org/web/20170521161209/http://docs.doctrine-project.org/en/latest/changelog/migration_2_5.html https://www.doctrine-project.org/2015/04/02/orm-2-5-0.html
needed for compatibility with PHP >= 7.0 to fix a bug in andWhere(). it built a query that contains itself, which crashed from infinite recursion when executed. fixed in 2.5: doctrine/orm#1164 different fix in 2.4: doctrine/orm#1142 updating directly to doctrine 2.5 might also work, but it is not 100% backwards compatible. for now i only did the minimum necessary update. maybe later. https://web.archive.org/web/20170521161209/http://docs.doctrine-project.org/en/latest/changelog/migration_2_5.html https://www.doctrine-project.org/2015/04/02/orm-2-5-0.html
Firstly, so no-one closes this as ENOTONMASTER, @Ocramius told me to open it directly against 2.4. :)
This PR fixes bugs in
Doctrine\ORM\QueryBuilderwhere the values provided to method arguments to::andWhere(),::orWhere(),::andHaving(), and::orHaving()are overwritten by code within the methods in HHVM and PHP7.After much fun and headscratching in both #doctrine and #hhvm on Freenode, we discovered that in the following code,
$where = $this->getDqlPart('where');overwrites the values stored internally for the$whereparameter of the function which is returned byfunc_get_args():This means that instead of
$argsbeing set as expected to an array containing the string or object provided to the function, it actually contains the object returned byQueryBuilder::getDqlPart(), which causes all the problems you'd expect it to.This PR simply swaps the order of the calls so that the function arguments are retrieved via
func_get_args()before the$wherevariable is modified, fixing the problem.