[php-src] master: ext/pgsql: fix the class name casing of pg_close_stmt()'s connection

lacatoire via David Carlier <[email protected]>
Newsgroups gmane.comp.php.cvs.general
Message-ID <[email protected]>
Author: lacatoire (lacatoire)
Committer: David Carlier (devnexen)
Date: 2026-08-20T21:37:42+01:00

Commit: https://github.com/php/php-src/commit/fb604aab1d581b5d51057208ab921eb94cc5f466
Raw diff: https://github.com/php/php-src/commit/fb604aab1d581b5d51057208ab921eb94cc5f466.diff

ext/pgsql: fix the class name casing of pg_close_stmt()'s connection

The stub spelled it Pgsql\Connection, the only such spelling in the
extension. Resolution is case-insensitive, but Reflection reported a
class name that does not match the declared one.

Close GH-23393

Changed paths:
  A  ext/pgsql/tests/pg_close_stmt_parameter_type.phpt
  M  NEWS
  M  ext/pgsql/pgsql.stub.php
  M  ext/pgsql/pgsql_arginfo.h


Diff:

diff --git a/NEWS b/NEWS
index 78265622e7d7..887ff5b3401d 100644
--- a/NEWS
+++ b/NEWS
@@ -58,6 +58,10 @@ PHP                                                                        NEWS
     left busy for the next fetch, and rows delivered from a result another
     statement took over. (KentarouTakeda)
 
+- PGSQL:
+  . Fixed the class name casing of pg_close_stmt()'s connection parameter.
+    (lacatoire)
+
 - Phar:
   . Fixed Phar archives being automatically detected when ".phar" only occurs
     in a directory name or is not a filename extension in an included file's
diff --git a/ext/pgsql/pgsql.stub.php b/ext/pgsql/pgsql.stub.php
index 52ddc3b3748a..8c5a7f4c6d98 100644
--- a/ext/pgsql/pgsql.stub.php
+++ b/ext/pgsql/pgsql.stub.php
@@ -956,7 +956,7 @@ function pg_socket_poll($socket, int $read, int $write, int $timeout = -1): int
     function pg_set_chunked_rows_size(PgSql\Connection $connection, int $size): bool {}
 #endif
 #ifdef HAVE_PG_CLOSE_STMT
-    function pg_close_stmt(Pgsql\Connection $connection, string $statement_name): PgSql\Result|false {}
+    function pg_close_stmt(PgSql\Connection $connection, string $statement_name): PgSql\Result|false {}
 #endif
 }
 
diff --git a/ext/pgsql/pgsql_arginfo.h b/ext/pgsql/pgsql_arginfo.h
index 63a1d185d535..974a6e9117cd 100644
--- a/ext/pgsql/pgsql_arginfo.h
+++ b/ext/pgsql/pgsql_arginfo.h
@@ -1,5 +1,5 @@
 /* This is a generated file, edit pgsql.stub.php instead.
- * Stub hash: f25b5a574c96d4bc2f08b8cacab16f499a164a6b */
+ * Stub hash: fa7cd778f4e791b15ffc8f1786384332449bda5a */
 
 ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_pg_connect, 0, 1, PgSql\\Connection, MAY_BE_FALSE)
 	ZEND_ARG_TYPE_INFO(0, connection_string, IS_STRING, 0)
@@ -503,7 +503,7 @@ ZEND_END_ARG_INFO()
 
 #if defined(HAVE_PG_CLOSE_STMT)
 ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_pg_close_stmt, 0, 2, PgSql\\Result, MAY_BE_FALSE)
-	ZEND_ARG_OBJ_INFO(0, connection, Pgsql\\Connection, 0)
+	ZEND_ARG_OBJ_INFO(0, connection, PgSql\\Connection, 0)
 	ZEND_ARG_TYPE_INFO(0, statement_name, IS_STRING, 0)
 ZEND_END_ARG_INFO()
 #endif
diff --git a/ext/pgsql/tests/pg_close_stmt_parameter_type.phpt b/ext/pgsql/tests/pg_close_stmt_parameter_type.phpt
new file mode 100644
index 000000000000..c9c6c4f40ad5
--- /dev/null
+++ b/ext/pgsql/tests/pg_close_stmt_parameter_type.phpt
@@ -0,0 +1,22 @@
+--TEST--
+pg_close_stmt(): the connection parameter is typed like every other pgsql function
+--EXTENSIONS--
+pgsql
+--SKIPIF--
+<?php
+if (!function_exists('pg_close_stmt')) die('skip pg_close_stmt() requires libpq >= 17');
+?>
+--FILE--
+<?php
+
+foreach (['pg_close_stmt', 'pg_connect_poll'] as $function) {
+    $parameter = (new ReflectionFunction($function))->getParameters()[0];
+    printf("%-16s %s\n", $function, $parameter->getType());
+}
+
+var_dump((new ReflectionClass(PgSql\Connection::class))->getName());
+?>
+--EXPECT--
+pg_close_stmt    PgSql\Connection
+pg_connect_poll  PgSql\Connection
+string(16) "PgSql\Connection"
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.