Bug #68116 [Com]: The code is same but it display different output

From: Date: Tue, 30 Sep 2014 03:30:04 +0000
Subject: Bug #68116 [Com]: The code is same but it display different output
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-187766@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=68116&edit=1 ID: 68116 Comment by: kabir dot pust at gmail dot com Reported by: kabir dot pust at gmail dot com Summary: The code is same but it display different output Status: Not a bug Type: Bug Package: Output Control Operating System: Ubuntu PHP Version: 5.4.33 Block user comment: N Private report: N New Comment: Could you clear this ? I need to remove(=) equal sign from the input url. How can I make this ? Previous Comments: ------------------------------------------------------------------------ [2014-09-29 12:49:42] leigh@php.net Sorry but this is not a bug. The base64_encoded version of 'masud' will have a single equals sign at the end for padding. When you urlencode this it will be converted to '%3D', bWFzdWQ= -> bWFzdWQ%3D You have changed the encoding, and have changed the value represented by this encoding. base64_decode is behaving correctly in this case. Thank you for your interest in PHP. ------------------------------------------------------------------------ [2014-09-29 12:28:26] kabir dot pust at gmail dot com Description: ------------ <?php echo $a = urlencode(base64_encode('fazlul')).' '; echo $str = @iconv('UTF-8', 'UTF-8//IGNORE', $a).' '; echo $c = urldecode(base64_decode($str)); echo "\r\n\r\n"; echo $a = urlencode(base64_encode('masud')).' ';//same for karim echo $str = @iconv('UTF-8', 'UTF-8//IGNORE', $a).' '; echo $c = urldecode(base64_decode($str)); Test script: --------------- Same process but the output is different. Expected result: ---------------- input: fazlul output: fazlul But, input: masud output: masud Actual result: -------------- input: fazlul output: fazlul But, input: masud output: masud7 ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=68116&edit=1

« previous php.bugs (#187766) next »