phpshell icon indicating copy to clipboard operation
phpshell copied to clipboard

browser crash / endless loop

Open staabm opened this issue 11 months ago • 3 comments

reproduced on Firefox 135a1 and latest macOS safari on macbook pro m4

repro

  • copy this text into clipboard:
for ($i = -5; $i < 5; $i++) {
    var_dump($i == null);
}
  • open https://3v4l.org/iGoti
  • click into the text editor and place the cursor at the very end after "\n";
  • press ENTER
  • paste the clipboard contents
  • move cursor using the keyboard-arrows just after == of the pasted text
  • press backspace

=> browser freezes at this screen

grafik

staabm avatar Jan 02 '25 14:01 staabm

nice, I'm getting reproducible OOMs as well on my x86 machine running firefox-133. It's not the highlighter but the live-preview WASM. There doesn't seem to be an infinite loop either, I'm unable to force my browser debug this without adding additional code

Using the global "Performance" profiler shows nothing useful besides reporting the Parent process reporting Jank - event processing delay

SjonHortensius avatar Jan 02 '25 15:01 SjonHortensius

As suggested by https://mastodon.social/@zimzat/113786499072771167:

The instructions in the linked GitHub issue say to press backspace on ==, which turns it into an assignment overwriting the $i used by the for loop. The wasm runs before the browser draws the change so the input doesn't look like an infinite loop but it is.

I'll look into the ordering - making sure the editor gets updated before the wasm runs and hangs your browser

SjonHortensius avatar Jan 10 '25 08:01 SjonHortensius

I am experiencing simillar browser hang.

Repro:

while (true) {}

This causes the "live preview" to never end, which is a situation not hard to get into when coding with live preview.

I would be happy if there can be some limit on time, memory, output data (for live preview).

mvorisek avatar Sep 09 '25 09:09 mvorisek