Ticket #7133 (closed defect: fixed)

Opened 5 months ago

Last modified 4 months ago

maybe_serialize does not match with maybe_unserialize

Reported by: hakre Assigned to: westi
Priority: high Milestone: 2.6
Component: General Version:
Severity: normal Keywords:
Cc:

Description

maybe_serialize is used in conjunction with maybe_unserialize. from a logical point of view, data passed through both functions should be returned unchanged:

<?php
$data_original = ' original ';
$data = maybe_serialize($data_original);
$data = maybe_unserialize($data);

printf('Original:"%s" Processed:"%s"', $data_original, $data);
?>

the output is: Original:" original " Processed:"original"

this example shows that data has been unecessarily manipulated.

when you look into the code you can see that maybe_serialize() trims the $data. this is of no use.

# to trim a string use trim() php function # serialization is about arrays and objects, not strings

Attachments

patch-r8069-7133-00.txt (0.5 kB) - added by hakre on 06/13/08 05:40:37.
Patch so solve the Problem
patch-r8069-7133-00.patch (0.5 kB) - added by hakre on 06/13/08 05:42:11.
Simply no need to trim(), fixes #7133

Change History

06/13/08 05:40:37 changed by hakre

  • attachment patch-r8069-7133-00.txt added.

Patch so solve the Problem

06/13/08 05:42:11 changed by hakre

  • attachment patch-r8069-7133-00.patch added.

Simply no need to trim(), fixes #7133

06/13/08 05:43:18 changed by hakre

  • owner changed from hakre to westi.

The solution is so simple like easy. There is no need to trim string data, so here it goes.

westi can you take a look?

06/16/08 20:41:02 changed by ryan

  • status changed from new to closed.
  • resolution set to fixed.

(In [8100]) Don't trim strings in maybe_serialize(). Props hakre. fixes #7132 #7133 #4781 for trunk

06/16/08 20:41:15 changed by ryan

(In [8101]) Don't trim strings in maybe_serialize(). Props hakre. fixes #7132 #7133 #4781 for 2.5

07/15/08 16:24:07 changed by ryan

  • milestone changed from 2.5.2 to 2.9.

Milestone 2.5.2 deleted

07/19/08 23:42:26 changed by westi

  • milestone changed from 2.9 to 2.6.