mirror of
https://github.com/php/php-src.git
synced 2024-09-23 10:57:26 +00:00
Merge branch 'master' of git.php.net:php-src
* 'master' of git.php.net:php-src: Fixed bug #72014 (Including a file with anonymous classes multiple times leads to fatal error)
This commit is contained in:
commit
d57505e234
29
ext/opcache/tests/bug72014.phpt
Normal file
29
ext/opcache/tests/bug72014.phpt
Normal file
@ -0,0 +1,29 @@
|
||||
--TEST--
|
||||
Bug #72014 (Including a file with anonymous classes multiple times leads to fatal error)
|
||||
--INI--
|
||||
opcache.enable=1
|
||||
opcache.enable_cli=1
|
||||
opcache.file_update_protection=0
|
||||
--SKIPIF--
|
||||
<?php require_once('skipif.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
file_put_contents(__DIR__ . "/bug72014.annon.php", <<<PHP
|
||||
<?php
|
||||
\$a = new class() { public \$testvar = "Foo\n"; };
|
||||
echo \$a->testvar;
|
||||
PHP
|
||||
);
|
||||
|
||||
include(__DIR__ . "/bug72014.annon.php");
|
||||
include(__DIR__ . "/bug72014.annon.php");
|
||||
include(__DIR__ . "/bug72014.annon.php");
|
||||
?>
|
||||
--CLEAN--
|
||||
<?php
|
||||
@unlink(__DIR__ . "/bug72014.annon.php")
|
||||
?>
|
||||
--EXPECT--
|
||||
Foo
|
||||
Foo
|
||||
Foo
|
@ -617,7 +617,6 @@ failure:
|
||||
|
||||
static void zend_accel_class_hash_copy(HashTable *target, HashTable *source, unique_copy_ctor_func_t pCopyConstructor)
|
||||
{
|
||||
zend_class_entry *ce1;
|
||||
Bucket *p, *end;
|
||||
zval *t;
|
||||
|
||||
@ -633,7 +632,17 @@ static void zend_accel_class_hash_copy(HashTable *target, HashTable *source, uni
|
||||
/* Mangled key - ignore and wait for runtime */
|
||||
continue;
|
||||
} else if (UNEXPECTED(!ZCG(accel_directives).ignore_dups)) {
|
||||
goto failure;
|
||||
zend_class_entry *ce1 = Z_PTR(p->val);
|
||||
if (!(ce1->ce_flags & ZEND_ACC_ANON_CLASS)) {
|
||||
CG(in_compilation) = 1;
|
||||
zend_set_compiled_filename(ce1->info.user.filename);
|
||||
CG(zend_lineno) = ce1->info.user.line_start;
|
||||
zend_error(E_ERROR,
|
||||
"Cannot declare %s %s, because the name is already in use",
|
||||
zend_get_object_type(ce1), ZSTR_VAL(ce1->name));
|
||||
return;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
t = _zend_hash_append_ptr(target, p->key, Z_PTR(p->val));
|
||||
@ -644,13 +653,6 @@ static void zend_accel_class_hash_copy(HashTable *target, HashTable *source, uni
|
||||
}
|
||||
target->nInternalPointer = target->nNumOfElements ? 0 : HT_INVALID_IDX;
|
||||
return;
|
||||
|
||||
failure:
|
||||
ce1 = Z_PTR(p->val);
|
||||
CG(in_compilation) = 1;
|
||||
zend_set_compiled_filename(ce1->info.user.filename);
|
||||
CG(zend_lineno) = ce1->info.user.line_start;
|
||||
zend_error(E_ERROR, "Cannot declare %s %s, because the name is already in use", zend_get_object_type(ce1), ZSTR_VAL(ce1->name));
|
||||
}
|
||||
|
||||
#ifdef __SSE2__
|
||||
|
Loading…
Reference in New Issue
Block a user