Block visibility PHP crash protection
iantresman - June 21, 2008 - 13:20
If I create or modify a block snippet in a block's "Page specific visibility settings", I could crash my Drupal set-up on displaying the faulty block code.
If I am not careful, I might not be able to re-edit the block contents, since the code will continue to crash the installation. What's the best way to ensure I can isolate and correct bad block code snippets?

Use a test site.
Use a test site.
Sure, but even that seems
Sure, but even that seems inefficient, having to re-install Drupal each time I make a silly PHP synatax error. For example:
I just thought that maybe someone had some experience of these, and could highlight some pros and cons.
This is a great idea. The
This is a great idea. The way Drupal handles bad code in a block feels like a critical core bug. But I have no idea how it can be fixed. Does PHP have any "test-eval" function?
But on the other hand that could be expensive, with all the queries usually run by blocks.
Test in new site but thats
Test in new site but thats gerrat !
http://forum.pcgames.ir
Solution
Try as I may, I was unable to crash Drupal 5.7 by inserting bad PHP code into the "PHP block visibility settings" section.
To be on the safe side, I created a test account, and ensured that the new block was visible only to the "Test" user. I was able to log-in to my site under two different account names, by using Firefox and MS Internet Explorer (actually the MS IE Tab add-on for Firefox)
Failing to return 'true' may
Failing to return 'true' may not be a mortal sin after all. Try bad code in the block content itself.
By the way, today while I was playing with some PHP code in Drupal 6 (although in a node, not in a block) I noticed that bad code was causing the "PHP input format" to be automatically unselected. I didn't check with a block, but progress may have been made after all.