From: Wez Furlong Date: Sat, 29 Oct 2005 03:11:46 +0000 (+0000) Subject: Closes PECL Bug #5772; FETCH_FUNC broken for mixed case function names X-Git-Tag: RELEASE_1_0RC2~30 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0139cd0e53c164dedac55d72cd3937b988b67438;p=php Closes PECL Bug #5772; FETCH_FUNC broken for mixed case function names --- diff --git a/ext/pdo/pdo_stmt.c b/ext/pdo/pdo_stmt.c index 64bc86c5ac..f4f96f89d4 100755 --- a/ext/pdo/pdo_stmt.c +++ b/ext/pdo/pdo_stmt.c @@ -682,7 +682,8 @@ static int make_callable_ex(pdo_stmt_t *stmt, zval *callable, zend_fcall_info * ce = *pce; } } - + + zend_str_tolower_copy(fname, fname, strlen(fname)); fci->function_table = ce ? &ce->function_table : EG(function_table); if (zend_hash_find(fci->function_table, fname, strlen(fname)+1, (void **)&function_handler) == FAILURE) { pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "user-supplied function does not exist" TSRMLS_CC); diff --git a/ext/pdo/tests/pecl_bug_5772.phpt b/ext/pdo/tests/pecl_bug_5772.phpt new file mode 100644 index 0000000000..d037609e2a --- /dev/null +++ b/ext/pdo/tests/pecl_bug_5772.phpt @@ -0,0 +1,29 @@ +--TEST-- +PDO Common: PECL Bug #5772 PDO::FETCH_FUNC breaks on mixed case func name +--SKIPIF-- + +--FILE-- +exec("CREATE TABLE test (id int(10) NOT NULL, PRIMARY KEY (id))"); +$db->exec("INSERT INTO test (id) VALUES (1)"); + +function heLLO($row) { + return $row; +} + +foreach ($db->query("SELECT * FROM test")->fetchAll(PDO::FETCH_FUNC, 'heLLO') as $row) { + var_dump($row); +} + +--EXPECT-- +string(1) "1"