php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #72151 mysqli_fetch_object changed behaviour from 5.6.20
Submitted: 2016-05-04 10:26 UTC Modified: 2016-07-25 08:46 UTC
Votes:18
Avg. Score:4.9 ± 0.2
Reproduced:18 of 18 (100.0%)
Same Version:15 (83.3%)
Same OS:4 (22.2%)
From: nicola at tiphys dot com Assigned: ab (profile)
Status: Closed Package: MySQLi related
PHP Version: 5.6.21 OS:
Private report: No CVE-ID: None
 [2016-05-04 10:26 UTC] nicola at tiphys dot com
Description:
------------
mysqli_fetch_object calls __set after calling the object constructor now.

In 5.6.20 and below the behaviour was the opposite, same with PDO and the old mysql extension.

I think the commit that makes this change is this one:

https://github.com/php/php-src/commit/1b632cfe834bfd87d182566d7d960df7d10ded72


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-05-04 10:30 UTC] nicola at tiphys dot com
-Summary: mysql_fetch_object changed behaviour from 5.6.20 +Summary: mysqli_fetch_object changed behaviour from 5.6.20
 [2016-05-04 10:30 UTC] nicola at tiphys dot com
changed title
 [2016-05-05 07:43 UTC] neo22s at gmail dot com
Same issue on PHP 7.0.6.
 [2016-05-08 08:00 UTC] neo22s at gmail dot com
In PHP.net documentation http://php.net/manual/en/mysqli-result.fetch-object.php

Says "Note that mysqli_fetch_object() sets the properties of the object before calling the object constructor."

So yes this is a bug :(
 [2016-05-09 13:42 UTC] ondrej@php.net
-Assigned To: +Assigned To: ab
 [2016-05-09 13:42 UTC] ondrej@php.net
This affects both 5.6.21 and 7.0.6 as well.
 [2016-05-09 15:43 UTC] ab@php.net
-Status: Assigned +Status: Closed
 [2016-05-09 15:43 UTC] ab@php.net
Thanks for the ping. These changes was reverted in the dev branch in 1cc536af5a9790288ef6638e3b167858d3b0cca1 and fc2a45b70a6675cad627cfe6341dc77d61952ba4. With this, the patches to bug #71820 are reverted.

See also bug #50636 and bug #49521 for the historical reasons. The change didn't cause any issues with the QA, thus it were released. The behavior is inconsistent, however it is documented this way. Thus reverted to avoid beyond breakage.

Thanks.
 [2016-05-09 15:44 UTC] ab@php.net
Also, please check the upcoming RC this week and ping back in case of issue.

Thanks.
 [2016-07-23 13:48 UTC] mauroasprea+php at gmail dot com
What about implementing something like PDO::FETCH_PROPS_LATE but for MySQLi and pg?
 [2016-07-25 08:46 UTC] ab@php.net
@mauroasprea, sounds sane to me, however i don't see where to pass this option to pg_fetch_object. Might be solvable anyway. Could you please open a FR for this, so the idea doesn't get forgotten?

Thanks.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Nov 21 10:01:29 2024 UTC