php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #26300 PB serialization ascii code greater than 127
Submitted: 2003-11-18 10:12 UTC Modified: 2003-11-18 15:24 UTC
From: pierre-marie dot mouliere at arc-intl dot com Assigned:
Status: Closed Package: WDDX related
PHP Version: 4.3.3 OS: HPUX
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: pierre-marie dot mouliere at arc-intl dot com
New email:
PHP Version: OS:

 

 [2003-11-18 10:12 UTC] pierre-marie dot mouliere at arc-intl dot com
Description:
------------
Hi,
There's a little bug with strings serialization, for strings containing characters with ascii code greater than 127 (with HP-UX v11).

We found that the problem is located in function  : php_wddx_serialize_string.
There is a line of code like :
     if (iscntrl((int)*p) {
When casting character (*p) to int for values greater than 127 (witch are considered negative) there is a sign extension so character '?'(ascii code 0xf0) become integer 0xfffffff0.
But the function iscntrl expects an integrer between 0 and 255, or the result is unpredictable.
The problem can be fixed by modifying the line above like :
     if(iscntrl((int)(unsigned char)*p) {	
Best Regards
Pierre-Marie MOULIERE

Reproduce code:
---------------
<?php
print "<u>Without locale :</u><br><br>";
print "???????????? ??????????? ? ?" . "<br>\n";
print wddx_deserialize(wddx_serialize_value("???????????? ??????????? ? ?")); 
print "<br><hr><br>";
print "<u>With locale (fr_FR.iso88591) :</u><br><br>";
setlocale(LC_CTYPE, "fr_FR.iso88591");
print "???????????? ??????????? ? ?" . "<br>\n";
print wddx_deserialize(wddx_serialize_value("???????????? ??????????? ? ?")); 
?>	


Expected result:
----------------
Result : 
Without locale :

???????????? ??????????? ? ?
???????????? ??????????? ? ?

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

With locale (fr_FR.iso88591) :

???????????? ??????????? ? ?
???????????? ??????????? ? ?



Actual result:
--------------
Result : 
Without locale :

???????????? ??????????? ? ?
???????????? ??????????? ? ?
		
-----------------------------------------------------------
		
With locale (fr_FR.iso88591) :
		
???????????? ??????????? ? ?
???????????? ??????????? ? ?	

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-11-18 15:24 UTC] iliaa@php.net
Thank you for your bug report. This issue has already been fixed
in the latest released version of PHP, which you can download at 
http://www.php.net/downloads.php


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed May 22 22:01:32 2024 UTC