#43786 [Opn]: declare() should complain with invalid directive

From: Date: Tue, 08 Jan 2008 13:25:02 +0000
Subject: #43786 [Opn]: declare() should complain with invalid directive
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-121131@lists.php.net to get a copy of this message
ID: 43786 User updated by: zabmilenko at charter dot net Reported By: zabmilenko at charter dot net Status: Open Bug Type: Unknown/Other Function Operating System: Any PHP Version: 5.2.5 New Comment: I solved this by adding the following just before line 4705 of ZendEngine2/zend_compile.c (rev 1.796): // Raise a warning zend_error(E_COMPILE_WARNING, "Illegal directive [%s]", Z_STRVAL(var->u.constant)); It appears to work on my Debian Etch box, but I don't know if Z_STRVAL is 100% appropriate. Thanks and have a nice day. Previous Comments: ------------------------------------------------------------------------ [2008-01-08 12:36:29] zabmilenko at charter dot net Description: ------------ If you use a misspelled or unknown directive in a declare() statement, no error or warning is produced. To help in debugging, at least a warning should be raised if a directive is used that is not known to the php engine. Reproduce code: --------------- <?php declare(foobar="baz") { echo 'Hello, world'; } ?> Expected result: ---------------- Perhaps an error or warning stating that the declare directive is unknown or invalid. Actual result: -------------- Blocked up code executes like expected but nothing occurs with the declare() statement. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=43786&edit=1

« previous php.bugs (#121131) next »