#33884 [NEW]: Only variable references should be returned by reference if I return nothing

2005-07-27 Thread php-bugs-2005 at ryandesign dot com
From: php-bugs-2005 at ryandesign dot com
Operating system: N/A
PHP version:  4.4.0
PHP Bug Type: Unknown/Other Function
Bug description:  Only variable references should be returned by reference if 
I return nothing

Description:

Hi. After upgrading from PHP 4.3.11 to 4.4.0 I get the 
famous Only variable references should be returned by 
reference notice in one of my projects. The function in 
question returns by reference, but only needs to do this 
sometimes. Other times, it returns nothing at all, because 
the caller does not need a return value. In these latter 
cases, PHP produces the notice as of 4.4.0.

This surprised me because it's perfectly fine to have a 
normal return-by-copy function that does not return 
anything. So why not a return-by-reference function?

I couldn't find any documentation that if your function 
returns by reference, then you must always return something.

In my particular case I can rewrite the function so that it 
always returns something, even when the caller has no use 
for it. I just wasn't sure if the notice in this case was 
intended, and if so, why.

If the behavior is intended, then the documentation should 
reflect this.

Reproduce code:
---
error_reporting(E_ALL);

function foo_by_reference_with_return() {
echo __FUNCTION__ . br /\n;
return $GLOBALS['bar'];
}
function foo_by_reference_without_return() {
echo __FUNCTION__ . br /\n;
} // line 11
function foo_by_copy_with_return() {
echo __FUNCTION__ . br /\n;
return $GLOBALS['bar'];
}
function foo_by_copy_without_return() {
echo __FUNCTION__ . br /\n;
}

foo_by_reference_with_return();
foo_by_reference_without_return(); // causes notice in 4.4.0
foo_by_copy_with_return();
foo_by_copy_without_return();

Expected result:

foo_by_reference_with_return
foo_by_reference_without_return
foo_by_copy_with_return
foo_by_copy_without_return

Actual result:
--
foo_by_reference_with_return
foo_by_reference_without_return
Notice: Only variable references should be returned by 
reference in references.php on line 11
foo_by_copy_with_return
foo_by_copy_without_return

-- 
Edit bug report at http://bugs.php.net/?id=33884edit=1
-- 
Try a CVS snapshot (php4):   http://bugs.php.net/fix.php?id=33884r=trysnapshot4
Try a CVS snapshot (php5.0): 
http://bugs.php.net/fix.php?id=33884r=trysnapshot50
Try a CVS snapshot (php5.1): 
http://bugs.php.net/fix.php?id=33884r=trysnapshot51
Fixed in CVS:http://bugs.php.net/fix.php?id=33884r=fixedcvs
Fixed in release:http://bugs.php.net/fix.php?id=33884r=alreadyfixed
Need backtrace:  http://bugs.php.net/fix.php?id=33884r=needtrace
Need Reproduce Script:   http://bugs.php.net/fix.php?id=33884r=needscript
Try newer version:   http://bugs.php.net/fix.php?id=33884r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=33884r=support
Expected behavior:   http://bugs.php.net/fix.php?id=33884r=notwrong
Not enough info: 
http://bugs.php.net/fix.php?id=33884r=notenoughinfo
Submitted twice: 
http://bugs.php.net/fix.php?id=33884r=submittedtwice
register_globals:http://bugs.php.net/fix.php?id=33884r=globals
PHP 3 support discontinued:  http://bugs.php.net/fix.php?id=33884r=php3
Daylight Savings:http://bugs.php.net/fix.php?id=33884r=dst
IIS Stability:   http://bugs.php.net/fix.php?id=33884r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=33884r=gnused
Floating point limitations:  http://bugs.php.net/fix.php?id=33884r=float
No Zend Extensions:  http://bugs.php.net/fix.php?id=33884r=nozend
MySQL Configuration Error:   http://bugs.php.net/fix.php?id=33884r=mysqlcfg


#32624 [NEW]: Rephrase: Please allow this report to be send to the PHP QA team.

2005-04-12 Thread php-bugs-2005 at ryandesign dot com
From: php-bugs-2005 at ryandesign dot com
Operating system: N/A
PHP version:  5.0.4
PHP Bug Type: Compile Warning
Bug description:  Rephrase: Please allow this report to be send to the PHP QA 
team.

Description:

In ./run-tests.php and ./server-tests.php the following 
message can be displayed:

 Please allow this report to be send to the PHP QA
 team. This will give us a better understanding in how
 PHP's test cases are doing.

There are a number of problems with this message. For 
one thing, it should be sent and not send, and I 
think understanding of how is better than 
understanding in how.

The fundamental problem though is made obvious by the 
prompt that follows it:

 (choose s to just save the results to a file)?
 [Yns]:

See, there's a question mark, and it expects a yes or 
no (or save) answer. I would therefore reformulate 
it as a question.

The message also seems to appear without any 
explanation to the user. It could be made friendlier. 
Suggestion below.

This problem is presumably also present in PHP4.

Reproduce code:
---
N/A

Expected result:

You may have found a problem in PHP's test cases.
We'd like to automatically send this report to the
PHP QA team, to give us a better understanding of how
the test cases are doing. If you don't want to send it
immediately, you can choose s to save the report to
a file that you can send us later.

May we send this report now? [Yns]:

Actual result:
--
Please allow this report to be send to the PHP QA
team. This will give us a better understanding in how
PHP's test cases are doing.

(choose s to just save the results to a file)? [Yns]:

-- 
Edit bug report at http://bugs.php.net/?id=32624edit=1
-- 
Try a CVS snapshot (php4):   http://bugs.php.net/fix.php?id=32624r=trysnapshot4
Try a CVS snapshot (php5.0): 
http://bugs.php.net/fix.php?id=32624r=trysnapshot50
Try a CVS snapshot (php5.1): 
http://bugs.php.net/fix.php?id=32624r=trysnapshot51
Fixed in CVS:http://bugs.php.net/fix.php?id=32624r=fixedcvs
Fixed in release:http://bugs.php.net/fix.php?id=32624r=alreadyfixed
Need backtrace:  http://bugs.php.net/fix.php?id=32624r=needtrace
Need Reproduce Script:   http://bugs.php.net/fix.php?id=32624r=needscript
Try newer version:   http://bugs.php.net/fix.php?id=32624r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=32624r=support
Expected behavior:   http://bugs.php.net/fix.php?id=32624r=notwrong
Not enough info: 
http://bugs.php.net/fix.php?id=32624r=notenoughinfo
Submitted twice: 
http://bugs.php.net/fix.php?id=32624r=submittedtwice
register_globals:http://bugs.php.net/fix.php?id=32624r=globals
PHP 3 support discontinued:  http://bugs.php.net/fix.php?id=32624r=php3
Daylight Savings:http://bugs.php.net/fix.php?id=32624r=dst
IIS Stability:   http://bugs.php.net/fix.php?id=32624r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=32624r=gnused
Floating point limitations:  http://bugs.php.net/fix.php?id=32624r=float
No Zend Extensions:  http://bugs.php.net/fix.php?id=32624r=nozend
MySQL Configuration Error:   http://bugs.php.net/fix.php?id=32624r=mysqlcfg


#32624 [Fbk-Opn]: Rephrase: Please allow this report to be send to the PHP QA team.

2005-04-12 Thread php-bugs-2005 at ryandesign dot com
 ID:   32624
 User updated by:  php-bugs-2005 at ryandesign dot com
 Reported By:  php-bugs-2005 at ryandesign dot com
-Status:   Feedback
+Status:   Open
 Bug Type: Compile Warning
 Operating System: N/A
 PHP Version:  5.0.4
 New Comment:

Oh, very well. :-)

http://test.michel-consulting.de/ryan/php-5.0.4-failed-
test-message.patch


Previous Comments:


[2005-04-07 17:53:58] [EMAIL PROTECTED]

Could you please be so kind and provide a patch?
(for run-tests.php)




[2005-04-07 16:17:35] php-bugs-2005 at ryandesign dot com

Description:

In ./run-tests.php and ./server-tests.php the following 
message can be displayed:

 Please allow this report to be send to the PHP QA
 team. This will give us a better understanding in how
 PHP's test cases are doing.

There are a number of problems with this message. For 
one thing, it should be sent and not send, and I 
think understanding of how is better than 
understanding in how.

The fundamental problem though is made obvious by the 
prompt that follows it:

 (choose s to just save the results to a file)?
 [Yns]:

See, there's a question mark, and it expects a yes or 
no (or save) answer. I would therefore reformulate 
it as a question.

The message also seems to appear without any 
explanation to the user. It could be made friendlier. 
Suggestion below.

This problem is presumably also present in PHP4.

Reproduce code:
---
N/A

Expected result:

You may have found a problem in PHP's test cases.
We'd like to automatically send this report to the
PHP QA team, to give us a better understanding of how
the test cases are doing. If you don't want to send it
immediately, you can choose s to save the report to
a file that you can send us later.

May we send this report now? [Yns]:

Actual result:
--
Please allow this report to be send to the PHP QA
team. This will give us a better understanding in how
PHP's test cases are doing.

(choose s to just save the results to a file)? [Yns]:





-- 
Edit this bug report at http://bugs.php.net/?id=32624edit=1