| 
        php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | 
  [2004-12-15 17:27 UTC] jyounger at caedic dot com
 Description:
------------
isset() when run using mod_php returns a false positive when checking a string variable for the presence of a property. isset() when run under the cli behaves correctly and returns false. This is in PHP 5.0.3RC2.
Reproduce code:
---------------
<?php
$simpleString = "Bogus String Text";
if (isset($simpleString->nonExistentStringProperty)) {
   echo "This line should not execute";
} else {
   echo "This line should execute";
}
?>
Expected result:
----------------
This line should execute
Actual result:
--------------
This line should not execute
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits             
             | 
    |||||||||||||||||||||||||||||||||||||
            
                 
                Copyright © 2001-2025 The PHP GroupAll rights reserved.  | 
        Last updated: Tue Nov 04 14:00:01 2025 UTC | 
This bug is rather significant to anyone that uses PEAR::DB with DB_DataObject. It effectively breaks the createTables.php script, which in turn effectively makes useless DB_DataObject. The offending code is the first line of function tableInfo in (phproot)/lib/php/DB/mysql.php: * @see DB_common::tableInfo() */ function tableInfo($result, $mode = null) { if (isset($result->result)) { /* * Probably received a result object. The isset() call returns true, regardless of whether $result->result is set, and even if $result is not an object. Note, this affects ALL (phproot)/lib/php/DB/??sql.php files, since they all contain tableInfo() functions. The patch supplied in this bug report doesn't solve the problem, so I had to temporarily change function tableInfo() to call is_object() instead of isset(). Matthew H. North