rfc:direct-execution-opcode

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Next revisionBoth sides next revision
rfc:direct-execution-opcode [2020/12/10 11:52] chopinsrfc:direct-execution-opcode [2020/12/10 12:33] chopins
Line 13: Line 13:
  
 When executing, judge whether the loaded PHP file is an opcode file based on the flag. if no flag, will run as it is now.If is opcode file will direct execution without check php source file. When executing, judge whether the loaded PHP file is an opcode file based on the flag. if no flag, will run as it is now.If is opcode file will direct execution without check php source file.
 +
 +The **includes()** **includes_once()** and **require()** **require_one()** can load opcode file. So if you include opcode files, the source code must use the compiled file path instead of the source file path.
  
 Change function to: Change function to:
Line 30: Line 32:
  
 php--->load code--->compile to opcode--->save to cache system directory-->same path file-->**copy cache file to the specified path** php--->load code--->compile to opcode--->save to cache system directory-->same path file-->**copy cache file to the specified path**
 +
 +new opcode file format like below:
 +
 +<PHP>
 +<?phpo{phpversionid}OPCACHE575d367cc725713f6f170910d6e9ee5e-------BINARY CONTENT OF OPCODE----
 +</PHP>
  
 **opcache exec process:** **opcache exec process:**
Line 46: Line 54:
 </PHP> </PHP>
 ===== Backward Incompatible Changes ===== ===== Backward Incompatible Changes =====
-This change causes **__FILE__** path obtained by the constant is not the path to the opcode file, but the path to the compiled PHP file.**__DIR__** this is also the problem.+Magic constant **%%__FILE__%%** is the absolute path to the compiled source file, not the path to the opcode file that is currently executing. **%%__DIR__%%** and **%%__LINE__%%** also have this problem. Therefore, applications that rely on these constants are affected. 
 The file path obtained by **error reporting**, **exceptions**, **reflections**, will also be the path to the compiled file, not the current opcode file path. The file path obtained by **error reporting**, **exceptions**, **reflections**, will also be the path to the compiled file, not the current opcode file path.
  
Line 75: Line 84:
     * set 1, default value, different version opcode file exec are prohibited     * set 1, default value, different version opcode file exec are prohibited
     * set 0, different version opcode file will report **E_WARNING** message     * set 0, different version opcode file will report **E_WARNING** message
- 
-===== Future Scope ===== 
-support opcode file in phar. 
  
 ===== Patches and Tests ===== ===== Patches and Tests =====
rfc/direct-execution-opcode.txt · Last modified: 2021/04/23 18:07 by imsop