Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:96786 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 39341 invoked from network); 9 Nov 2016 14:48:13 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 9 Nov 2016 14:48:13 -0000 Authentication-Results: pb1.pair.com smtp.mail=cmbecker69@gmx.de; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=cmbecker69@gmx.de; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmx.de designates 212.227.17.20 as permitted sender) X-PHP-List-Original-Sender: cmbecker69@gmx.de X-Host-Fingerprint: 212.227.17.20 mout.gmx.net Received: from [212.227.17.20] ([212.227.17.20:56072] helo=mout.gmx.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id E6/92-15787-92733285 for ; Wed, 09 Nov 2016 09:48:11 -0500 Received: from [192.168.2.103] ([79.243.119.150]) by mail.gmx.com (mrgmx102) with ESMTPSA (Nemesis) id 0LeSOH-1ccOkB0pSf-00q7n8; Wed, 09 Nov 2016 15:48:02 +0100 To: Derick Rethans , PHP Developers Mailing List References: Cc: Dmitry Stogov , Nikita Popov Message-ID: Date: Wed, 9 Nov 2016 15:48:03 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K0:vEkALeKxMjkor+SFKO739Sz3pfbUACiSdYkhqyUUiUINnXrUMUU ztd5HFDRHFJ9ksbu3qUXZs3VPF/591LVCfwlmCHd64bbq1UA8ilOLLuydkMtxbnwrSlPzF9 a+Ag3uUbEszEWLzbnPVVadhBqd4T5ulRRefEajqSN0dtjf6AgjukOZjWTXuRbNOHAt+PKbA ctcOanPO6/ZPO6exTVemA== X-UI-Out-Filterresults: notjunk:1;V01:K0:3S4ly7bIgWQ=:TpBqUBVTqfDfB2Ey7NvG3L LMnPTWytdni9dmjtweDBUk3fyvlwdZwzTeEO2nTcnxh/bhUUtfo5/d9+DuODGu0uH9tVSaI5z EGA0ZQYKAq1kXXyDdwMtq3R4LseKJoGR5A2CVn1ZA8p0dBr7bENRhjJ3goGiTk/8RgrB0EoU4 h1kxXJIkPh540VWt7AX6rNb5AYAOG+1oTp1ZgBJ5H30WzvOza0sV8/dOSubPHo+Bg7qkdlZHe IQdpzYLK/KyHSTu46VXR8cBVF2VGCK4pgErxMujHBfM2qp7iW4cI9Ezj5FkiPkINyrGr4kud6 x9wgP6/rf4ya8pLrwZ7IjXOftl3Bv8OIrjn+mn6OJm/xTZQKPlvUOGtpZ438/CJRtgA0ZqLvJ vAzJa95pxDiuZ4FWOwR6XIACY9MX9fE453Vn6CXo6CDsHBXZmfRLKwdFtTdZoQNq/UBUNT1ZE ZxALrGMOLyeU6owwC1r9oXLhM+4CYxLhb0i2MsxKkIDbnWNvSMjwyEv3pWHWxLU6fYEWTeYRy bMZRpikRS9AO4g9zPHxvfSp4rgFTmf2jUgvvqpxCacSgkyk11IH71PhgYACL5+aRCpAf31obp v7GnS/+9ae6NFvaTVD8To/AcHFZpvATmsRZ5rMgLBdQ+hTWt9sibgLU1LNkwRlKrOAjZAbpn8 0esHefl0esqhbgA7I8miv3kKae5CEfrs3xCujQ6korsLP+jFd9eH0ve6XVCjenC2kknZookQw 8bqF13fZIhoGCxlt6YLwCXCkt2QKbI456FmriyZXrd1+vLG8YDwMhQ7C/qurJkUr47AVq0Nme KjFhxlj Subject: Re: PHP 5.6 static access valgrind issue From: cmbecker69@gmx.de ("Christoph M. Becker") Hi Derick! On 09.11.2016 at 15:21, Derick Rethans wrote: > Hi! > > Through https://bugs.xdebug.org/view.php?id=1185 I ran into a bug in PHP > proper. Apparently, this script: > > > class A { > static private $a; > > static public function init() { > self::$a = 123; > } > } > > A::init(); > > echo 'succcess!'; > > And running it with "valgrind php -n index.php", produces: > > root@debian-8-64bit:/home/derick/xdebug-issue-1185# valgrind php -n index.php > ==760== Memcheck, a memory error detector > ==760== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al. > ==760== Using Valgrind-3.10.0 and LibVEX; rerun with -h for copyright info > ==760== Command: php -n index.php > ==760== > ==760== Conditional jump or move depends on uninitialised value(s) > ==760== at 0x797992: zend_std_get_static_method (zend_object_handlers.c:1261) > ==760== by 0x7B66FE: ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_CONST_HANDLER (zend_vm_execute.h:3887) > ==760== by 0x7A379F: execute_ex (zend_vm_execute.h:363) > ==760== by 0x76E2AF: zend_execute_scripts (zend.c:1341) > ==760== by 0x70CC87: php_execute_script (main.c:2613) > ==760== by 0x81A990: do_cli (php_cli.c:998) > ==760== by 0x431996: main (php_cli.c:1382) > ==760== > succcess!==760== > ==760== HEAP SUMMARY: > ==760== in use at exit: 96 bytes in 3 blocks > ==760== total heap usage: 19,605 allocs, 19,602 frees, 3,589,979 bytes allocated > ==760== > ==760== LEAK SUMMARY: > ==760== definitely lost: 0 bytes in 0 blocks > ==760== indirectly lost: 0 bytes in 0 blocks > ==760== possibly lost: 0 bytes in 0 blocks > ==760== still reachable: 96 bytes in 3 blocks > ==760== suppressed: 0 bytes in 0 blocks > ==760== Rerun with --leak-check=full to see details of leaked memory > ==760== > ==760== For counts of detected and suppressed errors, rerun with: -v > ==760== Use --track-origins=yes to see where uninitialised values come from > ==760== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0) > > This is with the latest PHP-5.6 branch, and the GCC that comes with > Debian Jessie: > > root@debian-8-64bit:/home/derick/xdebug-issue-1185# gcc --version > gcc (Debian 4.9.2-10) 4.9.2 > > > Annoyingly, I can only produce this on a Debian Jessie (8.6) fresh install, and > not on my local machine. I can't seem to find the problem either, but I *can* > provide a VM and instructions to reproduce this. Or provide SSH access > into it upon request. > > Anybody wants to try and fix this? I'm going to see whether PHP 7.0 and > 7.1 have a similar issue too. zend_std_get_static_method() declares use_heap[1] (if there's support for alloca), but doesn't initialize it with SET_ALLOCA_FLAG()[2]. It seems to me that ALLOCA_FLAG()[3] should be defined like so: # define ALLOCA_FLAG(name) \ zend_bool name = 0; [1] [2] [3] -- Christoph M. Becker