WordPress.org

Make WordPress Core

Opened 2 months ago

Last modified 2 months ago

#51773 new defect (bug)

wp_guess_url() calls strpos() incorrectly if $_SERVER['SCRIPT_FILENAME'] is empty

Reported by: bjorsch Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 3.7
Component: General Keywords:
Focuses: Cc:

Description

This can happen, for example, if using PHPUnit's @runInSeparateProcess.

The message produced is

PHP Warning:  strpos(): Empty needle in /var/www/html/wp-includes/functions.php on line 5435

In the aforementioned PHPUnit case, that warning causes tests to fail.

Attachments (1)

patch.diff (919 bytes) - added by bjorsch 2 months ago.
Patch to check for empty $script_filename_dir before passing it to strpos()

Download all attachments as: .zip

Change History (2)

@bjorsch
2 months ago

Patch to check for empty $script_filename_dir before passing it to strpos()

#1 @kraftbj
2 months ago

  • Version set to 3.7

Introduced in r25436.

Note: See TracTickets for help on using tickets.