From: Bob Weinand Date: Tue, 21 Jul 2015 18:34:06 +0000 (+0200) Subject: Fix bug #70106 (Inheritance by anonymous class) X-Git-Tag: php-7.0.0beta3~5^2~115 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2141ab9be5c2b07c24534552753f8227473efa07;p=php Fix bug #70106 (Inheritance by anonymous class) --- diff --git a/NEWS b/NEWS index 620046a5bd..908d8d9aa0 100644 --- a/NEWS +++ b/NEWS @@ -1,7 +1,8 @@ PHP NEWS ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| 06 Aug 2015, PHP 7.0.0 Beta 3 - +- Core: + . Fixed bug #70106 (Inheritance by anonymous class). (Bob) 23 Jul 2015, PHP 7.0.0 Beta 2 diff --git a/Zend/tests/anon/011.phpt b/Zend/tests/anon/011.phpt new file mode 100644 index 0000000000..0d16c874e8 --- /dev/null +++ b/Zend/tests/anon/011.phpt @@ -0,0 +1,14 @@ +--TEST-- +Ensure proper inheritance with get_class(anon class instance) used via class_alias (see also bug #70106) +--FILE-- +foo; + } +})->getFoo()); +?> +--EXPECT-- +int(1) diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index 73bb387c1e..ce4365896c 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -5172,11 +5172,11 @@ void zend_compile_class_decl(zend_ast *ast) /* {{{ */ } name = zend_new_interned_string(name); - lcname = zend_new_interned_string(lcname); } else { name = zend_generate_anon_class_name(decl->lex_pos); - lcname = zend_string_copy(name); /* this normally is an interned string, except with opcache. We need a proper copy here or opcache will fail with use after free. */ + lcname = zend_string_tolower(name); } + lcname = zend_new_interned_string(lcname); ce->type = ZEND_USER_CLASS; ce->name = name;