GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Invalid integer string convertion from PHP serialized .msgpack · Issue #226 · msgpack/msgpack-javascript

Invalid integer string convertion from PHP serialized .msgpack #226

New issue
Copy link
New issue
Copy link
Open
Open
Invalid integer string convertion from PHP serialized .msgpack#226
Copy link

Description

@RemiLelaidier
RemiLelaidier
opened on Apr 14, 2023
Issue body actions

Hi,

I am currently working on a project where I serialize JSON objects using the php library msgpack-php, but when I try to deserialize these objects using the javascript library msgpack-javascript, my integers are truncated.

PHP :

$data = [
    '7355750935770677725' => "test",
];

$msg = msgpack_pack($data);

...

JS :

import { decode } from '@msgpack/msgpack';

const decoded = decode(entry);

console.log(decoded)

Result :

{  '7355750935770677000': 'test'  }

As you can see the last three digits of my integer are set to 0.

This seems to be an interoperability problem between the php library and Node.js

Activity

  1. BerndAmend commented on Jun 1, 2023

    @BerndAmend
    BerndAmend
    on Jun 1, 2023
    More actions

    Your number is bigger than Number.MAX_SAFE_INTEGER and can therefore not be processed as a JavaScript number.
    You may need to have a look at the JavaScripts BigInt type and the DecoderOption useBigInt64.

  2. WebReflection commented on Feb 21, 2025

    @WebReflection
    WebReflection
    on Feb 21, 2025
    More actions

    curious to know, as PHP has both associative arrays and regular arrays or stdClass, how MessagePack addresses those ... clearly in here if MessagePack JS creates an array with such length some concern might rightly so raise?

    Reacted by Rémi Lelaidier - RLFly.fr
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402503 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.