php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #6267 parse_str fails to parse strings
Submitted: 2000-08-20 20:02 UTC Modified: 2000-08-23 07:15 UTC
From: ianm at judcom dot nsw dot gov dot au Assigned:
Status: Closed Package: Documentation problem
PHP Version: 4.0.1pl2 OS: Windows 98SE and NT 4.0 workstat
Private report: No CVE-ID: None
 [2000-08-20 20:02 UTC] ianm at judcom dot nsw dot gov dot au
This is, unfortunately, a reposting of #5991 which has been marked as closed - no feedback. I DID try to post feedback, but was unable to (I had no password) - I even emailed the person who posted the request for feedback, but got no answer. As this problem with parse_str is unresolved, and I am working on an enterprise project, I am persisting with the bug report.

PROBLEM WITH PARSE_STR
--------------------------------
Example, if I embed the following script into PHP code:

$alpha = 'beta=2&gamma=3';
parse_str($alpha);
echo "|$beta|$gamma|\n";

All I see is '|||' when I view the output. The code works fine under PHP 3.0 on Linux. All my other PHP code works fine.

I have tested this both in a web page from Peer Web Server(ISAPI) under Win NT 4.0
and at the command prompt running a stand-alone script through php.exe under NT 4.0 and Win 98 SE 
- with the same result. I got the same results with PHP 4.0.0 and 4.0.1pl2, which I downloaded and tried as requested in #5991.

BTW, I downloaded the Win32 binaries from www.Zend.com - I did not compile my own.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-08-20 20:29 UTC] jmoore@php.net
Tested Under Win 2k, Apache, thttpd and IIS5 (CGI and ISAPI)  Cannot recreate it at all (Using 4.0.1pl2 and Latest CVS win binaries). I get |2|3| outputted everytime.
 [2000-08-20 22:44 UTC] ianm at judcom dot nsw dot gov dot au
UPDATE

After reading comments by several people that they couldn't reproduce the problem, I wondered if it was a local configuration problem.

I backed up my current php.ini and copied php.ini-optimized as the new php.ini, and I still got the parse_str failure. I then replaced that php.ini with php.ini-dist ... and parse_str worked fine!

NB: I have been using a modified version of php.ini-optimized as my php.ini. 

CONCLUSION (thus far)

The php.ini-optimized that comes with PHP 4.0.x definitely causes parse_str to fail on my PCs, but the php.ini-dist works fine. I had used php.ini-optimized because it says it is optimized for 4.0.x and it is "recommended".

Does this help?
 [2000-08-20 23:02 UTC] rasmus@php.net
User had turned register_globals off in his php.ini file.  parse_str() requires register_globals to be on.
 [2000-08-20 23:23 UTC] ianm at judcom dot nsw dot gov dot au
UPDATE

After reading comments by several people that they couldn't reproduce the problem, I wondered if it was a local configuration problem.

I backed up my current php.ini and copied php.ini-optimized as the new php.ini, and I still got the parse_str failure. I then replaced that php.ini with php.ini-dist ... and parse_str worked fine!

NB: I have been using a modified version of php.ini-optimized as my php.ini. 

CONCLUSION (thus far)

The php.ini-optimized that comes with PHP 4.0.x definitely causes parse_str to fail on my PCs, but the php.ini-dist works fine. I had used php.ini-optimized because it says it is optimized for 4.0.x and it is "recommended".

Does this help?
 [2000-08-20 23:28 UTC] sas@php.net
This bug report has been closed. Please stop reopening it.
 [2000-08-21 00:13 UTC] waldschrott@php.net
after having realized that php.ini in interpreter dir
supersedes php.ini in [windows directory] I have enabled
register_globals and it works here too, but it?s not
documented not to work with register_globals=off

as rasmus pointed out, parse_str is not EGPCS variables and
I don?t see any reason why it should not work with
register_globals=off

reopened docu problem
 [2000-08-23 07:15 UTC] jmoore@php.net
Note added to function in docs
 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Tue Jun 16 12:00:02 2026 UTC