Bug #79714 [Opn]: Extension bcgen + PHAR archives appear not to be able to work together

[email protected]
Newsgroups php.pecl.dev
Message-ID <[email protected]>
Edit report at https://bugs.php.net/bug.php?id=79714&edit=1

 ID:                 79714
 Updated by:         [email protected]
 Reported by:        henry dot wood dot dk at gmail dot com
 Summary:            Extension bcgen + PHAR archives appear not to be
                     able to work together
 Status:             Open
 Type:               Bug
-Package:            PHAR related
+Package:            PECL
 Operating System:   Ubuntu 18.04
 PHP Version:        7.2.31
 Block user comment: N
 Private report:     N

 New Comment:

This is almost certainly a bcgen issue; just compare the
implementations of file_cache_compile_file in ZendAccelerator.c.
bcgen is missing phar handling there (and maybe elsewhere).


Previous Comments:
------------------------------------------------------------------------
[2020-06-18 21:44:39] henry dot wood dot dk at gmail dot com

No, I don't have a specific reason to believe that the problem is with the PHAR extension. However, it should be obvious by now that the combination of BCGEN + PHAR does not work as expected.

As previously stated, I have already submitted a bugreport to the authors of BCGEN, but as also previously stated, I appeared to be in need of help if this problem is to be resolved.

------------------------------------------------------------------------
[2020-06-18 21:00:36] henry dot wood dot dk at gmail dot com

As BCGEN is based on opcache code, I would - ideally - very much like for someone in the PHP Team to reach out to the BCGEN authors (either the opcache code authors and/or the PHAR authors) and help the authors of BCGEN as it is my feeling that the authors of BCGEN have admitted to not knowing enough about opcache code and/or PHAR extension in order to solve the problem on their own.

The goal would then - of course - be to benefit the BCGEN extension in such a way that it will become compatible with PHP version 7.2+.

Ultimately, I would like to achieve a situation where PHARs can be used to distribute applications in a way/format which is not so easily reverse engineered.
This would indeed benefit the entire PHP community in my humble opinion.
I think it is about time that it becomes possible to distribute PHARs in a secure manner.

------------------------------------------------------------------------
[2020-06-18 20:30:59] henry dot wood dot dk at gmail dot com

I have previously reported what I think is the same bug to bcgen - Please see: https://github.com/vjardin/bcgen/issues/10

Also running the simple.phar file on the command line, yields an exit code of 130.

------------------------------------------------------------------------
[2020-06-18 20:21:15] [email protected]

Do you have any specific reason to believe this issue is on the phar side rather than the bcgen side? I would recommend reporting the issue with bcgen first.

As the project is compatible only with PHP 7.2 and PHP 7.2 is no longer actively supported, we will not be able to fix anything anyway (though if the issue is indeed on the phar side, future versions may be fixed -- that's a big if though).

------------------------------------------------------------------------
[2020-06-18 20:11:29] henry dot wood dot dk at gmail dot com

Possible conclusion:

Any compiled file *WITHIN* the phar archive 'simple.phar' is simply read as-is and not parsed/evaluated/executed - however, the BCGEN header appears to be stripped from the output.
Any normal PHP file *WITHIN* the phar archive 'simple.phar' is read, parsed, evaluted and executed as expected.

------------------------------------------------------------------------


The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at

    https://bugs.php.net/bug.php?id=79714


--
Edit this bug report at https://bugs.php.net/bug.php?id=79714&edit=1
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.