PEAR is discontinued

This is a static archive preserving historical releases and metadata. No new packages or updates will be published. For updates to existing packages, or to publish new packages, please use Composer and Packagist.

Home » Database » DB » Bug #3083

Sybase Module Produces Notices on Free Result

Details

Submitted2005-01-03 16:58 UTC
Fromtyler at nas dot net
Assigneddanielc
StatusBogus
PackageDB
PHP Version4.3.10
OSRed 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