ID: 21006
User updated by: [EMAIL PROTECTED]
Reported By: [EMAIL PROTECTED]
Status: Bogus
Bug Type: IIS related
-Operating System: win 200 server
+Operating System: win 2000 server
PHP Version: 4.3.0RC3
New Comment:
I use bbedit, i am pretty sure it is rock solid editor, not
sure where the weird character is coming from, probably
golive which i use sometimes, but that is a side issue.
It was only in release candidate 2. Submitting the bug was
a mistake since it works in RC3, therefore i marked it
bogus--i did not shift refresh and was accessing a cached
page and also had an extended character after the $ on that
test.
I did a function, basically same as yours and it gave
error. I then deleted what made it a function, and it
worked, nothing else changed except code going through
function. I did this multiple times just adding in the
function part. Then i saw RC3 was up (as i could not select
RC2) so i installed it and did the same test again right
before submitting bug. I tested it quickly as i double
checked as posting. After posting I saw the "weird"
character, a "diamond" and looked at it again. It wasn't
until a shift refresh that it started working so i marked
it bogus.
The unexpected T_VARIABLE shows up when i use a undefined
variable, like the $_SERVER 'query' one, it errors when
there is no ?whatever=foo in the query but works fine
otherwise which made me do the isset(). This also happened
in my functions. The weird character gives another error
but i can't remember, but i have run into it a few times
and it is easy to fix with a zap gremlins. (At least that
has been what happens in my trial and error approach)
Using beta versions is prone to errors by it's nature, it
seems like it is an issue that basically was corrected on
its own. I can also say all the code i was trying to use as
it was also started working with RC3. I really can't
beleive how error free the release candidates are, or how
fast development is going. I can see PHP being the standard
within 5 years if this is kept up.
Previous Comments:
[2002-12-14 12:17:28] [EMAIL PROTECTED]
Some thoughts:
a) That error has nothing to do with undefined or "non global"
variables. It's a parse error.
b) Variables are case sensitive, never write $_Server it's ALWAYS
$_SERVER
c) A weird character?
I really don't think this was ever an error in PHP and has to do with
your code only, PHP won't put weird characters in your code. I blame
your text editor. Try this test:
What text editor do you use to write code?
[2002-12-14 01:49:43] [EMAIL PROTECTED]
RC3 seems to have fixed it weird character ahowing up in
front of $
[2002-12-14 01:26:40] [EMAIL PROTECTED]
On my IIS Server, now running 4.3.0RC3 ( i just installed
and tested it, started writing issue with RC2),
$_Server variables are not global, they don't work inside
functions
specifically $agent = $_SERVER["HTTP_USER_AGENT"];
I hear that *nix machines do not have this issue.
The following does not work, there is no variable set for
the user agent and i get an error.
Parse error: parse error, unexpected T_VARIABLE in c:\
inetpub\wwwroot\admin\index.php on line 26
PHP Parse error: parse error, unexpected T_VARIABLE in c:\
inetpub\wwwroot\admin\index.php on line 26
Basically the variable is not set.
This does work outside the function however
(i coded this to explain issue more simply,
originally got help at
http://www.webmasterworld.com/forum13/1766.htm
which has more specific details, example code and the like)
$_SERVER["HTTP_USER_AGENT"]; is global in scope but is not
accessable in my installation inside a function.
I now use define to pass variable down to my function and
avoid any more issues personally.
I have a feeling it has to do with my using release
candidate 2 but do not wish to test with previous versions
of php at this time.
This seems like an IIS quirk as the forum moderator seemed
not to have this issue and agreed $_SERVER variables are
global in scope, as is my understanding from was what i
read in the manual.
info from my phpinfo()
PHP Version 4.3.0RC2
System Windows NT localhost 5.0 build 2195
Build Date Nov 27 2002 21:11:38
Server API CGI/FastCGI
register globals is also on for the time being, (seems like
this is always asked)
--
Edit this bug report at http://bugs.php.net/?id=21006&edit=1