-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Fix PHPStan undefined variable errors at level 3 #11189
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
base: trunk
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -33,8 +33,10 @@ | |
| * Use `get_current_network_id()` instead. | ||
| * @global bool $public Deprecated. Whether the site found on load is public. | ||
| * Use `get_site()->public` instead. | ||
| * @global string $table_prefix Database table prefix. | ||
| * @global wpdb $wpdb WordPress database abstraction object. | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Global populated by |
||
| */ | ||
| global $current_site, $current_blog, $domain, $path, $site_id, $public; | ||
| global $current_site, $current_blog, $domain, $path, $site_id, $public, $table_prefix, $wpdb; | ||
|
|
||
| /** WP_Network class */ | ||
| require_once ABSPATH . WPINC . '/class-wp-network.php'; | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -29,8 +29,10 @@ | |||||||||||||||||
| * @global string[] $required_php_extensions The names of required PHP extensions. | ||||||||||||||||||
| * @global string $required_mysql_version The minimum required MySQL version string. | ||||||||||||||||||
| * @global string $wp_local_package Locale code of the package. | ||||||||||||||||||
| * @global array $wp_filter WordPress filter hooks. | ||||||||||||||||||
| * @global string $table_prefix Database table prefix. | ||||||||||||||||||
| */ | ||||||||||||||||||
| global $wp_version, $wp_db_version, $tinymce_version, $required_php_version, $required_php_extensions, $required_mysql_version, $wp_local_package; | ||||||||||||||||||
| global $wp_version, $wp_db_version, $tinymce_version, $required_php_version, $required_php_extensions, $required_mysql_version, $wp_local_package, $wp_filter, $table_prefix; | ||||||||||||||||||
westonruter marked this conversation as resolved.
Show resolved
Hide resolved
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There's something curious below in how the wordpress-develop/src/wp-settings.php Lines 140 to 147 in 30d971c
This to me looks like dead code. But in fact, it is pretty new: 61ae275 It was developed for Core-63627. I wonder if explicitly globalizing @SergeyBiryukov can you shed some light on this as you made that commit? It may be safer to do this patch instead: diff --git a/src/wp-settings.php b/src/wp-settings.php
index 023cdccd5e..87fa935aa1 100644
--- a/src/wp-settings.php
+++ b/src/wp-settings.php
@@ -100,7 +100,7 @@ if ( WP_CACHE && apply_filters( 'enable_loading_advanced_cache_dropin', true ) &
include WP_CONTENT_DIR . '/advanced-cache.php';
// Re-initialize any hooks added manually by advanced-cache.php.
- if ( $wp_filter ) {
+ if ( isset( $wp_filter ) ) {
$wp_filter = WP_Hook::build_preinitialized_hooks( $wp_filter );
}
}
@@ -140,7 +140,7 @@ require_wp_db();
*
* @global string $table_prefix The database table prefix.
*/
-if ( ! isset( $GLOBALS['table_prefix'] ) ) {
+if ( ! isset( $GLOBALS['table_prefix'] ) && isset( $table_prefix ) ) {
$GLOBALS['table_prefix'] = $table_prefix;
}But let's get confirmation.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Question raised: https://core.trac.wordpress.org/ticket/63627#comment:6 |
||||||||||||||||||
| require ABSPATH . WPINC . '/version.php'; | ||||||||||||||||||
| require ABSPATH . WPINC . '/compat-utf8.php'; | ||||||||||||||||||
| require ABSPATH . WPINC . '/compat.php'; | ||||||||||||||||||
|
|
||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Global populated in
wp-config.php.