|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #19569 urlencode() problem encoding strings containing single quotes
Submitted: 2002-09-24 02:01 UTC Modified: 2002-09-24 03:02 UTC
From: dbarndt at ntlpromos dot com Assigned:
Status: Not a bug Package: *URL Functions
PHP Version: 4.2.3 OS: Windows NT 4.0 SP6
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.
Block user comment
Status: Assign to:
Bug Type:
From: dbarndt at ntlpromos dot com
New email:
PHP Version: OS:


 [2002-09-24 02:01 UTC] dbarndt at ntlpromos dot com
I really hesitated putting this in as a bug, because it seems so simple.  The urlencode() documentation seems to imply that the following script should work fine, however it fails to output the second printf() on my system.  I am running with the php.ini-recommended INI file on Windows NT 4.0 SP6.  (I've tried various combinations of htmlentities() and htmlspecialchars() with the urlencode() as well, but so far without success.)

Here's the script:

$test_str = "Mickey's Fun House";
printf ($test_str);
$encoded_str = urlencode ($test_str);
printf ($encoded_str);

If this is something stupid on my end, I apologize for the bother.

Dave Barndt


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2002-09-24 02:03 UTC] dbarndt at ntlpromos dot com
fixed typo in title
 [2002-09-24 03:02 UTC]
Sorry, but the bug system is not the appropriate forum for asking
support questions. Your problem does not imply a bug in PHP itself.
For a list of more appropriate places to ask for help using PHP,
please visit

Thank you for your interest in PHP.

do not use printf unless you know what you are doing,
use plain print or echo instead

*and* please have a look at your error log first
before reporting problems

you would have seen a message like

  Warning:  printf(): too few arguments in ... on line 9

due to the fact that urlencode() converts your string to
"Mickey%27s+Fun+House", so requesting to output the 2nd parameter (not given here) as a 27 character wide string

see and for 
the different semantics of print() and printf()
 [2002-09-24 13:14 UTC] dbarndt at ntlpromos dot com
Thanks for the reply.  As a C/C++ developer for 13 years, but having only recently been introduced to PHP, I am painfully well aware of the joys and pitfalls of printf() functionality, and will look into print() as you suggested.

Probably because of the late hour, I neglected to check the log or support site.  So much for my first PHP bug submission.  I thought it was probably something stupid.  My apologies for wasting your valuable time.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Jun 14 10:01:35 2024 UTC