Make WordPress Core

Opened 11 years ago

Closed 11 years ago

#27277 closed defect (bug) (fixed)

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

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

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 11 years ago.

Download all attachments as: .zip

Change History (6)

#1 @pento
11 years ago

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

#2 @klihelp
11 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
11 years ago

#3 @pento
11 years ago

  • Keywords has-patch commit added

Nice catch!

attachment:27277.diff fixes this.

#4 @SergeyBiryukov
11 years ago

Introduced in [27250].

#5 @SergeyBiryukov
11 years ago

  • Resolution set to fixed
  • Status changed from assigned to 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.