SimplePortal

Support => English Support => Topic started by: frymaster on May 07, 2011, 03:18:13 PM

Title: "Database error in block code" when adding valid php block
Post by: frymaster on May 07, 2011, 03:18:13 PM
When adding seemingly any valid non-black php page, preview works but clicking "Edit page" gives the error:

Quote
Database error in block code. Please check the code.

This is the case even when the code is
Code: [Select]
echo 'test';
...which works fine in preview.

Using SMF 2RC5, Simpleportal 2.3.3.  No other mods installed - I wiped the database and filesystem after encountering this error, but that hasn't helped.

No errors in the SMF log (it's totally blank since I just reinstalled), and no errors in apache logs.

Any ideas?
Title: Re: "Database error in block code" when adding php page
Post by: frymaster on May 07, 2011, 03:31:28 PM
on later investigation, this only happens when we have apache authentication on (as this is a test site, we're restricting access until it's ready)

is there a fix for this?
Title: Re: "Database error in block code" when adding valid php block
Post by: AngelinaBelle on May 12, 2011, 07:38:23 AM
I've just asked for dev help on this, but, as Sinan is busy working on the SMF 2.0 release, I hope you won't mind me taking a stab at it.
I don't know anything about how apache authentication, what it might do to SMF URLs or session ids or data posted from a form.
One suggestion would be to use maintenance mode instead -- this prevents anyone but admin from seeing anything but the "Sorry, we're in maintenance mode" message.
Are you getting any errors on your SMF error log?
Title: Re: "Database error in block code" when adding valid php block
Post by: frymaster on May 12, 2011, 11:52:03 AM
nope, nothing in the error log at all - nothing in the apache error log either.

apache auth shouldn't alter any existing server data - it certainly won't change URLs or POST data - but it will change the environment somewhat.  For example, there'll be an environment variable called REMOTE_USER set to the username entered into the auth popup

atm I'm more concerned about finishing up the website since it's meant to go live tomorrow, but when I get a moment I'll post the complete list of changes with auth on or off.
Title: Re: "Database error in block code" when adding valid php block
Post by: AngelinaBelle on May 12, 2011, 02:46:27 PM
You could try, in settings.php, setting
Code: [Select]
$db_show_debug=true;, and seeing what  you discover (look for complete SQL queries at the bottom of the page). You might look for the difference with apache authentication turned on or off -- of course, you need to be very cautious about allowing guests into the forum when you are displaying SQL queries and related database debugging information.
No matter what the problem turns out to be, I think I will be surprised, since I have no idea.

Since SimplePortal was not designed to work with apache authentication, and was not tested in that environment, there was no consideration given to what sort of affect it could have on the storing of php code to the database.
SimplePortal 2.3.8 © 2008-2024, SimplePortal