Uploaded image for project: 'PHP Legacy Driver'
  1. PHP Legacy Driver
  2. PHP-1485

On a big endian platform the Pid read from a generated MongoID does not match the PHP pid

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Won't Fix
    • Affects Version/s: 1.6.11
    • Fix Version/s: None
    • Component/s: pecl-mongo
    • Labels:
      None
    • Environment:
    • # Replies:
      1
    • Last comment by Customer:
      true

      Description

      The following test (provided with the PHP MongoDB driver) expects the 'pid' field read from a generated MongoID to match that of the PHP process id, but for a big endian platform it does not, so the test fails. Diff between expected and actual output is shown below.

      Test for PHP-359: getPID() does not return expected PID when called on custom MongoID object. [tests/no-servers/bug00359.phpt]
      003+ bool(false)
      003- bool(true)

      The test was run on PHP MongoDB driver built for a Linux Z system (big endian).

      If the code is modified so that for big endian systems the 2 bytes of the pid field are stored in reverse order then the test passes and does not cause other tests that were passing to fail (for the tests provided with the driver, running in standalone setup).

      The modification was made to types/id.c , diff as follows (for version 1.6.11)
      62c62,63
      < memcpy(data + 7, P + 2, 2);

      > memcpy(data + 7, P + 3, 1);
      > memcpy(data + 8, P + 2, 1);

      I'm not suggesting that this is a valid fix, just using it to show the nature of the issue.

      Please could you fix this issue.

        Attachments

          Activity

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Days since reply:
                3 years, 34 weeks, 5 days ago
                Date of 1st Reply: