Make WordPress Core

Opened 17 years ago

Closed 17 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
Priority: normal Milestone: 3.0
Component: Permalinks Version: 2.9.1
Severity: normal Keywords: has-patch commit dev-reviewed
Cc: Focuses:

Description

Hello,

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 17 years ago.
Includes code convention cleanups. Actual fix is ~L 2267

Download all attachments as: .zip

Change History (6)

#1 @nacin
17 years ago

  • Component General → Permalinks
  • Keywords has-patch added
  • Milestone Unassigned → 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.

@nacin
17 years ago

Includes code convention cleanups. Actual fix is ~L 2267

#2 @firebird75
17 years ago

Damn, so fast, thanks a lot!

#3 @nacin
17 years ago

  • Keywords commit added

#4 @westi
17 years ago

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

This patch looks good.

#5 @nacin
17 years ago

  • Resolution → fixed
  • Status assigned → 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.