mirror of
https://github.com/php/php-src.git
synced 2025-08-15 21:48:51 +02:00
Merge branch 'PHP-8.0' into PHP-8.1
This commit is contained in:
commit
5975f33c37
2 changed files with 22 additions and 1 deletions
|
@ -226,7 +226,11 @@ static zend_string *pdo_sqlite_last_insert_id(pdo_dbh_t *dbh, const zend_string
|
|||
/* NB: doesn't handle binary strings... use prepared stmts for that */
|
||||
static zend_string* sqlite_handle_quoter(pdo_dbh_t *dbh, const zend_string *unquoted, enum pdo_param_type paramtype)
|
||||
{
|
||||
char *quoted = safe_emalloc(2, ZSTR_LEN(unquoted), 3);
|
||||
char *quoted;
|
||||
if (unquotedlen > (INT_MAX - 3) / 2) {
|
||||
return 0;
|
||||
}
|
||||
quoted = safe_emalloc(2, ZSTR_LEN(unquoted), 3);
|
||||
/* TODO use %Q format? */
|
||||
sqlite3_snprintf(2*ZSTR_LEN(unquoted) + 3, quoted, "'%q'", ZSTR_VAL(unquoted));
|
||||
zend_string *quoted_str = zend_string_init(quoted, strlen(quoted), 0);
|
||||
|
|
17
ext/pdo_sqlite/tests/bug81740.phpt
Normal file
17
ext/pdo_sqlite/tests/bug81740.phpt
Normal file
|
@ -0,0 +1,17 @@
|
|||
--TEST--
|
||||
Bug #81740 (PDO::quote() may return unquoted string)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('pdo_sqlite')) print 'skip not loaded';
|
||||
if (getenv("SKIP_SLOW_TESTS")) die("skip slow test");
|
||||
?>
|
||||
--INI--
|
||||
memory_limit=-1
|
||||
--FILE--
|
||||
<?php
|
||||
$pdo = new PDO("sqlite::memory:");
|
||||
$string = str_repeat("a", 0x80000000);
|
||||
var_dump($pdo->quote($string));
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(false)
|
Loading…
Add table
Add a link
Reference in a new issue