Make WordPress Core

Opened 14 years ago

Closed 14 years ago

Last modified 14 years ago

#22246 closed defect (bug) (fixed)

PHP Notice On _remove_theme_support() function

Reported by: alex-ye Owned by: ryan
Priority: normal Milestone: 3.5
Component: Warnings/Notices Version: 3.4.2
Severity: normal Keywords: has-patch
Cc: Focuses:

Description

Hi Guys , I just found this PHP Notice on _remove_theme_support() function , Tested On :

1 - WordPress 3.5 Beta 2

2 - PHP 5.4

To get this notice on just add child theme to TwentyTwelve and add this simple code on functions.php :

add_action ( 'after_setup_theme', 'Nash_setup' , 11 );

function Nash_setup() {

    remove_theme_support ( 'custom-background' );   
    remove_theme_support ( 'custom-header' );    

} // end Nash_setup()

Attachments (5)

theme.php.patch​ (1.4 KB ) - added by alex-ye 14 years ago.
Using isset() to fix the bug
22246.patch​ (1.4 KB ) - added by SergeyBiryukov 14 years ago.
With proper formatting
22246.diff​ (889 bytes ) - added by nacin 14 years ago.
22246.2.diff​ (1.6 KB ) - added by nacin 14 years ago.
Made against head.
theme.php.2.patch​ (1.2 KB ) - added by alex-ye 14 years ago.
Using isset() after nacin patch

Download all attachments as: .zip

Change History (18)

@alex-ye
14 years ago

Using isset() to fix the bug

#1 @alex-ye
14 years ago

  • Keywords has-patch added; needs-patch removed

@SergeyBiryukov
14 years ago

With proper formatting

#2 @SergeyBiryukov
14 years ago

  • Component Themes → Warnings/Notices
  • Milestone Awaiting Review → 3.5

#3 @ryan
14 years ago

  • Owner set to ryan
  • Resolution → fixed
  • Status new → closed

In [22274]:

Avoid notices in _remove_theme_support(). Props alex-ye, SergeyBiryukov. fixes #22246

@nacin
14 years ago

#4 @nacin
14 years ago

  • Resolution fixed
  • Status closed → reopened

Rather than papering over the notices in [22274], we can bail in the particular situation where this occurs: When the "just in time" initialization hasn't occurred yet, we don't need to do anything beyond unsetting the item from the global array. See 22246.diff​ (made against pre-[22274]).

@nacin
14 years ago

Made against head.

#5 @obenland
14 years ago

#21905 was marked as a duplicate.

#6 @ryan
14 years ago

Fine with 22246.2.diff.

#7 @nacin
14 years ago

In [22312]:

Revert [22274]. see #22246.

#8 @nacin
14 years ago

  • Resolution → fixed
  • Status reopened → closed

In [22313]:

If we have not yet initialized the custom header/background, do not do extra removal in _remove_theme_support(). fixes #22246.

#9 @alex-ye
14 years ago

  • Resolution fixed
  • Status closed → reopened
  • Version 3.4.2

As I test the PHP notice is still exists even after Nacin patch .
I just add isset() function to check the array :)

#10 @alex-ye
14 years ago

  • Version → 3.5

@alex-ye
14 years ago

Using isset() after nacin patch

#11 @SergeyBiryukov
14 years ago

  • Resolution → fixed
  • Status reopened → closed
  • Version 3.5 → 3.4.2

This ticket was closed on a completed milestone. Please open a new one.

#13 @SergeyBiryukov
14 years ago

In 23367:

Properly check if the custom header/background has been initialized. fixes #23170. see #22246.

Note: See TracTickets for help on using tickets.