Permalink
Browse files

Return false for instanceof on literal

  • Loading branch information...
nikic committed Dec 19, 2017
1 parent fc46c4b commit b6131364f95af68159b1c17ab48f9523e439cb65
Showing with 14 additions and 13 deletions.
  1. +0 −11 Zend/tests/errmsg_041.phpt
  2. +10 −0 Zend/tests/instanceof_const.phpt
  3. +4 −2 Zend/zend_compile.c

This file was deleted.

Oops, something went wrong.
@@ -0,0 +1,10 @@
--TEST--
Instanceof on literals returns false
--FILE--
<?php
var_dump("abc" instanceof stdclass);
?>
--EXPECT--
bool(false)
@@ -7463,8 +7463,10 @@ void zend_compile_instanceof(znode *result, zend_ast *ast) /* {{{ */
zend_compile_expr(&obj_node, obj_ast);
if (obj_node.op_type == IS_CONST) {
zend_error_noreturn(E_COMPILE_ERROR,
"instanceof expects an object instance, constant given");
zend_do_free(&obj_node);
result->op_type = IS_CONST;
ZVAL_FALSE(&result->u.constant);
return;
}
zend_compile_class_ref_ex(&class_node, class_ast,

0 comments on commit b613136

Please sign in to comment.