Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check that all "required" classes can be preloaded #4997

Closed
wants to merge 6 commits into from

Conversation

nikic
Copy link
Member

@nikic nikic commented Dec 10, 2019

During preloading, check that all classes that have been included as part of the preload script itself (rather than through opcache_compile_file) can actually be preloaded, i.e. satisfy Windows restrictions, have resolved initializers and resolved property types. When resolving initializers and property types, also autoload additional classes. Because of this, the resolution runs in a loop.

@@ -12,5 +12,4 @@ opcache.preload={PWD}/preload_undef_const.inc
var_dump(class_exists('Foo'));
?>
--EXPECTF--
Warning: Can't preload class Foo with unresolved initializer for constant A in %spreload_undef_const.inc on line 2
bool(false)
Fatal error: Undefined class constant 'self::DOES_NOT_EXIST' in Unknown on line 0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

May be add a hint to try preloading through opcache_compile_file()?

@@ -13,6 +13,6 @@ var_dump(trait_exists('T'));
var_dump(class_exists('Foo'));
?>
--EXPECTF--
Warning: Can't preload class Foo with unresolved initializer for constant C in %spreload_undef_const_2.inc on line 8
Warning: Use of undefined constant UNDEF - assumed 'UNDEF' (this will throw an Error in a future version of PHP) in Unknown on line 0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a questionable decision. It may be better to throw error with a hint to try preloading through opcache_compile_file(). Anyway, this may be fixed later.

@nikic
Copy link
Member Author

nikic commented Dec 10, 2019

Merged as 3f86adb and baf3a91.

@nikic nikic closed this Dec 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants