WordPress.org

Make WordPress Core

Opened 8 years ago

Closed 8 years ago

#23170 closed defect (bug) (fixed)

PHP Notice On _remove_theme_support() function

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

Description (last modified by SergeyBiryukov)

I create a ticket about this bug in #22246 but as I test the PHP notice is still exists even after Nacin patch .

Attachments (3)

theme.php.patch (1.2 KB) - added by alex-ye 8 years ago.
Using isset() to avoid the PHP notice .
theme.php.2.patch (1.2 KB) - added by alex-ye 8 years ago.
Using isset() to avoid the PHP notice .
23170.patch (908 bytes) - added by SergeyBiryukov 8 years ago.

Download all attachments as: .zip

Change History (11)

@alex-ye
8 years ago

Using isset() to avoid the PHP notice .

@alex-ye
8 years ago

Using isset() to avoid the PHP notice .

#1 @SergeyBiryukov
8 years ago

  • Description modified (diff)

#2 follow-up: @SergeyBiryukov
8 years ago

  • Milestone changed from Awaiting Review to 3.6

theme.php.2.patch would re-introduce a part of [22274], which was reverted in [22312] and replaced with [22313].

However, seems like the check in [22313] was inaccurate: did_action() can only return an integer. 23170.patch fixes the condition.

#3 @SergeyBiryukov
8 years ago

To reproduce the notice, use the code from #22246.

#4 in reply to: ↑ 2 ; follow-up: @alex-ye
8 years ago

Replying to SergeyBiryukov:

However, seems like the check in [22313] was inaccurate: did_action() can only return an integer. 23170.patch fixes the condition.

Good , but I have a tiny question why we check $support[0]wp-head-callback? in line 1495 it is not a boolean var and we should use empty() or isset() ... right ?!

And what about the line 1505 we don't check $support[0]wp-head-callback? at all , so what is the difference ?!

after all I want to learn more from you guys :)

#5 in reply to: ↑ 4 @SergeyBiryukov
8 years ago

Replying to alex-ye:

why we check $support[0]wp-head-callback? in line 1495 it is not a boolean var and we should use empty() or isset() ... right ?!

Yes, we just skip !empty() for brevity, since a non-empty string is considered true:
http://php.net/manual/en/language.types.boolean.php

And what about the line 1505 we don't check $support[0]wp-head-callback? at all , so what is the difference ?!

I guess the difference is that unlike custom header, custom background has a default callback:
http://core.trac.wordpress.org/browser/tags/3.5/wp-includes/theme.php#L1353

#6 @SergeyBiryukov
8 years ago

  • Keywords commit added

#7 @nacin
8 years ago

Good to go.

#8 @SergeyBiryukov
8 years ago

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

In 23367:

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

Note: See TracTickets for help on using tickets.