Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:103131 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 90814 invoked from network); 5 Sep 2018 13:25:07 -0000 Received: from unknown (HELO xdebug.org) (82.113.146.227) by pb1.pair.com with SMTP; 5 Sep 2018 13:25:07 -0000 Received: from localhost (localhost [IPv6:::1]) by xdebug.org (Postfix) with ESMTPS id 7B02010C01D; Wed, 5 Sep 2018 10:27:56 +0100 (BST) Date: Wed, 5 Sep 2018 10:27:56 +0100 (BST) X-X-Sender: derick@singlemalt.home.derickrethans.nl To: Dmitry Stogov cc: PHP Developers Mailing List In-Reply-To: Message-ID: References: User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Subject: Re: Mysterious (to me) Xdebug issue with PHP 7.3 From: derick@php.net (Derick Rethans) Hi, in Xdebug, I do supply my own opcode handlers for quite a few opcodes, including ZEND_IS_EQUAL, and a whole bunch of others. Is it possible that when you use zend_set_user_opcode_handler[1][2] that this swap isn't done with zend_swap_operands? My opcode handler basically just does some code and then uses ZEND_VM_DISPATCH[3]. [1] https://github.com/derickr/xdebug/blob/PHP-7.3-support/xdebug_code_coverage.h#L47-L48 [2] https://github.com/derickr/xdebug/blob/PHP-7.3-support/xdebug.c#L781 [3] https://github.com/derickr/xdebug/blob/PHP-7.3-support/xdebug_code_coverage.c#L125-L142 cheers, Derick On Wed, 5 Sep 2018, Dmitry Stogov wrote: > Hi Derick, > > > The message "Invalid opcode 17/1/8" means that PHP doesn't have handler for opcode 17 (ZEND_IS_EQUAL) where first operand IS_CONST and second operand IS_CV. > > > ZEND_IS_EQUAL is a commutative operator. zend_vm_gen.php doesn't generate code for ZEND_IS_EQUAL_SPEC_CONST_CV_HANDLER, but PHP code-generator swaps operands, if necessary, to use ZEND_IS_EQUAL_SPEC_CV_CONST_HANDLER. > > > ZEND_API void ZEND_FASTCALL zend_vm_set_opcode_handler(zend_op* op) > { > zend_uchar opcode = zend_user_opcodes[op->opcode]; > uint32_t spec = zend_spec_handlers[opcode]; > > if (spec & SPEC_RULE_COMMUTATIVE) { > if (op->op1_type < op->op2_type) { > zend_swap_operands(op); > } > } > op->handler = zend_vm_get_opcode_handler_ex(spec, op); > } > > > I have no idea, why PHP with xdebug doen't swap operands. > > > Thanks. Dmitry. > > ________________________________ > From: Derick Rethans > Sent: Tuesday, September 4, 2018 7:26:49 PM > To: Dmitry Stogov > Cc: PHP Developers Mailing List > Subject: Mysterious (to me) Xdebug issue with PHP 7.3 > > Hi, > > I'm finalizing Xdebug support for PHP 7.3, and although I have fixed > many things, there is one thing that is (currently) eluding me. > > The branch I'm working on is > https://github.com/derickr/xdebug/tree/PHP-7.3-support > > With Xdebug (just) loaded, the following script: > > $ cat /tmp/bug01471.php > $c = "aa" == $ff ? 1 : 0; > ?> > > Fails to run with: > > $ php -n -dzend_extension=xdebug.so /tmp/bug01471.php > > Fatal error: Invalid opcode 17/1/8. in /tmp/bug01471.php on line 2 > > Call Stack: > 0.0002 0 1. {main}() /tmp/bug01471.php:0 > > I also see others, like when running with a Composer library: > > $ vendor/bin/phpunit --debug > > Fatal error: Invalid opcode 16/1/2. in /home/derick/dev/php/derickr-mongo-php-library/vendor/composer/autoload_real.php on line 18 > > Call Stack: > 0.0003 431424 1. {main}() /home/derick/dev/php/derickr-mongo-php-library/vendor/phpunit/phpunit/phpunit:0 > 0.0005 433616 2. require('/home/derick/dev/php/derickr-mongo-php-library/vendor/autoload.php') /home/derick/dev/php/derickr-mongo-php-library/vendor/phpunit/phpunit/phpunit:51 > 0.0008 450432 3. ComposerAutoloaderInit96731179a4aab6838b54de3a71995ee1::getLoader() /home/derick/dev/php/derickr-mongo-php-library/vendor/autoload.php:7 > > And I can't figure out why. The backtrace isn't particularly useful > either. I got similar issues with get_zval_ptr [1], as it changed, but I > can't track this specific one down. Would you mind having a look? > > cheers, > Derick > > [1] https://github.com/derickr/xdebug/commit/70d9189700d57707d842020493a3df23e0c76098 > -- > > > -- > https://derickrethans.nl | https://xdebug.org | https://dram.io > Like Xdebug? Consider a donation: https://xdebug.org/donate.php, > or become my Patron: https://www.patreon.com/derickr > twitter: @derickr and @xdebug > -- https://derickrethans.nl | https://xdebug.org | https://dram.io Like Xdebug? Consider a donation: https://xdebug.org/donate.php, or become my Patron: https://www.patreon.com/derickr twitter: @derickr and @xdebug