From:             robertleglu at msn dot com
Operating system: z/OS
PHP version:      Irrelevant
Package:          URL related
Bug Type:         Bug
Bug description:base64_encode broken with binary string

Description:
------------
problem occurs on z/OS 1.11 (OS of IBM mainframe) with latest version of
php for 
that system.

binary strings are badly encoded with base64_encode.
rewriting my own (portable) version bypass the problem.


php version : (php_cli --version)
PHP 5.1.2 (cli) (built: Sep 28 2010 16:33:24)
Copyright (c) 1997-2006 The PHP Group
Zend Engine v2.1.0, Copyright (c) 1998-2006 Zend Technologies

Note that z/OS works in EBCDIC, so any code that assume ascii code, ascii
order 
and ascii continuity is broken 






Test script:
---------------
<?php
$str = chr(0x47).chr(0x49).chr(46);
echo base64_encode($str).PHP_EOL;
?>

Expected result:
----------------
R0ku


Actual result:
--------------
5fEG



-- 
Edit bug report at https://bugs.php.net/bug.php?id=62875&edit=1
-- 
Try a snapshot (PHP 5.4):            
https://bugs.php.net/fix.php?id=62875&r=trysnapshot54
Try a snapshot (PHP 5.3):            
https://bugs.php.net/fix.php?id=62875&r=trysnapshot53
Try a snapshot (trunk):              
https://bugs.php.net/fix.php?id=62875&r=trysnapshottrunk
Fixed in SVN:                        
https://bugs.php.net/fix.php?id=62875&r=fixed
Fixed in SVN and need be documented: 
https://bugs.php.net/fix.php?id=62875&r=needdocs
Fixed in release:                    
https://bugs.php.net/fix.php?id=62875&r=alreadyfixed
Need backtrace:                      
https://bugs.php.net/fix.php?id=62875&r=needtrace
Need Reproduce Script:               
https://bugs.php.net/fix.php?id=62875&r=needscript
Try newer version:                   
https://bugs.php.net/fix.php?id=62875&r=oldversion
Not developer issue:                 
https://bugs.php.net/fix.php?id=62875&r=support
Expected behavior:                   
https://bugs.php.net/fix.php?id=62875&r=notwrong
Not enough info:                     
https://bugs.php.net/fix.php?id=62875&r=notenoughinfo
Submitted twice:                     
https://bugs.php.net/fix.php?id=62875&r=submittedtwice
register_globals:                    
https://bugs.php.net/fix.php?id=62875&r=globals
PHP 4 support discontinued:          
https://bugs.php.net/fix.php?id=62875&r=php4
Daylight Savings:                    https://bugs.php.net/fix.php?id=62875&r=dst
IIS Stability:                       
https://bugs.php.net/fix.php?id=62875&r=isapi
Install GNU Sed:                     
https://bugs.php.net/fix.php?id=62875&r=gnused
Floating point limitations:          
https://bugs.php.net/fix.php?id=62875&r=float
No Zend Extensions:                  
https://bugs.php.net/fix.php?id=62875&r=nozend
MySQL Configuration Error:           
https://bugs.php.net/fix.php?id=62875&r=mysqlcfg

Reply via email to