getkirby-v2 / panel

This is the deprecated admin panel for Kirby v2.
http://getkirby.com
Other
134 stars 70 forks source link

400 Bad request error when deleting image and pages #263

Closed JimmyRittenborg closed 10 years ago

JimmyRittenborg commented 10 years ago

When I'm trying to delete an image or an page, it throws an "Unexpected error" in the modal

Error

In Dev Tools I see a "400 bad request" and the API returns

{
"status": "error",
"code": 400,
"message": "Invalid API method",
"data": []
}

I'm only getting this on my server, not on my local vagrant vm.

Do anyone know why i'm getting this, or which direction i should look - the error messages doesn't tell me much, and I'm not getting anything in my error.log

JimmyRittenborg commented 10 years ago

Why is Kirby throwing this error?

JimmyRittenborg commented 10 years ago

For some weird reason, it's the terror debugger, which is causing this issue for me.

Even with c::set('debug', false); terror is messing this stuff up - I can set if(!defined('TERROR')) define('TERROR', false); in bootstrap.php and then everything works a treat.

Also the terror debugger eliminates the ability to use more unobtrusive PHP debugger extensions like xdebug, which could be an great annoyance to some.

Besides stuff being pretty much broken (for me at least) with the terror debugger turned on, I don't know if it would be "safe" to make an option to completely turn it off ?

Though I'm still not sure why I'm only having this issue on my (not yet published) production environment and not my local vagrant machine.

JimmyRittenborg commented 10 years ago

hmm.. finally nailed it :laughing:

A difference between my production and dev environment is xdebug and full error logging, so I turned on full error logging on my production environment temporary and I finally got the root cause to the issue

"PHP message: PHP Deprecated:  Automatically populating $HTTP_RAW_POST_DATA is deprecated and will be removed in a future version. To avoid this warning set 'always_populate_raw_post_data' to '-1' in php.ini and use the php://input stream instead. in Unknown on line 0"

This issue is known for us serving kirby with php5-fpm and is easily solved by just simply obeying the suggestion ..I just completely forgot everything about it, since I fixed on my local environment.

Now I'll turn off full error logging again and go for a beer, Cheers @bastianallgeier :beer: