Use of undefined constants STYLESHEETPATH and TEMPLATEPATH PHP warning #26359
Labels
Global Styles
Anything related to the broader Global Styles efforts, including Styles Engine and theme.json
Needs Dev
Ready for, and needs developer efforts
[Type] Bug
An existing feature does not function as intended
Describe the bug
The Gutenberg's Global Styles feature is throwing following PHP warnings in curtomizer context on some requests:
This is caused by the call of the
locate_template
ingutenberg/lib/global-styles.php
Line 14 in 9ce9380
which is being hooked to the
wp_enqueue_scripts
action via some function chain ingutenberg/lib/global-styles.php
Line 979 in 9ce9380
However, the WordPress customizer may call the
wp_enqueue_scripts
prior setting up a theme and defining the templating constants (STYLESHEETPATH
,TEMPLATEPATH
) in case a user w/o necessary capabilities for switching theme is attempting to review a customizer changeset. Customizer is hooking thesetup_theme
action and eventually dying. See:https://github.com/WordPress/WordPress/blob/a7d6e929c96f2d1e6e0307e781d36c338b8bf877/wp-includes/class-wp-customize-manager.php#L366 and https://github.com/WordPress/WordPress/blob/a7d6e929c96f2d1e6e0307e781d36c338b8bf877/wp-includes/class-wp-customize-manager.php#L505
To reproduce
Steps to reproduce the behavior:
?customize_changeset_uuid=c0af4551-5b8c-4260-ad4e-368af589c737&customize_theme=twentyseventeen&customize_messenger_channel=preview-0
)Expected behavior
No PHP warning
Editor version (please complete the following information):
The text was updated successfully, but these errors were encountered: