mirror of
https://github.com/php/php-src.git
synced 2024-09-23 02:47:26 +00:00
Fixed #46053 (SplFileObject::seek - Endless loop)
This commit is contained in:
parent
f327994df3
commit
f49c3c98bc
@ -2612,7 +2612,9 @@ SPL_METHOD(SplFileObject, seek)
|
||||
spl_filesystem_file_rewind(getThis(), intern TSRMLS_CC);
|
||||
|
||||
while(intern->u.file.current_line_num < line_pos) {
|
||||
spl_filesystem_file_read_line(getThis(), intern, 1 TSRMLS_CC);
|
||||
if (spl_filesystem_file_read_line(getThis(), intern, 1 TSRMLS_CC) == FAILURE) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
} /* }}} */
|
||||
|
||||
|
12
ext/spl/tests/bug46053.phpt
Normal file
12
ext/spl/tests/bug46053.phpt
Normal file
@ -0,0 +1,12 @@
|
||||
--TEST--
|
||||
Bug #46053 (SplFileObject::seek - Endless loop)
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$x = new splfileobject(__FILE__);
|
||||
$x->getPathName();
|
||||
$x->seek(10);
|
||||
$x->seek(0);
|
||||
var_dump(trim($x->fgets()));
|
||||
--EXPECTF--
|
||||
string(%d) "<?php"
|
Loading…
Reference in New Issue
Block a user