#50411 [NEW]: less important: global and static in global scope
| From: | dkr at mindwerk dot de | Date: | Tue, 08 Dec 2009 13:51:22 +0000 |
| Subject: | #50411 [NEW]: less important: global and static in global scope | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-145526@lists.php.net to get a copy of this message | ||
From: dkr at mindwerk dot de
Operating system: linux 2.6.21
PHP version: 5.2.11
PHP Bug Type: Scripting Engine problem
Bug description: less important: global and static in global scope
Description:
------------
Hi!
Either its some documentation problem or a error reporting problem, but
"static" and "global" can be used in the global scope, and this makes no
sense?
Or is it some kind of: make statics or globalize variables in a file
included in a function in another file? if so, close this bugreport and
eventually make some documentation for that... :)
thx and greets
Reproduce code:
---------------
<?php
error_reporting(E_ALL);
# The php doc says "A static variable exists only in a local function
scope"
# but this does not fail in any way:
static $test = 1;
echo("test for static successfull\n");
# As global does only makes sense within the function, this should fail
# also with some error or something:
global $test2;
echo("test2 for global successfull\n");
Expected result:
----------------
Any error message like "The keyword static|global is not allowed in global
scope"
Actual result:
--------------
test for static successfull
test2 for global successfull
--
Edit bug report at http://bugs.php.net/?id=50411&edit=1
--
Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=50411&r=trysnapshot52
Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=50411&r=trysnapshot53
Try a snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=50411&r=trysnapshot60
Fixed in SVN: http://bugs.php.net/fix.php?id=50411&r=fixed
Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=50411&r=needdocs
Fixed in release: http://bugs.php.net/fix.php?id=50411&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=50411&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=50411&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=50411&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=50411&r=support
Expected behavior: http://bugs.php.net/fix.php?id=50411&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=50411&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=50411&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=50411&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=50411&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=50411&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=50411&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=50411&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=50411&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=50411&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=50411&r=mysqlcfg