ID:               46858
 User updated by:  eric at livejournal dot dk
-Reported By:      eric at livejorunal dot dk
+Reported By:      eric at livejournal dot dk
-Status:           No Feedback
+Status:           Open
 Bug Type:         MySQLi related
 Operating System: Linux
 PHP Version:      5.2.8
 New Comment:

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.


Previous Comments:
------------------------------------------------------------------------

[2008-12-26 01:00:02] php-bugs at lists dot php dot net

No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".

------------------------------------------------------------------------

[2008-12-18 15:28:28] [email protected]

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

Reply via email to