Skip to content

FIX allow double colon and string obfuscation in dol eval for computed extra fields #34015

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

lvessiller-opendsi
Copy link
Contributor

FIX allow double colon and string obfuscation in dol eval for computed extra fields

To reproduce

  • create a decimal (24,8) extra-field with computed value such as :
    dol_include_once('/MODULE/class/tools.class.php')?Tools::calculateWeight($object,isset($obj)?$obj:$objp):'Error'
  • it uses a static method "Tools" of Tools class

Then when you want to update a field of the object card, you got an error on computed field because you got a bad value containing the error in a string : "Bad string syntax to evaluate (double : char is forbidden) ..."

Backport
The is a backport to allow to concat several point without decimal values in computed extra-field. The const "MAIN_DISALLOW_STRING_OBFUSCATION_IN_DOL_EVAL" was added in commit 3edadbd

Add a const
A const "MAIN_DISALLOW_DOUBLE_COLON_IN_DOL_EVAL" was added here, in order to allow call of static methods.
Otherwise you got an error when you want to update a field on object card.
I don't if it's the good way to by pass this check : e5fd841

@eldy eldy merged commit cc78023 into Dolibarr:18.0 May 6, 2025
6 of 7 checks passed
@lvessiller-opendsi lvessiller-opendsi deleted the 18.0_fix-extra-computed-eval-with-static-method branch May 12, 2025 06:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants