Bug #46785

FileDoesNotExistException

Added by Vincent Mans over 7 years ago. Updated about 3 years ago.

Status:
Closed
Priority:
Should have
Category:
-
Target version:
Start date:
2013-03-29
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
6.0
PHP Version:
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

Frontend form with image upload to tt_news record. If the image is not found (because of external reasons) the page with (in this case) uid=15 shows "Oops, an error occurred!" in the backend.

Obviously, we must take care that the path is correct.

But the point is: an editor should be able to open the page and edit the tt_news record, if such things happen. So this exception should be handled differently.

(TYPO3 v 6.0.4)

Extension: Core: Exception handler (WEB)
Severity: 4

Uncaught TYPO3 Exception: | TYPO3\CMS\Core\Resource\Exception\FileDoesNotExistException thrown in file /home/sites/clients/client4/web48/web/typo3/sysext/core/Classes/Resource/Driver/AbstractDriver.php in line 399. Requested URL: http://test.domain.tld/typo3/mod.php?M=web_list&id=15


Related issues

Related to TYPO3 Core - Bug #44440: Setting an external link with domain of the backend leads to exceptionClosedStanislas Rolland2013-01-10

Actions
Related to TYPO3 Core - Bug #48956: Copying a link to a non-exisiting location into the text editor throws errorClosed2013-06-08

Actions
Related to TYPO3 Core - Bug #49444: No file found for given UID after deleting a referenced image fileClosed2013-06-26

Actions
Related to TYPO3 Core - Bug #60316: Parsing RTE links should not throw an exception if a resource is missing or its path invalidClosedHelmut Hummel2014-07-14

Actions
Has duplicate TYPO3 Core - Bug #47222: Uncaught TYPO3 Exception in RTE when using FAL makes the tceform unusable for editorsClosed2013-04-15

Actions
Has duplicate TYPO3 Core - Bug #49123: RTE-Htmlarea is unable to edit when images are unknownClosedStanislas Rolland2013-06-14

Actions
#1

Updated by Rastislav Birka over 7 years ago

same problem is in RTE in standard text CE, if there is link to file which doesn't exist is not possible edit this CE in BE because shows error "Oops, an error occurred!"

#2

Updated by Markus Blaschke over 7 years ago

All TCA-based tables and also flexforms will crash with a FileDoesNotExistException if one of the files is missing.

Should be a BLOCKER here because an admin have to fix the relations manually in database, no editor can fix this.

#3

Updated by Franz Holzinger over 7 years ago

I have a FE user franzholz, from whom the image file is 'Reisepass-kl.jpg'.
However this is not found.
Why does it try to read this file "uploads/pics/franzholz_Reisepass-kl_497dbf6406.jpg"?

This is stored in the image field of the fe_users Table:

franzholz_Reisepass-kl_497dbf6406.jpg,Reisepass-kl.jpg,franzholz_img_8667_skl_d695bde941.jpg

I do not know, where the name 'franzholz_Reisepass-kl_497dbf6406.jpg' comes from. Maybe the install tool has added this?

--------------------------------------------------

Uncaught TYPO3 Exception

TYPO3\CMS\Core\Resource\Exception\FileDoesNotExistException thrown in file
/var/www/path/web/typo3_src-6.0.4/typo3/sysext/core/Classes/Resource/Driver/AbstractDriver.php in line 399.

11 TYPO3\CMS\Core\Resource\Driver\AbstractDriver::getFile("uploads/pics/franzholz_Reisepass-kl_497dbf6406.jpg")

/var/www/path/web/typo3_src-6.0.4/typo3/sysext/core/Classes/Resource/ResourceStorage.php:

00798:   */
00799:  public function getFile($identifier) {

00800:   return $this->driver->getFile($identifier);

00801:  }
00802: 

10 TYPO3\CMS\Core\Resource\ResourceStorage::getFile("uploads/pics/franzholz_Reisepass-kl_497dbf6406.jpg")

/var/www/path/web/typo3_src-6.0.4/typo3/sysext/core/Classes/Resource/ResourceFactory.php:

00285:    $fileIdentifier = $parts[0];
00286:   }

00287:   return $this->getStorageObject($storageUid)->getFile($fileIdentifier);

00288:  }
00289: 

9 TYPO3\CMS\Core\Resource\ResourceFactory::getFileObjectFromCombinedIdentifier("uploads/pics/franzholz_Reisepass-kl_497dbf6406.jpg")

/var/www/path/web/typo3_src-6.0.4/typo3/sysext/core/Classes/Resource/ResourceFactory.php:

00328:   } else {
00329:    // only the path

00330:    return $this->getFileObjectFromCombinedIdentifier($input);

00331:   }
00332:  }

8 TYPO3\CMS\Core\Resource\ResourceFactory::retrieveFileOrFolderObject("uploads/pics/franzholz_Reisepass-kl_497dbf6406.jpg")

/var/www/path/web/typo3_src-6.0.4/typo3/sysext/backend/Classes/Utility/BackendUtility.php:

01519:     if ($theFile) {
01520:      $fileName = trim($uploaddir . '/' . $theFile, '/');

01521:      $fileObject = \TYPO3\CMS\Core\Resource\ResourceFactory::getInstance()->retrieveFileOrFolderObject($fileName);

01522:      $fileExtension = $fileObject->getExtension();
01523:      if ($fileExtension == 'ttf' || \TYPO3\CMS\Core\Utility\GeneralUtility::inList($GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'], $fileExtension)) {

7 TYPO3\CMS\Backend\Utility\BackendUtility::thumbCode(array, "fe_users", "image", "")

/var/www/path/web/typo3_src-6.0.4/typo3/sysext/recordlist/Classes/RecordList/AbstractDatabaseRecordList.php:

00530:   */
00531:  public function thumbCode($row, $table, $field) {

00532:   return \TYPO3\CMS\Backend\Utility\BackendUtility::thumbCode($row, $table, $field, $this->backPath);

00533:  }
00534: 

6 TYPO3\CMS\Recordlist\RecordList\AbstractDatabaseRecordList::thumbCode(array, "fe_users", "image")

/var/www/path/web/typo3_src-6.0.4/typo3/sysext/recordlist/Classes/RecordList/DatabaseRecordList.php:

00651:      // Render thumbsnails if a thumbnail column exists and there is content in it:
00652:      if ($this->thumbs && trim($row[$thumbsCol])) {

00653:       $theData[$fCol] .= '
' . $this->thumbCode($row, $table, $thumbsCol);

00654:      }
00655:      $localizationMarkerClass = '';

5 TYPO3\CMS\Recordlist\RecordList\DatabaseRecordList::renderListRow("fe_users", array, 4, "username", "image")

/var/www/path/web/typo3_src-6.0.4/typo3/sysext/recordlist/Classes/RecordList/DatabaseRecordList.php:

00496:       $cc++;
00497:       $this->translations = FALSE;

00498:       $iOut .= $this->renderListRow($table, $row, $cc, $titleCol, $thumbsCol);

00499:       // If localization view is enabled it means that the selected records are
00500:       // either default or All language and here we will not select translations

4 TYPO3\CMS\Recordlist\RecordList\DatabaseRecordList::getTable("fe_users", 0, "")

/var/www/path/web/typo3_src-6.0.4/typo3/sysext/recordlist/Classes/RecordList/AbstractDatabaseRecordList.php:

00433:     }
00434:     // Finally, render the list:

00435:     $this->HTMLcode .= $this->getTable($tableName, $this->id, implode(',', $fields));

00436:    }
00437:   }

3 TYPO3\CMS\Recordlist\RecordList\AbstractDatabaseRecordList::generateList()

/var/www/path/web/typo3_src-6.0.4/typo3/sysext/recordlist/Classes/RecordList.php:

00312:    }
00313:    // Render the list of tables:

00314:    $dblist->generateList();

00315:    // Write the bottom of the page:
00316:    $dblist->writeBottom();

2 TYPO3\CMS\Recordlist\RecordList::main()

/var/www/path/web/typo3_src-6.0.4/typo3/sysext/recordlist/mod1/index.php:

00056: }
00057: $SOBE->clearCache();

00058: $SOBE->main();

00059: $SOBE->printContent();
00060: ?>

1 require("/var/www/path/web/typo3_src-6.0.4/typo3/sysext/recordlist/mod1/index.php")

/var/www/path/web/typo3_src-6.0.4/typo3/mod.php:

00039:  require $temp_path . 'conf.php';
00040:  $BACK_PATH = '';

00041:  require $temp_path . 'index.php';

00042:  $isDispatched = TRUE;
00043: } else {

#4

Updated by Alexander Opitz over 7 years ago

  • Status changed from New to Accepted
  • Target version set to 6.0.5

Verified with 6.2-dev trunk

#5

Updated by Alexander Opitz over 7 years ago

  • Assignee set to Alexander Opitz
#6

Updated by Gerrit Code Review over 7 years ago

  • Status changed from Accepted to Under Review

Patch set 2 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/20570

#7

Updated by Alexander Opitz over 7 years ago

  • Target version changed from 6.0.5 to 6.2.0
#8

Updated by Gerrit Code Review over 7 years ago

Patch set 3 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/20570

#9

Updated by Gerrit Code Review over 7 years ago

Patch set 4 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/20570

#10

Updated by Gerrit Code Review over 7 years ago

Patch set 5 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/20570

#11

Updated by Alexander Opitz over 7 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100
#12

Updated by Gerrit Code Review over 7 years ago

  • Status changed from Resolved to Under Review

Patch set 1 for branch TYPO3_6-1 has been pushed to the review server.
It is available at https://review.typo3.org/21041

#13

Updated by Gerrit Code Review over 7 years ago

Patch set 1 for branch TYPO3_6-0 has been pushed to the review server.
It is available at https://review.typo3.org/21042

#14

Updated by Gerrit Code Review over 7 years ago

Patch set 2 for branch TYPO3_6-0 has been pushed to the review server.
It is available at https://review.typo3.org/21042

#15

Updated by Alexander Opitz over 7 years ago

  • Status changed from Under Review to Resolved
#16

Updated by Thomas Allmer over 7 years ago

it seems that AFTER 6.0.4? we now have two different Exceptions FileDoesNotExistException and FolderDoesNotExistException... so we have to catch them both

I did it like this

} catch(\Exception  $e) {
    if ($e instanceof \TYPO3\CMS\Core\Resource\Exception\FileDoesNotExistException OR $e instanceof \TYPO3\CMS\Core\Resource\Exception\FolderDoesNotExistException) {
        // no file or folder - nothing to do
    } else {
        // Rethrow the Exception
        throw $e;
    }
}
#17

Updated by Alexander Opitz over 7 years ago

Hi Thomas,

can you verify this with the newer Version 6.0.6? If yes, what needs to be done to reproduce the FileDoesNotExistException with 6.0.6?

The correct solution is following:

} catch (\TYPO3\CMS\Core\Resource\Exception\FolderDoesNotExistException $folderNotFoundException) {
    // Nothing to be done if folder not found
} catch (\TYPO3\CMS\Core\Resource\Exception\FileDoesNotExistException $fileNotFoundException) {
    // Nothing to be done if file not found
}

#18

Updated by Henrik Ziegenhain over 7 years ago

Something strange here.
Could it be, that the patch set 2 for branch TYPO3_6-0 was never merged?

I updated recently to 6.0.6 and got a folder not found exception, because a pdf file was deleted in the meanwhile.

I am not sure, if this Exception was there before.

After applying patch set 2 everything in the backend is working again.

#19

Updated by Alexander Opitz over 7 years ago

The fix was merged after the 6.0.6 release and so it will be in 6.0.7

#20

Updated by Henrik Ziegenhain over 7 years ago

Ups. Thanks for the hint :)

#21

Updated by Riccardo De Contardi about 3 years ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF