Make WordPress Core

Opened 8 years ago

Closed 8 years ago

#12078 closed defect (bug) (fixed)

Warning : in_array Invalid argument in wp-includes/post.php on line 1997

Reported by: firebird75 Owned by: nacin
Milestone: 3.0 Priority: normal
Severity: normal Version: 2.9.1
Component: Permalinks Keywords: has-patch commit dev-reviewed
Focuses: Cc:



I am receiving a warning while publishing a new post through the post by email feature.

The warning states that the second argument is invalid in wp-includes/post.php on line 1997.

Here is the code :

if ( $post_name_check
in_array($slug, $wp_rewrite->feeds) ) {

If I modify this line to this :

if ( $post_name_check
in_array($slug, $feeds) ) {

Then the warning goes away. I am not sure however about the implications around this change.

Please note that you may not see this error by using the post by email feature as I am reusing the code as part of the plugin to allow custom post types submission by email but the code is the same, it is just the way I call it that is different. Instead of requiring the direct call to wp-mail.php, I have created a function which contains the code of wp-mail.php as part of my plugin.

The plugin in question is WATS (wordpress advanced ticket system).

The problem can be reproduced with any kind of email received (plain text, html, etc...).

Attachments (1)

12078.diff (4.8 KB) - added by nacin 8 years ago.
Includes code convention cleanups. Actual fix is ~L 2267

Download all attachments as: .zip

Change History (6)

#1 @nacin
8 years ago

  • Component changed from General to Permalinks
  • Keywords has-patch added
  • Milestone changed from Unassigned to 3.0
  • Owner set to ryan

Looking through the rest of the code the change looks correct without any implications. Above that:

$feeds = $wp_rewrite->feeds;
if ( !is_array($feeds) )
    $feeds = array();

And a bunch of $post_name_check || in_array($slug, $feeds) between that line and this as well.

Patch forthcoming.

8 years ago

Includes code convention cleanups. Actual fix is ~L 2267

#2 @firebird75
8 years ago

Damn, so fast, thanks a lot!

#3 @nacin
8 years ago

  • Keywords commit added

#4 @westi
8 years ago

  • Keywords dev-reviewed added
  • Owner changed from ryan to nacin
  • Status changed from new to assigned

This patch looks good.

#5 @nacin
8 years ago

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

(In [13075]) Use correct var name. Props firebird75. Whitespace cleanup in wp_unique_post_slug(). Fixes #12078.

Note: See TracTickets for help on using tickets.