Skip to content

Commit 2e0f75e

Browse files
authored
ext/pgsql: pg_lo_read addressing the todo. (php#11159)
1 parent bb38ad7 commit 2e0f75e

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

ext/pgsql/pgsql.c

+2-3
Original file line numberDiff line numberDiff line change
@@ -2490,9 +2490,8 @@ PHP_FUNCTION(pg_lo_read)
24902490
RETURN_FALSE;
24912491
}
24922492

2493-
/* TODO Use truncate API? */
2494-
ZSTR_LEN(buf) = nbytes;
2495-
ZSTR_VAL(buf)[ZSTR_LEN(buf)] = '\0';
2493+
ZSTR_VAL(buf)[nbytes] = '\0';
2494+
buf = zend_string_truncate(buf, nbytes, 0);
24962495
RETURN_NEW_STR(buf);
24972496
}
24982497
/* }}} */

0 commit comments

Comments
 (0)