php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #12325 Query_string not defined
Submitted: 2001-07-23 21:30 UTC Modified: 2001-07-25 02:02 UTC
From: danradigan at yahoo dot com Assigned:
Status: Not a bug Package: Unknown/Other Function
PHP Version: 4.0.6 OS: Win 2k
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.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: danradigan at yahoo dot com
New email:
PHP Version: OS:

 

 [2001-07-23 21:30 UTC] danradigan at yahoo dot com
Here is the code I am trying to run:

if ($QUERY_STRING != "") {
    $insertFormAction .= "?" . $QUERY_STRING;

When I call the page from the browser with no querystring I get:

Warning: Undefined variable: QUERY_STRING in
c:\inetpub\wwwroot\gabe\deleteParam.php on line 3

This only reproduces when using the installer for windows
from the download section at php.net.  I cannot reproduce on
Linux or OSX.  Also I installed the zip version and cannot
reproduce it.  Only the installer.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-07-24 09:24 UTC] andy@php.net
Can you include a copy of your php.ini file?
 [2001-07-24 16:18 UTC] danradigan at yahoo dot com
I think this is the relevant section:
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Error handling and logging ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

; error_reporting is a bit-field.  Or each number up to get desired error
; reporting level
; E_ALL             - All errors and warnings
; E_ERROR           - fatal run-time errors
; E_WARNING         - run-time warnings (non-fatal errors)
; E_PARSE           - compile-time parse errors
; E_NOTICE          - run-time notices (these are warnings which often result
;                     from a bug in your code, but it's possible that it was
;                     intentional (e.g., using an uninitialized variable and
;                     relying on the fact it's automatically initialized to an
;                     empty string)
; E_CORE_ERROR      - fatal errors that occur during PHP's initial startup
; E_CORE_WARNING    - warnings (non-fatal errors) that occur during PHP's
;                     initial startup
; E_COMPILE_ERROR   - fatal compile-time errors
; E_COMPILE_WARNING - compile-time warnings (non-fatal errors)
; E_USER_ERROR      - user-generated error message
; E_USER_WARNING    - user-generated warning message
; E_USER_NOTICE     - user-generated notice message
;
; Examples:
;
;   - Show all errors, except for notices
;
;error_reporting = E_ALL & ~E_NOTICE
;
;   - Show only errors
;
;error_reporting = E_COMPILE_ERROR|E_ERROR|E_CORE_ERROR
;
;   - Show all errors except for notices
;
error_reporting  = E_ALL; display all errors, warnings and notices

; Print out errors (as a part of the output).  For production web sites,
; you're strongly encouraged to turn this feature off, and use error logging
; instead (see below).  Keeping display_errors enabled on a production web site
; may reveal security information to end users, such as file paths on your Web
; server, your database schema or other information.
display_errors = On

; Even when display_errors is on, errors that occur during PHP's startup
; sequence are not displayed.  It's strongly recommended to keep
; display_startup_errors off, except for when debugging.
display_startup_errors = Off

; Log errors into a log file (server-specific log, stderr, or error_log (below))
; As stated above, you're strongly advised to use error logging in place of
; error displaying on production web sites.
log_errors = Off

; Store the last error/warning message in $php_errormsg (boolean).
track_errors = Off

; String to output before an error message.
;error_prepend_string = "<font color=ff0000>"

; String to output after an error message.
;error_append_string = "</font>"

; Log errors to specified file.
;error_log = filename

; Log errors to syslog (Event Log on NT, not valid in Windows 95).
;error_log = syslog

; Warn if the + operator is used with strings.
warn_plus_overloading = Off

However, since QUERY_STRING is a PHP variable, I think it should be defined as "" if there is no querystring specified.

 [2001-07-24 17:21 UTC] andy@php.net
in your php.ini file make sure this line is included...

register_globals = on
 [2001-07-24 20:28 UTC] danradigan at yahoo dot com
register globals is on.  The php.ini is the same one that came with the installer available at php.net.  We made no changes to it.
 [2001-07-24 20:43 UTC] rasmus@php.net
No bug here.  The default php.ini file has error_reporting set to E_ALL & ~E_NOTICE.  You have it set to E_ALL which is why you get the warning.
The proper way to code this is to use:

if(isset($QUERY_STRING)) ...

And no, $QUERY_STRING should not be set when there is no query string arguments in the URL.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Apr 20 01:01:28 2024 UTC