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 {
--- /dev/null
+--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)