Make WordPress Core

Opened 13 years ago

Closed 13 years ago

#27277 closed defect (bug) (fixed)

Php 5.2 Warning for strstr() in wp-db.php

Reported by: klihelp Owned by: pento
Priority: normal Milestone: 3.9
Component: Database Version: 3.9
Severity: normal Keywords: has-patch commit
Cc: Focuses:

Description

Warning: Wrong parameter count for strstr() in /var/www/wp-includes/wp-db.php on line 1319

Input was $host = "mysql01.myhostcp.com:3306";
Line 1319
$host = strstr( $host, ':', true );

In strstr() the third parameter was added in PHP 5.3.0:
​http://uk1.php.net/strstr

Attachments (1)

27277.diff​ (567 bytes ) - added by pento 13 years ago.

Download all attachments as: .zip

Change History (6)

#1 @pento
13 years ago

  • Milestone Awaiting Review → 3.9
  • Owner set to pento
  • Status new → assigned

#2 @klihelp
13 years ago

From the php forum:

  • For the needle_before (first occurrance) parameter when using PHP 5.x or less:

substr($haystack, 0, strpos($haystack, $needle));

@pento
13 years ago

#3 @pento
13 years ago

  • Keywords has-patch commit added

Nice catch!

attachment:27277.diff​ fixes this.

#4 @SergeyBiryukov
13 years ago

Introduced in [27250].

#5 @SergeyBiryukov
13 years ago

  • Resolution → fixed
  • Status assigned → closed

In 27503:

Avoid a warning in wpdb::db_connect(). before_needle parameter of strstr() was added in PHP 5.3.

props klihelp, pento.
fixes #27277.

Note: See TracTickets for help on using tickets.