laravel - Pinpoint exact cause of PHP out of memory error ( ...it was var_dump() ) -


i've been getting out of memory error few months on app has been in continuous development & has 20 users far.

it didn't seem have negative repurcussions detect, have found culprit.

i don't know how had default 404 error view strange code had found way, i'm not sure how did that. default 404 error view called framework automatically if 1 uses findorfail() , db not find record. when page not available in app (which should be, content can published/unpublished), error view triggering.

the weird code was:

<!-- <div><?php var_dump($exception); ?></div> --> <div class="text">{{$exception->getmessage()}}</div> 

totally weird know.

firstly, html comments, since blade file, not apply, var_dump being called despite being 'commented out'.

so replaced this:

{{ var_dump($exception) }} 

and out of memory error (and 500 error in browser) can reliably reproduced.

removing it, , 404 view renders fine.

replacing {{ dd($exception) }} works fine - render of trace.

so, why var_dump line cause out of memory error?

what should investigate further?

i'm on laravel 5.3

this happens because content of $exception variable big. when dump variable, php attempt convert string representation. uses lot of memory.

i don't see why need output entire exception object. need message (which fetch $exception->getmessage(). rest backtrace , references related objects , instances.


Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -