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:

That makes sense.  Would E_STRICT be appropriate in place of
E_COMPILE_WARNING then?


Previous Comments:
------------------------------------------------------------------------

[2008-01-08 17:53:33] [EMAIL PROTECTED]

I think it's intentional. It at lest helps with PHP 6 compatibility
:-)

declare(encoding="iso-8859-1");

and such work in PHP 5 and PHP 6 - meaning that PHP 5 ignores it and
PHP 6 uses that encoding while parsing the file.

------------------------------------------------------------------------

[2008-01-08 13:25:01] zabmilenko at charter dot net

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.

------------------------------------------------------------------------

[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

Reply via email to