Bug #52573 [Csd]: SplFileObject::fscanf Segmentation fault

From: Date: Mon, 16 Aug 2010 07:04:47 +0000
Subject: Bug #52573 [Csd]: SplFileObject::fscanf Segmentation fault
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-153469@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
 User updated by:    ti dot bugmenot at gmail dot com
 Reported by:        ti dot bugmenot at gmail dot com
 Summary:            SplFileObject::fscanf  Segmentation fault
 Status:             Closed
 Type:               Bug
 Package:            SPL related
-Operating System:   
+Operating System:   FreeBSD
-PHP Version:        5.3.3
+PHP Version:        PHP 5.3.99-dev (snapshot 201008160630)
 Assigned To:        felipe
 Block user comment: N

 New Comment:

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


Previous Comments:
------------------------------------------------------------------------
[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&amp;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


Thread (4 messages)

« previous php.bugs (#153469) next »