|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2010-08-10 10:15 UTC] ti dot bugmenot at gmail dot com
Description:
------------
Segmentation fault when using additional parameters SplFileObject::fscanf
Test script:
---------------
<?php // test
error_reporting(E_ALL);
echo "TEST 1:\n";
$f = new SplFileObject(__FILE__, 'r');
$f->fscanf('<?php // %s', $result);
echo $result;
echo "TEST 2:\n";
$result = null;
$f = new SplFileObject(__FILE__, 'r');
$f->fscanf('<?php // %s', $result);
echo $result;
Expected result:
----------------
TEST 1:
test
TEST 2:
test
Actual result:
--------------
TEST 1:
<br />
<b>Notice</b>: Undefined variable: result in <b>/tmp/fail.php</b> on line <b>7</b><br />
<br />
<b>Notice</b>: Undefined variable: result in <b>/tmp/fail.php</b> on line <b>8</b><br />
TEST 2:
<br />
<b>Warning</b>: Parameter 3 to fscanf() expected to be a reference, value given in <b>/tmp/fail.php</b> on line <b>15</b><br />
Segmentation fault
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Nov 01 04:00:02 2025 UTC |
Fail. CODE: <?php // test error_reporting(E_ALL); echo "TEST 2:\n"; $result = null; $f = new SplFileObject(__FILE__, 'r'); $f->fscanf('<?php // %s', $result); echo $result; /opt/php-trunk/bin/php /tmp/test.php RESULT: Warning: Parameter 3 to fscanf() expected to be a reference, value given in /tmp/test.php on line 8 CODE: <?php // test error_reporting(E_ALL); echo "TEST 3:\n"; $result = null; $f = new SplFileObject(__FILE__, 'r'); $f->fscanf('<?php // %s', &$result); echo $result; RESULT: Fatal error: Call-time pass-by-reference has been removed in /tmp/test.php on line 8 http://snaps.php.net/php-trunk-201008160630.tar.bz2