PHP7 Uniform Variable Syntax (was export permissions don't work with PHP7) #4597
Closed
9 tasks done
Labels
Bug
This is a bug (something does not work as expected)
Priority - High / Blocking
This is a security hole or a bug that make a feature not possible to use or very expected feature.
When using PHP7, export is always unavailable.
The interface always displays
NotEnoughPermissions
.After a deep analysis, the defect is caused by a backward incompatible change introduced by the "Uniform Variable Syntax" RFC.
I've published a condensed example in the following gist to help understanding the behavior differences: https://gist.github.com/rdoursenaud/224ac8dff52518402cc5
In Dolibarr the offending code is in
export.class.php
around line 134.Eg.:
In PHP7, this is interpreted as
and triggers a "Notice: Array to string conversion" and "Notice: Undefined property".
$bool then becomes a null.
The workaround is to explicitly require the old behavior by adding braces to force precedence:
I believe that this problem is widespread in Dolibarr codebase and can have very uncontrolled behavior.
IMHO, we should warn users that Dolibarr is incompatible with PHP7 for the moment and should not be used with it before this bug is ironed out.
Edit – List of affected files and number of occurrences:
The text was updated successfully, but these errors were encountered: