News for hackers. Stuff that matters.
Re:Peachpie – Open Source PHP Compiler to .NET and WordPress... by jakubmisek on Friday July 28, 2017 @10:53AM (#14874661)
Disclaimer - Peachpie dev. Some of the weird PHP constructs will never work - by purpose. In such case it will be reported in compile-time or at least in run-time. However, there is always a way of slightly changing the original code to make it running on .NET.
Re:Peachpie – Open Source PHP Compiler to .NET and WordPress... by maxxxxx on Friday July 28, 2017 @11:04AM (#14874759)
What PHP version is Peachpie targeting?
Re:Peachpie – Open Source PHP Compiler to .NET and WordPress... by teh_klev on Friday July 28, 2017 @11:24AM (#14874896)
From this:

https://github.com/peachpiecompiler/peachpie/wiki/Peachpie-R...

Looks like PHP 5.4 and 7.1 roadmap goals have been achieved.

Though http://www.peachpie.io/about references Phalanger as the inspiration which apparently got as far as PHP 5.6.

There's also compatibility page that looks useful:

https://github.com/peachpiecompiler/peachpie/wiki/Compatibil...

Re:Peachpie – Open Source PHP Compiler to .NET and WordPress... by tokenizerrr on Friday July 28, 2017 @10:58AM (#14874698)
Do you happen to have any examples?
Re:Peachpie – Open Source PHP Compiler to .NET and WordPress... by jakubmisek on Saturday July 29, 2017 @06:48AM (#14880559)
For example one CLR limitation - `yield` cannot be in a catch block. Two workarounds - compiler can generate a crazy state machine or user can just move the PHP yield outside the catch.

Error handling is a big issue - in PHP every notice and warning can be handled in user code, in .NET we use Debug Assertions or exceptions. But .NET has threads and async which shares one thread by more requests, so in case of error we just don't know what request has to handle the error. We would have to pass some request context object to every function in runtime in order to be able to let the correct request's error_handler to handle the error - or we just assume warnings and errors should not happen and crash when it does.

Garbage Collection - for performance reasons (and sanity) we let .NET GC to do its job. But unlike PHP's GC it is undeterministic and does its job on a different thread. For now, __destruct is not handled in Peachpie yet cause there are more ways on how to simulate PHPs behavior.

Changing existing closure's $this to anything - well.. besides it would make type analysis useless, it totaly violates strong .NET method access checks.

Re:Peachpie – Open Source PHP Compiler to .NET and WordPress... by maxxxxx on Saturday July 29, 2017 @07:35AM (#14880680)
__destruct is not called when the reference count goes to 0? This is one of the (few) features I think PHP does better than C#.
Re:Peachpie – Open Source PHP Compiler to .NET and WordPress... by jakubmisek on Saturday July 29, 2017 @08:37AM (#14880913)
And one of the features caused memory leaking in PHP for a decade. .NET has real garbage collection, we can take advantage of it.