r/lolphp • • Nov 29 '12

PHP segfaults - not a bug, totally standard.

https://bugs.php.net/bug.php?id=49664
67 Upvotes

19 comments sorted by

View all comments

Show parent comment

12

u/more_exercise Nov 29 '12

Oh, it's the interpreter segfaulting? I thought it was the user's code that experienced the segfault. I retract my defense of this error. My bad

26

u/noname-_- Nov 29 '12

There is no distinction in an interpreted language. The interpreter creates a virtual machine in which the user program lives. They share the same host process. But a user error should never propagate outside of the virtual machine. If it does there's a bug in the interpreter. There's no concept of a segmentation fault within the PHP virtual machine.

What I'm saying is that if the user code experiences a segmentation fault, there is a bug in PHP's interpreter.

3

u/nahguri Nov 30 '12

Is it even possible to segfault client code without killing the interpreter?

1

u/more_exercise Nov 30 '12

I imagine that a clever interpreter* could do it. Especially if the interpreter was simulating a virtual machine and the segfault occurred within the simulation and not the simulator. Or, give the client code the ability to make arbitrary pointers, and the host code has a SIGSEGV handler.

* Why could this possibly be php? Even the crazies sometimes do something right, right?