implications of changing serialize_precision to -1

  • Unknown's avatar

    Hi,

    I’m well out of my depth on this question and really need some advice. This is in context of a problem which arose with an EPOS-woocommerce integration which is, hopefully, about to be implemented.

    I’ve been asked by the developer to change serialize_precision in php.ini to -1

    “I think your server, for whatever reason, has that value set to something other than the default which, when data is serialised in JSON format to be sent to the API, the precision of the TotalAmount property changes leading to this (from the log):

    [2019-08-04 22:01:06] api_create_transaction (failed) Failed to create transaction
    Response: “The field TotalAmount must match the regular expression ‘^(-)?(\d){1,10}(\.\d{0,2})?$’.”
    Request: {“DateTime”:”2019-08-04T22:01:06.000Z”,”StatusId”:8,”TotalAmount”:95.4500000000000028421709430404007434844970703125,”AdjustStock”:false,”IsTransactionIncTax”:true,”CustomerId”:2705835}

    “Notice the TotalAmount has a huge number of decimal places. It’s not possible to round the data, or manipulate it at all once it has been serialised, so the fix I pushed recently to fix this issue, had no effect, because the TotalAmount was already to two decimal places.”

    Should I just do as asked?

    The blog I need help with is: (visible only to logged in users)

  • Unknown's avatar

    The blog I need help with is not jimmypowdrellcampbell.wordpress.com! (Didn’t expect that to be appended)!

  • Unknown's avatar

    Apologies – another unexpected change to what I thought I was posting. Part of the error message got truncated.

    I’ll try (without the blockquote) to post that part again just for clarity:

    Request: {“DateTime”:”2019-08-04T22:01:06.000Z”,”StatusId”:8,”TotalAmount”:95.4500000000000028421709430404007434844970703125,”AdjustStock”:false,”IsTransactionIncTax”:true,”CustomerId”:2705835}

  • Unknown's avatar

    nope – same deal – truncated again.

    I’ll try separating it into different lines! :-)

    Request:
    {
    “DateTime”:”2019-08-04T22:01:06.000Z”,
    “StatusId”:8,
    “TotalAmount”:95.4500000000000028421709430404007434844970703125,
    “AdjustStock”:false,
    “IsTransactionIncTax”:true,
    “CustomerId”:2705835
    }

  • Hi there,

    You have posted in the support forum for free sites hosted on WordPress.com. We do not provide support here for the open source WordPress software found on WordPress.org, or for specific plugins for that software like WooCommerce.

    You can find the WooCommerce forums at https://wordpress.org/support/plugin/woocommerce/ – hopefully they will be able to advise you on this.

  • Unknown's avatar

    Ah… of course! Thank you!

  • No worries! Take care :)

  • The topic ‘implications of changing serialize_precision to -1’ is closed to new replies.