php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #65618 function return in write mode fails to throw error within foreach loop
Submitted: 2013-09-04 19:49 UTC Modified: 2013-10-15 11:54 UTC
From: cavensben at gmail dot com Assigned:
Status: No Feedback Package: Reproducible crash
PHP Version: 5.4.19 OS: windows vista
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2013-09-04 19:49 UTC] cavensben at gmail dot com
Description:
------------
PHP version 5.3.8

When a function return is in write mode inside a foreach loop, no exception is 
thrown. Fatal exception 'Can't use function return value in write context' 
should be thrown but instead, Apache crashes with following error details 
(dutch): 

Gebeurtenisnaam van probleem:	APPCRASH
  Naam van de toepassing:	httpd.exe
  Versie van toepassing:	2.2.21.0
  Tijdstempel van toepassing:	4e6b3136
  Naam van foutmodule:	        php5ts.dll
  Versie van foutmodule:	5.3.8.0
  Tijdstempel van foutmodule:	4e537a04
  Uitzonderingscode:	        c0000005
  Uitzonderingsmarge:	        0003c45d
  Versie van besturingssysteem:	6.0.6002.2.2.0.256.6
  Landinstelling-id:	        2067
  Aanvullende informatie 1:	f1e8
  Aanvullende informatie 2:	d4eb7cf28a4f910486e91a11f70d294f
  Aanvullende informatie 3:	9e36
  Aanvullende informatie 4:	0fa4d7271c395f5ea87ec2c924074b62


Test script:
---------------
foreach($values as $value)
{
    if(!empty(trim($value))){ $result = $value;}
}

Expected result:
----------------
Fatal exception: Can't use function return value in write context

Actual result:
--------------
Apache crashes

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2013-09-04 20:38 UTC] aharvey@php.net
-Status: Open +Status: Feedback -Package: Apache related +Package: Reproducible crash
 [2013-09-04 20:38 UTC] aharvey@php.net
I can't reproduce this. Does this still happen on a current 5.4 build? (You can 
get a snapshot at http://windows.php.net/snapshots/.) If so, could you please try 
to get a backtrace using the instructions at http://bugs.php.net/bugs-generating-
backtrace-win32.php?

The empty() changes in PHP 5.5 mean that this is likely to just work regardless 
(without the error) in 5.5 onwards, so the only branch that's still fully 
supported that's likely to be affected is 5.4.
 [2013-10-15 11:54 UTC] php-bugs at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat May 04 18:01:32 2024 UTC