|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2005-11-19 12:13 UTC] tony2001@php.net
[2005-11-27 01:00 UTC] php-bugs at lists dot php dot net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Oct 28 07:00:01 2025 UTC |
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.