Bug #68116 [Nab]: The code is same but it display different output
Edit report at https://bugs.php.net/bug.php?id=68116&edit=1
ID: 68116
Updated by: leigh@php.net
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: No
+Block user comment: Yes
Private report: N
New Comment:
This is a bug report system, not a support forum. There are various methods for obtaining support
documented at: http://php.net/support.php - but you'll
probably get results faster by using a search engine.
Previous Comments:
------------------------------------------------------------------------
[2014-09-30 03:30:04] kabir dot pust at gmail dot com
Could you clear this ?
I need to remove(=) equal sign from the input url. How can I make this ?
------------------------------------------------------------------------
[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
Thread (4 messages)