php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #74513 Working with wrappers
Submitted: 2017-04-28 20:08 UTC Modified: 2017-04-30 15:33 UTC
From: acuna dot personal at gmail dot com Assigned:
Status: Not a bug Package: opcache
PHP Version: 7.1.4 OS: Windows 10.1 x64
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: acuna dot personal at gmail dot com
New email:
PHP Version: OS:

 

 [2017-04-28 20:08 UTC] acuna dot personal at gmail dot com
Description:
------------
Hello!

I'm writing the opensource and light-weight PHP compiler as the replace of monstrous HHVM and other ancient PHP compilers which are all dead now. I'm using my own embedder to pack different files to one executable, and mcrypt to encrypt the sources (unfortunately there's impossible for me to use the OpenSSL because it's requires so much side libraries, but mcrypt requires none, so now there's only php7.dll library file requres for ready executables (awesome)). And there's no more, now I'm looking for the way to embed this library to executable too and unpack it to its folder after execute the file)

So, now I'm thinking about how to embed the executable contents to the true bytecode, not an encrypted sources, because it's simply an emulation and temporary solution to hide the sources, and it requires decryption at every launch. I'm using the win32std library to address to the embedded parts of the executable and I assume to make the butecode of main wrapper contents which created by it and decompyle it with embedder while execute the file.

I' planning to use opcache for work with it, because it's recommended and working from the box. There's an magic string in my embedder:

char *eval_string = "require 'res:///PHP/MAIN'";

which is starts the file as wrapper. I can't use the variables in that string, but I can address it to another PHP file in which I can do everything, but the greatest way is decompyle this wrapper on the fly like a file (because it's a file). So, can I ask you, is the opcache can do this? Or is it impossible, I can use another technique - decompyle it in embedder and execute its content by output buffering or eval (). So in conclusion - the task is to get the compiled content of the wrapper and decompyle it before its executing.

BTW, bcompiler could do it all (If I get it right), but it's dead too. I tried to port it to the PHP7 (who could think? :D) and have done it at ~60%, but acquainted to one guy who ported it at 5.6 and he says, that it's working only with "Hello World" and crashes if the scripts are more difficult for it, so I got that because the new PHP's have many new constructions like new array operators, closures etc, so now this problem will take so much time, so now it's abandoned by me.

Hope you understand it all and thanks in advance!

Cheers,
A.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2017-04-29 07:02 UTC] requinix@php.net
-Status: Open +Status: Not a bug
 [2017-04-29 07:02 UTC] requinix@php.net
Try the internals mailing list.
http://php.net/mailing-lists.php
 [2017-04-30 15:33 UTC] acuna dot personal at gmail dot com
Ah yes, sure, thanks.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Mar 29 05:01:28 2024 UTC