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 » HTTP » HTTP_Upload » Bug #6752

'Only variable references should be returned by reference' PHP notice

Details

Submitted2006-02-11 15:44 UTC
Fromkoto at webworkers dot pl
Assignedwenz
StatusClosed
PackageHTTP_Upload
PHP Version5.1.2
OSwinxp
Roadmaps(Not assigned)

Comments

[2006-02-11 15:44 UTC] koto at webworkers dot pl

Description:
------------
Using the package with php 4.4.x or php 5 could result in
'only variable references should be returned by reference' PHP Notice due to using syntax:

return new .....

in functions that are defined to return a reference
(function &name {} )

Simple fix is to apply a patch included below.

Test script:
---------------
--- c:\php\PEAR\HTTP\Upload.php 2006-02-11 15:02:47.956125000 +0100
+++ c:\doc\www\b2boss\admin\includes\PEAR\HTTP\Upload.php 2006-02-11 15:20:37.596750000 +0100
@@ -364,7 +364,8 @@
// warn him about it with a faked upload
- return new HTTP_Upload_File(
- '_error', null,
- null, null,
- null, 'DEV_NO_DEF_FILE',
- $this->lang);
+ $fake =& new HTTP_Upload_File(
+ '_error', null,
+ null, null,
+ null, 'DEV_NO_DEF_FILE',
+ $this->lang);
+ return $fake;
}
@@ -385,3 +386,4 @@
{
- return $this->raiseError('BAD_FORM');
+ $bad_form =& $this->raiseError('BAD_FORM');
+ return $bad_form;
}