Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:7876 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 7572 invoked by uid 1010); 16 Feb 2004 15:00:18 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 7528 invoked from network); 16 Feb 2004 15:00:17 -0000 Received: from unknown (HELO jan.prima.de) (62.72.86.57) by pb1.pair.com with SMTP; 16 Feb 2004 15:00:17 -0000 Received: from [10.0.1.2] (pD9E13042.dip.t-dialin.net [::ffff:217.225.48.66]) (AUTH: LOGIN jan) by jan.prima.de with esmtp; Mon, 16 Feb 2004 15:00:13 +0000 Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=_jan.prima.de-37723-1076943614-0001-2" To: PHP Developers Mailing List Message-ID: Date: Mon, 16 Feb 2004 15:59:53 +0100 X-Mailer: Apple Mail (2.612) Subject: instanceof has higher precedence than casts From: jan@php.net (Jan Lehnardt) --=_jan.prima.de-37723-1076943614-0001-2 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Hi, some dude on IRC found out that php -r 'var_export((object)1 instanceof stdClass);'; results in class stdClass { public $scalar = false; } IMHO it should just return true. The ZEND_ENGINE file doesn't state anything about the precedence of instanceof. The fix is pretty simple and a patch to zend_language_parser.y is attached. make test runs through fine, so I guess it doesn't brake anything else, but I can't tell for sure of course. It would be great if someone could look into this. Best regards, Jan -- GPG Key: BB96 56B0 Q: Thank Jan? - A: http://geschenke.an.dasmoped.net/ --=_jan.prima.de-37723-1076943614-0001-2 Content-Type: text/plain; x-unix-mode=0644; name="zend_language_scanner.y.patch.txt"; charset=iso-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=zend_language_scanner.y.patch.txt Index: zend_language_parser.y =================================================================== RCS file: /repository/ZendEngine2/zend_language_parser.y,v retrieving revision 1.138 diff -u -r1.138 zend_language_parser.y --- zend_language_parser.y 11 Feb 2004 22:13:39 -0000 1.138 +++ zend_language_parser.y 16 Feb 2004 14:51:33 -0000 @@ -67,9 +67,10 @@ %left T_SL T_SR %left '+' '-' '.' %left '*' '/' '%' +%nonassoc T_INSTANCEOF %right '!' '~' T_INC T_DEC T_INT_CAST T_DOUBLE_CAST T_STRING_CAST T_ARRAY_CAST T_OBJECT_CAST T_BOOL_CAST T_UNSET_CAST '@' %right '[' -%nonassoc T_NEW T_INSTANCEOF T_CLONE +%nonassoc T_NEW T_CLONE %token T_EXIT %token T_IF %left T_ELSEIF --=_jan.prima.de-37723-1076943614-0001-2--