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 invoices #26180

Merged
merged 1 commit into from
Oct 11, 2023

Conversation

am97
Copy link
Contributor

@am97 am97 commented Oct 11, 2023

FIX: modification of complementary attributes in invoices

Similar to #26115 , this PR fixes the modification of complementary attributes in invoices, which was leading to a blank page with the following error:

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

Fixes the following error:

PHP Fatal error:  Uncaught Exception: Serialization of PgSql\Connection is not allowed in /var/www/html/core/lib/functions.lib.php:1168
Stack trace:
#0 /var/www/html/core/lib/functions.lib.php(1168): serialize()
Dolibarr#1 /var/www/html/compta/facture/card.php(2798): dol_clone()
Dolibarr#2 {main}
@eldy
Copy link
Member

eldy commented Oct 11, 2023

This looks strange because into the dol_clone method when using parameter zero, we have
if (isset($object->db) && isset($object->db->db) && is_object($object->db->db) && get_class($object->db->db) == 'PgSql\Connection') { $tmpsavdb = $object->db; unset($object->db); // Such property can not be serialized with pgsl (when object->db->db = 'PgSql\Connection')
So we should not experience this trouble. Can you check why we don't enter into this test ?

@eldy eldy added the Discussion Some questions or discussions are opened and wait answers of author or other people to be processed label Oct 11, 2023
@hregis
Copy link
Contributor

hregis commented Oct 11, 2023

@am97 what is the version of your php ?

@am97
Copy link
Contributor Author

am97 commented Oct 11, 2023

Can you check why we don't enter into this test ?

I made a dump of the object passed to dol_clone, there is another PgSql\Connection object (lines[0]->db->db). Here is the dump (I replaced some data with **redacted**):

php_object_dump.txt

@am97 what is the version of your php ?

PHP 8.1.20 (we are using a Docker image based on tuxgasy/dolibarr:16.0.5)

@eldy eldy merged commit b9136ee into Dolibarr:16.0 Oct 11, 2023
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Discussion Some questions or discussions are opened and wait answers of author or other people to be processed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants