1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00

Merge branch 'PHP-8.2'

* PHP-8.2:
  Fix delayed early binding class redeclaration error
This commit is contained in:
Ilija Tovilo
2023-05-12 19:29:27 +02:00
4 changed files with 20 additions and 3 deletions

View File

@@ -0,0 +1,2 @@
<?php
class Bar extends Foo {}

View File

@@ -0,0 +1,2 @@
<?php
class Bar extends Foo {}

View File

@@ -0,0 +1,13 @@
--TEST--
Delayed early binding throws class redeclaration error
--EXTENSIONS--
opcache
--FILE--
<?php
class Foo {}
include __DIR__ . '/delayed_early_binding_redeclaration-1.inc';
include __DIR__ . '/delayed_early_binding_redeclaration-2.inc';
var_dump(class_exists(Bar::class));
?>
--EXPECTF--
Fatal error: Cannot declare class Bar, because the name is already in use in %sdelayed_early_binding_redeclaration-2.inc on line %d

View File

@@ -363,9 +363,9 @@ static void zend_accel_do_delayed_early_binding(
ce = zend_try_early_bind(orig_ce, parent_ce, early_binding->lcname, zv);
}
}
}
if (ce && early_binding->cache_slot != (uint32_t) -1) {
*(void**)((char*)run_time_cache + early_binding->cache_slot) = ce;
if (ce && early_binding->cache_slot != (uint32_t) -1) {
*(void**)((char*)run_time_cache + early_binding->cache_slot) = ce;
}
}
}
CG(compiled_filename) = orig_compiled_filename;