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
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

# Collapse generated files within git and pull request diff.
**/*_arginfo.h linguist-generated -diff
**/*_decl.h linguist-generated -diff
/main/debug_gdb_scripts.c linguist-generated -diff
/Zend/zend_vm_execute.h linguist-generated -diff
/Zend/zend_vm_handlers.h linguist-generated -diff
Expand Down
13 changes: 10 additions & 3 deletions .github/actions/brew/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,18 @@ runs:
# Some packages exist on x86 but not arm, or vice versa.
# Install them with reinstall to avoid warnings.
brew reinstall autoconf webp tidy-html5 libzip libsodium icu4c curl
brew install \
brew reinstall -v \
autoconf \
webp \
tidy-html5 \
libzip \
libsodium \
icu4c \
curl
brew install -v \
bison \
re2c
brew install \
brew install -v \
bzip2 \
enchant \
libffi \
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,7 @@ jobs:
- name: Update clang
uses: ./.github/actions/macos-update-clang
- name: brew
timeout-minutes: 10
uses: ./.github/actions/brew
- name: ./configure
uses: ./.github/actions/configure-macos
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,7 @@ jobs:
- name: Update clang
uses: ./.github/actions/macos-update-clang
- name: brew
timeout-minutes: 10
uses: ./.github/actions/brew
- name: ccache
uses: hendrikmuhs/ccache-action@v1.2
Expand Down
3 changes: 3 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ PHP NEWS
. Fixed GH-20564 (Don't call autoloaders with pending exception). (ilutov)
. Fix deprecation now showing when accessing null key of an array with JIT.
(alexandre-daubois)
. Fixed bug GH-20174 (Assertion failure in
ReflectionProperty::skipLazyInitialization after failed LazyProxy
initialization). (Arnaud)

- Date:
. Update timelib to 2022.16. (Derick)
Expand Down
9 changes: 9 additions & 0 deletions UPGRADING.INTERNALS
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,20 @@ PHP 8.6 INTERNALS UPGRADE NOTES
automatically unwrap references when the result of the call is stored in an
IS_TMP_VAR variable. This may be achieved by calling the
zend_return_unwrap_ref() function.
. The php_math_round_mode_from_enum() function now takes a
zend_enum_RoundingMode parameter.
. Added Z_PARAM_ENUM().
. Added zend_enum_fetch_case_id().

========================
2. Build system changes
========================

. build/gen_stub.php may now generate a _decl.h file in addition to
the _arginfo.h file, if the stub declares enums and is annotated with
@generate-c-enums. For each enum the file will contain a C enum. Enum values
can be compared to the result of zend_enum_fetch_case_id(zend_object*).

========================
3. Module changes
========================
Expand Down
33 changes: 33 additions & 0 deletions Zend/tests/lazy_objects/gh20174.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
--TEST--
GH-20174: Assertion failure in ReflectionProperty::skipLazyInitialization after failed LazyProxy skipLazyInitialization
--CREDITS--
vi3tL0u1s
--FILE--
<?php

class C {
public $b;
public $c;
}

$reflector = new ReflectionClass(C::class);

$obj = $reflector->newLazyProxy(function ($obj) {
$obj->b = 4;
throw new Exception();
});

try {
$reflector->initializeLazyObject($obj);
} catch (Exception $e) {
$reflector->getProperty('b')->skipLazyInitialization($obj);
}

var_dump($obj);

?>
--EXPECTF--
lazy proxy object(C)#%d (1) {
["b"]=>
NULL
}
24 changes: 24 additions & 0 deletions Zend/tests/lazy_objects/gh20504-001.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
--TEST--
GH-20504: Assertion failure in zend_get_property_guard() when lazy proxy adds magic method - isset
--CREDITS--
vi3tL0u1s
--FILE--
<?php

class RealInstance {
public $_;
}
class Proxy extends RealInstance {
public function __isset($name) {
return isset($this->$name['']);
}
}
$rc = new ReflectionClass(Proxy::class);
$obj = $rc->newLazyProxy(function () {
return new RealInstance;
});
var_dump(isset($obj->name['']));

?>
--EXPECT--
bool(false)
23 changes: 23 additions & 0 deletions Zend/tests/lazy_objects/gh20504-002.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
--TEST--
GH-20504: Assertion failure in zend_get_property_guard() when lazy proxy adds magic method - get
--FILE--
<?php

class RealInstance {
public $_;
}
class Proxy extends RealInstance {
public function __get($name) {
return $this->$name;
}
}
$rc = new ReflectionClass(Proxy::class);
$obj = $rc->newLazyProxy(function () {
return new RealInstance;
});
var_dump($obj->name);

?>
--EXPECTF--
Warning: Undefined property: RealInstance::$name in %s on line %d
NULL
33 changes: 33 additions & 0 deletions Zend/tests/lazy_objects/gh20504-003.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
--TEST--
GH-20504: Assertion failure in zend_get_property_guard() when lazy proxy adds magic method - set
--FILE--
<?php

#[AllowDynamicProperties]
class RealInstance {
public $_;
}
class Proxy extends RealInstance {
public function __set($name, $value) {
$this->$name = $value;
}
}
$rc = new ReflectionClass(Proxy::class);
$obj = $rc->newLazyProxy(function () {
return new RealInstance;
});
$obj->name = 0;

var_dump($obj);

?>
--EXPECTF--
lazy proxy object(Proxy)#%d (1) {
["instance"]=>
object(RealInstance)#%d (2) {
["_"]=>
NULL
["name"]=>
int(0)
}
}
28 changes: 28 additions & 0 deletions Zend/tests/lazy_objects/gh20504-004.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
--TEST--
GH-20504: Assertion failure in zend_get_property_guard() when lazy proxy adds magic method - proxy defines __isset(), both have guards
--FILE--
<?php

class RealInstance {
public $_;
public function __get($name) {
printf("%s::%s\n", static::class, __FUNCTION__);
}
}
class Proxy extends RealInstance {
public function __isset($name) {
printf("%s::%s\n", static::class, __FUNCTION__);
return isset($this->$name['']);
}
}
$rc = new ReflectionClass(Proxy::class);
$obj = $rc->newLazyProxy(function () {
return new RealInstance;
});
var_dump(isset($obj->name['']));

?>
--EXPECT--
Proxy::__isset
Proxy::__get
bool(false)
30 changes: 30 additions & 0 deletions Zend/tests/lazy_objects/gh20504-005.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
--TEST--
GH-20504: Assertion failure in zend_get_property_guard() when lazy proxy adds magic method - unset
--FILE--
<?php

class RealInstance {
public $_;
}
class Proxy extends RealInstance {
public function __unset($name) {
unset($this->$name);
}
}
$rc = new ReflectionClass(Proxy::class);
$obj = $rc->newLazyProxy(function () {
return new RealInstance;
});
unset($obj->name);

var_dump($obj);

?>
--EXPECTF--
lazy proxy object(Proxy)#%d (1) {
["instance"]=>
object(RealInstance)#%d (1) {
["_"]=>
NULL
}
}
32 changes: 32 additions & 0 deletions Zend/tests/lazy_objects/gh20657-001.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
--TEST--
GH-20657: GC during zend_lazy_object_realize()
--CREDITS--
vi3tL0u1s
--FILE--
<?php

class C {
public $a;
}

$reflector = new ReflectionClass(C::class);

for ($i = 0; $i < 10000; $i++) {
$obj = $reflector->newLazyGhost(function ($obj) {});

// Add to roots
$obj2 = $obj;
unset($obj2);

// Initialize all props to mark object non-lazy. Also create a cycle.
$reflector->getProperty('a')->setRawValueWithoutLazyInitialization($obj, $obj);
}

var_dump($obj);

?>
--EXPECTF--
object(C)#%d (1) {
["a"]=>
*RECURSION*
}
43 changes: 43 additions & 0 deletions Zend/tests/lazy_objects/gh20657-002.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
--TEST--
GH-20657 002: GC during zend_lazy_object_realize() - reset as lazy during realize()
--FILE--
<?php

class C {
public $a;
}

class D {
public $self;
public function __construct() {
$this->self = $this;
}
public function __destruct() {
global $obj, $reflector;
$reflector->resetAsLazyGhost($obj, function () {});
}
}

new D();

$reflector = new ReflectionClass(C::class);

for ($i = 0; $i < 10000; $i++) {
$obj = $reflector->newLazyGhost(function ($obj) {});

// Add to roots
$obj2 = $obj;
unset($obj2);

// Initialize all props to mark object non-lazy. Also create a cycle.
$reflector->getProperty('a')->setRawValueWithoutLazyInitialization($obj, $obj);
}

var_dump($obj);

?>
--EXPECTF--
object(C)#%d (1) {
["a"]=>
*RECURSION*
}
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ $obj = $reflector->newLazyProxy(function ($obj) {
throw new Exception('initializer exception');
});

// Initializer effects on the proxy are not reverted
test('Proxy', $obj);

--EXPECTF--
Expand All @@ -63,12 +62,10 @@ Is lazy: 1
# Proxy:
string(11) "initializer"
initializer exception
lazy proxy object(C)#%d (3) {
["a"]=>
int(3)
lazy proxy object(C)#%d (1) {
["b"]=>
int(4)
uninitialized(int)
["c"]=>
int(5)
int(0)
}
Is lazy: 1
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ $obj = $reflector->newLazyProxy(function ($obj) {
throw new Exception('initializer exception');
});

// Initializer effects on the proxy are not reverted
test('Proxy', $obj);

--EXPECTF--
Expand All @@ -66,14 +65,10 @@ Is lazy: 1
# Proxy:
string(11) "initializer"
initializer exception
lazy proxy object(C)#%d (4) {
["a"]=>
int(3)
lazy proxy object(C)#%d (1) {
["b"]=>
int(4)
uninitialized(int)
["c"]=>
int(5)
["d"]=>
int(6)
int(0)
}
Is lazy: 1
Loading