Project

General

Profile

Actions

Bug #47648

closed

PHP Warning: rtrim() expects parameter 1 to be string in ElementBrowser.php line 1867

Added by d.ros no-lastname-given over 11 years ago. Updated about 6 years ago.

Status:
Closed
Priority:
Must have
Assignee:
-
Category:
File Abstraction Layer (FAL)
Target version:
Start date:
2013-04-27
Due date:
% Done:

100%

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

Description

The following error happens when the FAL Relation Wizard is opened.
E.g. when in an image content element you click "Add image", then you have this error in the bottom of the TYPO3 element browser:

27-04-13 14:33 - PHP Warning: rtrim() expects parameter 1 to be string, object given in ~/typo3_src-6.0.6/typo3/sysext/recordlist/Classes/Browser/ElementBrowser.php line 1867


Related issues 4 (0 open4 closed)

Related to TYPO3 Core - Bug #45859: Element Browser stops workingClosedBenni Mack2013-02-26

Actions
Related to TYPO3 Core - Bug #51752: FAL ArrayIterator::seek() warning in ElementBrowserClosed2013-09-04

Actions
Related to TYPO3 Core - Bug #53580: Cleanup ElementBrowserClosedMarkus Klein2013-11-13

Actions
Related to TYPO3 Core - Bug #49391: options.folderTree.altElementBrowserMountPoints (readonly filemounts) not working with FALClosed2013-06-24

Actions
Actions #1

Updated by Chris topher over 11 years ago

  • Subject changed from ElementBrowser.php line 1867 - PHP Warning: rtrim() expects parameter 1 to be string to PHP Warning: rtrim() expects parameter 1 to be string in ElementBrowser.php line 1867

This is the PHP code:
isReadOnlyFolder($folder) { return $GLOBALS['FILEMOUNTS'][$this->fileProcessor->checkPathAgainstMounts(rtrim($folder, '/') . '/')]['type'] == 'readonly';

Here $folder is a folder object from TYPO3\CMS\Core\Resource\Folder. But instead, it should be a string with an absolute filepath.

Backtrace:

#0 TYPO3\CMS\Recordlist\Browser\ElementBrowser->isReadOnlyFolder(TYPO3\CMS\Core\Resource\Folder Object (
  [] => TYPO3\CMS\Core\Resource\ResourceStorage Object (
    [] => TYPO3\CMS\Core\Resource\Driver\LocalDriver Object (
      [] => /var/www/fileadmin/,
      [] => Array ([0] => sha1,
      [1] => md5),
      [] => fileadmin/,
      [] => ,
      [] => TYPO3\CMS\Core\Resource\ResourceStorage Object (
        *RECURSION*,
        [] => ,
        [] => TYPO3\CMS\Core\Resource\Folder Object (
          *RECURSION*,
          [] => Array (
            [basePath] => fileadmin/,
            [pathType] => relative
          ),
          [] => getFileList_itemCallback,
          [] => getFolderList_itemCallback,
          [] => 7
        ),
        [] => Array (
          [uid] => 1,
          [pid] => 0,
          [tstamp] => 1371345593,
          [crdate] => 1371345593,
          [cruser_id] => 0,
          [deleted] => 0,
          [hidden] => 0,
          [name] => fileadmin/,
          [description] => Das lokale fileadmin/ Verzeichnis.,
          [driver] => Local,
          [configuration] => fileadmin/ relative ,
          [is_browsable] =>
        ..........
#1 TYPO3\CMS\Recordlist\Browser\ElementBrowser->main_file() called at [~/typo3_src-6.0.6/typo3/sysext/recordlist/Classes/Controller/ElementBrowserController.php:145]
#2 TYPO3\CMS\Recordlist\Controller\ElementBrowserController->main() called at [~/typo3_src-6.0.6/typo3/browse_links.php:49]

So it is in fact TYPO3\CMS\Recordlist\Browser\ElementBrowser::main_file(), which gives the wrong argument to isReadOnlyFolder().

The problem is line 1138, where the code even says that $fileOrFolderObject, an object, will be put into the variable:

$fileOrFolderObject = \TYPO3\CMS\Core\Resource\ResourceFactory::getInstance()->retrieveFileOrFolderObject($this->expandFolder); if ($fileOrFolderObject instanceof \TYPO3\CMS\Core\Resource\Folder) { // It's a folder $this->selectedFolder = $fileOrFolderObject; ... if ($this->selectedFolder && !$this->isReadOnlyFolder($this->selectedFolder)) {
Actions #2

Updated by Ernesto Baschny over 11 years ago

  • Category set to File Abstraction Layer (FAL)
  • Priority changed from Should have to Must have
Actions #3

Updated by Ernesto Baschny over 11 years ago

  • Status changed from New to Accepted

At the end we need to replace the usage of the (deprecated) BasicFileUtility (which is $this->fileProcessor in ElementBrowser) by the new BE_USERS->getFileStorages() and then call isWithinFileMountBoundaries instead of the old-school methods of BasicFileUtility.

This will not only solve this bug, but fix a deprecation policy violation, that we currently have, where we init BasicFileUtility which is deprecated since 6.0.

Actions #4

Updated by Markus Klein about 11 years ago

  • Is Regression set to No

$GLOBALS['FILEMOUNTS'] is always empty now.

Actions #5

Updated by Gerrit Code Review about 11 years ago

  • Status changed from Accepted to Under Review

Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/25358

Actions #6

Updated by Steffen Ritter about 11 years ago

  • Target version set to next-patchlevel
Actions #7

Updated by Gerrit Code Review about 11 years ago

Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/25358

Actions #8

Updated by Gerrit Code Review about 11 years ago

Patch set 3 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/25358

Actions #9

Updated by Markus Klein almost 11 years ago

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

Updated by Gerrit Code Review almost 11 years ago

  • Status changed from Resolved to Under Review

Patch set 1 for branch TYPO3_6-1 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/26467

Actions #11

Updated by Gerrit Code Review almost 11 years ago

Patch set 1 for branch TYPO3_6-0 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/26468

Actions #12

Updated by Markus Klein almost 11 years ago

  • Status changed from Under Review to Resolved
Actions #13

Updated by Benni Mack about 6 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF