Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ PHP NEWS
. Fixed bug GH-25313 (Assertion !EG(exception) in ZEND_FE_FREE when unpacking
a generator into a by-ref parameter throws). (ndossche)
. Fix OSS-Fuzz #588264417. (ndossche)
. Fixed bug GH-25788 (clone() with properties corrupts memory with JIT when
__clone() keeps a reference and the result is discarded). (Tomasz Kowalczyk)

- Curl:
. Fixed curl_reset() retaining CURLOPT_PRIVATE after reset. (lacatoire)
Expand Down
1 change: 0 additions & 1 deletion Zend/Optimizer/zend_func_infos.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/* This is a generated file, edit the .stub.php files instead. */

static const func_info_t func_infos[] = {
F1("clone", MAY_BE_OBJECT),
F1("zend_version", MAY_BE_STRING),
FN("func_get_args", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_LONG|MAY_BE_ARRAY_OF_ANY),
F1("get_class_vars", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_STRING|MAY_BE_ARRAY_OF_ANY|MAY_BE_ARRAY_OF_REF),
Expand Down
42 changes: 42 additions & 0 deletions Zend/tests/clone/gh25788.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
--TEST--
GH-25788: clone() with properties corrupts memory with JIT when __clone() keeps a reference and the result is discarded
--EXTENSIONS--
opcache
--INI--
opcache.enable=1
opcache.enable_cli=1
opcache.jit=function
opcache.jit_buffer_size=64M
opcache.file_update_protection=0
--FILE--
<?php

class Row {
public static array $rows = [];

public int $id = 1;

public function __clone() {
self::$rows[] = $this;
}

public function __destruct() { echo "destruct\n"; }
}

function test(Row $row) {
clone($row, ['id' => 2]);
}

test(new Row());
var_dump(Row::$rows);
?>
--EXPECTF--
destruct
array(1) {
[0]=>
object(Row)#%d (1) {
["id"]=>
int(2)
}
}
destruct
1 change: 0 additions & 1 deletion Zend/zend_builtin_functions.stub.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ class stdClass
{
}

/** @refcount 1 */
function clone(object $object, array $withProperties = []): object {}

function exit(string|int $status = 0): never {}
Expand Down
2 changes: 1 addition & 1 deletion Zend/zend_builtin_functions_arginfo.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading