Bug #68243 [Com]: IMPORTANT! Checking empty value failed

From: Date: Sat, 18 Oct 2014 16:39:18 +0000
Subject: Bug #68243 [Com]: IMPORTANT! Checking empty value failed
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-188179@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=68243&edit=1 ID: 68243 Comment by: keithm at aoeex dot com Reported by: Siemienik dot Pawel at gmail dot com Summary: IMPORTANT! Checking empty value failed Status: Open Type: Bug Package: *PDF functions Operating System: Ubuntu 14 PHP Version: 5.5.17 Block user comment: N Private report: N New Comment: Works for me If you believe this is a problem, provide a small but complete test script (including class definitions) which will reproduce the problem. Test Script: ----------------------------------------------------------------- <?php class A { static $instance; public static function getInstance(){ if (!self::$instance){ self::$instance=new self; } return self::$instance; } public function __get($nm){ return ''; } } var_dump( !empty(A::getInstance()->title) , !empty((A::getInstance()->title)) , !empty((A::getInstance()->title)) !== empty(A::getInstance()->title) ); Result: ----------------------------------------------------------------- bool(false) bool(false) bool(true) Version: ----------------------------------------------------------------- Linux: PHP 5.5.9-1ubuntu4.4 (cli) (built: Sep 4 2014 06:56:34) Copyright (c) 1997-2014 The PHP Group Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies with Zend OPcache v7.0.3, Copyright (c) 1999-2014, by Zend Technologies Windows: PHP 5.5.18 (cli) (built: Oct 15 2014 13:04:56) Copyright (c) 1997-2014 The PHP Group Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies Previous Comments: ------------------------------------------------------------------------ [2014-10-16 12:27:59] siemienik dot pawel at gmail dot com int AnyClass is function __get(), which will return string value; ------------------------------------------------------------------------ [2014-10-16 12:25:00] Siemienik dot Pawel at gmail dot com Description: ------------ !empty((AnyClass::getInstance()->title)) !== !empty(AnyClass::getInstance()->title) Test script: --------------- var_dump( !empty((AnyClass::getInstance()->title)), !empty(AnyClass::getInstance()->title) ) if(!empty((AnyClass::getInstance()->title)) !== empty(AnyClass::getInstance()->title)) var_dump('BIG PROBLEM HERE!') ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=68243&edit=1

« previous php.bugs (#188179) next »