From ef3b427e5c92d32fc27c1c28fd53ea63b5e1bce3 Mon Sep 17 00:00:00 2001 From: Marcus Boerger Date: Sat, 29 Oct 2005 11:10:34 +0000 Subject: [PATCH] - Fix PECL Bug #5772; FETCH_FUNC broken for mixed case function names # Mhhh, now wez and me did it in different branches only because i forgot # to commit and MFH too --- ext/pdo/pdo_stmt.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/ext/pdo/pdo_stmt.c b/ext/pdo/pdo_stmt.c index 9a48a30118..99283379e1 100755 --- a/ext/pdo/pdo_stmt.c +++ b/ext/pdo/pdo_stmt.c @@ -637,6 +637,8 @@ static int make_callable_ex(pdo_stmt_t *stmt, zval *callable, zend_fcall_info * zval **object = NULL, **method; zend_class_entry * ce = NULL, **pce; zend_function *function_handler; + char *lcname; + unsigned int lcname_len; if (Z_TYPE_P(callable) == IS_ARRAY) { if (Z_ARRVAL_P(callable)->nNumOfElements < 2) { @@ -674,11 +676,15 @@ static int make_callable_ex(pdo_stmt_t *stmt, zval *callable, zend_fcall_info * return 0; } + lcname = zend_u_str_case_fold(Z_TYPE_PP(method), Z_UNIVAL_PP(method), Z_UNILEN_PP(method), 1, &lcname_len); + fci->function_table = ce ? &ce->function_table : EG(function_table); - if (zend_u_hash_find(fci->function_table, Z_TYPE_PP(method), Z_UNIVAL_PP(method), Z_UNILEN_PP(method)+1, (void **)&function_handler) == FAILURE) { + if (zend_u_hash_find(fci->function_table, Z_TYPE_PP(method), lcname, lcname_len+1, (void **)&function_handler) == FAILURE) { + efree(lcname); pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "user-supplied function does not exist" TSRMLS_CC); return 0; } + efree(lcname); fci->size = sizeof(zend_fcall_info); fci->function_name = NULL; -- 2.40.0