PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » Database » DB_Pager » Bug #6677

Only variable references should be returned by reference

Details

Submitted2006-02-02 23:40 UTC
Fromkoto at webworkers dot pl
Assignedquipo
StatusClosed
PackageDB_Pager
PHP Version5.1.2
OSWIN XP
Roadmaps(Not assigned)

Comments

[2006-02-02 23:40 UTC] koto at webworkers dot pl

Description:
------------
PHP 4.3.10 and PHP 5 versions enforce stronger checking of return values from functions that should return references.

'Only variable references should be returned by reference' PHP notice is the common effect of this policy - this package is unfortunately also affected, as various other PEAR packages (try searching for 'references' within bugs).

This bug triggers PHP notices on line 170,175 and 199 of DB/Pager.php file.

Proposed simple fix (unfortunalely it's not very pretty, although AFAIK there is no other way around it):
line 170:

$ret = null;
return $ret;

line 175:
$ret =& PEAR::raiseError (null, 'wrong "limit" param', null,
null, null, 'DB_Error', true);
return $ret;

line 199:
$ret =& PEAR::raiseError (null, 'wrong "from" param', null,
null, null, 'DB_Error', true);
return $ret;

Test script:
---------------
require 'DB/Pager.php';

// empty data passed
$result =& DB_Pager::getData(0, 10, 0);

Expected result:
----------------
$result = null;

Actual result:
--------------
Notice: Only variable references should be returned by reference in c:\php\PEAR\DB\Pager.php on line 170