Skip to content
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

FIX: modification of complementary attributes in commercial proposals #26115

Merged
merged 1 commit into from
Oct 5, 2023

Conversation

am97
Copy link
Contributor

@am97 am97 commented Oct 4, 2023

FIX: modification of complementary attributes in commercial proposals

Problem

We have some complementary attributes in /comm/admin/propal_extrafields.php in our Dolibarr 16.0.5 instance. When trying to modify these attributes on any commercial proposal, we get a blank page. For example:

dolibarr_clone_bug

Here, we click on the pen icon next to % Facturé, we select a value, then we click on MODIFY. We get a blank page, and the following error in the logs:

PHP Fatal error:  Uncaught Exception: Serialization of 'PgSql\Connection' is not allowed in /var/www/html/core/lib/functions.lib.php:1166
Stack trace:
#0 /var/www/html/core/lib/functions.lib.php(1166): serialize()
#1 /var/www/html/comm/propal/card.php(1470): dol_clone()
#2 {main}

Fix

This PR replaces the dol_clone function by the one in the 17.0 branch, in order to have the method 2 (Full isolation method keeping only scalar and array properties). There should be no side effects, but if you want to be extra sure, I can keep the old conditions (ie. if (empty($native)) instead of if ($native == 0) and if ($tmpsavdb) instead of if (!empty($tmpsavdb))).

Then, I use the method 2 in the dol_clone that caused the PHP error in comm/propal/card.php.

I tested this fix in our instance and everything seems fine.

The db object must not be cloned in order to avoid a PHP Fatal error:  Uncaught Exception: Serialization of 'PgSql\Connection' is not allowed

This commit replaces the dol_clone function by the one in the 17.0 branch
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