ID:               45216
 Updated by:       [EMAIL PROTECTED]
-Summary:          SplFileObject::fgetss is not mapped correctly
 Reported By:      perrick at noparking dot net
-Status:           Open
+Status:           Closed
 Bug Type:         SPL related
 Operating System: mac os x
 PHP Version:      5.3CVS-2008-06-09 (snap)
 Assigned To:      colder
 New Comment:

This bug has been fixed in CVS.

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.

As the title change says, the problem was not the mapping, but rather
that fgetss was fed with the max_line_len which could be 0, and fgetss
choke on 0. 

Now if the max_line_len is <= 0, it defaults to 1024.


Previous Comments:
------------------------------------------------------------------------

[2008-06-09 15:52:52] perrick at noparking dot net

Description:
------------
SplFileObject::fgetss($allowable_tags = NULL) doesn't work at all.

The underlying fgetss that's called in the object needs a length :
"string fgetss ( resource $handle [, int $length [, string
$allowable_tags ]] )"

A test is available on testfest.php.net :

http://testfest.php.net/index.php?do=details&task_id=126

Reproduce code:
---------------
$file = dirname(__FILE__) . '/foo.html';
file_put_contents($file, 'text 0<div class="tested">text 1</div>');
$handle = fopen($file, 'r');

$object = new SplFileObject($file);
var_dump($object->fgetss());
var_dump(fgetss($handle));

Expected result:
----------------
string(12) "text 0text 1"
string(12) "text 0text 1"


Actual result:
--------------
Warning: fgetss(): Length parameter must be greater than 0 in
/Users/perrick/Desktop/testfest/spl_fileobject_fgetss_basic.php on line
7

string(12) "text 0text 1"



------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=45216&edit=1

Reply via email to