colder Wed Jun 18 10:05:15 2008 UTC
Added files:
/php-src/ext/spl/tests bug45216.phpt
Modified files:
/php-src/ext/spl spl_directory.c
Log:
Fix #45216 (Add a default size for fgetss)
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_directory.c?r1=1.155&r2=1.156&diff_format=u
Index: php-src/ext/spl/spl_directory.c
diff -u php-src/ext/spl/spl_directory.c:1.155
php-src/ext/spl/spl_directory.c:1.156
--- php-src/ext/spl/spl_directory.c:1.155 Tue May 20 21:46:13 2008
+++ php-src/ext/spl/spl_directory.c Wed Jun 18 10:05:14 2008
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: spl_directory.c,v 1.155 2008/05/20 21:46:13 colder Exp $ */
+/* $Id: spl_directory.c,v 1.156 2008/06/18 10:05:14 colder Exp $ */
#ifdef HAVE_CONFIG_H
# include "config.h"
@@ -2427,7 +2427,12 @@
spl_filesystem_object *intern =
(spl_filesystem_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
zval *arg2 = NULL;
MAKE_STD_ZVAL(arg2);
- ZVAL_LONG(arg2, intern->u.file.max_line_len);
+
+ if (intern->u.file.max_line_len > 0) {
+ ZVAL_LONG(arg2, intern->u.file.max_line_len);
+ } else {
+ ZVAL_LONG(arg2, 1024);
+ }
spl_filesystem_file_free_line(intern TSRMLS_CC);
intern->u.file.current_line_num++;
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/tests/bug45216.phpt?view=markup&rev=1.1
Index: php-src/ext/spl/tests/bug45216.phpt
+++ php-src/ext/spl/tests/bug45216.phpt
--TEST--
SPL: SplFileObject::fgetss (bug 45216)
--CREDITS--
Perrick Penet <[EMAIL PROTECTED]>
#testfest phpcampparis 2008-06-07
--FILE--
<?php
$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));
?>
--CLEAN--
<?php
unlink(dirname(__FILE__) . '/foo.html');
?>
--EXPECTF--
string(12) "text 0text 1"
string(12) "text 0text 1"
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php