Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:111925 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 23743 invoked from network); 23 Sep 2020 07:48:17 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 23 Sep 2020 07:48:17 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 286BA1804E3 for ; Tue, 22 Sep 2020 23:58:23 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from mail-ej1-f52.google.com (mail-ej1-f52.google.com [209.85.218.52]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Tue, 22 Sep 2020 23:58:22 -0700 (PDT) Received: by mail-ej1-f52.google.com with SMTP id u21so26292439eja.2 for ; Tue, 22 Sep 2020 23:58:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to:cc; bh=us4q2UCjhzaC2sZFMmvdM/nsXOvm9wQ0o0FwEpGHZ10=; b=Mf4CY4/jyRW5obBiDH2V5GFcEQTFNXZ3G9bH/u6wsGv3h3Uwm6A/qFZjvPQSxYD/gF lcf3NtJ/vlJr1NcynNKChRN9V0zYHPdj5bMNDxVOzGHgT0Evv+PEziewxz70AUEPW9dv qD8S3yd33wCEHwVTCw68T+OfvBYS3pIEi0VrRzV5bn6xDckpoCR0DZzEqwPr3PuLOW1d qdBDX2w7d+YDMlo98+EY9Ok8HR0+QUZYU9rV/42MoTnioCrDYxNnGWvdtpBuyirQjB+e PDGsAK/tj+VGPdKd8GtoedyTjJYs34P6kqp61rc4vMsVYU/ZJ5gbl2BqnPdlvvIiNnBg uipQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to:cc; bh=us4q2UCjhzaC2sZFMmvdM/nsXOvm9wQ0o0FwEpGHZ10=; b=dmgfjsKc5fq84bB2In0EJJw4oBwGlSz3PkzHxSxsllJk85jcdJUSeHbswgbmC4vIzZ /uwb7AeAwW+/TxJwzjwgNC3wO6NbilJRlDnnKGc9On+t88vVsFBF5hbNvd8lTpF3T2G5 9+/ey6GuTlGTodhR+CVBGeDzlMtx/ttLBxMP+kxBz1KW2IRDxDW6WJX6osU/Yqms5j46 PSvlsTw0wbSzjAkXvjLEe4WO6UVSmf+7kCn2NBegqt5UIZDgvzoXgoB6HpJxjuON/pzC c8l0a3e0pxeb3I7kEwjrO1P2QQBfOONInpSd4A4uZ0T6G8LiJVgABCsazT75P/tq3Pp7 sqcA== X-Gm-Message-State: AOAM5335cj1F7aMwzWzXAuArj/GvOx2Xb7AjVp00f5cPgHN2g/pcuBwu 489F5YtyIGJMyE/tB7J6jVkPZ0R8Y1jeC2lIOmraShrE2uY= X-Google-Smtp-Source: ABdhPJz3d0G+ljuaI7qGkBW0mw5PzsA44rymx/29gNmzDK+uxdmT7hkZT6gjp9oTVAQbWUegDd6MJQphv9MoILPAcgA= X-Received: by 2002:a17:906:ca4f:: with SMTP id jx15mr8681499ejb.454.1600844300963; Tue, 22 Sep 2020 23:58:20 -0700 (PDT) MIME-Version: 1.0 Date: Wed, 23 Sep 2020 13:58:09 +0700 Message-ID: To: PHP internals Cc: Nikita Popov Content-Type: text/plain; charset="UTF-8" Subject: Re: [PHP-DEV] Passing HashTable data from php.ini to an extension method: corrupted values From: alex.mashin@gmail.com (Alexander Mashin) 18.09.2020 14:36, Nikita Popov wrote: > ZVAL_STRINGL allocates a per-request string. You'll want to use ZVAL_STR(&val_z, zend_string_init(val, val_len, 1)); or so. Thank you very much, it helped. Might I ask a further question? I want to make a PHP extension call certain functions from external libraries. The libraries and function names are to be taken from php.ini, therefore the libraries are to be loaded with dlopen(), and pointers to functions will be returned by dlsym(). Functions' signatures are uniform and known at compilation time. The pointers to the functions are to be stored in a global hashtable MYEXT_G(libs). The task is to make sure that these pointers, initialised at PHP_MINIT stage remain valid and callable while serving HTTP requests. So, how I should initialise the hashtable, wrap function pointers in zval and add them to the hashtable? I tried things like ZVAL_PTR and ZVAL_FUNC but the pointers became invalid by the time HTTP request was served. Alexander Mashin