Page MenuHomePhabricator

FSRepo does not work well
Closed, ResolvedPublic


Author: mediawiki-bug

I'm using FSRepo for my wiki. After upgrading to 1.12.0, an internal error occurs when I see a foreign image file.

wfTimestamp() called with illegal output type.


#0 /home/barosl/public_html/dic.real/includes/filerepo/File.php(1030): wfTimestamp(1166106854)
#1 /home/barosl/public_html/dic.real/includes/ImagePage.php(421): File->getTimestamp()
#2 /home/barosl/public_html/dic.real/includes/ImagePage.php(87): ImagePage->imageHistory()
#3 /home/barosl/public_html/dic.real/includes/Wiki.php(390): ImagePage->view()
#4 /home/barosl/public_html/dic.real/includes/Wiki.php(48): MediaWiki->performAction(Object(OutputPage), Object(ImagePage), Object(Title), Object(User), Object(WebRequest))
#5 /home/barosl/public_html/dic.real/index.php(90): MediaWiki->initialize(Object(Title), Object(OutputPage), Object(User), Object(WebRequest))
#6 /home/barosl/public_html/dic(20): require_once('/home/barosl/pu...')
#7 {main}

I found the implementation of wfTimestamp() in GlobalFunctions.php, and it says the first argument of the function must be $outputtype, not $ts. But getTimestamp() in filerepo/File.php calls the function as "wfTimestamp( filemtime( $path ) )". I think it is a bug.

After changing it to "wfTimestamp( TS_UNIX, filemtime( $path ) )", happily, the error doesn't occur. But, another warning occurs.

Warning: Invalid argument supplied for foreach() in /home/barosl/public_html/dic.real/includes/ImagePage.php on line 428

In the code of ImagePage.php: "$hist = $this->img->getHistory(); foreach( $hist as $file ) { ... }". And it calls getHistory() in filerepo/File.php. But strangely, getHistory() in filerepo/File.php is only a stub, just returning false.

When I change "return false;" of getHistory() in filerepo/File.php to "return array();", the warning does not occur. But I guess there might be a better solution.

Version: 1.12.x
Severity: normal



Event Timeline

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

I believe the first error was backported in to 1.12 SVN.

I'll look into the second.