Save(), Insert(), And Update() All Terminate Script

I’m having some trouble getting my model to update its data in the database.

My current relevant code looks like this, in all its temporary-debugging-code glory:

                                echo "Here, before database interaction!";

                                /* if ( $_POST['story_id'] == 'new' ) {


                                } else {


                                } */    




                                echo "Here, after DB interaction!";

                                new dBug( $story->errors() );     

                                new dBug( $story->getErrors() );  

                                echo CHtml::errorSummary($story); 

                                echo "Here, after error summary!";

When I go to execute this, the data is not saved to the database, and the screen output I get is just:

Here, before database interaction!

and that’s the end of the source code; even the view doesn’t finish rendering. This happens whether I’m using save(), insert(), or update().

Other relevant information:

  • I’m using Yii 1.1.14

  • I’m using PHP 5.2.17 (and am on a shared hosting server; I have no access to upgrade to 5.3)

  • There are no PHP errors in the error log

  • YII_DEBUG is set to true

  • I do not have any beforeValidate/beforeSave/related functions in the Story model

  • The database user has permissions to update/insert into the database, and the database connection is good (and data can be loaded into the model with no problems)

  • If I add the validate() function, it returns true, but the save(), insert() and update() methods still terminate the script

  • The same thing happens whether I use save() or save(false)

I’m completely flummoxed. Any ideas what’s going wrong?

It looks like the databases throws an exception which is not displayed. Can you check error_log setting in PHP or other relevant stuff in php.ini?

I think you shouldn’t try to guess what’s wrong with the database, just make error reporting work as expected. You are going to need it sooner or later.

Okay. I’ve went and switched some things around in my php.ini file. My current settings are:

error_reporting = E_ALL & ~E_DEPRECATED

display_errors = On

log_errors = On

and I’ve set error_log to a new file. I removed a semicolon somewhere just to make sure that logging was writing correctly to that file; it is. Replaced it, ran the script again, and I’m still getting the same behavior – no errors, termination of script, no database interaction. Are there other settings I should change?