ID:               48487
 User updated by:  joel at purerave dot com
 Reported By:      joel at purerave dot com
 Status:           Open
 Bug Type:         MySQLi related
 Operating System: win2k sp4
 PHP Version:      5.2.9
 New Comment:

No response yet?


Previous Comments:
------------------------------------------------------------------------

[2009-06-06 20:33:40] joel at purerave dot com

Description:
------------
mysqli_fetch_object with custom class calls __set() before constructor.

Reproduce code:
---------------
<?php
$mysqli = new mysqli("localhost", "root", "root", "test");
class myData {
        function __construct($param) {
                echo 'creating'.PHP_EOL;
        }
        function __set($name, $value) {
                $this->{$name} = $value;
                echo 'setting'.PHP_EOL;
        }
}

$sql = "SELECT id FROM test LIMIT 1";
$result = $mysqli->query($sql);
while ($obj = $result->fetch_object('myData', array('data'))) {
}

Expected result:
----------------
creating
setting


Actual result:
--------------
setting
creating



------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=48487&edit=1

Reply via email to