box2-lib icon indicating copy to clipboard operation
box2-lib copied to clipboard

Unexpected behaviour when using webPhar

Open darrenmothersele opened this issue 8 years ago • 0 comments

I can't pass a custom rewrite function, because it gets escaped and inserted in as a string. It's not passed to Phar::webPhar as a callable.

The PHP docs seem to suggest that if I pass an empty array of mimetypes, then it will use the default. If I pass an empty array, then I get the default, but my custom rewrite is not added.

This might work?

https://github.com/box-project/box2-lib/blob/master/src/lib/Herrera/Box/StubGenerator.php#L416

if ($this->mimetypes) {
    $stub .= ', ' . var_export(
        $this->mimetypes,
        true
    );

    if ($this->rewrite) {
        $stub .= ', ' . $this->rewrite;
    }
}
else {
    if ($this->rewrite) {
        $stub .= ', array(), ' . $this->rewrite;
    }
}

darrenmothersele avatar Jul 01 '16 11:07 darrenmothersele