|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2012-04-24 19:49 UTC] jdolieslager at gmail dot com
[2012-04-24 19:49 UTC] jdolieslager at gmail dot com
-Package: mysql
+Package: MySQLi related
[2012-04-24 21:35 UTC] johannes@php.net
-Status: Open
+Status: Wont fix
[2012-04-24 21:35 UTC] johannes@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Oct 29 18:00:01 2025 UTC |
Description: ------------ I retrieve a record from the database and want to store into an object. This will be a dataobject that does basically validate the values. I noticed that the constructor will be called after the magic function __set has been called. This should be the other way around. =============== SYSTEM INFO ================== System Windows NT JESPER-LT 6.1 build 7601 (Windows 7 Ultimate Edition Service Pack 1) i586 Build Date Feb 2 2012 20:26:31 Compiler MSVC9 (Visual C++ 2008) Architecture x86 Configure Command cscript /nologo configure.js "--enable-snapshot-build" "--disable-isapi" "--enable-debug-pack" "--disable-isapi" "--without-mssql" "--without-pdo-mssql" "--without-pi3web" "--with-pdo-oci=C:\php-sdk\oracle\instantclient10\sdk,shared" "--with-oci8=C:\php-sdk\oracle\instantclient10\sdk,shared" "--with-oci8-11g=C:\php-sdk\oracle\instantclient11\sdk,shared" "--enable-object-out-dir=../obj/" "--enable-com-dotnet" "--with-mcrypt=static" "--disable-static-analyze" =============================================== ================ MYSQLI ======================= MysqlI Support enabled Client API library version mysqlnd 5.0.8-dev - 20102224 - $Revision: 321634 $ Active Persistent Links 0 Inactive Persistent Links 0 Active Links 0 Directive Local Value Master Value mysqli.allow_local_infile On On mysqli.allow_persistent On On mysqli.default_host no value no value mysqli.default_port 3306 3306 mysqli.default_pw no value no value mysqli.default_socket no value no value mysqli.default_user no value no value mysqli.max_links Unlimited Unlimited mysqli.max_persistent Unlimited Unlimited mysqli.reconnect Off Off ===================================================== Beneath you'll find a basic example of the bug. The database structure I use for this example: CREATE TABLE `users` ( `id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, `username` VARCHAR(50) NOT NULL, `password` VARCHAR(50) NOT NULL, `created` DATETIME NULL DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE INDEX `username` (`username`) ) Test script: --------------- class foo { function __construct() { echo '__construct() <br />'; } function __set($key, $value) { echo '__set() <br />'; } } $mysql = new mysqli('127.0.0.1', 'root', '', 'test'); $rs = $mysql->query('SELECT id, username, password FROM users'); $obj = $rs->fetch_object('foo'); Expected result: ---------------- __construct() __set() __set() __set() Actual result: -------------- __set() __set() __set() __construct()