Project

General

Profile

Actions

Bug #98330

open

PHP warning log with EXT-syntax using asset vh in BE

Added by Roman Büchler over 1 year ago. Updated 10 months ago.

Status:
Needs Feedback
Priority:
Should have
Assignee:
-
Category:
Miscellaneous
Start date:
2022-09-12
Due date:
% Done:

0%

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

Description

Description
When using an asset view helper in the backend context referencing a resource from a 3rd party extension a php warning entry is added to the sys_log table. The behavior can be observed when the php configuration `open_basedir` is set and "Live" is selected as debug settings in the configuration presets from the settings module. The warning log entry looks as following:

Core: Error handler (BE): PHP Warning: file_exists(): open_basedir restriction in effect. File(/typo3conf/ext/pizpalue/Sysext/backend/Resources/Public/Css/LayoutModule/collapsible-content-element.css) is not within the allowed path(s): (/home/httpd/vhosts/domain.ch/:/tmp/) in /home/httpd/vhosts/domain.ch/httpdocs/pizpalue/public/typo3/sysext/core/Classes/Utility/GeneralUtility.php line 2317 

Example use case
An extension with the extension key myext overwrites the partial `PageLayout/Record.html` from the system extension "backend" and uses an asset view helper in the overriding partial as following:

<f:asset.css identifier="myext-backend" href="EXT:myext/Path/To/Css/custom.css" />

Findings
- The log entry can be avoided by adjusting the global configuration `[SYS][belogErrorReporting]`
- When checking for file existence in `GeneralUtility` the `open_basedir` could be checked using `ini_get('open_basedir')` prior using `file_exists()`


Related issues 2 (0 open2 closed)

Related to TYPO3 Core - Bug #98545: file_exists(): open_basedir restriction in effectResolved2022-10-07

Actions
Related to TYPO3 Core - Bug #98152: PHP Warning: file_exists(): open_basedir restriction in effect. ClosedBenni Mack2022-08-16

Actions
Actions #1

Updated by Jonas Eberle over 1 year ago

Is that extension installed?

I can't reproduce with

<f:asset.css identifier="ext-styleguide" href="EXT:styleguide/Resources/Public/Css/frontend.css" />

in a backend template with installed EXT:styleguide.

Actions #2

Updated by Roman Büchler over 1 year ago

Jonas Eberle wrote in #note-1:

Is that extension installed?

I can't reproduce with

[...]

in a backend template with installed EXT:styleguide.

Could you set a breakpoint at [GeneralUtility.php#L2158](https://github.com/TYPO3-CMS/core/blob/8f4d7dd84ca36f626676250b493d26c2bcce7851/Classes/Utility/GeneralUtility.php#L2158) and check the path for that asset? On my side it starts with `/typo3conf` which should trigger a php warning related to open_basedir.

Actions #3

Updated by Benni Mack over 1 year ago

  • Related to Bug #98545: file_exists(): open_basedir restriction in effect added
Actions #4

Updated by Benni Mack over 1 year ago

  • Related to Bug #98152: PHP Warning: file_exists(): open_basedir restriction in effect. added
Actions #5

Updated by Benni Mack 11 months ago

  • Target version changed from 12 LTS to Candidate for patchlevel
Actions #6

Updated by Benni Mack 10 months ago

  • Status changed from New to Needs Feedback

Hey Roman,

can you please give some feedback?

Actions #7

Updated by Roman Büchler 10 months ago

Jonas Eberle wrote in #note-1:

Is that extension installed?

I can't reproduce with

[...]

in a backend template with installed EXT:styleguide.

... yes, the extension is installed.

Actions #8

Updated by Roman Büchler 10 months ago

Roman Büchler wrote in #note-2:

Jonas Eberle wrote in #note-1:

Is that extension installed?

I can't reproduce with

[...]

in a backend template with installed EXT:styleguide.

Could you set a breakpoint at [GeneralUtility.php#L2158](https://github.com/TYPO3-CMS/core/blob/8f4d7dd84ca36f626676250b493d26c2bcce7851/Classes/Utility/GeneralUtility.php#L2158) and check the path for that asset? On my side it starts with `/typo3conf` which should trigger a php warning related to open_basedir.

I tried to debug it but didn't manage yet to inspect the suggested breakpoint. In my ddev environment I added

open_basedir = /var/www/html

to ".ddev/php/custom.ini" and then get a similar error accessing the be login:

PHP Warning: file_exists(): open_basedir restriction in effect. File(/var/www/html/.build/vendor/bk2k/bootstrap-package/Resources/Public/Icons/ContentElements/container-columns-1.svg) is not within the allowed path(s): (/var/www/html) in /var/www/html/.build/vendor/b13/container/Classes/Tca/Registry.php line 115
Actions

Also available in: Atom PDF