Skip to content
Closed
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
4 changes: 4 additions & 0 deletions src/Type/Constant/ConstantArrayType.php
Original file line number Diff line number Diff line change
Expand Up @@ -782,6 +782,10 @@ private function checkOurKeys(Type $type, bool $strictTypes): AcceptsResult

public function isSuperTypeOf(Type $type): IsSuperTypeOfResult
{
if ($type === $this) {
return IsSuperTypeOfResult::createYes();
}

if ($type instanceof self) {
$thisUnsealedness = $this->isUnsealed();
$typeUnsealedness = $type->isUnsealed();
Expand Down
1 change: 1 addition & 0 deletions tests/bench/data/bug-7903.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace Bug7903;

// Loop-scope merges repeatedly compare the identical nested template shapes shared below.
class Thing
{
private const C = 1;
Expand Down
6 changes: 3 additions & 3 deletions tests/bench/expected.neon
Original file line number Diff line number Diff line change
Expand Up @@ -302,9 +302,9 @@ bug-7901.php:
peakMemory: 93495520

bug-7903.php:
instructions: 7793234919
estimatedCycles: 9815275959
peakMemory: 50541320
instructions: 6358641712
estimatedCycles: 7995544152
peakMemory: 50524392

bug-8146a.php:
instructions: 882446224
Expand Down
2 changes: 2 additions & 0 deletions turbo-ext/src/ConstantArrayType.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1785,6 +1785,8 @@ class ConstantArrayType
* CompoundType callback; no otherwise; UNDEF = pending exception */
zv::Val isSuperTypeOf(zval *type) const
{
if (Z_OBJ_P(type) == self) return pt_type_is_super_type_of_result(PT_TRI_YES);

if (instanceof_function(Z_OBJCE_P(type), pt_ce_constant_array_type)) {
zend_long thisUnsealedness = thisIsUnsealed();
if (UNEXPECTED(thisUnsealedness < 0)) return zv::Val();
Expand Down
Loading