Skip to content

Fix OSS-Fuzz #403308724 #18074

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
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
30 changes: 30 additions & 0 deletions Zend/tests/property_hooks/oss_fuzz_403308724.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
--TEST--
OSS-Fuzz #403308724
--FILE--
<?php
class Base {
public $y { get => 1; }
}

class Test extends Base {
public $y {
get => [new class {
public $inner {get => __PROPERTY__;}
}, parent::$y::get()];
}
}

$test = new Test;
$y = $test->y;
var_dump($y);
var_dump($y[0]->inner);
?>
--EXPECT--
array(2) {
[0]=>
object(class@anonymous)#2 (0) {
}
[1]=>
int(1)
}
string(5) "inner"
4 changes: 2 additions & 2 deletions Zend/zend_compile.c
Original file line number Diff line number Diff line change
Expand Up @@ -8645,7 +8645,7 @@ static void zend_compile_prop_decl(zend_ast *ast, zend_ast *type_ast, uint32_t f
/* FIXME: This is a dirty fix to maintain ABI compatibility. We don't
* have an actual property info yet, but we really only need the name
* anyway. We should convert this to a zend_string. */
ZEND_ASSERT(!CG(context).active_property_info);
const zend_property_info *old_active_property_info = CG(context).active_property_info;
zend_property_info dummy_prop_info = { .name = name };
CG(context).active_property_info = &dummy_prop_info;

Expand Down Expand Up @@ -8742,7 +8742,7 @@ static void zend_compile_prop_decl(zend_ast *ast, zend_ast *type_ast, uint32_t f
zend_compile_attributes(&info->attributes, attr_ast, 0, ZEND_ATTRIBUTE_TARGET_PROPERTY, 0);
}

CG(context).active_property_info = NULL;
CG(context).active_property_info = old_active_property_info;
}
}
/* }}} */
Expand Down
Loading