#51219 closed defect (bug) (fixed)
Theme editor page showing undefined variable notice
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 5.5.2 | Priority: | normal |
Severity: | normal | Version: | 5.5.1 |
Component: | Administration | Keywords: | commit fixed-major |
Focuses: | administration | Cc: |
Description
The theme editor ('wp-admin/theme-editor.php') page showing a "Undefined variable: error" notice for a fresh installation.
After checking the 'theme-editor.php' file, I found that the error variable used on line number 159 and 277 is not defined except on line number 153, where it is defined inside an 'if' conditional block.
<?php if ( ! is_file( $file ) ) { $error = true; }
The variable should be initialized prior to line number 152:
<?php $error = false; if ( ! is_file( $file ) ) { $error = true; }
To recreate the issue, please enable debug mode and visit 'wp-admin/theme-editor.php' page.
Attachments (1)
Change History (9)
#1
@
4 years ago
- Keywords dev-feedback removed
- Milestone changed from Awaiting Review to 5.5.2
- Owner set to SergeyBiryukov
- Status changed from new to accepted
Hi there, welcome to WordPress Trac! Thanks for the report.
Just noting that while the $error
variable could indeed be explicitly defined for better readability, that is not the issue here, as the variable is already set to an empty string by this line above:
wp_reset_vars( array( 'action', 'error', 'file', 'theme' ) );
The issue was introduced in [48850] / #51073, where this variable is now unset before it can be used.
It looks like the code in wp-admin/admin-header.php
should use a unique or at least a less common variable name, something like $error_get_last
.
#3
@
4 years ago
- Keywords commit fixed-major added
- Resolution fixed deleted
- Status changed from closed to reopened
Reopening for backporting to the 5.5 branch.
#4
follow-up:
↓ 6
@
4 years ago
- Resolution set to fixed
- Status changed from reopened to closed
In 48955:
#6
in reply to:
↑ 4
;
follow-up:
↓ 7
@
4 years ago
Hello,
I'm having the same problem here when firing the filter hook for registration_errors. I see that the problem is fixed but I was wondering if I should also fix it myself locally or wait for an update (my registration form validation is not triggering because of this). Can you please enlighten me as what to do next?
Thanks!
Best regards,
Replying to SergeyBiryukov:
In 48955:
#7
in reply to:
↑ 6
@
4 years ago
Replying to youcefb:
I'm having the same problem here when firing the filter hook for registration_errors. I see that the problem is fixed but I was wondering if I should also fix it myself locally or wait for an update (my registration form validation is not triggering because of this). Can you please enlighten me as what to do next?
It's likely that there will be a 5.5.2 release before 5.6, but there is no timeline at the moment, so I would suggest fixing the issue locally or working around it for now.
Notice: Undefined variable