GithubHelp home page GithubHelp logo

Comments (9)

caponica avatar caponica commented on June 10, 2024

I think I had that error before... but I can't remember how to fix it :-/

Have you tried with a real file (saved on disk) instead of a temp file?

The basic method you're using looks reasonable. My code looks similar:

    $clientPack = $mwsClientPool->getFeedAndReportClientPack();
    $fileHandle = @fopen($fullFilePath, 'r');
    /** @var \MarketplaceWebService_Model_SubmitFeedResponse $mwsResponse */
    $mwsResponse = $clientPack->callSubmitFeed($feedType, $fileHandle);

from amazonmwscomplete.

bizou78 avatar bizou78 commented on June 10, 2024

Thank you for your fast response, i'm gonna try your solution as soon as possible and i come back for tell you if it's working.

Thank you very much.

from amazonmwscomplete.

bizou78 avatar bizou78 commented on June 10, 2024

Hi,

I just test your solution and i have the same issue with a real file save on Disk.

you can show my code below:

`$fullPAth = '/var/www/testAmazon/document/report.txt';
var_dump($fullPAth);

    $feedHandle = @fopen($fullPAth, 'r');

    var_dump($feedHandle);
    fwrite($feedHandle, $feed);

    $productClientPackUsa->callSubmitFeed('_POST_PRODUCT_DATA_', $feedHandle);
    rewind($feedHandle);

    @fclose($feedHandle);`

and the var_dump($feedhandle): resource(573, stream)

I don't know what is going wrong here.

Thank you for your help.

from amazonmwscomplete.

bizou78 avatar bizou78 commented on June 10, 2024

I try to follow the code and i think i find something in /var/www/testAmazon/vendor/caponica/amazon-mws-complete/src/AmazonPhpClientLibrary/MarketplaceWebService/Client.php

var_dump($headers);
array_push($headers, "Content-Type: " . $request->getContentType()->toString());
      var_dump($headers);

The firsts var_dump() give me a response

/var/www/testAmazon/vendor/caponica/amazon-mws-complete/src/AmazonPhpClientLibrary/MarketplaceWebService/Client.php:1454: array (size=0) empty

But the second return nothing.

Do you think the problem is here ?

from amazonmwscomplete.

bizou78 avatar bizou78 commented on June 10, 2024

Finaly i find the problem, it's from ContentType.php

public function isSetParameters() { return count ($this->fields['Parameters']['FieldValue']) > 0; }
the function call the function count but $this->fields['Parameters']['fieldValue'] is not an array

from amazonmwscomplete.

bizou78 avatar bizou78 commented on June 10, 2024

So i change the function by
public function isSetParameters() { if (is_array($this->fields['Parameters']['FieldValue'])){ return count ($this->fields['Parameters']['FieldValue']) > 0; }else{ return false; } }

and it's work for me.

Do you think it's good ?

from amazonmwscomplete.

caponica avatar caponica commented on June 10, 2024

I'll try to take a look at this later today and get back to you

from amazonmwscomplete.

caponica avatar caponica commented on June 10, 2024

OK, so this is caused by your PHP version handling count() differently to PHP<7.2.0.

Changing the Amazon library is not the best idea, since it will be over-written when the library pack is next updated. (This is obviously frustrating, since some of the code in there is... interesting.)

If you're using PHP 7.2.x I guess you're likely to run into several compatibility issues until Amazon updates the codebase.

Based on the documentation, I'm guessing that you are getting a warning (rather than a fatal error) - is that correct? If so then you may be better using a custom error handler to deal with it rather than changing the Amazon library.

See discussions here and here for more insight, as well as the PHP docs here.

from amazonmwscomplete.

bizou78 avatar bizou78 commented on June 10, 2024

Sorry for my absence and thank you for your answer.

At the moment, i just change my php version for the 7.1 and it's work very well.

I will wait for use the 7.2 :)

Thank you for you help.

from amazonmwscomplete.

Related Issues (18)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.