Commit d68cd18ceb7 for php

commit d68cd18ceb7afa5107764e39b899bd785bd89b1e
Author: lacatoire <la.catoire@gmail.com>
Date:   Thu Nov 12 18:01:39 2026 +0000

    ext/pgsql: fix the wrong names in the pg_lo_write() and pg_lo_read() errors

    pg_lo_write() referred to a nonexistent $buf parameter; it is $data.
    pg_lo_read() was the only check worded "greater or equal than".

    Close GH-25409

diff --git a/ext/pgsql/pgsql.c b/ext/pgsql/pgsql.c
index 2eb2d6b306e..64d3b61d18d 100644
--- a/ext/pgsql/pgsql.c
+++ b/ext/pgsql/pgsql.c
@@ -2785,7 +2785,7 @@ PHP_FUNCTION(pg_lo_read)
 	CHECK_PGSQL_LOB(pgsql);

 	if (buffer_length < 0) {
-		zend_argument_value_error(2, "must be greater or equal than 0");
+		zend_argument_value_error(2, "must be greater than or equal to 0");
 		RETURN_THROWS();
 	}

@@ -2825,7 +2825,7 @@ PHP_FUNCTION(pg_lo_write)
 			RETURN_THROWS();
 		}
 		if (z_len > (zend_long)ZSTR_LEN(str)) {
-			zend_argument_value_error(3, "must be less than or equal to the length of argument #2 ($buf)");
+			zend_argument_value_error(3, "must be less than or equal to the length of argument #2 ($data)");
 			RETURN_THROWS();
 		}
 		len = z_len;
diff --git a/ext/pgsql/tests/pg_lo_write_null_bytes.phpt b/ext/pgsql/tests/pg_lo_write_null_bytes.phpt
index 44073692a18..681669895b8 100644
--- a/ext/pgsql/tests/pg_lo_write_null_bytes.phpt
+++ b/ext/pgsql/tests/pg_lo_write_null_bytes.phpt
@@ -36,6 +36,11 @@
 pg_lo_close($handle);
 $handle = pg_lo_open($db, $oid, "r");
 var_dump(bin2hex(pg_lo_read($handle)));
+try {
+    pg_lo_read($handle, -1);
+} catch (Throwable $e) {
+    echo $e::class, ": ", $e->getMessage(), "\n";
+}
 pg_lo_close($handle);
 pg_exec($db, "ROLLBACK");
 ?>
@@ -45,5 +50,6 @@
 int(2)
 int(0)
 ValueError: pg_lo_write(): Argument #3 ($length) must be greater than or equal to 0
-ValueError: pg_lo_write(): Argument #3 ($length) must be less than or equal to the length of argument #2 ($buf)
+ValueError: pg_lo_write(): Argument #3 ($length) must be less than or equal to the length of argument #2 ($data)
 string(6) "780079"
+ValueError: pg_lo_read(): Argument #2 ($length) must be greater than or equal to 0