PHP :: Bug #31098 :: isset false positive
| Bug #31098 | isset false positive | |||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Submitted: | 2004-12-15 17:27 UTC | Modified: | 2005-01-12 10:28 UTC |
|
||||||||||
| From: | jyounger at caedic dot com | Assigned: | dmitry (profile) | |||||||||||
| Status: | Closed | Package: | Scripting Engine problem | |||||||||||
| PHP Version: | 5CVS-2005-01-10 | OS: | * | |||||||||||
| Private report: | No | CVE-ID: | None | |||||||||||
[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
Patches
Pull Requests
History
AllCommentsChangesGit/SVN commits
[2004-12-17 22:19 UTC] ptchristendom at yahoo dot com
[2004-12-20 02:10 UTC] jkkn at jkkn dot dk
[2004-12-31 18:58 UTC] mnorth at ucsd dot edu
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[2005-01-03 03:51 UTC] jkkn at jkkn dot dk
[2005-01-11 23:05 UTC] moriyoshi@php.net
[2005-01-12 10:28 UTC] dmitry@php.net