[Vtigercrm-developers] [PATCH] PearDatabase.php sanity check in Move()

Enrico Weigelt weigelt at metux.de
Thu May 10 17:13:35 PDT 2007


Hi folks,

as we sometimes get some errors like:

# Fatal error: Call to a member function Move() on a non-object 
# in .../include/database/PearDatabase.php on line 443

Obviously sometimes the query_result() method is called with an
non-existing result object.

This patch adds an check which throws an exception on missing 
result object, so we can easily track it down.


cu
-- 
---------------------------------------------------------------------
 Enrico Weigelt    ==   metux IT service

  phone:     +49 36207 519931         www:       http://www.metux.de/
  fax:       +49 36207 519932         email:     contact at metux.de
  cellphone: +49 174 7066481
---------------------------------------------------------------------
 -- DSL ab 0 Euro. -- statische IP -- UUCP -- Hosting -- Webshops --
---------------------------------------------------------------------
-------------- next part --------------
diff -ruN htdocs.orig/include/database/PearDatabase.php htdocs/include/database/PearDatabase.php
--- htdocs.orig/include/database/PearDatabase.php	2007-05-09 00:56:24.000000000 +0200
+++ htdocs/include/database/PearDatabase.php	2007-05-11 01:51:08.000000000 +0200
@@ -438,6 +438,8 @@
     function query_result(&$result, $row, $col=0)
     {		
 	//$this->println("ADODB query_result r=".$row." c=".$col);
+	if (!is_object($result))
+	    throw new Exception("result is not an object");
 	$result->Move($row);
 	$rowdata = $this->change_key_case($result->FetchRow());
 	//$this->println($rowdata);


More information about the vtigercrm-developers mailing list