Skip to content

Commit 56d2c76

Browse files
committed
Merge branch 'PHP-8.2'
2 parents 44c8876 + b9474bf commit 56d2c76

File tree

3 files changed

+54
-3
lines changed

3 files changed

+54
-3
lines changed

Zend/zend_execute.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1227,8 +1227,8 @@ static zend_never_inline ZEND_ATTRIBUTE_UNUSED bool zend_verify_internal_arg_typ
12271227
* trust that arginfo matches what is enforced by zend_parse_parameters. */
12281228
ZEND_API bool zend_internal_call_should_throw(zend_function *fbc, zend_execute_data *call)
12291229
{
1230-
if (fbc->internal_function.handler == ZEND_FN(pass)) {
1231-
/* Be lenient about the special pass function. */
1230+
if (fbc->internal_function.handler == ZEND_FN(pass) || (fbc->internal_function.fn_flags | ZEND_ACC_FAKE_CLOSURE)) {
1231+
/* Be lenient about the special pass function and about fake closures. */
12321232
return 0;
12331233
}
12341234

ext/pdo/pdo_dbh.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1254,7 +1254,7 @@ bool pdo_hash_methods(pdo_dbh_object_t *dbh_obj, int kind)
12541254
func.function_name = zend_string_init(funcs->fname, strlen(funcs->fname), dbh->is_persistent);
12551255
func.scope = dbh_obj->std.ce;
12561256
func.prototype = NULL;
1257-
ZEND_MAP_PTR(func.run_time_cache) = rt_cache_size ? pemalloc(rt_cache_size, dbh->is_persistent) : NULL;
1257+
ZEND_MAP_PTR(func.run_time_cache) = rt_cache_size ? pecalloc(rt_cache_size, 1, dbh->is_persistent) : NULL;
12581258
func.T = ZEND_OBSERVER_ENABLED;
12591259
if (funcs->flags) {
12601260
func.fn_flags = funcs->flags | ZEND_ACC_NEVER_CACHE;
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
--TEST--
2+
Observer: PDO::sqliteCreateFunction() can be observed
3+
--EXTENSIONS--
4+
zend_test
5+
PDO
6+
pdo_sqlite
7+
--INI--
8+
zend_test.observer.enabled=1
9+
zend_test.observer.observe_all=1
10+
--FILE--
11+
<?php
12+
13+
function returnOne() {
14+
return 1;
15+
}
16+
17+
$db = new PDO('sqlite::memory:');
18+
$db->sqliteCreateFunction('returnOne', 'returnOne', 0);
19+
20+
foreach ($db->query('SELECT returnOne()') as $row) {
21+
var_dump($row);
22+
}
23+
24+
echo 'Done' . PHP_EOL;
25+
?>
26+
--EXPECTF--
27+
<!-- init '%s' -->
28+
<file '%s'>
29+
<!-- init PDO::__construct() -->
30+
<PDO::__construct>
31+
</PDO::__construct>
32+
<!-- init PDO::sqliteCreateFunction() -->
33+
<PDO::sqliteCreateFunction>
34+
</PDO::sqliteCreateFunction>
35+
<!-- init PDO::query() -->
36+
<PDO::query>
37+
<!-- init returnOne() -->
38+
<returnOne>
39+
</returnOne>
40+
</PDO::query>
41+
<!-- init var_dump() -->
42+
<var_dump>
43+
array(2) {
44+
["returnOne()"]=>
45+
int(1)
46+
[0]=>
47+
int(1)
48+
}
49+
</var_dump>
50+
Done
51+
</file '%s'>

0 commit comments

Comments
 (0)