This repository has been archived by the owner on Jan 2, 2020. It is now read-only.
prevent fatal error when posix_getpwuid is disabled #103
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
The following code generates a Fatal error when the
posix_getpwuid
function is disabled, which some shared hosters do as a "security" measure:Thus you cannot use the Contao Check in order to check the system requirements, install Contao or validate an existing Contao installation on such hostings.
See #86, #93, #100, #101.
Reproduction
Simply add
to your PHP.ini and access the Contao Check (any PHP version).
Explanation
function_exists
returnsfalse
if a function is either not declared or disabled. It will returntrue
otherwise.Proposed fix
This PR adds additional checks for a disabled
posix_getpwuid
function, thus not generating a fatal error anymore when you open the Contao Check. Instead it will display messages which explain that this function is in the list of disabled functions and thus file permissions cannot be checked.Note: Since the check for the composer client also checks the file permissions, I removed that
<li>
from theindex.phtml
whenever theposix_getpwuid
function is disabled (since you cannot say whether or not you can use the composer client then).Translations
As mentioned in #102, I am not sure what the best practice for creating the appropriate *.pot translation files is. Thus any translation adaptions are yet missing from this PR.