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)
This commit is contained in:
Calvin Buckley committed 2026-10-27 11:30:04 -03:00
commit fc68de60d7
2 files changed
+25 -4

No files matched your search

+20
View File
@@ -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)
+5 -4
View File
@@ -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;
}
/**