@@ -19,7 +19,8 @@ PHP Code compiler - Phar executable compiling utility
1919 - [ Quick install] ( #quick-install )
2020- [ Pitfalls] ( #pitfalls )
2121 - [ Shebang line in main script] ( #shebang-line-in-main-script )
22- - [ Local versus compiled files] ( #local-versus-compiled-files )
22+ - [ Local versus compiled files: missing file] ( #local-versus-compiled-files-missing-file )
23+ - [ Local versus compiled files: name collision] ( #local-versus-compiled-files-name-collision )
2324 - [ Size too big] ( #size-too-big )
2425- [ License] ( #license )
2526
@@ -154,9 +155,7 @@ $ bin/phpcc --version
154155PHP Code Compiler version 1.3.0-dev
155156```
156157
157- ### Local versus compiled files
158-
159- #### Trap 1: file missing in compiled phar but present in local working dir
158+ ### Local versus compiled files: missing file
160159
161160Let's consider the following tree (all files required by the app)
162161
@@ -173,20 +172,20 @@ Compile it (Oops... one Unknown File Object has not been included)
173172phpcc -e bin/acme.php -f bin/acme.php -d src/ -o bin/acme
174173```
175174
176- ##### Problem
175+ #### Problem
177176
178177Launching the ` bin/acme ` compiled archive should raise an error because of the missing file.
179178
180179Well...not. What happens here then ?
181180
182181If the ` bin/acme ` compiled archive stays in its place,the ` lib/Ufo.php ` can still be found from its point of view.
183182
184- ##### Solution
183+ #### Solution
185184
186185Always move the compiled executable ** out** of the project's working directory before testing it.
187186
188187
189- #### Trap 2: different files with the same relative path
188+ ### Local versus compiled files: name collision
190189
191190Eg:
192191
@@ -196,11 +195,11 @@ require "vendor/autoload.php"
196195
197196Chances are, there might be such a ` vendor/autoload.php ` file in the project to be compiled.
198197
199- ##### Problem
198+ #### Problem
200199
201200From the compiled app point of view, ` vendor/autoload.php ` refers to a relative path in the PHAR archive.
202201
203- ##### Workaround
202+ #### Workaround
204203
205204The phpcc execution dir (i.e the compiled project's top directory) must be added first in the include path.
206205
0 commit comments