|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #68116 The code is same but it display different output
Submitted: 2014-09-29 12:28 UTC Modified: 2014-09-30 07:04 UTC
From: kabir dot pust at gmail dot com Assigned:
Status: Not a bug Package: Output Control
PHP Version: 5.4.33 OS: Ubuntu
Private report: No CVE-ID: None
 [2014-09-29 12:28 UTC] kabir dot pust at gmail dot com
    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


input: masud 
output: masud

Actual result:
input: fazlul
output: fazlul


input: masud 
output: masud7


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2014-09-29 12:49 UTC]
-Status: Open +Status: Not a bug
 [2014-09-29 12:49 UTC]
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-30 03:30 UTC] 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-30 07:04 UTC]
-Block user comment: No +Block user comment: Yes
 [2014-09-30 07:04 UTC]
This is a bug report system, not a support forum. There are various methods for obtaining support documented at: - but you'll probably get results faster by using a search engine.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed May 22 14:01:33 2024 UTC