Bug #81024

getFilenameFromMainDir() triggers PHP Warnings open_basedir

Added by Christian Toffolo over 2 years ago. Updated almost 2 years ago.

Status:
Closed
Priority:
Should have
Category:
Backend API
Target version:
Start date:
2016-11-28
Due date:
2016-11-28
% Done:

100%

TYPO3 Version:
8
PHP Version:
7.1
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

Method

\TYPO3\CMS\Core\Resource\ResourceCompressor::getFilenameFromMainDir()

triggers warnings
core: Core: Error handler (BE): PHP Warning: is_file(): open_basedir restriction in effect. File(/var/www/website/htdocs/../typo3conf/ext/extension/Resources/Public/file) is not within the allowed path(s):

when the BE is browsed.

This happens because "is_file($absolutePath)" checks outside the website root in the case of a passed file that has a relative path that begins with "../typo3conf/extension..." and open_basedir doesn't allow it.

Me and Markus Klein talked about the problem and decided to use the PHP error control operator @ to suppress the warnings because other solutions could break the code in other cases.


Related issues

Duplicated by TYPO3 Core - Bug #81115: TYPO3-Exception in BE-Log due to "PHP Warning: is_file(): open_basedir restriction in effect" Closed 2016-11-28 2016-11-28
Duplicates TYPO3 Core - Bug #79218: ResourceCompressor.php PHP Warning: is_file(): open_basedir restriction in effect Closed 2017-01-09
Follows TYPO3 Core - Bug #78803: ResourceCompressor can't deal with paths relative to docroot Closed 2016-11-25

Associated revisions

Revision aa2cd35f (diff)
Added by Christian Toffolo over 2 years ago

[BUGFIX] Ignore open_basedir warning for files outside the website root

Suppress warnings generated by getFilenameFromMainDir() when it needs
to check file paths outside the website root and open_basedir
is in effect.

Resolves: #81024
Releases: master, 8.7
Change-Id: Ia339c907577547374545c0a94393f698828523c7
Reviewed-on: https://review.typo3.org/52614
Reviewed-by: Stephan Großberndt <>
Tested-by: Stephan Großberndt <>
Tested-by: TYPO3com <>
Reviewed-by: Oliver Klee <>
Reviewed-by: Henrik Elsner <>
Reviewed-by: Markus Klein <>
Tested-by: Markus Klein <>

Revision f187f599 (diff)
Added by Christian Toffolo over 2 years ago

[BUGFIX] Ignore open_basedir warning for files outside the website root

Suppress warnings generated by getFilenameFromMainDir() when it needs
to check file paths outside the website root and open_basedir
is in effect.

Resolves: #81024
Releases: master, 8.7
Change-Id: Ia339c907577547374545c0a94393f698828523c7
Reviewed-on: https://review.typo3.org/52694
Reviewed-by: Markus Klein <>
Tested-by: Markus Klein <>
Tested-by: TYPO3com <>

History

#1 Updated by Gerrit Code Review over 2 years ago

  • Status changed from New 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/52614

#2 Updated by Gerrit Code Review over 2 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/52614

#3 Updated by Markus Klein over 2 years ago

  • Duplicated by Bug #81115: TYPO3-Exception in BE-Log due to "PHP Warning: is_file(): open_basedir restriction in effect" added

#4 Updated by Gerrit Code Review over 2 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/52614

#5 Updated by Stephan Großberndt over 2 years ago

  • Due date set to 2016-11-28
  • Start date changed from 2017-04-26 to 2016-11-28
  • Follows Bug #78803: ResourceCompressor can't deal with paths relative to docroot added

#6 Updated by Markus Klein over 2 years ago

  • Duplicates Bug #79218: ResourceCompressor.php PHP Warning: is_file(): open_basedir restriction in effect added

#7 Updated by Gerrit Code Review over 2 years ago

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

#8 Updated by Christian Toffolo over 2 years ago

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

#9 Updated by Riccardo De Contardi almost 2 years ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF