-
Notifications
You must be signed in to change notification settings - Fork 120
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Compatibility with PHP 7.3 #124
Conversation
Per the upgrade notes, zend_fcall_info_cache is considered initialized if zend_fcall_info_cache.function_handler is set.
Woo! It compiles! Tests are now failing in exactly the expected manner due to changes in PHP master:
|
msgpack_pack.c
Outdated
@@ -280,15 +280,15 @@ static inline void msgpack_serialize_array(smart_str *buf, zval *val, HashTable | |||
value_noref = value; | |||
} | |||
|
|||
if ((Z_TYPE_P(value_noref) == IS_ARRAY && ZEND_HASH_GET_APPLY_COUNT(Z_ARRVAL_P(value_noref)) > 1)) { | |||
if (Z_TYPE_P(value_noref) == IS_ARRAY && Z_IS_RECURSIVE_P(value_noref)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the test failures may be related to this part.
Z_IS_RECURSIVE is mostly equiv. to ZEND_HASH_GET_APPLY_COUNT > 0 (not > 1)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the review! What do you recommend to bridge this gap? Is there a different check that will say if a single count is present?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sadly, I have no idea, probably @laruence will know
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting - the in-tree JSON extension is using GC_IS_RECURSIVE
instead of Z_IS_RECURSIVE
: https://github.com/php/php-src/blob/master/ext/json/json_encoder.c#L143
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was able to fix the yaml ext which have the same issue
php/pecl-file_formats-yaml#33
But this require a bit more change... need to find the proper fix.
I think this is working now for PHP 7.3, but it still fails for PHP master. I'm waiting for travis-ci/travis-ci#9717 to get a PHP 7.3 image on Travis CI. |
I think I understand the crux of the problem. This module has always behaved incorrectly and the tests were configured to ensure incorrect behavior. Given this recursive scenario:
In all versions of PHP 7.x the output of
The unit tests pack and unpack the variable to see how it goes through msgpack:
The unit tests then expect to see the following output. Note the expectation of iterating the recursion exactly once, whereas PHP itself does not iterate the recursion at all as seen above:
Therefore I believe the correct fix is to change the unit tests to match the PHP 7.3 required behavior (i.e. no longer being able to check that we've been through the recursion just once, but rather only being able to check before the zero-th pass) and to change the code to operate the same way for PHP 7.0-7.2. |
And there we have it, tests! Anybody around to code review now? |
Hellooooo PHP 7.3.0 is released already. I'm a bit blocked on updating the memcached pecl module, unless I release-note that msgpack is no longer supported. |
@sodabrew are you sure that msgpack unsupported? |
@andypost it does not compile with 7.3 |
Any update on this PR? |
I have tested this PR and the changes look good. Could we get this merged, please? |
@laruence perhaps you’ve seen this PR since before you did similar work this week? Did I waste my time here? |
msgpack/msgpack-php#124 msgpack/msgpack-php#127 ignore test suite result for now
No description provided.