|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2008-05-18 11:16 UTC] partner55470745 at aravensoft dot com
Description:
------------
If an input function argument is passed as a reference (as opposed to as a value) and it is used as an argument to fopen(), parsing and/or execution of the script freezes without ANY warning or error whatsoever.
Reproduce code:
---------------
// This does NOT work (although it shoud)
function log_an_event (&$logfile, &$event)
{
$f=fopen($logfile, 'a');
// ...
}
// This is a workaround for the above (first arg not passed as reference)
function log_an_event ($logfile, &$event)
{
$f=fopen($logfile, 'a');
// ...
}
Expected result:
----------------
Non-freezing execution.
Actual result:
--------------
Execution of the script freezes/exits without ANY warning or error whatsoever.
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Dec 02 16:00:02 2025 UTC |
Well the script itself is included in another script using require(). All files are pure .php scripts (no HTML) executed via browser (not CLI). MySQL is used in other parts of the scripts, but is not involved here. PHP Version 5.2.0-8+etch11 This is a shortened but functional version of my reproduce code: <?php function logevent (&$logfile, &$logevent) { $f=fopen($logfile, 'a'); if($f) { fputs($f, $logevent); fclose($f); return true; } return false; } logevent ('/var/logs/somelog.log','somelogevent'); ?>