com php-src: Fix bug #67805 - SplFileObject setMaxLineLength.: ext/spl/spl_directory.c ext/spl/tests/bug67805 .phpt

From: Date: Mon, 08 Jun 2015 09:36:27 +0000
Subject: com php-src: Fix bug #67805 - SplFileObject setMaxLineLength.: ext/spl/spl_directory.c ext/spl/tests/bug67805 .phpt
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-87092@lists.php.net to get a copy of this message
Commit: 8e747f6833190d2fd189b037af6d7636abd4d7f4 Author: Willian Gustavo Veiga <contact@willianveiga.com> Fri, 5 Jun 2015 21:31:33 -0300 Committer: Anatol Belski <ab@php.net> Mon, 8 Jun 2015 11:36:27 +0200 Parents: 0cd86f6b7783ad09acd98a655f38d1359d9e0c72 Branches: master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=8e747f6833190d2fd189b037af6d7636abd4d7f4 Log: Fix bug #67805 - SplFileObject setMaxLineLength. Bugs: https://bugs.php.net/67805 Changed paths: M ext/spl/spl_directory.c A ext/spl/tests/bug67805.phpt Diff: diff --git a/ext/spl/spl_directory.c b/ext/spl/spl_directory.c index 12c50c0..dbf34f1 100644 --- a/ext/spl/spl_directory.c +++ b/ext/spl/spl_directory.c @@ -2031,7 +2031,7 @@ static int spl_filesystem_file_read(spl_filesystem_object *intern, int silent) / if (intern->u.file.max_line_len > 0) { buf = safe_emalloc((intern->u.file.max_line_len + 1), sizeof(char), 0); - if (php_stream_get_line(intern->u.file.stream, buf, intern->u.file.max_line_len, &line_len) == NULL) { + if (php_stream_get_line(intern->u.file.stream, buf, intern->u.file.max_line_len + 1, &line_len) == NULL) { efree(buf); buf = NULL; } else { diff --git a/ext/spl/tests/bug67805.phpt b/ext/spl/tests/bug67805.phpt new file mode 100644 index 0000000..ba07b3d --- /dev/null +++ b/ext/spl/tests/bug67805.phpt @@ -0,0 +1,15 @@ +--TEST-- +Bug #67805 SplFileObject setMaxLineLength +--CREDITS-- +Willian Gustavo Veiga <contact@willianveiga.com> +--FILE-- +<?php +$splFileObject = new SplFileObject(__FILE__); +$splFileObject->setMaxLineLen(3); +$line = $splFileObject->getCurrentLine(); +var_dump($line === '<?p'); +var_dump(strlen($line) === 3); +?> +--EXPECTF-- +bool(true) +bool(true)

« previous php.cvs (#87092) next »