Home » Database » DB » Bug #3083
Sybase Module Produces Notices on Free Result
Details
| Submitted | 2005-01-03 16:58 UTC |
|---|---|
| From | tyler at nas dot net |
| Assigned | danielc |
| Status | Bogus |
| Package | DB |
| PHP Version | 4.3.10 |
| OS | Red Hat 9 |
| Roadmaps | (Not assigned) |
Comments
[2005-01-03 16:58 UTC] tyler at nas dot net
Description:
------------
I checked this with DB 1.6.8, the latest stable version, it's line 374:
unset($this->num_rows[(int)$result]);
The problem is $this->num_rows is only set by the simpleQuery method. If simpleQuery isn't called then num_rows is undefined.
See Bug #2111 (incorrectly marked bogus) for a patch. It is bad coding style to unset a potentially undefined variable.
Reproduce code:
---------------
Fill in your own answers for $user, $pass, $host, and $select:
<?php
require_once('DB.php');
$query = 'SELECT something FROM somewhere';
$dbsy = DB::connect("sybase://$user:$pass@$host");
$handle = $dbsy->prepare($select);
$result = $dbsy->execute($handle, array());
if ($result) {
$result->free();
}
?>
Expected result:
----------------
No output.
Actual result:
--------------
Notice: Undefined property: num_rows in /usr/share/pear/DB/sybase.php on line 374