From: Johannes Schlüter Date: Thu, 28 Aug 2014 23:34:46 +0000 (+0200) Subject: Fix comparison in case of constant NULL as default value X-Git-Tag: PRE_PHP7_REMOVALS~208 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=659270634039cadbd877b6c9c5ad36bb81950654;p=php Fix comparison in case of constant NULL as default value Fixes "Fatal error: Default value for parameters with a class type hint can only be NULL in ext/phar/phar.php on line 1120" whie creating phar.phar --- diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index ed95d7eb62..63ca671d93 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -5293,7 +5293,7 @@ void zend_compile_params(zend_ast *ast TSRMLS_DC) { zend_bool has_null_default = default_ast && (Z_TYPE(default_node.u.constant) == IS_NULL || (Z_TYPE(default_node.u.constant) == IS_CONSTANT - && strcasecmp(Z_STRVAL(default_node.u.constant), "NULL")) + && strcasecmp(Z_STRVAL(default_node.u.constant), "NULL") == 0) || Z_TYPE(default_node.u.constant) == IS_CONSTANT_AST); // ??? op_array->fn_flags |= ZEND_ACC_HAS_TYPE_HINTS;