php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #44806 Serialize an Object with Private vars in txt file
Submitted: 2008-04-23 08:48 UTC Modified: 2008-04-23 08:56 UTC
From: aymeric dot jouno at free dot fr Assigned:
Status: Not a bug Package: Class/Object related
PHP Version: 5.2.5 OS: XP
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: aymeric dot jouno at free dot fr
New email:
PHP Version: OS:

 

 [2008-04-23 08:48 UTC] aymeric dot jouno at free dot fr
Description:
------------
There is a mismatch/bug under PHP 5.2.5( id don't try it in other version)

CONTEXT :

Serialize an Object with Private vars in a text file using 
fopen no binary and fwrite.



RESULT :

serialize Object is forced to bad binary mode in file.
if you change private vars to public vars it work !...


SOLUTION :
1 but poor => encode_base_64(Serialized Objet)
2 good => use fopen in binary mode


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-04-23 08:56 UTC] derick@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

This is correct, private (and also protected) methods are serialized containing a \\0 character.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Thu Jul 03 15:01:34 2025 UTC