Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:110736 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 12845 invoked from network); 26 Jun 2020 16:27:51 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 26 Jun 2020 16:27:51 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 1860C1804A8 for ; Fri, 26 Jun 2020 08:15:46 -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_H2,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS15169 209.85.128.0/17 X-Spam-Virus: No X-Envelope-From: Received: from mail-lj1-f172.google.com (mail-lj1-f172.google.com [209.85.208.172]) (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 ; Fri, 26 Jun 2020 08:15:45 -0700 (PDT) Received: by mail-lj1-f172.google.com with SMTP id s9so10686091ljm.11 for ; Fri, 26 Jun 2020 08:15:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=to:from:subject:message-id:date:user-agent:mime-version :content-transfer-encoding:content-language; bh=UCwpxCSc+ko7q8LzdDDIXFc8niggqSTgfgljvH1Zjxg=; b=K/n5JHDAJBTA2yoB65mV8tWSSMBOzkucpTG3LntZTE4kEL2TorxMfMmTe0HwV91yRs AxZvzUKvDPnOEW1akXu05lrbWPUA8dTeas+jeAeShxVJanardPTlrLhux2iq/mUb1FMI 9f+PH0oer+IyObv1OJgfRVAdE+ydQj2TyEajuIgVqKlyOIHDKhEe88fOAWfK5mkrKgig 8fTJ+uQP6tmEV8gcpA4yRkqK/im30UmLsHVphuT0X0Ci119U0k/3XIZpcQ1+obPO3yrN YToVFxNHZWTsD5Zsui8TEcvWGaq3NK2tzQ1V1tGa4brQF8Tpub8SmKZRhIea786/AcBL 7AZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:to:from:subject:message-id:date:user-agent :mime-version:content-transfer-encoding:content-language; bh=UCwpxCSc+ko7q8LzdDDIXFc8niggqSTgfgljvH1Zjxg=; b=KHxMKhVu9dyQBgqFPSA/LWmNWtWZseZaOHueOvQKuZCMco1iQnMF1MGJ3LRBogxcu2 DIvQZby8fRbDaO56k9cw9eANWOlfLguKOcx6FpWqt11VRALc6XBJtNzZaSawaCEtXYkG c1CHNThnjFy8oXuzK9JViSxu0ByuHY7VGeeOORNpIbjNgbBqcH+CkexO3xqgVwWd9kUx 4zbB6lIc3q2Md//qOk74WKgx1ep1/TMUhpS4NMdJ728NaBipE81jxLfDVglC5nMYHPF+ L6oDD7m5vs+j6H9VE8z1xECyzRwFKwcQ2kSa3jPfMQ/1WjFNVcJLaQkZ63KHJiGgYDJ5 2YQg== X-Gm-Message-State: AOAM530JU5Nd3Z0qRt7oBZYr5sWy/V66CJWjDDN1VFMLvdXWgD8EjhVg IWwrq5pX9e0BgOEQO+Q6jwUPl/gY X-Google-Smtp-Source: ABdhPJxNaArUmkq6arke13DwLiXuQUBca1ZEKQKseglxRDpRX/4IWG+exloYppuDTKf8uZ2G4sKy3A== X-Received: by 2002:a2e:9cd4:: with SMTP id g20mr1649401ljj.371.1593184542275; Fri, 26 Jun 2020 08:15:42 -0700 (PDT) Received: from ?IPv6:2a02:aa7:400a:8a23:4443:3d1:9caa:e5cc? ([2a02:aa7:400a:8a23:4443:3d1:9caa:e5cc]) by smtp.gmail.com with ESMTPSA id q20sm5547804lji.124.2020.06.26.08.15.40 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 26 Jun 2020 08:15:41 -0700 (PDT) To: internals@lists.php.net Message-ID: Date: Fri, 26 Jun 2020 17:15:40 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:79.0) Gecko/20100101 Thunderbird/79.0a1 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US Subject: PHP Bug #79714 (need advice) + a couple of ideas for the future ! From: henry.wood.dk@gmail.com (Henrik Skov) Hi list ! While I am still trying to fix bug 79714 (please see: https://bugs.php.net/bug.php?id=79714), I got a few ideas. First though, let me say that I still need advice about fixing the bug above as per my earlier mail. But now, my new idea: For future versions of PHP (8.1 ?), I would like following additions to PHP: The goal is still the same as what I am trying to achieve by fixing the 79714 bug, namely to be able to build PHARs that can be distributed as single-file while remaining harder to reverse-engineer. Now about my changes: Opcache: opcache_compile_file_2_binfile(string $phpFile, string $outputBinFile) New function which operates similar to opcache_compile_file() while compiling $phpFile into the binary OpCache bytecode and save it as $outputBinFile Core: requirebin(string $dotbin_file_path) Like require() but the parameter is the parameter is the path to a .bin (opCache bytecode file) includebin(string $dotbin_file_path) Like include() but the parameter is the parameter is the path to a .bin (opCache bytecode file) requirebin_once(string $dotbin_file_path) Like require_once() but the parameter is the parameter is the path to a .bin (opCache bytecode file) includebin_once(string $dotbin_file_path) Like include_once() but the parameter is the parameter is the path to a .bin (opCache bytecode file) Phar Extension: Phar::addOpcacheFile(string $pathToOpCacheBinFile, string $localName) Like Phar::addFile but first parameter is the path to a file produced by opcache_compile_file_2_binfile() (requires the opcache extension to be present) Phar::setOpcachedStub(string $code) Like Phar::setStub(string $code) but $code is first converted into byte code (requires the opcache extension to be present). I think these changes would mean that using an autoloader (ie. vendor/autoload.php) in the PHAR - which would contain a check to see if a .bin exists, then use includebin_once() to load it. If a .bin file does *NOT* exist but a .PHP file does, then simply use include_once() to load the PHP file - would allow for distributing PHARs that have their source code relatively well protected. What do you guys think about my idea ? Best regards, Henrik Skov Secuno A/S