[TYPO3-core] RFC: minor optimisation of getRecordRaw()

Ernesto Baschny [cron IT] ernst at cron-it.de
Fri Dec 1 10:40:32 CET 2006


Dmitry Dulepov wrote: on 01.12.2006 10:29:

> By the way, I had an idea to add a call to devLog to sql_fetch_assoc()
> function in case if passed $res is not valid. It could use
> debug_backtrace() (PHP>=4.3) to show who passed bad $res. Thus helps
> locating the problem much easier. While I had to put
> debug_print_backtrace() several times locally to discover problem
> origins, I never managed to make a good patch for it due to lack of time :)

This is something I have in my development code:

--- class.t3lib_db.php~ 2006-08-24 12:01:17.000000000 +0200
+++ class.t3lib_db.php  2006-08-24 12:01:29.000000000 +0200
@@ -742,6 +742,10 @@
         * @return      array           Associative array of result row.
         */
        function sql_fetch_assoc($res)  {
+               if (!$res) {
+                       echo
"<pre>".$sql."\n".mysql_error()."\n".print_r(debug_backtrace(),
true)."</pre>";
+                       die();
+               }
                return mysql_fetch_assoc($res);
        }

It proved to be VERY useful.

Cheers,
Ernesto


More information about the TYPO3-team-core mailing list