Fatal error: invalid xml string returned
| Project: | Amazon Module |
| Version: | 6.x-1.0-beta10 |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed |
Hi,
Excuse me for my lack of english...
I'm pretty new user of amazon's module and i've installed them for testing purpose.
I havre created a new content type with an amazon item field. When i submit a new content php crash down with the following message:
"
Fatal error: Uncaught exception 'Exception' with message 'String could not be parsed as XML' in C:\wamp\www\chap4\sites\all\modules\contrib\amazon\amazon.module:251 Stack trace: #0 C:\wamp\www\chap4\sites\all\modules\contrib\amazon\amazon.module(251): SimpleXMLElement->__construct('<?xml version="...') #1 C:\wamp\www\chap4\sites\all\modules\contrib\amazon\amazon.module(332): amazon_http_request('ItemLookup', Array) #2 C:\wamp\www\chap4\sites\all\modules\contrib\amazon\amazon.module(309): _amazon_item_batch_lookup_from_web(Array) #3 C:\wamp\www\chap4\sites\all\modules\contrib\amazon\amazon.module(289): amazon_item_lookup_from_web(Array) #4 C:\wamp\www\chap4\sites\all\modules\contrib\amazon\asin\asin.module(145): amazon_item_lookup(Array) #5 C:\wamp\www\chap4\sites\all\modules\contrib\amazon\asin\asin.module(99): _asin_load_items(Array) #6 C:\wamp\www\chap4\sites\all\modules\contrib\cck\content.module(1253): asin_field('validate', Object(stdClass), Array, Array, Array, NULL) #7 C:\wamp\www\chap4\sites\all\modules\contrib\cc in C:\wamp\www\chap4\sites\all\modules\contrib\amazon\amazon.module on line 251"
Unfortunately, i'm unable to determine the source of the error. I guess tha data returned by AWS arent well formated.
Might i be wrong?
kindely yours,
francois xavier
my config:
- drupal 6.14
- php 5.2.11

#1
Wow, that's a pretty nasty error. Please let me know
* what ASIN you entered
* what locale you're using (US? Canada? Japan?)
With that kind of information perhaps I can recreate the issue and improve the code.
Please export the CCK type you created as text and attach it to this as well.
Thanks for the report.
#2
Thanks a lot for your reply,
I'm using the French locale.
I've make additionnal tests using the amazon module test page (admin/settings/amazon/test):
with locale set to french:
- with an US ASIN (B0008JIW8U) or an invalid ASIN (falseasin) nothing appens.
- with a correct french asin (B000RO9WQM) php crash down
with locale set to 'United States':
- with a french ASIN (B000RO9WQM) or an invalid ASIN (falseasin) nothing appens
- with a correct us asin (B0008JIW8U) php crash down
I've the same behaviours using my CCK type. Issue remain with 'store amazon data locally' unchecked.
I've attached my type definition to this reply. It's pretty simple. this type came from the french translation of the 'using drupal' book.
is there a way to retrieve the data returned by AWS? it would be nice to know if the string is XML!
Also, how do you add an exception handler into the module that handles this kind of mistake?
thank you for your generous support
FX
#3
#4
I just tried both of the crash combinations you mention with the France and US locales, and have no trouble. PHP 5.2.15. Apache, Ubuntu.
I also used your cck content type, which worked fine for me.
I suspect this has something to do with your platform or PHP build.
Could you please try it on another machine, or a virtual machine? Also, please provide more details about your webserver environment. Apache + PHP version, server platform.
I doubt that I will be able to help you with this, as it appears to be something weird with your situation.
#5
Update: OK - I see you're running WAMP on Windows. You may want to try it with Xampp, or try a more normal server environment. At least see if you can narrow it down. My bet is that you won't see it outside your current environment, and it might even be that a new WAMP environment wouldn't show this.
Anybody else out there trying this on Windows?
#6
Thank you for spending time to solve my problem.
I am happy to know that the problem comes from me and your code is flawless!
Since I am better trained to use drupal and now I know I did not follow the best practices, especially during
updates.
For now, unfortunately I do not have time to work on amazon module. But promised, I remake all the test before the end
of the year to make sure everything runs smoothly on your module.
As you are American, I wish you good holiday and very good Thanksgiving!
François-Xavier