Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:102029 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 15558 invoked from network); 12 Apr 2018 19:52:53 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 12 Apr 2018 19:52:53 -0000 Authentication-Results: pb1.pair.com header.from=HMWiesinger@liwjatan.at; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=HMWiesinger@liwjatan.at; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain liwjatan.at designates 81.19.149.137 as permitted sender) X-PHP-List-Original-Sender: HMWiesinger@liwjatan.at X-Host-Fingerprint: 81.19.149.137 mx27lb.world4you.com Received: from [81.19.149.137] ([81.19.149.137:36132] helo=mx27lb.world4you.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 72/E7-36099-319BFCA5 for ; Thu, 12 Apr 2018 15:52:52 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=liwjatan.at; s=dkim11; h=Content-Type:MIME-Version:Message-ID:Date:Subject:To:From; bh=du1FnYyR3SwEcIIaYe16n47DfINqzd6KkVPAnrnuzik=; b=R3k3tFNfu+S5ALng9jNHb14UI1p9cvQ1pzlC2eAlxv9IROvDpjqTxH1p6X4omoQJxTRvZmeA7rRJCAofBKfvhPbN7Q9eWK5sPqFO+UKzKjcktAB+3m5cz+IoYviKuTn2CWrG4x8y6iQHKj/xqi3EK4K49oWEvD9cdBGhoDo3BJI=; Received: from [89.98.171.157] (helo=titania.liwjatan.org) by mx27lb.world4you.com with esmtpsa (TLSv1:DHE-RSA-AES256-SHA:256) (Exim 4.84_2) (envelope-from ) id 1f6iH2-0004eI-9i for internals@lists.php.net; Thu, 12 Apr 2018 21:52:48 +0200 To: internals Date: Thu, 12 Apr 2018 21:53:40 +0200 Message-ID: <1695946.AXCnACv0zz@titania.liwjatan.org> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="nextPart2830861.13N9sxtV7R"; micalg="pgp-sha256"; protocol="application/pgp-signature" X-SA-Do-Not-Run: Yes X-AV-Do-Run: Yes X-SA-Exim-Connect-IP: 89.98.171.157 X-SA-Exim-Mail-From: HMWiesinger@liwjatan.at X-SA-Exim-Scanned: No (on mx27lb.world4you.com); SAEximRunCond expanded to false Subject: Request-global hashtable initialization From: HMWiesinger@liwjatan.at (Heinz Wiesinger) --nextPart2830861.13N9sxtV7R Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Hi everyone! I ventured into writing my first PHP extension and did pretty well so far following the existing documentation and example code inside the php source. However, I hit an odd bug in my code that I can't quite explain. I'm obviously missing something and I hope someone here can point me in the right direction :) I'd like to set up a request global hashtable. For now I'm running ALLOC_HASHTABLE() and zend_hash_init() inside PHP_GINIT_FUNCTION. I then have a user function that's supposed to add entries to that hashtable and another user function that reads entries from the hashtable. I tested with code passed directly on the command line (using php -r) and that works just like I would expect it too. The value gets written to the hashtable and I can read it afterwards from the other function. I also verified it's the same value that I first stored, so from what I can tell the basic functionality is good. When I take the same testcode and write it into a file, and then run php on that file, execution aborts trying to allocate almost 2GB of memory when trying to store the value in the hashtable (using zend_hash_update()). I can see PHP_GINIT_FUNCTION being executed in that case as well so I'd assume the hashtable is setup just fine. Yet something is different. What's the difference between " php -r '' " and "php test.php" in that regard? I uploaded my current state of the extension to github in case someone would like to take a closer look at the code: https://github.com/pprkut/autoload-psr Thanks in advance! Grs, Heinz --nextPart2830861.13N9sxtV7R Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part. Content-Transfer-Encoding: 7Bit -----BEGIN PGP SIGNATURE----- iHUEABEIAB0WIQQRpqSSOxrcqQ33x62nXtwz5SpGygUCWs+5RAAKCRCnXtwz5SpG yirQAP9N7VKuxQ0SOwBsZUJACCE1597BuTvh8/Qd4igIzby2KQD/YHrYFGIseFQk Uy9RMWXnLPgwtrvdP2FC5aYpgdcTbDM= =4xNp -----END PGP SIGNATURE----- --nextPart2830861.13N9sxtV7R--