WordPress.org

Make WordPress Core

Opened 7 years ago

Closed 7 years ago

#9393 closed defect (bug) (fixed)

PHP notices for WordPress 2.8

Reported by: Viper007Bond Owned by:
Milestone: 2.8 Priority: lowest
Severity: minor Version: 2.8
Component: Warnings/Notices Keywords: has-patch tested commit
Focuses: Cc:

Description

Been catching a lot of PHP notices lately and rather than making a ton of more tickets, I figured one per milestone would be better.

So here's one for 2.8. Feel free to attach patches of your own to this ticket.

Other notice tickets: #9292 #9309 #9333 #9336 #9365 #9366 #9367 #9369 #9370 #9392 (plus more probably)

Attachments (18)

9393-wp_explain_nonce.patch (641 bytes) - added by Viper007Bond 7 years ago.
wp_explain_nonce() fix for custom nonces
9393-plugin-editor.diff (967 bytes) - added by sivel 7 years ago.
check if variable is set rather than counting it
9393_theme-install.patch (2.6 KB) - added by Viper007Bond 7 years ago.
Notice fixes for the theme installer
9393-admin-php.diff (372 bytes) - added by sivel 7 years ago.
Notice fix for media upload. check if WP_ADMIN is defined before trying to define it.
9393-media-fixes.diff (1.9 KB) - added by sivel 7 years ago.
Misc media fixes, viewing and editing an image in the image library
9393-media-fixes.2.diff (4.1 KB) - added by sivel 7 years ago.
Update to 9393-media-fixes.diff. More notice fixes found through the media area.
9393-registration.diff (1.6 KB) - added by sivel 7 years ago.
Only check for unique user_nicename when updating since a user_id hasn't been created for a new user yet
9393-wp_handle_upload.diff (721 bytes) - added by sivel 7 years ago.
Set empty file type if skipping file type check. Fixes notices when importing.
9393-widgets.diff (545 bytes) - added by nbachiyski 7 years ago.
Deleting a widget, which is beng used generates non-existing array key notices
9393-sticky.diff (639 bytes) - added by nbachiyski 7 years ago.
Sometimes the sticky option has value of 'Array'. It has been fixed, but until changing it I get the notices. Another check won't harm.
9393-widgets-var-notice.diff (724 bytes) - added by sivel 7 years ago.
If there are no widgets don't try looping through them
template.diff (520 bytes) - added by mrmist 7 years ago.
wp-admin\includes\template.php
9393-registration.2.diff (1.2 KB) - added by sivel 7 years ago.
9393-template.php (833 bytes) - added by sivel 7 years ago.
Replaces template.diff as this fixes the notice in 2 locations where as the other missed one
post_template.patch (724 bytes) - added by mrmist 7 years ago.
Uses get_the_author_meta instead of get_author_name()
9393-template.2.php (833 bytes) - added by sivel 7 years ago.
This patch replaces post_template.patch. Replaces get_author_name in all locations in which it is used
9393-get_author_name.diff (3.5 KB) - added by sivel 7 years ago.
This patch replaces post_template.patch. Replaces get_author_name in all locations in which it is used
9393-the_author_url.diff (2.0 KB) - added by sivel 7 years ago.
Last round of replacements for deprecated get_the_author_* and the_author_* functions.

Download all attachments as: .zip

Change History (49)

@Viper007Bond
7 years ago

wp_explain_nonce() fix for custom nonces

#1 @markjaquith
7 years ago

(In [10857]) PHP Notice fix for non-normative nonce action strings. props Viper007Bond. see #9393

@sivel
7 years ago

check if variable is set rather than counting it

@Viper007Bond
7 years ago

Notice fixes for the theme installer

#2 @Viper007Bond
7 years ago

Don't commit 9393_theme-install.patch. It's deprecated as I didn't see #9508.

#3 @sivel
7 years ago

  • Keywords tested added

#4 @cyberhobo
7 years ago

I included a fix for a notice (Undefined index: metakeyselect in admin-ajax.php) in #7541.

@sivel
7 years ago

Notice fix for media upload. check if WP_ADMIN is defined before trying to define it.

@sivel
7 years ago

Misc media fixes, viewing and editing an image in the image library

@sivel
7 years ago

Update to 9393-media-fixes.diff. More notice fixes found through the media area.

@sivel
7 years ago

Only check for unique user_nicename when updating since a user_id hasn't been created for a new user yet

#5 @azaozz
7 years ago

(In [11052]) Notice fixes, props sivel, see #9393

@sivel
7 years ago

Set empty file type if skipping file type check. Fixes notices when importing.

#6 @sivel
7 years ago

Patches still waiting:

9393-plugin-editor.diff
9393-registration.diff
9393-wp_handle_upload.diff

#7 @ryan
7 years ago

  • Component changed from General to Warnings/Notices
  • Owner anonymous deleted

@nbachiyski
7 years ago

Deleting a widget, which is beng used generates non-existing array key notices

@nbachiyski
7 years ago

Sometimes the sticky option has value of 'Array'. It has been fixed, but until changing it I get the notices. Another check won't harm.

#8 @nbachiyski
7 years ago

Two more tiny notice patches.

@sivel
7 years ago

If there are no widgets don't try looping through them

#9 @sivel
7 years ago

  • Cc matt@… added

Patches still waiting:

9393-plugin-editor.diff
9393-registration.diff
9393-wp_handle_upload.diff
9393-widgets.diff
9393-sticky.diff
9393-widgets-var-notice.diff

@mrmist
7 years ago

wp-admin\includes\template.php

#10 @mrmist
7 years ago

Added patch for wp-admin\includes\template.php fixes notice for author ID function.

#11 @sivel
7 years ago

  • Keywords commit added

#12 @westi
7 years ago

(In [11226]) Notice fix for plugin editor when no functions found. See #9393 props sivel.

#13 @westi
7 years ago

(In [11227]) Set empty file type if skipping file type check. Fixes notices when importing. See #9393 props sivel.

#14 @westi
7 years ago

(In [11229]) Fix notices when an in-use widget is deleted. See #9393 props nbachiyski

#15 @westi
7 years ago

(In [11230]) Prevent notice check on invalid sticky settings. See #9393 props nbachiyski.

#16 @westi
7 years ago

Todo:

  • 9393-registration.diff - need to spend a little time understanding issue
  • 9393-widgets-var-notice.diff - no longer applies
  • template.diff - need more detail to understand issue.

#17 @sivel
7 years ago

Perhaps a better way to handle 9393-registration.diff is to instead of excluding ID of the user being updated created is to use the user_login.

When creating a user the users ID does not exist and is of course not in the database yet. So a notice is thrown reporting that $ID is undefined. Instead of using ID perhaps user_login would be better.

#18 @mrmist
7 years ago

template.diff - need more detail to understand issue

The patch changes the call to the_author_ID which otherwise on current trunk produces PHP Notice: the_author_ID is deprecated since version 2.8! on the edit posts screen.

@sivel
7 years ago

Replaces template.diff as this fixes the notice in 2 locations where as the other missed one

#19 @sivel
7 years ago

Apologies on the file extension for that last one. I don't know what I was thinking.

#20 @automattor
7 years ago

(In [11322]) Use the_author_meta(). Props sivel. see #9393

@mrmist
7 years ago

Uses get_the_author_meta instead of get_author_name()

#21 @mrmist
7 years ago

Added patch for post_template to use get_the_author_meta ('display_name') instead of deprecated get_author_name function, fixes notice shown on publishing new posts.

#22 @ryan
7 years ago

(In [11331]) Use user_login instead of ID to check if user exists when creating unique nicenames. ID isn't available when inserting new users. Props sivel. see #9393

@sivel
7 years ago

This patch replaces post_template.patch. Replaces get_author_name in all locations in which it is used

#23 @sivel
7 years ago

Accidental attachment of incorrect patch. Ignore the previous attachment.

@sivel
7 years ago

This patch replaces post_template.patch. Replaces get_author_name in all locations in which it is used

#24 @westi
7 years ago

(In [11370]) Migrate final get_author_name() calls to use get_the_author_meta() instead. See #9393 props sivel.

#25 follow-up: @Viper007Bond
7 years ago

current_theme_info() is still throwing notices.

#26 in reply to: ↑ 25 @scribu
7 years ago

Also getting a notice while trying to add a category in edit.php (rev. 11372):

Notice: Trying to get property of non-object in /home/cristi/svn/wp/wp-includes/category-template.php on line 91

@sivel
7 years ago

Last round of replacements for deprecated get_the_author_* and the_author_* functions.

#27 @ryan
7 years ago

(In [11416]) Use get_the_author_meta(). Props sivel. see #9393

#28 follow-up: @mrmist
7 years ago

A few notices on the new widgets page now -

PHP Notice: Undefined index: count in E:\webpage\svn\trunk\wp-includes\default-widgets.php on line 493 PHP Notice: Undefined index: hierarchical in E:\webpage\svn\trunk\wp-includes\default-widgets.php on line 494 PHP Notice: Undefined index: dropdown in E:\webpage\svn\trunk\wp-includes\default-widgets.php on line 495 PHP Notice: Undefined index: title in E:\webpage\svn\trunk\wp-includes\default-widgets.php on line 595 PHP Notice: Undefined index: number in E:\webpage\svn\trunk\wp-includes\default-widgets.php on line 596 PHP Notice: Undefined index: title in E:\webpage\svn\trunk\wp-includes\default-widgets.php on line 1017 PHP Notice: Undefined index: filter in E:\webpage\svn\trunk\wp-includes\default-widgets.php on line 415
No patch from me yet, sorry.

#29 @sirzooro
7 years ago

When DB Cache plugin is active, WP shows following warning many times:

Notice: Undefined index: debug in C:\wordpress28.local\wp-content\db.php on line 646

I am not sure if this is a WP or plugin issue. I am using WP 2.8 beta 2.

#30 @dd32
7 years ago

When DB Cache plugin is active, WP shows following warning many times:

Thats a issue in the DB Cache plugin, not WordPress.

Its probably got code such as this:

if ( $this->options['debug'] ) {
...

Which is wrong, Really, it should be written like this:

if ( isset($this->options['debug']) && $this->options['debug'] ) {
or just
if ( !empty($this->options['debug']) ) {

#31 in reply to: ↑ 28 @Denis-de-Bernardy
7 years ago

  • Resolution set to fixed
  • Status changed from new to closed

see #10025

Note: See TracTickets for help on using tickets.