Skip to content
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

fix for PHP 7.3 API changes, and array_init always succeeds #7

Merged
merged 1 commit into from
Jun 27, 2018

Conversation

remicollet
Copy link
Contributor

From UPGRADING.INTERNALS

  a. array_init() and array_init_size() are not functions anymore.
     They don't return any values.

@adamdickmeiss adamdickmeiss merged commit 68271a5 into indexdata:master Jun 27, 2018
@adamdickmeiss
Copy link
Contributor

Thx

@remicollet remicollet deleted the issue-php73 branch June 27, 2018 12:50
@ryandesign
Copy link

Is this the correct thing to do for PHP 7.2 and earlier? I thought you would need to check PHP_VERSION_ID and if it's less than 70300 then check the return value otherwise don't.

@adamdickmeiss
Copy link
Contributor

adamdickmeiss commented Dec 10, 2018

Yep. php 7.1.25 _array_init always returns SUCCESS. So check is redundant.

ZEND_API int _array_init(zval arg, uint32_t size ZEND_FILE_LINE_DC) / {{{ */
{
ZVAL_NEW_ARR(arg);
_zend_hash_init(Z_ARRVAL_P(arg), size, ZVAL_PTR_DTOR, 0 ZEND_FILE_LINE_RELAY_CC);
return SUCCESS;
}

@ryandesign
Copy link

Ok great. I was curious, so I checked, and it used to return FAILURE in out of memory situations, but that was removed in php/php-src@87e3924 back in 2001 and since then it always returns SUCCESS. That change was included in PHP 4.1.0 and since phpyaz requires PHP 4.3.0 that should be fine. Now we just need a new release of phpyaz that contains the fix! :)

@adamdickmeiss
Copy link
Contributor

adamdickmeiss commented Dec 11, 2018 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants