From: viewport2heaven at yahoo dot com Operating system: Red Hat 4.0.1-5 PHP version: 4.4.1 PHP Bug Type: Variables related Bug description: erroneous notice concerning return by reference
Description: ------------ When returning a newly created object, PHP throws up a notice (sounds like warning) like "Only variable references should be returned by reference". This happens in PEAR::Mail_Mime, location Mail/mime.php on line 320. I don't think this is a Mail_Mime error. The one on line 593 is a Mail_Mime error, though. It returns the value of a function call, and that function called wasn't declared with return-by-reference. Even if this isn't a bug by your standards (and by the PHP manual written by you guys), please do consider it a feature request? I upgraded from 4.4.0 just because I thought you guys fixed this issue. I'm using Mail 1.1.9 and Mail_Mime 1.3.1. My PHP config: --enable-safe-mode --disable-short-tags --with-apxs=myapxs --enable-discard-path --enable-fastcgi --with-mysql Reproduce code: --------------- function &_addTextPart(&$obj, $text) { $params['content_type'] = 'text/plain'; $params['encoding'] = $this->_build_params['text_encoding']; $params['charset'] = $this->_build_params['text_charset']; if (is_object($obj)) { return $obj->addSubpart($text, $params); } else { return new Mail_mimePart($text, $params); // Offending line!! } } function &headers($xtra_headers = null) { // Content-Type header should already be present, // So just add mime version header $headers['MIME-Version'] = '1.0'; if (isset($xtra_headers)) { $headers = array_merge($headers, $xtra_headers); } $this->_headers = array_merge($headers, $this->_headers); return $this->_encodeHeaders($this->_headers); // Offending line!! } Expected result: ---------------- There shouldn't be a notice when we return a new instantiation of an object through a function declared to return by-reference. -- Edit bug report at http://bugs.php.net/?id=35291&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=35291&r=trysnapshot4 Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=35291&r=trysnapshot50 Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=35291&r=trysnapshot51 Fixed in CVS: http://bugs.php.net/fix.php?id=35291&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=35291&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=35291&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=35291&r=needscript Try newer version: http://bugs.php.net/fix.php?id=35291&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=35291&r=support Expected behavior: http://bugs.php.net/fix.php?id=35291&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=35291&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=35291&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=35291&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=35291&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=35291&r=dst IIS Stability: http://bugs.php.net/fix.php?id=35291&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=35291&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=35291&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=35291&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=35291&r=mysqlcfg