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

php7[01234].extension.decimal: Override decimal to allow use in PHP 7 #400

Merged
merged 3 commits into from
Feb 9, 2025

Conversation

agj
Copy link
Contributor

@agj agj commented Feb 8, 2025

“decimal” is a PHP extension I added recently to Nixpkgs in this PR with the aid of @jtojnar. Here I patch it to make it work for PHP 7, as it requires the JSON extension which wasn't included in PHP until version 8. They also helped me get this working in issue #399.

This PR will have to wait until flake.lock is updated, though.

agj added 2 commits February 9, 2025 11:53
Depends on the JSON extension, which was included in PHP starting from
version 8, so it's added when building for PHP 7. See:
https://www.php.net/manual/en/json.installation.php
@agj agj force-pushed the extensions/fix-decimal-php7 branch from 2bddad9 to ae5ed57 Compare February 9, 2025 14:54
@agj
Copy link
Contributor Author

agj commented Feb 9, 2025

Ugh, looks like it's breaking for PHP 7.0 through 7.3… I'll take a look.

@jtojnar
Copy link
Member

jtojnar commented Feb 9, 2025

Looking at

/build/decimal-1.5.0/php_decimal.c: In function 'php_decimal_register_class_handlers':
/build/decimal-1.5.0/php_decimal.c:2732:43: error: assignment to 'zend_object_write_property_t' {aka 'void (*)(struct _zval_struct *, struct _zval_struct *, struct _zval_struct *, void **)'} from incompatible pointer type 'zval * (*)(zval *, zval *, zval *, void **)' {aka 'struct _zval_struct * (*)(struct _zval_struct *, struct _zval_struct *, struct _zval_struct *, void **)'} []

It might need

env = mergeEnv attrs {
NIX_CFLAGS_COMPILE = lib.optionals (lib.versionOlder prev.php.version "7.0") [
"-Wno-incompatible-${lib.optionalString isClang "function-"}pointer-types"
];
};
for PHP 7.0 to 7.3 (inclusive).

@agj
Copy link
Contributor Author

agj commented Feb 9, 2025

Thanks! There goes the change. Fingers crossed!

@jtojnar jtojnar merged commit 1d220e5 into fossar:master Feb 9, 2025
45 checks passed
@drupol
Copy link
Collaborator

drupol commented Feb 9, 2025

Thank you for this!

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