Bug #52573 [Csd]: SplFileObject::fscanf Segmentation fault
| From: | felipe@php.net | Date: | Wed, 18 Aug 2010 02:00:14 +0000 |
| Subject: | Bug #52573 [Csd]: SplFileObject::fscanf Segmentation fault | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-153545@lists.php.net to get a copy of this message | ||
Edit report at http://bugs.php.net/bug.php?id=52573&edit=1
ID: 52573
Updated by: felipe@php.net
Reported by: ti dot bugmenot at gmail dot com
Summary: SplFileObject::fscanf Segmentation fault
Status: Closed
Type: Bug
Package: SPL related
Operating System: FreeBSD
PHP Version: PHP 5.3.99-dev (snapshot 201008160630)
Assigned To: felipe
Block user comment: N
New Comment:
Thanks for the feedback, I've fixed this issue in SVN.
Thanks.
Previous Comments:
------------------------------------------------------------------------
[2010-08-18 03:59:39] felipe@php.net
Automatic comment from SVN on behalf of felipe
Revision: http://svn.php.net/viewvc/?view=revision&revision=302420
Log: - Improved fix for bug #52573
------------------------------------------------------------------------
[2010-08-16 09:04:46] 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-11 00:37:31] felipe@php.net
This bug has been fixed in SVN.
Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
Thank you for the report, and for helping us make PHP better.
------------------------------------------------------------------------
[2010-08-11 00:37:26] felipe@php.net
Automatic comment from SVN on behalf of felipe
Revision: http://svn.php.net/viewvc/?view=revision&revision=302085
Log: - Fixed bug #52573 (SplFileObject::fscanf Segmentation fault)
------------------------------------------------------------------------
[2010-08-10 10:15:00] 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
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/bug.php?id=52573&edit=1