RETURN_NULL();
}
- php_stream_from_zval(stream, &zstream);
-
- if (length > 0) {
+ if (length == 1) {
/* For BC reasons, fgets() should only return length-1 bytes. */
+ RETURN_FALSE;
+ } else if (length > 1) {
length--;
}
+ php_stream_from_zval(stream, &zstream);
+
buf.v = php_stream_get_line_ex(stream, stream->readbuf_type, NULL_ZSTR, 0, length, &retlen);
if (!buf.v) {
RETURN_FALSE;
}
/* }}} */
-/* {{{ proto string fgetss(resource fp [, int length, string allowable_tags]) U
+/* {{{ proto string fgetss(resource fp [, int lengthish, string allowable_tags]) U
Get a line from file pointer and strip HTML tags */
PHPAPI PHP_FUNCTION(fgetss)
{
return;
}
+ if (length == 1) {
+ /* For BC reasons, fgetss() should only return length-1 bytes. */
+ RETURN_FALSE;
+ } else if (length > 1) {
+ length--;
+ }
+
php_stream_from_zval(stream, &zstream);
if (length > 0) {