Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:100988 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 29682 invoked from network); 30 Oct 2017 07:55:57 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 30 Oct 2017 07:55:57 -0000 Authentication-Results: pb1.pair.com header.from=dmitry@zend.com; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=dmitry@zend.com; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain zend.com from 104.47.33.106 cause and error) X-PHP-List-Original-Sender: dmitry@zend.com X-Host-Fingerprint: 104.47.33.106 mail-bn3nam01on0106.outbound.protection.outlook.com Received: from [104.47.33.106] ([104.47.33.106:57248] helo=NAM01-BN3-obe.outbound.protection.outlook.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 6F/44-07742-70BD6F95 for ; Mon, 30 Oct 2017 02:55:52 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=RWSoftware.onmicrosoft.com; s=selector1-zend-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=kQzRcDZaXaMFnnOqYdn9Xo5rmFjERwTow4RV7J75QZI=; b=dO18Y3lUQDh4YsT3idFLx1gvE2tLHIAaczVm+c0jkRdYuZ4CqvkE5lxciOh2V9U71kR94DhZLUAMZMjZhh1GNalU6tOHP9iZES7aqX05MeGA2ehlKKw67yv/7rhFv1YU1CEPSoU+DVwWVeng1xhSs0TaVJ9Q4nYJ5gfDG6CrNaI= Received: from BN6PR02MB3234.namprd02.prod.outlook.com (10.161.152.32) by BN6PR02MB3234.namprd02.prod.outlook.com (10.161.152.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.156.4; Mon, 30 Oct 2017 07:55:47 +0000 Received: from BN6PR02MB3234.namprd02.prod.outlook.com ([10.161.152.32]) by BN6PR02MB3234.namprd02.prod.outlook.com ([10.161.152.32]) with mapi id 15.20.0156.006; Mon, 30 Oct 2017 07:55:47 +0000 To: Xinchen Hui , Derick Rethans CC: Nikita Popov , PHP Developers Mailing List Thread-Topic: [PHP-DEV] Weird PHP 7.2 bug Thread-Index: AQHTUOZ5BPlzp2K/bEaMygoH9hvrbqL7+SQAgAAMbS0= Date: Mon, 30 Oct 2017 07:55:46 +0000 Message-ID: References: , In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=dmitry@zend.com; x-originating-ip: [213.21.45.232] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;BN6PR02MB3234;6:aqYul36rfVOp7U1kHMV4FraJkmEH2tWsiHvWOZE0e0V0xPDFBwO78sFEovPo6iJtRLrySfU82j3yD0IpHTTiLHubbhXV6Z3mT5vex59Z2d8NwCgzAvhKloIP+i+a3MpfWSzbflejid6Kz8Mktz6QKNRz33yKpDighR3lKSMYjzLg6puqeJ5OiYRZtPE6Vbv78zJ22U2aKHnibMhR17PvZkYWs5rgs7TnCL+0Z04eF3YqKLb61CDLs6kNvuiM/rNIfgweW/0tUa53Q1ELKBkyYTVVYvhubkn4Pcbr+RL+aLcAg9Sp4iOfOY+dqU5g13t1YCxyRD2Je5uJz6LY7oywiw==;5:kKOaQR2qufHRaUQ0idu5zcFYVkp5pS/VXjabSLkdKI8cn6PK5fjAm/uLZ8oaYC3jaYs4QTLd6cYa/VLpslsJnDJD7fIgncItj81UWjIVmljT5AQ/FSUWCUuVO3WtCGo3DHddxX+DEz1e0xcEQ4RHLg==;24:KXU2KMU0RdZMmknEbcosmq3U4NXmnjPI3LCckzMETokBRNTOSYp0u5CWt40tcThBxhqViUR87/8v1xak4vdOdrNNNGJUAG1zIrm8omsoQcA=;7:+BwhLCbp3OdieN9RdPkAniHcFlXqFKLugpAXtXlP8bV2kZvOpQLgay3XuHrvGAwyrMj+B9ybotGKXYBBPmfH8E1vY/gFUL2bdo+oYagw50CIVC8TUQD13w00WHsgI9PFLUD83axY3FrTpEHNHQctLhYbIIcVA8imY0OxnsI4XvV2816hJdCPOufckB2n7O3JMuDPPdVF3YfX8hJXV94HyQjq39bUXbSZXw/i+90o5ig= x-ms-exchange-antispam-srfa-diagnostics: SSOS; x-ms-office365-filtering-correlation-id: 53cc2f04-215e-40e8-5c69-08d51f6ba15b x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001)(4534020)(4602075)(2017052603199);SRVR:BN6PR02MB3234; x-ms-traffictypediagnostic: BN6PR02MB3234: x-exchange-antispam-report-test: UriScan:(148322886591682)(23657631684272)(166708455590820)(275740015457677)(192278398808882); x-microsoft-antispam-prvs: x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(2401047)(5005006)(8121501046)(3002001)(10201501046)(3231020)(93006095)(93001095)(100000703101)(100105400095)(6041248)(20161123564025)(20161123562025)(20161123555025)(20161123558100)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123560025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095);SRVR:BN6PR02MB3234;BCL:0;PCL:0;RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095);SRVR:BN6PR02MB3234; x-forefront-prvs: 0476D4AB88 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(39830400002)(376002)(346002)(189002)(52314003)(76104003)(24454002)(199003)(16799955002)(6116002)(3846002)(102836003)(74316002)(7696004)(8936002)(19627405001)(5660300001)(229853002)(478600001)(86362001)(68736007)(9686003)(81166006)(606006)(15188155005)(6306002)(110136005)(16410355002)(99286003)(25786009)(53546010)(4326008)(2906002)(77096006)(55016002)(2950100002)(66066001)(54906003)(316002)(189998001)(53936002)(54356999)(50986999)(39060400002)(3280700002)(966005)(3660700001)(106356001)(236005)(54896002)(2900100001)(14454004)(101416001)(97736004)(8676002)(6246003)(76176999)(6436002)(33656002)(16297215004)(81156014)(6506006)(7736002)(105586002);DIR:OUT;SFP:1102;SCL:1;SRVR:BN6PR02MB3234;H:BN6PR02MB3234.namprd02.prod.outlook.com;FPR:;SPF:None;PTR:InfoNoRecords;MX:1;A:1;LANG:en; received-spf: None (protection.outlook.com: zend.com does not designate permitted sender hosts) spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: multipart/alternative; boundary="_000_BN6PR02MB32342919931413B4F1E17A1CBF590BN6PR02MB3234namp_" MIME-Version: 1.0 X-OriginatorOrg: zend.com X-MS-Exchange-CrossTenant-Network-Message-Id: 53cc2f04-215e-40e8-5c69-08d51f6ba15b X-MS-Exchange-CrossTenant-originalarrivaltime: 30 Oct 2017 07:55:46.9999 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 32210298-c08b-4829-8097-6b12c025a892 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR02MB3234 Subject: Re: [PHP-DEV] Weird PHP 7.2 bug From: dmitry@zend.com (Dmitry Stogov) --_000_BN6PR02MB32342919931413B4F1E17A1CBF590BN6PR02MB3234namp_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Fixed. thanks. for catching. The real problem - incorrect handling of "wrong index type. In this situation PHP should keep input array unchanged. Inferring types "by usage" makes sense (for array) e.g. $a[$n]++ should change the type of array. Thanks. Dmitry. ________________________________ From: Xinchen Hui Sent: Monday, October 30, 2017 10:05:30 AM To: Derick Rethans Cc: Dmitry Stogov; Nikita Popov; PHP Developers Mailing List Subject: Re: [PHP-DEV] Weird PHP 7.2 bug 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=3Dopcache.so -dopcache.enable_cli=3D1 tests/bug01= 263.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 $u= ncoveredFiles are IS_UNDEF for sure(thus the foreach block actually won't b= e executed), then in typeinfo inference system, we will get $uncoveredFile with type inf= o 0. then later while doing type inference for ZEND_FETCH_W ($data[$uncoveredFil= e][$i] =3D ), 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_ARR= AY_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 tru= st def info, not use info... so, I propose fix this by: https://gist.github.com/laruence/9990ce5f9f3b30d= d98dbff4f59109232 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/ --_000_BN6PR02MB32342919931413B4F1E17A1CBF590BN6PR02MB3234namp_--