Uploaded image for project: 'Thrift'
  1. Thrift
  2. THRIFT-3874

_TSPEC is not populated on de-serialization of type classes

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 0.9.3
    • Fix Version/s: None
    • Component/s: PHP - Compiler
    • Labels:
      None
    • Patch Info:
      Patch Available
    • Flags:
      Patch

      Description

      When type class which was serialized and deserialized by internal PHP functions (for example, if data was stored to memcache and then retrieved) is used in requests, thrift_extension gives an 'Attempt to send non-Thrift object as a T_STRUCT' error.

      This is because thrift_extension binary_serialize() function is tries to access to the $_TSPEC static property of object to determine it's target structure. Static $_TSPEC array for generated PHP classes is populated in __construct(). But when objects are deserialized, __construct() isn't called, instead of that PHP calls __wakeup() function. So type class should be instantiated once before sending it via Thrift.

      The solution is to move code that populates $_TSPEC out of constructor to the generic function, and call this function both in __construct() and __wakeup() functions.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                sashakavun Aleksandr Kavun
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated: