|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2009-09-29 16:34 UTC] patrickdk at patrickdk dot com
Description: ------------ the global modifier causes http 500 errors but doesn't produce any syntax errors or other messages when used incorrectly. It's behavure isn't documented and is described next to static that works differently. Reproduce code: --------------- <?php global $test=true; Expected result: ---------------- It should give a syntax error, and manual should be updates to explain assigning a value on the global declaration isn't valid, unlike with static. Actual result: -------------- php-cgi test.php Status: 500 Internal Server Error X-Powered-By: PHP/5.2.11 Content-type: text/html PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2026 The PHP GroupAll rights reserved. |
Last updated: Fri Feb 20 02:00:01 2026 UTC |
I dunno what you mean by 'all parse problems'. I turned on as much debugging info as I can, have all warnings/notify also logged. I saw normal errors like syntax/unused vars/... in the logs, but never anything about that global line. I used the test code: <?php global $test=true; To figure out what was wrong. I also used this to see if it made a difference: <?php function testing() { global $test=true; } And it didn't, both fail without any warning/error/message.