MyBB Community Forums

Full Version: Error logging doesn't log the script name and line number for SQL errors
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi, having activated error logging, MyBB logs errors in the file error.log without the script name and line number, such as the following:

<error>
	<dateline>1371742556</dateline>
	<script></script>
	<line>0</line>
	<type>20</type>
	<friendly_type>MyBB SQL Error</friendly_type>
	<message>SQL Error: 22P02 - ERROR:  invalid input syntax for integer: «»
LINE 4:     AND p.dateline <= ''
                              ^

Query: 
				SELECT COUNT(p.dateline) AS count FROM mybb_posts p
				WHERE p.tid = '1'
				AND p.dateline <= ''
				AND (p.visible='0' OR p.visible='1')
			</message>
</error>

Is this intented? Shouldn't it be a way for MyBB error handling to detect in which script the SQL query was called, and log it, so we can know what file to search for errors? In the above example, it should have logged:
<script>showthread.php</script>
Also, it would be a great plus if it also had the approximate line of the code that caused the error.

This happens to me in MyBB 1.6.10 using both MySQLi 5.5.24 and PostgreSQL 9.2.1
This is actually intended because all errors are thrown in inc/db_*.php which isn't helpful either. A debug trace would help but I'm not sure if it is planned for future versions.