From fd4b5f305f57f1726a512cb5ced0997cdb0cd7d5 Mon Sep 17 00:00:00 2001 From: Platonides Date: Tue, 21 Jun 2011 15:13:03 +0000 Subject: [PATCH] Follow up with the problem noted in r90530. 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 | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/includes/upload/UploadStash.php b/includes/upload/UploadStash.php index f926584d96..8432f0d4f3 100644 --- a/includes/upload/UploadStash.php +++ b/includes/upload/UploadStash.php @@ -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' ); } -- 2.20.1