#46858 [Opn->Asn]: Incorrect isset result on MySQLi_Result properties (only in PHP_5_2)
| From: | jani@php.net | Date: | Mon, 13 Apr 2009 17:26:22 +0000 |
| Subject: | #46858 [Opn->Asn]: Incorrect isset result on MySQLi_Result properties (only in PHP_5_2) | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-135774@lists.php.net to get a copy of this message | ||
ID: 46858
Updated by: jani@php.net
-Summary: Incorrect isset result on MySQLi_Result properties
Reported By: eric at livejournal dot dk
-Status: Open
+Status: Assigned
Bug Type: MySQLi related
-Operating System: Linux
+Operating System: *
-PHP Version: 5.2.8
+PHP Version: 5.2.9
-Assigned To:
+Assigned To: andrey
New Comment:
Andrey, any possibility to fix this also in PHP_5_2 ?
(See bug #44352)
Previous Comments:
------------------------------------------------------------------------
[2008-12-31 16:11:47] eric at livejournal dot dk
The property doesn't exist if the query failed. I realise I could
simply check the error member, but I figured I'd still report it because
IMO a bug exists - isset incorrectly returns false.
------------------------------------------------------------------------
[2008-12-18 15:28:28] jani@php.net
Why do you test if that property exists anyway? It's always there, you
don't need to test for that. :)
------------------------------------------------------------------------
[2008-12-13 16:46:02] eric at livejournal dot dk
Description:
------------
isset returns false when applied to a MySQLi_result object that does
indeed exist.
Reproduce code:
---------------
<?php
$db = new mysqli('localhost', 'test', 'test', 'test');
$result = $db->query('SELECT * FROM test;'); //contains 1 row
echo $result->num_rows;
if (isset($result->num_rows))
echo 'defined';
else
echo 'undefined';
?>
Expected result:
----------------
1defined
Actual result:
--------------
1undefined
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=46858&edit=1