Bug #71627 [Fbk->Nab]: save function doesn't work baddly

From: Date: Wed, 24 Feb 2016 14:00:20 +0000
Subject: Bug #71627 [Fbk->Nab]: save function doesn't work baddly
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-199455@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=71627&edit=1

 ID:                 71627
 Updated by:         ab@php.net
 Reported by:        dubois-holvoet dot patrick at neuf dot fr
 Summary:            save function doesn't work baddly
-Status:             Feedback
+Status:             Not a bug
 Type:               Bug
 Package:            DOM XML related
 Operating System:   Windows 10
 PHP Version:        5.5.32
 Block user comment: N
 Private report:     N

 New Comment:

Thanks for the followup. Yeah, as alternative, you could also like base64 encode the data that you
put into XML, could work too.

Thanks.


Previous Comments:
------------------------------------------------------------------------
[2016-02-19 10:05:50] dubois-holvoet dot patrick at neuf dot fr

Finally I applied the addslashes() function before using my serialized object into the XML structure
generated with the DOMDocument class.
I do it like this : 
addslashes(serialize($data));

And the result is perfect. The DOMDocument::save() runs fine now !

Of course when I want to use the serialized object I do it as follows :
unserialize(stripslashes($obj_serialized));

Thanks a lot for your feedback

------------------------------------------------------------------------
[2016-02-18 19:16:05] ab@php.net

Thanks for the report. Please post some reproduce code.

Cheers.

------------------------------------------------------------------------
[2016-02-18 19:11:10] dubois-holvoet dot patrick at neuf dot fr

Description:
------------
---
From manual page: http://www.php.net/domdocument.save
---
Here is the problem.

Before using DOMDocument to build a XML structure and save it in a file, I needed to serialize an
object witch has to be included in the XML structure. 

But this object is from a class containing Protected members. 

And as it's written in the PHP documentation the name of the protected members is prefixed by
the serialize function with an asterisc and a nul character on each side of the asterisc.

And these nul characters cause the bug with the DOMDocument::save function. The saved file is
troncated juste before the first nul character met.

Is there a solution to solve that ?      



------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=71627&edit=1


Thread (5 messages)

« previous php.bugs (#199455) next »