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

Assigning the return value of new by reference is deprecated

Details

Submitted2005-12-29 01:36 UTC
Fromfbricker at gmail dot com
StatusBogus
PackageDB
PHP Version5.0.5
OSLinux
Roadmaps(Not assigned)

Comments

[2005-12-29 01:36 UTC] fbricker at gmail dot com

Description:
------------
When i'm calling a function published via PEAR::SOAP works fine. But if I use DB_DataObject package inside the called function I get this error:

[0] => Assigning the return value of new by reference is deprecated
[1] => Server
[2] =>
[3] =>
[4] => Errno: 2048 Filename: /usr/local/php5/lib/php/DB.php Lineno: 470

I'm using last version of DB_DataObject and DB.
DB.php Line: 470 contains the next instrucion
@$obj =& new $classname;

Changing the line to
@$obj = new $classname;

The error moves to another line whith another description:
[0] => Var deprecated, please use public, protected, private...
[1] => Server
[2] =>
[3] =>
[4] => Errno: 2048 Filename: /usr/local/php5/lib/php/DB.php Lineno: 924

DB.php Line: 924 contains the next instrucion
var $autofree;

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

So i left my DB.php as the original and decided to take a look al SOAP classes.

Looking in SOAP/Server.php I found that changing the function _errorHandler to ignore errno 2048, everything starts working again.

So, my Server.php file looks like:
121: if (!$errno || $errno == E_NOTICE || $errno==2048) {
122: return;
123: }

Instead of:
121: if (!$errno || $errno == E_NOTICE ) {
122: return;
123: }

I Don“t know if this is a good solution, but may be... Please let me know about de status of this topic.

regards... Federico Bricker

Test script:
---------------
in myWS.php
------------
class myWebService{

...
...
...

function remoteFunction($id){
if($id!=''){
$sarasa=DB_DataObject::factory('MASTER_ONLINE');
$sarasa->find();
return "THIS TEXT WILL NOT BE SHOWED";
}
}

}

in client.php
-------------
require_once('SOAP/Client.php');

$wsdl=new SOAP_WSDL('http://localhost/ws/myWS.php?wsdl');
$myWS=$wsdl->getProxy();

$res=$myWS->remoteFunction('22');

print_r($res);

Expected result:
----------------
THIS TEXT WILL NOT BE SHOWED

Actual result:
--------------
SOAP_Fault Object ( [error_message_prefix] => PHP [mode] => 1 [level] => 1024 [code] => SOAP-ENV:Server [message] => Assigning the return value of new by reference is deprecated [userinfo] => Array ( [0] => stdClass Object ( [file] => /usr/local/php5/lib/php/SOAP/Fault.php [line] => 52 [function] => PEAR_Error [class] => PEAR_Error [type] => -> [args] => Array ( [0] => Assigning the return value of new by reference is deprecated [1] => Server [2] => [3] => [4] => Errno: 2048 Filename: /usr/local/php5/lib/php/DB.php Lineno: 470 ) ) [1] => stdClass Object ( [file] => /usr/local/php5/lib/php/SOAP/Server.php [line] => 126 [function] => SOAP_Fault [class] => SOAP_Fault [type] => -> [args] => Array ( [0] => Assigning the return value of new by reference is deprecated [1] => Server [2] => PHP [3] => Errno: 2048 Filename: /usr/local/php5/lib/php/DB.php Lineno: 470 ) ) [2] => stdClass Object ( [function] => _errorHandler [class] => SOAP_Server [type] => -> [args] => Array ( [0] => 2048 [1] => Assigning the return value of new by reference is deprecated [2] => /usr/local/php5/lib/php/DB.php [3] => 470 [4] => stdClass Object ( [options] => stdClass Object ( [ARCHIVO_PROTEGIDO] => Cancelando la visualizacion del mismo mysql://root:popmysql@pop-server-db/popdata [schema_location] => ./clasesDAO/ [class_location] => ./clasesDAO/ [require_prefix] => DataObjects/ [class_prefix] => DataObjects_ ) [dsn] => mysql://root:popmysql@pop-server-db/popdata [db_options] => ) ) ) [3] => stdClass Object ( [file] => /usr/local/php5/lib/php/DB/DataObject.php [line] => 2134 [function] => _connect [class] => DB_DataObject [type] =>

...
...
...