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 build with PHP 7.4 #445

Merged
merged 1 commit into from
Nov 18, 2019
Merged

Fix build with PHP 7.4 #445

merged 1 commit into from
Nov 18, 2019

Conversation

sunpoet
Copy link
Contributor

@sunpoet sunpoet commented Nov 18, 2019

Build error on FreeBSD with PHP 7.4 RC6:

--- php_memcached.lo ---
/wrkdirs/usr/ports/databases/pecl-memcached/work-php74/memcached-3.1.4/php_memcached.c:3237:7: error: expected ';' after expression
        ulong key_index;
             ^
             ;
/wrkdirs/usr/ports/databases/pecl-memcached/work-php74/memcached-3.1.4/php_memcached.c:3237:2: error: use of undeclared identifier 'ulong'
        ulong key_index;
        ^
/wrkdirs/usr/ports/databases/pecl-memcached/work-php74/memcached-3.1.4/php_memcached.c:3237:8: error: use of undeclared identifier 'key_index'
        ulong key_index;
              ^
/wrkdirs/usr/ports/databases/pecl-memcached/work-php74/memcached-3.1.4/php_memcached.c:3250:49: error: use of undeclared identifier 'key_index'
        ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(options), key_index, key, value) {
                                                       ^
/wrkdirs/usr/ports/databases/pecl-memcached/work-php74/memcached-3.1.4/php_memcached.c:3255:44: error: use of undeclared identifier 'key_index'
                        if (!php_memc_set_option(intern, (long) key_index, value)) {
                                                                ^
5 errors generated.
*** [php_memcached.lo] Error code 1

Build error on FreeBSD with PHP 7.4 RC6:
--- php_memcached.lo ---
/wrkdirs/usr/ports/databases/pecl-memcached/work-php74/memcached-3.1.4/php_memcached.c:3237:7: error: expected ';' after expression
        ulong key_index;
             ^
             ;
/wrkdirs/usr/ports/databases/pecl-memcached/work-php74/memcached-3.1.4/php_memcached.c:3237:2: error: use of undeclared identifier 'ulong'
        ulong key_index;
        ^
/wrkdirs/usr/ports/databases/pecl-memcached/work-php74/memcached-3.1.4/php_memcached.c:3237:8: error: use of undeclared identifier 'key_index'
        ulong key_index;
              ^
/wrkdirs/usr/ports/databases/pecl-memcached/work-php74/memcached-3.1.4/php_memcached.c:3250:49: error: use of undeclared identifier 'key_index'
        ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(options), key_index, key, value) {
                                                       ^
/wrkdirs/usr/ports/databases/pecl-memcached/work-php74/memcached-3.1.4/php_memcached.c:3255:44: error: use of undeclared identifier 'key_index'
                        if (!php_memc_set_option(intern, (long) key_index, value)) {
                                                                ^
5 errors generated.
*** [php_memcached.lo] Error code 1
@sodabrew sodabrew merged commit 03f034f into php-memcached-dev:master Nov 18, 2019
@sodabrew
Copy link
Contributor

Thank you!

@fluffykhv
Copy link

There should be "long" instead of "zend_ulong" to avoid type conversion and possible uint64_t -> int32_t misuse

@sodabrew
Copy link
Contributor

sodabrew commented Nov 20, 2019

I think this is correct. For example the PHP codebase using zend_ulong:

https://github.com/php/php-src/blob/f7c44ef2a0e1e1e5bed5527b8899c66b00416f43/Zend/zend_objects.c#L238-L251

@fluffykhv
Copy link

but in your code used pure long as function parameter:
int php_memc_set_option(php_memc_object_t *intern, long option, zval *value)

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

Successfully merging this pull request may close these issues.

3 participants