#51219 closed defect (bug) (fixed)
Theme editor page showing undefined variable notice
| Reported by: | vinayak.anivase | Owned by: | SergeyBiryukov |
|---|---|---|---|
| Priority: | normal | Milestone: | 5.5.2 |
| Component: | Administration | Version: | 5.5.1 |
| Severity: | normal | Keywords: | commit fixed-major |
| Cc: | Focuses: | administration |
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
@
6 years ago
- Keywords dev-feedback removed
- Milestone Awaiting Review → 5.5.2
- Owner set to
- Status new → 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
@
6 years ago
- Keywords commit fixed-major added
- Resolution fixed
- Status closed → reopened
Reopening for backporting to the 5.5 branch.
#6
in reply to: ↑ 4
;
follow-up:
↓ 7
@
6 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
@
6 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.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
Notice: Undefined variable