How can PHP cause memory leaks, buffer overflows, stack overflows and any other errors of such kind? Can PHP even cause such errors?
How can PHP cause memory leaks, buffer overflows, stack overflows and any other errors
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
By causing some kinda infinite recursion, you can cause a PHP crash.
For example, a file that recursively requires itself should cause a stack overflow:
Or a recursion in the magic
__sleep()method that is supposed to unserialize an object, but callsserialize()instead:Or a class destructor that creates new instances:
As well as a recursive
__toString():There are other recursion scenarios that PHP is protected against. For example, calling a recursive function without an exit condition or a recursive self-yielding generator. These ones do not cause a crash, but a
Allowed memory size of ...fatal error.For more examples, you might want to see: