Skip to content

Firefox - unreachable code after return statement php8.4-web.mjs:9:25165 #104

Description

@kasparsatke

I am new to your package & still am tinkering with it. So please bear with me if I don't use it optimal so far.

I include php-wasm like so:

<script type=module>

const { PhpWeb } = await import('https://cdn.jsdelivr.net/npm/php-wasm/PhpWeb.mjs');

export const php = new PhpWeb({sharedLibs: [
    `php${PhpWeb.phpVersion}-phar.so`,
    `php\${PHP_VERSION}-sqlite.so`,
    `php${PhpWeb.phpVersion}-xml.so`,
    `php${PhpWeb.phpVersion}-dom.so`,
]});

[...]

So since the new update some days ago, PHP was obviously bumped to 8.4.1, which is cool but I get two issues here:

  • First the titular one: unreachable code after return statement php8.4-web.mjs:9:25165 is thrown in the browser console in Firefox. The code snippet here is if(prop===Symbol.iterator){return;const [...] - ([...] for omission of the following). It looks like a missing closing brace after the return statement. Or intentionally dead code? I could not find this code here in the repo so far but I checked in on https://www.npmjs.com/package/php-wasm?activeTab=code and found it there. Strangely, Edge (Chromium) does not complain about this dead code, also instead of all being in one line like in FF (minified)?), it is properly formatted like so:
if (prop === Symbol.iterator) {
                                return;
                                const [...]
  • Second thing: I have tried to load module with sharedLibs option - as I have read it somewhere. With the last version I was getting 21 libs although I thought I would only get those four which I included. But that was a problem I wanted to deal with later. Now, since the version update, I actually get the following:
Warning: PHP Startup: Unable to load dynamic library 'phpundefined-phar.so' (tried: ./phpundefined-phar.so (), ./phpundefined-phar.so.so ()) in Unknown on line 0

Warning: PHP Startup: Unable to load dynamic library 'php-sqlite.so' (tried: ./php-sqlite.so (), ./php-sqlite.so.so ()) in Unknown on line 0

Warning: PHP Startup: Unable to load dynamic library 'phpundefined-xml.so' (tried: ./phpundefined-xml.so (), ./phpundefined-xml.so.so ()) in Unknown on line 0

Warning: PHP Startup: Unable to load dynamic library 'phpundefined-dom.so' (tried: ./phpundefined-dom.so (), ./phpundefined-dom.so.so ()) in Unknown on line 0

I mean I can of course comment those includes out since I have all those libs anyways (see above) but I assume the way I tried without success must have made some sense at some time (as I found it somewhere in the docs) and it initially silently failed but now not anymore. Or is it just a version issue, as the version is not defined like this anymore in your .mjs? And maybe there is a different way to control the lib includes if one wants more or less libs?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions