mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00
ext/pdo_sqlite: PDO::sqliteCreateCollection return type strenghtening.
Is supposed to be Pdo_Sqlite::createCollation but behavior differs in regard of return type checks. close GH-18799
This commit is contained in:
parent
eac91d0453
commit
e3cfa4bcae
5 changed files with 23 additions and 6 deletions
|
@ -483,9 +483,16 @@ static int php_sqlite3_collation_callback(void *context, int string1_len, const
|
|||
|
||||
zend_call_known_fcc(&collation->callback, &retval, /* argc */ 2, zargs, /* named_params */ NULL);
|
||||
|
||||
zval_ptr_dtor(&zargs[0]);
|
||||
zval_ptr_dtor(&zargs[1]);
|
||||
|
||||
if (!Z_ISUNDEF(retval)) {
|
||||
if (Z_TYPE(retval) != IS_LONG) {
|
||||
convert_to_long(&retval);
|
||||
zend_string *func_name = get_active_function_or_method_name();
|
||||
zend_type_error("%s(): Return value of the collation callback must be of type int, %s returned",
|
||||
ZSTR_VAL(func_name), zend_zval_value_name(&retval));
|
||||
zend_string_release(func_name);
|
||||
ret = FAILURE;
|
||||
}
|
||||
if (Z_LVAL(retval) > 0) {
|
||||
ret = 1;
|
||||
|
@ -495,9 +502,6 @@ static int php_sqlite3_collation_callback(void *context, int string1_len, const
|
|||
zval_ptr_dtor(&retval);
|
||||
}
|
||||
|
||||
zval_ptr_dtor(&zargs[0]);
|
||||
zval_ptr_dtor(&zargs[1]);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue