mirror of
https://github.com/php/php-src.git
synced 2026-10-28 17:56:50 +08:00
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:
2 files changed
+25
-4
No files matched your search
@@ -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)
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in new issue
Block a user