Symfony ObjectHelper woes

12 02 2009

Another dreaded case of Symfony’s white-screen of death struck on a customized Admin Generator -created page for editing. I got no on-screen or logged PHP errors. I tried doing some manual echo statements to track where the problem lay, but it just got me down the wrong path. Of course, the problem only occurred on my production server, but my almost identical development server showed the pages just fine.

Finally, I had a look at the Symfony logs, and noticed where the execution stopped short – right after a partial field that I was using to provide a drop-down category select. I was using the object_select_tag function, and removing that line fixed the problem. Thankfully, that function is an elegant wrapper for the select_tag/objects_for_select functions (the latter being a wrapper for the options_for_select function), and replacing the object function with its functional equivalent made things work fine.

Debugging is tiring!

The technical info:
Symfony 1.0.17 (and post upgrade to 1.0.19)
PHP 5.2.6 FreeBSD (my dev server which worked is 5.2.5 Windows , though I’m not sure this would make a difference)
The options are being taken from a “virtual” DB class, as I created a special class for these categories which inherits from a more general class equipped with fields for id & name, which was mostly all I needed for these categories.
The category value is not located in the object’s table, but was created using my own Behavior class, which works quite well otherwise.
Either of these 2 complications might have caused the problem, but I’m happy enough with the work-around to leave it alone.

Advertisements

Actions

Information

One response

20 10 2009
Christopher Shennan

I was having the white screen of death issues and this article helped direct me to the problem.

I had separate functions for configuring the widgets and validators but I had set up the options for the choices for the select elements within the configureWidgets() function. As a results when I tried to use the choices within the configureValidators() function they obviously weren’t defined.

I had to move the choices for the select elements out of the configureWidgets and pass them into each function like $this->configureWidgets($options); and $this->configureValidators($options); and update the variable names within each function appropriates.

Now everything works great.

Many thanks for the pointer.

Chris.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s




%d bloggers like this: