com php-src: Fix bug #70106 (Inheritance by anonymous class): NEWS Zend/tests/anon/011.phpt Zend/zend_compile.c

From: Date: Tue, 21 Jul 2015 18:34:06 +0000
Subject: com php-src: Fix bug #70106 (Inheritance by anonymous class): NEWS Zend/tests/anon/011.phpt Zend/zend_compile.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-88104@lists.php.net to get a copy of this message
Commit: 2141ab9be5c2b07c24534552753f8227473efa07 Author: Bob Weinand <bobwei9@hotmail.com> Tue, 21 Jul 2015 20:34:06 +0200 Parents: 81a2c43d5ef3dd0ed87c995f327274fb2e183687 Branches: master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=2141ab9be5c2b07c24534552753f8227473efa07 Log: Fix bug #70106 (Inheritance by anonymous class) Bugs: https://bugs.php.net/70106 Changed paths: M NEWS A Zend/tests/anon/011.phpt M Zend/zend_compile.c Diff: diff --git a/NEWS b/NEWS index 620046a..908d8d9 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 0000000..0d16c87 --- /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-- +<?php + +class_alias(get_class(new class { protected $foo = 1; }), "AnonBase"); +var_dump((new class extends AnonBase { + function getFoo() { + return $this->foo; + } +})->getFoo()); +?> +--EXPECT-- +int(1) diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index 73bb387..ce43658 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;

« previous php.cvs (#88104) next »