Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:100987 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 26355 invoked from network); 30 Oct 2017 07:06:00 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 30 Oct 2017 07:06:00 -0000 Authentication-Results: pb1.pair.com header.from=laruence@php.net; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=xinchen.h@zend.com; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain zend.com from 209.85.216.177 cause and error) X-PHP-List-Original-Sender: xinchen.h@zend.com X-Host-Fingerprint: 209.85.216.177 mail-qt0-f177.google.com Received: from [209.85.216.177] ([209.85.216.177:51502] helo=mail-qt0-f177.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 82/C3-07742-35FC6F95 for ; Mon, 30 Oct 2017 02:05:56 -0500 Received: by mail-qt0-f177.google.com with SMTP id h4so15129378qtk.8 for ; Mon, 30 Oct 2017 00:05:55 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=dcyIz7KkCy3DyRnIzRlcuSNC3uSuM5dBbMe239pAJgE=; b=qjQ0P0xEwgbc4SQDZAehP4mWwiNhhw7GXBRZvuUxh+4036ybyR5VPixH3TLFDL1/Ya OTJEbpIbzGEcVjT2HBmfoSL7lfya2sRTzpDBFnWS+z4jkJ47G4tRSHOj4g8xnVaNUICn GcuJRzAX8x/oVx4h0pcJu9sUqPWkENIXEEETQGA5aSzXtHGFI8oNJ7H1VIWpKqfqXTCh 18Td0CszV2WbXAwBd65X0rNXL05pOttMr9zSl1IbdOvBlt3kKIQjTybG7gzXHS69R+Dl 3sJMhBRAY6DIGnzWisBcG8ZuxgY4SFwXM9K8PZk8GftlV3MdwjW3gxMeEOlDnAGfAfIv t8Ug== X-Gm-Message-State: AMCzsaVxz8w6rxID/J7gin4hNp9VW2nmrSnZ5nfMcdPX+XEJqJQo1/3o li05zzRa7qkn1ZJA0NTh5Tod0Oq+ X-Google-Smtp-Source: ABhQp+TOLcVg4R2gvqWW8kVHQt95F1ghzU5+t/+3FFQwMbsiiVzV3aXpT0hyQAyHEb298PkWLTzdbw== X-Received: by 10.237.37.8 with SMTP id v8mr13058634qtc.275.1509347153480; Mon, 30 Oct 2017 00:05:53 -0700 (PDT) Received: from mail-qk0-f174.google.com (mail-qk0-f174.google.com. [209.85.220.174]) by smtp.gmail.com with ESMTPSA id v21sm9729608qtv.21.2017.10.30.00.05.51 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 30 Oct 2017 00:05:52 -0700 (PDT) Received: by mail-qk0-f174.google.com with SMTP id b15so14905251qkg.9 for ; Mon, 30 Oct 2017 00:05:51 -0700 (PDT) X-Received: by 10.55.162.198 with SMTP id l189mr11887360qke.168.1509347151097; Mon, 30 Oct 2017 00:05:51 -0700 (PDT) MIME-Version: 1.0 Received: by 10.12.167.154 with HTTP; Mon, 30 Oct 2017 00:05:30 -0700 (PDT) In-Reply-To: References: Date: Mon, 30 Oct 2017 15:05:30 +0800 X-Gmail-Original-Message-ID: Message-ID: To: Derick Rethans Cc: Dmitry Stogov , Nikita Popov , PHP Developers Mailing List Content-Type: multipart/alternative; boundary="001a114d6dbcc8b572055cbe44e7" Subject: Re: [PHP-DEV] Weird PHP 7.2 bug From: laruence@php.net (Xinchen Hui) --001a114d6dbcc8b572055cbe44e7 Content-Type: text/plain; charset="UTF-8" Hey: On Mon, Oct 30, 2017 at 2:48 AM, Derick Rethans wrote: > Hi, > > running: > https://raw.githubusercontent.com/xdebug/xdebug/master/tests/bug01263.inc > > with: > $ php -n -dzend_extension=opcache.so -dopcache.enable_cli=1 > tests/bug01263.inc > > Produces the following output with PHP 7.2 build at Oct 29 2017 18:49:58: > > In function PHP_CodeCoverage::addUncoveredFilesFromWhitelist (after sccp): > var 10 (CV $data) has array value type but not key type > var 15 (CV $data) has array value type but not key type > var 21 (CV $data) has array value type but not key type > > In function PHP_CodeCoverage::addUncoveredFilesFromWhitelist (after > calls): > var 10 (CV $data) has array value type but not key type > var 15 (CV $data) has array value type but not key type > var 21 (CV $data) has array value type but not key type > > In function PHP_CodeCoverage::addUncoveredFilesFromWhitelist (after dce): > var 10 (CV $data) has array value type but not key type > var 15 (CV $data) has array value type but not key type > var 21 (CV $data) has array value type but not key type > > In function PHP_CodeCoverage::addUncoveredFilesFromWhitelist (after dfa): > var 10 (CV $data) has array value type but not key type > var 15 (CV $data) has array value type but not key type > var 21 (CV $data) has array value type but not key type > First, this won't bring any harm to execution, this is becuase we know $uncoveredFiles are IS_UNDEF for sure(thus the foreach block actually won't be executed), then in typeinfo inference system, we will get $uncoveredFile with type info 0. then later while doing type inference for ZEND_FETCH_W ($data[$uncoveredFile][$i] = ), since $unconveredFile has 0 type info, thus we won't get any key info of the array ($data), but in the current type inference system, FETCH_W's result will be used in ASSIGN_DIM , then the system think $data maybe an array of array(MAY_BE_ARRAY_OF_ARRAY). which result: has array value type but not key type anyway, I think infer type infos by usage is wrong here, we should only trust def info, not use info... so, I propose fix this by: https://gist.github.com/laruence/9990ce5f9f3b30dd98dbff4f59109232 Dmitry, what do you think? thanks > > > cheers, > Derick > > -- > https://derickrethans.nl | https://xdebug.org | https://dram.io > Like Xdebug? Consider a donation: https://xdebug.org/donate.php > twitter: @derickr and @xdebug > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > -- Xinchen Hui @Laruence http://www.laruence.com/ --001a114d6dbcc8b572055cbe44e7--