Fatal error: Exception thrown without a stack frame in Unknown on line 0


If anyone is having this issue. It is most probably due to the establishment of a new mysql connection to a database (other than the one elgg is installed in), as in my case. The reason being that in some parts of elgg (mod/search/start.php) there are queries such as this:

$r = mysql_query('SELECT @@ft_min_word_len as min, @@ft_max_word_len as max');

The astute reader will notice that it's missing the second argument for mysql_query which although being optional is VERY important for portability and integration (with other systems)! (Again) when we establish a new mysql connection to another database (other than the one elgg is installed in), the mysql_query above returns an error / exception which is caught in a shutdown handler resulting in the mysterious fatal error. The fix is quick and simple:

$mysql_dblink = @mysql_connect($CONFIG->dbhost, $CONFIG->dbuser, $CONFIG->dbpass, true);
if($mysql_dblink) @mysql_select_db($CONFIG->dbname);
$r = mysql_query('SELECT @@ft_min_word_len as min, @@ft_max_word_len as max', $mysql_dblink);

Please consider issues like these in the next release, it would save a lot of time and energy.

Thank you!

  • I had this happen yesterday,took me down for a few minutes.But it had something to do with the izap plugin.It was the same fatal error message.Would this be the same as the error you are talking about?

    Would I take your code and replace the code at the top of your post?


  • I'm sorry I cannot assist you in relation to the plugin (since I don't use if of course). I am just explaining what worked for me, it may or may not work for you but there is a high probability that the cause it the same. The solution above only works if you have the exact same setup (i.e. no extra plugins + external database connection). Anything else is beyond my scope.