[php-src] master: Merge branch 'PHP-8.5' into PHP-8.6
| From: | Calvin Buckley | Date: | Tue, 27 Oct 2026 14:30:34 +0000 |
| Subject: | [php-src] master: Merge branch 'PHP-8.5' into PHP-8.6 | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-142802@lists.php.net to get a copy of this message | ||
Author: Calvin Buckley (NattyNarwhal)
Date: 2026-10-27T11:30:04-03:00
Commit: https://github.com/php/php-src/commit/fc68de60d762ad4cdab4392ef0c6c3e5ee4892f4
Raw diff: https://github.com/php/php-src/commit/fc68de60d762ad4cdab4392ef0c6c3e5ee4892f4.diff
Merge branch 'PHP-8.5' into PHP-8.6
* PHP-8.5:
Fix GH-24736: php_odbc_connstr_is_quoted() accepts missing closing brace (#24737)
Changed paths:
A ext/odbc/tests/gh24736.phpt
M main/php_odbc_utils.c
Diff:
diff --git a/ext/odbc/tests/gh24736.phpt b/ext/odbc/tests/gh24736.phpt
new file mode 100644
index 000000000000..a96fedeb3948
--- /dev/null
+++ b/ext/odbc/tests/gh24736.phpt
@@ -0,0 +1,20 @@
+--TEST--
+GH-24736 (Connection string value without closing brace treated as quoted)
+--EXTENSIONS--
+odbc
+--FILE--
+<?php
+var_dump(odbc_connection_string_is_quoted("{;Trusted_Connection=yes;UID=x"));
+var_dump(odbc_connection_string_is_quoted("{"));
+var_dump(odbc_connection_string_is_quoted("{foo}}"));
+var_dump(odbc_connection_string_is_quoted("{foo}"));
+var_dump(odbc_connection_string_is_quoted("{foo}}}"));
+var_dump(odbc_connection_string_is_quoted("{}"));
+?>
+--EXPECT--
+bool(false)
+bool(false)
+bool(false)
+bool(true)
+bool(true)
+bool(true)
diff --git a/main/php_odbc_utils.c b/main/php_odbc_utils.c
index dc91f637c566..a34a539c6868 100644
--- a/main/php_odbc_utils.c
+++ b/main/php_odbc_utils.c
@@ -46,12 +46,13 @@ PHPAPI bool php_odbc_connstr_is_quoted(const char *str)
if (str[i] == '}' && str[i + 1] == '}') {
/* Skip over so we don't count it again */
i++;
- } else if (str[i] == '}' && str[i + 1] != '\0') {
- /* If not at the end, not quoted */
- return false;
+ } else if (str[i] == '}') {
+ /* Only quoted if at the end */
+ return str[i + 1] == '\0';
}
}
- return true;
+ /* No closing brace */
+ return false;
}
/**