I am developer of ko-worker library. I add feature with phar executable as daemons application. And found strange behavior with phar and process forking undex linux. Each time the master process fork`s more then 1 child i got error like that
include(phar:///opt/www/worker.phar/vendor/path/to/file.php):
failed to open stream: phar error: internal corruption of phar
"/opt/www/worker.phar" (crc32 mismatch on file "vendor/path/to/file.php")
in `phar:///opt/www/worker.phar/vendor/composer/ClassLoader.php` line 412
The stub (original stub here) of phar look`s like
#!/usr/bin/env php
<?php
Phar::mapPhar('worker.phar');
require_once 'phar://worker.phar/vendor/autoload.php';
//Execute next going fork code more then one 1 time
...
$pid = pcntl_fork();
if ($pid == -1) {
die('could not fork');
} else if ($pid) {
// we are the parent
...
} else {
// we are the child
...
exit(1);
}
__HALT_COMPILER();
I do not use cache_list. This happens only if phar is compressed with GZ or BZ2. Phar files without compression do not reproduce this bug. Is any workarounds around it or may be some information about restriction of compressed phars and forked process?