PHP :: Bug #52573 :: SplFileObject::fscanf Segmentation fault
| Bug #52573 | SplFileObject::fscanf Segmentation fault | |||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Submitted: | 2010-08-10 10:15 UTC | Modified: | 2010-08-18 04:00 UTC |
|
||||||||||
| From: | ti dot bugmenot at gmail dot com | Assigned: | felipe (profile) | |||||||||||
| Status: | Closed | Package: | SPL related | |||||||||||
| PHP Version: | PHP 5.3.99-dev (snapshot 201008160630) | OS: | FreeBSD | |||||||||||
| Private report: | No | CVE-ID: | None | |||||||||||
[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
Patches
Pull Requests
History
AllCommentsChangesGit/SVN commits
[2010-08-11 00:37 UTC] felipe@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: felipe
[2010-08-11 00:37 UTC] felipe@php.net
[2010-08-16 09:04 UTC] ti dot bugmenot at gmail dot com
-Operating System: +Operating System: FreeBSD -PHP Version: 5.3.3 +PHP Version: PHP 5.3.99-dev (snapshot 201008160630)
[2010-08-16 09:04 UTC] ti dot bugmenot at gmail dot com
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[2010-08-18 04:00 UTC] felipe@php.net