peachpiecompiler / peachpie

PeachPie - the PHP compiler and runtime for .NET and .NET Core
https://www.peachpie.io
Apache License 2.0
2.33k stars 202 forks source link

Problems related to WordPress PHPUnit tests #791

Open roberthusak opened 4 years ago

roberthusak commented 4 years ago

This issue summarizes all the problems which cause WordPress PHPUnit tests to end prematurely (uncaught .NET exception, stack overflow etc.) or pollute output with extra text. Currently, they are solved by workarounds - by commenting certain parts out or by skipping. Some of them might require further investigation.

jakubmisek commented 3 years ago

@roberthusak can we implement symlink using Mono.Unix.UnixSymbolicLinkInfo.CreateSymbolicLinkTo() ?

jakubmisek commented 3 years ago

@roberthusak I think $x[0] causes a fatal error in PHP which won't be handled either? Isn't it a different bug in PeachPie?

roberthusak commented 3 years ago

@roberthusak can we implement symlink using Mono.Unix.UnixSymbolicLinkInfo.CreateSymbolicLinkTo() ?

@jakubmisek That's true, we can make it work the same way as chown. If we want to make it run on Windows as well (PHP does that since Windows Vista), we'll just need to find an appropriate way (maybe using P/Invoke as here), as .NET Standard seems not to have the API yet.

@roberthusak I think $x[0] causes a fatal error in PHP which won't be handled either? Isn't it a different bug in PeachPie?

In fact, it throws a catchable Error (it seems the fatal error is caused by not catching it), try this code (tested on PHP 7.4.1):

function test($a) {
  try {
    echo $a[0];
  } catch (Throwable $e) {
    echo get_class($e);
  }
}

test(new stdClass());

The reason why this error occurred at all is probably a bug in Peachpie (or some kind of incompatibility), which will require further investigation (as well as in the case of other unsuccessful tests).

jakubmisek commented 3 years ago

Note - large getid3_quicktime.QuicktimeParseAtom stack size might be caused when debugging since the compiler emits IndirectLocal for each local variable to be displayed in IDE's "Locals" window.

This might help: https://github.com/peachpiecompiler/peachpie/commit/df2266aa88ef0f0ef0a235fc97e55a00df34c975

roberthusak commented 3 years ago

Note - large getid3_quicktime.QuicktimeParseAtom stack size might be caused when debugging since the compiler emits IndirectLocal for each local variable to be displayed in IDE's "Locals" window.

This might help: df2266a

Unfortunately, this doesn't help. The stack overflow still happens even with the latest commit of Peachpie and even in Release.

jakubmisek commented 3 years ago

issue with stack size in getid3_quicktime.QuicktimeParseAtom is related to https://github.com/dotnet/runtime/issues/8980

The method is too large for JIT. The solution would be for us to emit fewer temp value types on the stack.