colder Wed Jun 18 10:05:29 2008 UTC Added files: (Branch: PHP_5_3) /php-src/ext/spl/tests bug45216.phpt
Modified files: /php-src/ext/spl spl_directory.c Log: MFH: Fix #45216 (Add a default size for fgetss) http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_directory.c?r1=1.45.2.27.2.23.2.21&r2=1.45.2.27.2.23.2.22&diff_format=u Index: php-src/ext/spl/spl_directory.c diff -u php-src/ext/spl/spl_directory.c:1.45.2.27.2.23.2.21 php-src/ext/spl/spl_directory.c:1.45.2.27.2.23.2.22 --- php-src/ext/spl/spl_directory.c:1.45.2.27.2.23.2.21 Tue May 20 21:46:50 2008 +++ php-src/ext/spl/spl_directory.c Wed Jun 18 10:05:29 2008 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: spl_directory.c,v 1.45.2.27.2.23.2.21 2008/05/20 21:46:50 colder Exp $ */ +/* $Id: spl_directory.c,v 1.45.2.27.2.23.2.22 2008/06/18 10:05:29 colder Exp $ */ #ifdef HAVE_CONFIG_H # include "config.h" @@ -2295,7 +2295,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