Recently, I started converting my Drupal 6 module on PHP 5.2.x to Drupal 7 on PHP 5.3.x, and now I get following warning
Deprecated function: Assigning the
return value of new by reference is
deprecated inrequire_once()(line
27 of
C:\Users\ajinkya\Desktop\xampp\php\PEAR\SOAP\WSDL.php).
Line 27 of WSDL.php is : require_once 'HTTP/Request.php';
I am not able to figure out what is the cause of this warning. Has the behavior of require_once() changed in PHP 5.3.x?
file.inc in Drupal 7 has a line : require_once DRUPAL_ROOT . '/includes/stream_wrappers.inc; and it does not throw any warning. Why?
If I put error_reporting(E_ALL & ~E_DEPRECATED); in a setting.php of Drupal 7, the warning goes away. Is it good to suppress a warning like that?
The error message says that the code is using
$something = &new SomeObject();instead of$something = new SomeObject();.&newwas necessary in ancient PHP versions to ensure objects were always passed by reference. But in recent versions there is no reason to do this at all so it’s deprecated.I have no idea why your PHP reports an incorrect filename/line number though…