#7509 closed defect (bug) (fixed)
Fix up some Notices in admin
Reported by: | DD32 | Owned by: | |
---|---|---|---|
Milestone: | 2.7 | Priority: | normal |
Severity: | normal | Version: | 2.7 |
Component: | General | Keywords: | has-patch commit |
Focuses: | Cc: |
Description
Attached patch silences a lot of errors with the adition of isset()'s and use of temporary variables.
A special note needs to be given to wp-includes/taxonomy.php, A 'return null' was replaced with a WP_Error return value, The function allready returns a WP_Error on the next line for a different error condition, so it shouldnt break any code, But it may need to be replaced with a null again.
Affected code is about line 300:
if ( empty($term) ) { return null;
Replaced with:
if ( empty($term) ) { $error = new WP_Error('invalid_term', __('Empty Term')); return $error; }
Could also be replaced with:
if ( empty($term) ) { $error = null; return $error; }
(Only variables can be returned by reference, returning null or new WP_Error directly causes a notice)
Attachments (21)
Change History (71)
#2
@
16 years ago
There are too many open tickets for PHP notices, but thanks. It was getting annoying seeing all of the notices. I think also the problem is that some notices only appear when the cron runs or you do an action.
#5
@
16 years ago
Theres also complains over COOKIEHASH not being defined when the database upgrade kicks in too.
#6
@
16 years ago
You are right, the ticket I made was committed to 2.6 and closed. I would like to get rid of the COOKIEHASH notice also.
#7
@
16 years ago
From #5752:
These appear to not be fixed from the patch in the ticket, from #6669 patch.
- wp-admin/import/blogger.php
- wp-admin/includes/user.php
- wp-content/themes/default/header.php
- wp-includes/taxonomy.php
I'm going to check your current patch to see if you fix these issues. I think that eventually, the notices will be found again, but it is nice to have a record of all the current patches of where notices have been found by people. Which is why I kept the #6669 ticket. There are currently only two tickets (that I know of) that exist on this issue.
#6669 isn't completed, but if you want to close that to keep this one open, then that might make more sense. However, it will be a good idea to go over the duplicated tickets referenced in #6669 to make sure something wasn't forgotten.
#8
@
16 years ago
attachment 7509.2.diff added.
notice in generate_tag_cloud() & attempt at getting rid of the cookiehash message
The cookiehash can probably be handled better, That's mainly me just wanting the message gone so i could focus on the other errors.
The tag cloud on the other hand, checks to see if the ID is set, else sets it to the key... on the other hand, the input data should be correct..
#10
@
16 years ago
Maybe we can get rid of the WP_INSTALLING conditional around COOKIEHASH. I don't think we really need it.
#12
@
16 years ago
In [8646] the change in wp-admin/includes/theme.php to
$page_templates[trim( $name )] = theme_basename( $template );
Seems to break the "Write new Page" screen. In the svn version I just checked I get
Fatal error: Call to undefined function theme_basename() in /home/www/svn/trunk/wp-admin/includes/theme.php on line 47
From page-new.php. Dunno if the svn is meant to be stable or not so whether that's a valid bug in it's own right I am not sure. :)
#13
@
16 years ago
$page_templates[trim( $name )] = theme_basename( $template );
Ah yes, Can someone revert trunk/wp-admin/includes/theme.php
please? Thats a line from a patch for something else.. I must've missed it on the file list when creating the patch.
#16
@
16 years ago
New patch fixes more notices. Going through and correcting more notices. There aren't any real major changes to the code, so the patch should be ready to go.
#17
@
16 years ago
New patch corrects every notice I could find. Doesn't seem to be any more, but probably not looking hard enough.
#18
@
16 years ago
attachment 7509.3.diff added.
patch fixes a notice error in feeds, and an undefined variable in a feed-related function.
#19
@
16 years ago
Can these two patches be committed? It is very annoying when WP_DEBUG is turned on.
#20
@
16 years ago
- Keywords commit added
Can the last two patches go in? Probably won't fix the ticket until the administration panel changes stop and the notices can be checked again, however, it would be nice to have these two patches in to ensure that new notices are corrected instead of releasing patches that already fixed the notices.
#24
@
16 years ago
- Summary changed from Fix up some Notice's in admin to Fix up some Notices in admin
#25
@
16 years ago
attachment 7509.4.diff added.
Fixes no-styling-on-install which stems from a PHP warning in the attribute about an indefined variable.
That file is allways called directly, So i dont see a need for a full absolute path, relative should do it.
#27
@
16 years ago
attachment 7509.5.diff added.
[9000] doesnt appear to have fixed the problem completely.
I was having an issue where $wp_filter[$tag] was set, however [$tag][$priority] wasnt, which would cause a error to rise.
Note: Also needs to be applied to BackPress
#28
@
16 years ago
attachment 7509.6.diff added.
- includes changes from .5.diff
- Fixes a notice level error on times when wp_uploads_dir() returns a error condition(ie. It couldnt create a folder for this month)
- Fixes 2 notices on canonical errors, It assumes path? is set, which it isnt allways for http://domain.com site urls.
#30
@
16 years ago
7509.7.diff (1.6 kB) - added by DD32 on 10/20/08 01:26:14.
Ignore that patch
7509.diff (1.9 kB) - added by DD32 on 10/20/08 01:33:40.
oops, I checked the replace option.. Patch includes a notice on export, and a notice in the unique filename code (When using it as such wp_unique_filename('filename_no_extension')
#32
@
16 years ago
attachment 7509.8.diff added.
- ensure ->response is set on update_plugins option to prevent menu notice when no plugins have a avaialble update.
#35
@
16 years ago
- Resolution fixed deleted
- Status changed from closed to reopened
Closing 'er up for 2.7
Sorry! Its likely there'll be a few more before 2.7 ships :)
attachment 7509.9.diff added.
- Fixes 2 notices which spawn on Editing posts page, $temp_id is not initialised, which causes a notice, and $post_id is passed instead of $post_ID
#39
@
16 years ago
attachment 7509.10.diff added.
- (Not a warning) Use strlen() when mb_strlen() is not available for title length (Unlikely those with double-byte characters will be using PHP without mb, so limited impact)
- Correct a seemingly bad copy of the Edit-tags page to add-tags
- Fix a defaults warning on the dashboard options on first page load
- Fix warnings related to Autosaves when no except/content is available
- Fix autosave when creating a new post/page (I believe this may fix the root cause of #6728)
- Fix warning in Screen options for when a page doesnt contain any table columns
- Fix a warning on install when Title/email/show_public is not provided
- Fix warnings on page/post publish related to undefined array index's
- Fix a warning on the pinging when a link is not parseable (ie. http://)
- Pass the User-ID of the current user along with Autosaves, fixes a warning related to the publish code expecting a user_id or custom post_author to be passed
- Set a default list of tags for publish (Empty tag list)
- Ensure that the Currently-queried-page is a valid page before attempting to use it in query
- Fix warnings in term sanitization on Add-tag/category pages related to non-set index's
- Extract the Widget inputs in the options page, Fixes undefined variable notices
- define
COOKIEHASH
on all pages, Removes warnings on installing - As per discussion near the start of this ticket
(Phew, Sorry for the big patch :P)
#40
@
16 years ago
Also just a quick note:
- There's more notices on attempting to add new Links / edding links
#42
@
16 years ago
attachment 7509.11.diff added.
- Registration unset vars
- Warning on retrieve new password page
- isset() in RSS (Its inside the magpie class i believe, I dont think thats being maintained anymore upstream?)
- isset() in some post functions, and some trailing whitespace cleanup of tag inputs
#43
@
16 years ago
attachment 7509.13.diff added.
- Replaces both 11 and 12
- Includes Notices of undefined post_password on add new page/post pages
#44
@
16 years ago
Can we init post_password in get_default_post_to_edit() and avoid those isset checks?
#45
@
16 years ago
Can we init post_password in get_default_post_to_edit() and avoid those isset checks?
That would indeed be a better location for it, I wasnt aware of that.
An even bigger patch is aboutto be submitted with a lot of other stuff included too..
Things to note of 7509.14.diff
- Replaces 11+
- Includes user-new fixes
- Remember passed details on failing to add user, default to blank strings
- Redirect to correct search page afterwards
- Dashboard: Right now
- The dashboard basically assumes theres posts posted, In the case where there are no posts, things break, That fix in the patch isnt the best, Its mainly as a reminder to whoever finishes all the TODO's (The other code branches probably suffer the same thing)
- a few more random notice fixes
Also,
wp-admin/edit.php
has some dead code in it, Which i commented out, I'm not sure if that needs to be kept and fixed up, or discarded all together. (See first chunk in the Diff)Also,
wp-includes/capabilities.php
change added first and last names only as they can be commonly empty, I'm not sure if any other members which are added should also be prefilled to empty, However, Someone may want to take a closer look at that edit to see if it needs more default properties for the other fields.