0

so im using m2e pro extension on magento 2.3 suddenly the synchronizing stopped from working. thats because that m2e pro uses their own cron job and they sends curl calls to the server, but my server response with BOM byte. script for exemple:

?php

$ch = curl_init(); curl_setopt_array($ch, array(

CURLOPT_URL => 'http://my-sire-ip/index.php/M2ePro/cron/test/',

CURLOPT_HTTPHEADER => array('Host: my-site-name.com'), CURLOPT_RETURNTRANSFER => 1 ));

var_dump(json_encode(curl_exec($ch))); // return string(8) ""\ufeff""

// "\ufeff" - this is BOM byte it should not be in response.

the response is:

string(8) ""\ufeff""

this is what stopping from their cron to work on my server. how can i remove this BOM byte so it will work properly?

1 Answer 1

0

I've just checked your test script with one of our clients which have M2EPro installed.

<?php

$ch = curl_init();
curl_setopt_array($ch, [
    CURLOPT_URL => 'http://clientdomain/M2ePro/cron/test',
    CURLOPT_RETURNTRANSFER => 1
]);

var_dump(json_encode(curl_exec($ch))); // string(4) ""ok""

The BOM byte is not being returned by the module. It could be worth checking searching the Magento dir for files which start with the byte order mark.

grep -rl $'\xEF\xBB\xBF' .
2
  • thank you for your answer, ive tried "grep -rl $'\xEF\xBB\xBF'". i get a lot of files. what can i do to fix it? Jul 30, 2019 at 16:21
  • There shouldn't be any files with the BOM byte, it sounds like during deployment something has gone wrong. You can use find combined with sed to remove all the BOM bytes. WARNING: I'd always advise making a copy of the M2 installation and testing this before running it on your production application. find . -type f -exec sed -i -e '1s/^\xEF\xBB\xBF//' {} \; Jul 31, 2019 at 11:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.