1
0
mirror of https://github.com/php/php-src.git synced 2026-04-12 18:43:37 +02:00

Fix incorrect assertion in property type variance check

Only one of the status has to be UNRESOLVED, the other could also
be SUCCESS.

Fixes oss-fuzz #19108 and oss-fuzz #19111.
This commit is contained in:
Nikita Popov
2019-12-04 11:07:22 +01:00
parent 7b34e30b9a
commit a6832caac9
2 changed files with 14 additions and 1 deletions

View File

@@ -0,0 +1,13 @@
--TEST--
Invalid property inheritance where one direction is valid and the other unresolved
--FILE--
<?php
class A {
public X|B $prop;
}
class B extends A {
public B $prop;
}
?>
--EXPECTF--
Fatal error: Type of B::$prop must be X|B (as in class A) in %s on line %d

View File

@@ -966,7 +966,7 @@ inheritance_status property_types_compatible(
if (status1 == INHERITANCE_ERROR || status2 == INHERITANCE_ERROR) {
return INHERITANCE_ERROR;
}
ZEND_ASSERT(status1 == INHERITANCE_UNRESOLVED && status2 == INHERITANCE_UNRESOLVED);
ZEND_ASSERT(status1 == INHERITANCE_UNRESOLVED || status2 == INHERITANCE_UNRESOLVED);
return INHERITANCE_UNRESOLVED;
}