⚠ In case you've missed it, we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This is an archived forum. ⚠

  •     

profile picture

Why would I get "An error has been occured on saving"?



amityweb
  • profile picture
  • Member

Posted 13 March 2012 - 08:48 AM

Hi

My customer had a pop up when trying to enter lots of multiple selection fields.
"An error has been occured on saving"

What reasons could this be please?

Thanks


P.S. This is not good english it should be "An error has occurred on saving" (also not the spelling of occurred) :)

web-johnny
  • profile picture
  • Administrator
  • 1,166 posts

Posted 13 March 2012 - 21:53 PM

Well... this is embarrassing. I just changed it. Thanks to mention the wrong spelling.

Actually this error is for two main reasons (I have the same error twice so I don't know where EXACTLY the problem is). Is an internal server error or is a database error.

The only solution to find the problem is to debug it with the firebug so you can see the result of why this is happening. I tried to crack grocery CRUD ( with as many multiple selection fields I could) but I couldn't crack it. I have a print-screen of what you have to look at firebug:[attachment=65:firebug-test.png]

I guess that it should be a suhosin error. First of all check IF you have suhosin to your server (if not go straight away and add it :) ) . You can check it with a simple php_info() and a quick search for the word "suhosin". If it is installed then you have to change the default:


suhosin.post.max_array_depth = 100
suhosin.post.max_array_index_length = 64

suhosin.request.max_array_depth = 100
suhosin.request.max_array_index_length = 64


to:


suhosin.post.max_array_depth = 4096
suhosin.post.max_array_index_length = 640
suhosin.post.max_vars = 4096

suhosin.request.max_array_depth = 4096
suhosin.request.max_array_index_length = 640
suhosin.request.max_vars = 4096


I think if you just change the

suhosin.post.max_vars = 4096
suhosin.request.max_vars = 4096

It will be fine.

I think the problem is there. So you can change it and see. I think you have to talk with your hosting plan to change this. I suppose you checked it at the local machine and everything works fine right?

Adamantus
  • profile picture
  • Member

Posted 14 May 2012 - 15:58 PM

Hi. I'm using GC as well and although my content displays fine, I get this error when I try to do an update. Things I've tried so far:

Check db user to ensure update / edit is possible (it is)
Checked the theme folder to see if it uses form_open(), it's doesn't! This could be an issue for CSRF protection options in CI which needs form_open to work.

web-johnny
  • profile picture
  • Administrator
  • 1,166 posts

Posted 14 May 2012 - 17:49 PM

grocery CRUD doesn't support yet csrf_protection. It is a known issue ( http://www.grocerycrud.com/documentation/known-issues ) , you can take a look of this work around

[b]P.S.[/b] Don't try to just add the form_open instead of form , it is not so easy fix.

Kindest Regards

Johnny

marioromero78
  • profile picture
  • Member

Posted 14 May 2012 - 20:11 PM

Hi! I got the same message... So I used firebug as web-johnny said and I realized that CI was given me the "Disallowed Key Characters" error.
After looking the code I realized I named one table's field with the "ñ" character. So I removed it and it works!

Thank you! :)

Adamantus
  • profile picture
  • Member

Posted 15 May 2012 - 08:31 AM

[quote name='web-johnny' timestamp='1337017744' post='1748']
grocery CRUD doesn't support yet csrf_protection. It is a known issue ( http://www.grocerycr...on/known-issues ) , you can take a look of this work around

[b]P.S.[/b] Don't try to just add the form_open instead of form , it is not so easy fix.

Kindest Regards

Johnny
[/quote]

I was thinking of doing that but then I realised that as you pointed out it probably doesn't fix it that easily.

I think this could have something to do with the client-side / ajax elements of GC?
If so then I think that the Jquery cookie plugin might be what you need. I had problems using AJAX with Code Igniter with the CSRF protection turned on and this fixed it.
http://aymsystems.co...-codeigniter-20
Then again you might already know about this solution.

Pavel
  • profile picture
  • Member

Posted 07 September 2012 - 17:11 PM

I meet another problem with "An error has been occured on saving" message. Spending some hours i resolved it:

If all fields validated correctly - no prob, but if some of them not perform any rules - i receive "An error has..."

Cause of this message - NOT success on ajax response. I look at error field of response and saw "Uncaught SyntaxError: Unexpected token \."
I use utf8 and my response from server look like:
[quote][color=#000000][font=Consolas,]{"success":false,"error_message":"[/font][/color][color=#881280][font=Consolas,]<[/font][/color][color=#881280][font=Consolas,]p[/font][/color][color=#881280][font=Consolas,]>[/font][/color][color=#000000][font=Consolas,]\u041f\u043e\u043b\u0435 &quot;\u0421\u043e\u043a\u0440\u0430\u0449\u0435\u043d\u043d\u043e\u0435 \u0438\u043c\u044f&quot; \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0434\u043b\u044f \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f.[/font][/color][color=#881280][font=Consolas,]<[/font][/color][color=#881280][font=Consolas,]\/p[/font][/color][color=#881280][font=Consolas,]>[/font][/color][color=#000000][font=Consolas,]\n","error_fields":{"uriname":"\u041f\u043e\u043b\u0435 &quot;\u0421\u043e\u043a\u0440\u0430\u0449\u0435\u043d\u043d\u043e\u0435 \u0438\u043c\u044f&quot; \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0434\u043b\u044f \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f."}}[/font][/color][/quote]

parser cant read such string as json and think that its bad response.

Solution: Use htmlentities($message, ENT_NOQUOTES,'UTF-8') for all data that sending by json.
For example i change in grocery_crud.php (line 1737)

protected function validation_layout($validation_result)
{
@ob_end_clean();
echo "<textarea>".json_encode($validation_result)."</textarea>";
$this->set_echo_and_die();
}

to

protected function validation_layout($validation_result)
{
@ob_end_clean();
echo "<textarea>".htmlentities(json_encode($validation_result), ENT_NOQUOTES,'UTF-8')."</textarea>";
$this->set_echo_and_die();
}