Giter Club home page Giter Club logo

demo's Issues

RangeError: Maximum call stack size exceeded with custom compile

hello, first of all, I'm sorry because this may not be an actual issue and it's kinda offtopic.

I've been trying to compile PHP 8.1 for WASM for a few weeks now and haven't had much luck. I recently came across this repo and noticed you managed to do it.

I've cloned your repo locally and tried to do the compile myself, and when I try to run code in the demo app it works but fails for more complex code snippets (like including the phan phar or its autoload.php, or a deeply recursive function) - those same code snippets work when I just download your compiled php.wasm, php.data and php.js from https://phan.github.io/demo/ and load them locally or even in the online demo app.
The error I'm getting when trying to run the complex code (sometimes in the output section in page and sometimes in console):

Unexpected error reloading php: RangeError: Maximum call stack size exceeded

I then proceeded to modify the build.sh - get rid of most extensions and change the compile flags in attempts to get it to work but with no success and I've done over a hundred different compiles at this point.

If anyone's interested to help me out, here are the important parts of my build.sh:

export CFLAGS='-O1 -DZEND_MM_ERROR=0'
./buildconf --force
emconfigure ./configure \
  --with-layout=GNU \
  --enable-embed=static \
  --disable-all \
  --disable-cgi \
  --disable-cli \
  --disable-rpath \
  --disable-phpdbg \
  --without-pear \
  --without-pcre-jit \
  --without-valgrind \
  --with-valgrind=no \
  --disable-fiber-asm \
  --enable-phar

emmake make clean
emmake make -j5
emcc $CFLAGS -I . -I Zend -I main -I TSRM/ ../pib_eval.c -c -o pib_eval.o
emcc $CFLAGS \
  --llvm-lto 2 \
  -s ENVIRONMENT=web \
  -s EXPORTED_FUNCTIONS='["_pib_eval", "_php_embed_init", "_zend_eval_string", "_php_embed_shutdown"]' \
  -s EXTRA_EXPORTED_RUNTIME_METHODS='["ccall"]' \
  -s MODULARIZE=1 \
  -s EXPORT_NAME="'PHP'" \
  -s TOTAL_MEMORY=134217728 \
  -s INVOKE_RUN=0 \
  -s ERROR_ON_UNDEFINED_SYMBOLS=0 \
  -s ASSERTIONS=1 \
  -s TOTAL_STACK=10485760 \
  --preload-file some.phar \
  libs/libphp.a pib_eval.o -o out/php.js

I'm running Emscripten SDK version 1.39.18 with the following command:

docker run --rm -v $(pwd):/src trzeci/emscripten /bin/bash -c "apt-get update ; apt-get install -y autoconf ; ./build.sh"

thanks very much in advance to anyone who's willing to help regarding this.

Question: using this demo with a different config

I'd love to fork this demo to provide an online demo for the taint-check plugin. All I'd need is basically be able to use a different config for running phan. AFAICS it should be doable if I just change the content of #phan_runner_source and adjust it to my needs, although that seems fragile. Is there a recommended way for my use case, or should I just go ahead with the above?

Live syntax check not using PHP8

The header says

Uses Phan 4.0.0 and PHP 8.0.0

And this seems to be correct, if I run this code:

<?php

function baz() {
	$val = match ( 'foo' ) {
		'foo' => 'v1',
		'bar' => 'v2'
	};
	echo $val;
}
baz();

it yields the expected output (link)

However, the ace editor isn't validating the code against PHP 8, because it displays a syntax error on line 5.

Support a non-emscripten backend

This might be useful for local setups (e.g. against an internal codebase)

  • This would require hosting, and memory/time limits
  • Don't provide "run" capabilities or UI
  • Don't save files to disk

Figure out how to report fatal errors to stderr

Fatal errors aren't handled by regular error handlers. I tried patching php-src/main/main.c to support logging them to stderr, but this isn't working as intended.

Seen when clicking RUN on snippets such as:

<?php
class X {}
class X {}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.