php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #29894 $_SERVER['PHP_SELF'] behaviour changed
Submitted: 2004-08-30 12:36 UTC Modified: 2004-08-30 13:08 UTC
From: jeanphilippe dot glomot at bnpparibas dot com Assigned:
Status: Not a bug Package: Scripting Engine problem
PHP Version: 4.3.8 OS: RedHat Linux
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: jeanphilippe dot glomot at bnpparibas dot com
New email:
PHP Version: OS:

 

 [2004-08-30 12:36 UTC] jeanphilippe dot glomot at bnpparibas dot com
Description:
------------
I have upgraded PHP on Linux from 4.3.1 to 4.3.8 versions (the configuration remains the same)

The following script ...
echo "php_self is $_SERVER['PHP_SELF']"; 
... was OK in 4.3.1

I got this error in 4.3.8 ...
Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING 

It seems that $_SERVER['PHP_SELF'] has changed is type (?).
If you try this code ...
   $code = '$_SERVER[\'PHP_SELF\']';
   foreach(token_get_all($code) as $c)
   {
       if(is_array($c))
       {
           print(token_name($c[0]) . ": '" . htmlentities($c[1]) . "'\n");
       }
       else
       {
           print("$c\n");
       }
   }

In 4.3.1, you get ...
T_INLINE_HTML: '$_SERVER['PHP_SELF']'

With 4.3.8, you get ...
T_VARIABLE: '$_SERVER'
[
T_CONSTANT_ENCAPSED_STRING: ''PHP_SELF''
]

Any idea ?

Reproduce code:
---------------
# very (too much ?) simple ...
echo "php_self is $_SERVER['PHP_SELF']"; 

Expected result:
----------------
php_self is /something/file.php

Actual result:
--------------
Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING 


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-08-30 13:08 UTC] derick@php.net
Sorry, but 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 http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions. 

Thank you for your interest in PHP.

.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Thu Jul 17 02:01:33 2025 UTC