|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2014-10-16 12:25 UTC] 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!')
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Oct 27 12:00:02 2025 UTC |
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