mirror of
https://github.com/php/php-src.git
synced 2024-12-24 17:30:48 +08:00
8754b191f7
This fixes the following issues: * "use function" and "use const" inside namespaced code were checking for conflicts against class imports. Now they always check against the correct symbol type. * Symbol conflicts are now always checked within a single file only. Previously class uses inside namespaced code were checked globally. This behavior is illegal because symbols from other files are not visible if opcache is used, resulting in behavioral discrepancies. Additionally this made the presence/absence of symbol errors dependent on autoloading order, which is volatile. * The "single file" restriction is now enforced by collecting defined symbols inside a separate hash table. Previously it was enforced (for the non-namespaced case) by comparing the filename of the symbol declaration. However this is inaccurate if the same filename is used multiple times, such as may happen if eval() is used. * Additionally the previous approach relies on symbols being registered at compile-time, which is not the case for late-bound classes, which makes the behavior dependent on class declaration order, as well as opcache (which may cause delayed early-binding). * Lastly, conflicts are now consistently checked for conditionally defined symbols. Previously only declaration-after-use conflicts were checked in this case. Now use-after-declaration conflicts are detected as well. |
||
---|---|---|
.. | ||
includes | ||
alias.phpt | ||
basic.phpt | ||
case_insensivity.phpt | ||
conditional_function_declaration.phpt | ||
conflicting_use_alias.phpt | ||
conflicting_use_const_alias.phpt | ||
conflicting_use.phpt | ||
define_imported_before.phpt | ||
define_imported.phpt | ||
ignore_constants.phpt | ||
no_conflict_with_classes.phpt | ||
no_global_fallback2.phpt | ||
no_global_fallback.phpt | ||
self_parent.phpt | ||
shadow_core.phpt | ||
shadow_global.phpt |