Page MenuHomePhabricator

Wrong order of arguments for strpos in function tableName
Closed, ResolvedPublic

Description

Author: rhaertel80

Description:
Patch to swap the order of the arguments to strpos

I wrote an install script for my own MediaWiki extension based mostly on the install.php of the bad image list extension. However, when I run it I get the following error:

Warning: strpos(): Empty delimiter. in /home/rah67/workspaces/MayaWiki Workspace/MayaWiki/includes/Database.php on line 1586

There is no call to strpos() on line 1586 (rev 25203; last changed revision of Database.php was 24969). However, there is a call on the previous line (1585):

if ( $this->mTablePrefix !== '' && strpos( $name, '.' ) === false ) { ... }

Note that the PHP documentation defines strpos like this:

int strpos ( string $haystack, mixed $needle [, int $offset] )

It appears, therefore, that the order of the arguments are reversed on line 1585. When I swap them, the code runs without warning.


Version: unspecified
Severity: normal

Attached:

Details

Reference
bz11082

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 9:49 PM
bzimport set Reference to bz11082.
bzimport added a subscriber: Unknown Object (MLST).

Congratulations, that's been broken since July 2004. :)

Fixed in r25204