Bug #47648
closedPHP 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.
100%
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
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)) {
Updated by Ernesto Baschny over 11 years ago
- Category set to File Abstraction Layer (FAL)
- Priority changed from Should have to Must have
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.
Updated by Markus Klein about 11 years ago
- Is Regression set to No
$GLOBALS['FILEMOUNTS'] is always empty now.
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
Updated by Steffen Ritter about 11 years ago
- Target version set to next-patchlevel
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
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
Updated by Markus Klein almost 11 years ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset e8a2b21e913e4c309f80ca809b23876c79adad49.
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
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
Updated by Markus Klein almost 11 years ago
- Status changed from Under Review to Resolved
Applied in changeset e8978f9d8c70febb6fb8ec0f6181f533f2523ccf.