ID: 49606 Updated by: j...@php.net Reported By: clin dot isbut at gmail dot com Status: Feedback Bug Type: Scripting Engine problem Operating System: Windows Xp PHP Version: 5.3.0 New Comment:
I still can not reproduce this with the class extending mysqli. Please try the snapshot. (And next time, DO NOT use the "Add comment" tab when you add comments to your _own_ report! Use the "Edit Submission" tab!) Previous Comments: ------------------------------------------------------------------------ [2009-09-20 18:25:21] clin dot isbut at gmail dot com Sorry, expected and actual result are as this: Expected result: ---------------- Publish_date: 45678 publish IS NOT EMPTY! Actual result: --------------- Publish_date: 45678 publish IS EMPTY! ------------------------------------------------------------------------ [2009-09-20 18:14:32] clin dot isbut at gmail dot com Ok, I found the root of problems. Seems it fails when the class extends mysqli class (?¿). See this: Reproduce code: --------------- FooClass.php class FooClass extends mysqli { var $publish_date; function __construct() { } function foo( $var ) { $this->publish_date = $var; echo "Publish_date:".$this->publish_date."<br>"; if( empty( $this->publish_date ) ) echo "publish IS EMPTY!<br>"; else echo "publish IS NOT EMPTY!<br>"; } } Index.php include ("FooClass.php"); $obj = new FooClass(); $obj->foo( '45678' ); Expected result: ---------------- Publish_date: 45678 publish IS NOT EMPTY! Actual result: --------------- Publish_date: 45678 publish IS NOT EMPTY! I expect this time you can reproduce it. ------------------------------------------------------------------------ [2009-09-20 17:45:24] clin dot isbut at gmail dot com Seems like my example code does not reproduce the error. I'll try to reduce my failing code to write here. ------------------------------------------------------------------------ [2009-09-20 17:23:18] j...@php.net Please try using this snapshot: http://snaps.php.net/php5.3-latest.tar.gz For Windows: http://windows.php.net/snapshots/ Works fine for me.. ------------------------------------------------------------------------ [2009-09-20 11:15:04] clin dot isbut at gmail dot com Description: ------------ empty( $this->variable ) returns always true. Reproduce code: --------------- class FooClass { var $publish; function foo() { $this->publish = '123456'; if( empty( $this->publish ) ) echo "publish is empty."; else echo "publish is NOT empty."; } } Expected result: ---------------- "publish is NOT empty." Actual result: -------------- "publish is empty." ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=49606&edit=1