ajax bug in 1.2.4

A place for users and developers of the Xataface to discuss and receive support.

ajax bug in 1.2.4

Postby kevinwen » Thu Jun 17, 2010 5:04 pm

Hi, Steve

I found a bug in 1.2.4 when deleting an attachement, while I do it well in 1.2.2. Our application uses E_ALL level for error reporting. Here's how I recreate the bug:

In 1.2.4, $fieldDef['mimetype'] is undefined at line 62 in xataface/actions/delete_file.php, and evaluating it will result in a E_NOTICE because of E_ALL level of error reporting. In chain, it returns this as part of the response to XHR object, even if all actions were completely done. That's why an exception is thrown in xataface/js/delete_file.js.

Code: Select all
$mimeTypeField =& $record->_table->getField($fieldDef['mimetype']);


In 1.2.2, since you put the following code in xataface/dataface-public-api.php at line 44, the problem above won't happen because E_NOTICE will not be reported:

Code: Select all
error_reporting(E_ALL^E_NOTICE);


Can we do something to solve this problem, or you would consider this as a bug?
kevinwen
 
Posts: 109
Joined: Mon Dec 28, 2009 3:44 pm

Re: ajax bug in 1.2.4

Postby shannah » Fri Jun 18, 2010 9:51 am

I have fixed this in SVN. Here is the DIFF:

Code: Select all
Index: delete_file.php
===================================================================
--- delete_file.php   (revision 1867)
+++ delete_file.php   (revision 1868)
@@ -59,9 +59,11 @@
         @unlink($filePath);
         
         $record->setValue($fieldDef['Field'], null);
-         $mimeTypeField =& $record->_table->getField($fieldDef['mimetype']);
-         if ( !PEAR::isError($mimeTypeField) ){
-            $record->setValue($fieldDef['mimetype'], null);
+         if ( @$fieldDef['mimetype'] ){
+            $mimeTypeField =& $record->_table->getField($fieldDef['mimetype']);
+            if ( !PEAR::isError($mimeTypeField) ){
+               $record->setValue($fieldDef['mimetype'], null);
+            }
         }
         $res = $record->save();
         if ( PEAR::isError($res) ) return $res;
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm


Return to Xataface Users

Who is online

Users browsing this forum: No registered users and 38 guests

Powered by Dataface
© 2005-2007 Steve Hannah All rights reserved