Follow up with the problem noted in r90530.
authorPlatonides <platonides@users.mediawiki.org>
Tue, 21 Jun 2011 15:13:03 +0000 (15:13 +0000)
committerPlatonides <platonides@users.mediawiki.org>
Tue, 21 Jun 2011 15:13:03 +0000 (15:13 +0000)
You can't pass the result of a function to reset(), since it expects a reference.

Those random errors show now as UploadStashFileException: error storing file in
'tests/phpunit/includes/upload/bug29408.': fileexistserror images/temp/0/02/20110621151405!bug29408.
because it gets run twice in the same second.

includes/upload/UploadStash.php

index f926584..8432f0d 100644 (file)
@@ -140,9 +140,11 @@ class UploadStash {
                        // This is a bit lame, as we may have more info in the $status and we're throwing it away, but to fix it means
                        // redesigning API errors significantly.
                        // $status->value just contains the virtual URL (if anything) which is probably useless to the caller
-                       $error = reset( $status->getErrorsArray() );
+                       $error = $status->getErrorsArray();
+                       $error = reset( $error );
                        if ( ! count( $error ) ) {
-                               $error = reset( $status->getWarningsArray() );
+                               $error = $status->getWarningsArray();
+                               $error = reset( $error );
                                if ( ! count( $error ) ) {
                                        $error = array( 'unknown', 'no error recorded' );
                                }