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 #2468

Deprecated code in DB.php

Details

Submitted2004-10-06 15:18 UTC
Fromtemp dot addr at jonaskochbentzen dot com
Assigneddanielc
StatusBogus
PackageDB
PHP Version5.0.2
OSLinux (Fedora Core 2)
Roadmaps(Not assigned)

Comments

[2004-10-06 15:18 UTC] temp dot addr at jonaskochbentzen dot com

Description:
------------
There's a deprecated piece of code in DB.php:310 ("@$obj =& new $classname;") which makes PHP issue warnings if you use your own error handler (via set_error_handler())

Reproduce code:
---------------
<?php
set_error_handler('error');

function error($type, $message, $file, $line) {
echo '<p>';
echo '<strong>Error</strong><br/>';
echo $message.'<br/>';
echo $file.':'.$line;
echo '</p>';
}

require_once('DB.php');
?>

Expected result:
----------------
"require_once('DB.php');" should not output anything - it should just include the specified file.

Actual result:
--------------
Multiple error messages like this:

"Error:
Assigning the return value of new by reference is deprecated
/usr/local/lib/php/DB.php:310"

[2004-10-07 23:37 UTC] temp dot addr at jonaskochbentzen dot com

I'm aware that custom error handlers catch *all* errors. This is rather the point: It promotes good coding. Which leads me to this: Shouldn't DB be strict compliant? And isn't ignoring E_STRICT errors a bad way to handle the problem? If you ignore all E_STRICT errors, some errors (caused by other pieces of code than those in DB) that might be important to the developer will not be displayed to him/her.