[FX.php List] Fatal error: Cannot use object of type FX_Error

DC dan.cynosure at dbmscan.com
Tue Dec 13 21:08:34 MST 2005


Try this instead of your basic print_r() function:

print_r("<pre>".$result."</pre>");

You can also make it a function:

function pre($in, $exit=FALSE) {
	print_r("<pre>".$in."</pre>");
	if ($exit) {exit();}
}

Then call it like this:

pre($result);

or to exit right after showing the variable:

pre($result,TRUE);

It will turn that mess into something a little more readable in the 
browser.

As far as the error goes, it sounds like there are some spurious 
characters in the XML that are gunking up the xml parsing in FX.php. 
Did you look at line 6 with the mismatched tag notice? What is at line 
6?

dan

On Dec 13, 2005, at 10:51 PM, William Akey wrote:

> Hi Dale,
>
> Thanks for your help. As I mentioned in my original post, when I use
> print_r($result), and then exit, I get the following mess:
>
> FX_Error Object ( [error_message_prefix] => [mode] => 1 [level] =>   
> 1024
> [code] => 100 [message] => FX: ExecuteQuery XML error: Mismatched  tag 
> at
> line 6 [userinfo] => [backtrace] => Array ( [0] => Array ( [file] =>
> c:\Inetpub\wwwroot\FX\FX.php [line] => 1262 [function] => FX_Error   
> [class]
> => FX_Error [type] => -> [args] => Array ( [0] => ExecuteQuery XML   
> error:
> Mismatched tag at line 6 ) ) [1] => Array ( [file] =>
> c:\Inetpub\wwwroot\FX\FX.php [line] => 1417 [function] => ExecuteQuery
> [class] => FX [type] => -> [args] => Array ( [0] => -find ) ) [2]   => 
> Array
> ( [file] => c:\Inetpub\wwwroot\FX\FX.php [line] => 1641 [function] =>
> FMAction [class] => FX [type] => -> [args] => Array ( [0] => -find   
> [1] =>
> 1 [2] => full [3] => 1 ) ) [3] => Array ( [file] =>
> c:\Inetpub\wwwroot\sppc_web\search_results.php [line] => 62   
> [function] =>
> FMFind [class] => FX [type] => -> [args] => Array ( ) ) )   [callback] 
> => )
>
> I don't know how to interpret this. It does not look like records are
> returned even though, as I mentioned, the URL that is passed to the 
> database
> (shown by using define("DEBUG", true) ), is absolutely fine and, if
> followed, returns the correct and proper XML and proper data with no 
> error.
> I have not had this problem with other databases on the same server and
> using pretty much the same code.
>
> Any ideas of things to try to solve this would be much appreciated.
>
> Thanks
>
> William
>
>
> ----- Original Message -----
> From: "Dale Bengston" <dbengston at preservationstudio.com>
> To: "FX.php Discussion List" <fx.php_list at mail.iviking.org>
> Sent: Tuesday, December 13, 2005 6:51 PM
> Subject: Re: [FX.php List] Fatal error: Cannot use object of type 
> FX_Error
>
>
>> Hi William,
>>
>> What happens when you print_r($result) on the page? Are you getting
>> what you're expecting back from FX?
>>
>> -Dale
>> --
>> Dale Bengston | Streamline Studio, LLC | 
>> dbengston at streamline-studio.com
>> Associate Member, FileMaker Solutions Alliance
>>
>>
>>
>>
>>
>> On Dec 13, 2005, at 4:43 PM, William Akey wrote:
>>
>>> Hi Folks,
>>>
>>> I have a situation where I consistently get the following error:
>>>
>>> Fatal error: Cannot use object of type FX_Error as array in
>>> c:\Inetpub\wwwroot\sppc_web\search_results.php on line 67
>>>
>>> when I try to access $result['errorCode'] or $result['foundCount'].
>>>
>>> If I use: FX::isError($result), then I don't get the Fatal error
>>> message,
>>> but there is still an error. When I turn on define("DEBUG", true),
>>> and use
>>> Print_r ($result), I get the following page:
>>>
>>> ***************************
>>> Accessing FileMaker Pro 7 data.
>>>
>>> Using FileMaker URL:
>>> http://127.0.0.1:80/fmi/xml/FMPXMLRESULT.xml?-db=sppc_web.fp7&-
>>> lay=cgi_cty&-max=20&First_Name.op=eq&First_Name=Michael&-find
>>>
>>> FX_Error Object ( [error_message_prefix] => [mode] => 1 [level] =>
>>> 1024
>>> [code] => 100 [message] => FX: ExecuteQuery XML error: Mismatched
>>> tag at
>>> line 6 [userinfo] => [backtrace] => Array ( [0] => Array ( [file] =>
>>> c:\Inetpub\wwwroot\FX\FX.php [line] => 1262 [function] => FX_Error
>>> [class]
>>> => FX_Error [type] => -> [args] => Array ( [0] => ExecuteQuery XML
>>> error:
>>> Mismatched tag at line 6 ) ) [1] => Array ( [file] =>
>>> c:\Inetpub\wwwroot\FX\FX.php [line] => 1417 [function] => 
>>> ExecuteQuery
>>> [class] => FX [type] => -> [args] => Array ( [0] => -find ) ) [2]
>>> => Array
>>> ( [file] => c:\Inetpub\wwwroot\FX\FX.php [line] => 1641 [function] =>
>>> FMAction [class] => FX [type] => -> [args] => Array ( [0] => -find
>>> [1] => 1
>>> [2] => full [3] => 1 ) ) [3] => Array ( [file] =>
>>> c:\Inetpub\wwwroot\sppc_web\search_results.php [line] => 62
>>> [function] =>
>>> FMFind [class] => FX [type] => -> [args] => Array ( ) ) )
>>> [callback] => )
>>> ***********************************
>>>
>>> However, what is unusual is that, if I follow the URL above that is
>>> generated by the debug process, it works fine and returns perfect
>>> XML with
>>> an errorcode of "0" and the exact data that I would expect. I have
>>> tried
>>> everything I can think of, including reducing the search page to
>>> one single
>>> value and adding only one parameter to the FMFind() call. It seems
>>> that the
>>> XML that is being passed to the database works correctly, but
>>> somehow I still get some unknown error. Since I can't use
>>> $result['errorCode'], I can't even find out what the error is.
>>>
>>> Any help you could provide would be most welcome.
>>>
>>> Thanks
>>>
>>> William
>>> _______________________________________________
>>> FX.php_List mailing list
>>> FX.php_List at mail.iviking.org
>>> http://www.iviking.org/mailman/listinfo/fx.php_list
>>
>>
>>
>>
>> _______________________________________________
>> FX.php_List mailing list
>> FX.php_List at mail.iviking.org
>> http://www.iviking.org/mailman/listinfo/fx.php_list
>>
> _______________________________________________
> FX.php_List mailing list
> FX.php_List at mail.iviking.org
> http://www.iviking.org/mailman/listinfo/fx.php_list
>



More information about the FX.php_List mailing list