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

PHP 8.3 compatibility (and 8.x prototypes fixes) #616

Closed
wants to merge 31 commits into from
Closed
Changes from 1 commit
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
581acc4
Fix Imagick::getResourceLimit() proto
remicollet May 31, 2023
ab33ea0
Fix Imagick::evaluateImages() proto
remicollet May 31, 2023
47b415a
Fix Imagick::optimizeImageLayers() proto
remicollet May 31, 2023
98c7a4a
review object_handlers
remicollet May 31, 2023
d021813
Fix Imagick::getImageBlob() proto
remicollet May 31, 2023
451c176
Fix Imagick::getRegistry() proto
remicollet May 31, 2023
957b48a
Fix ImagickPixelIterator::getNextIteratorRow() proto
remicollet May 31, 2023
20ea362
Fix ImagickKernel::fromMatrix() proto
remicollet May 31, 2023
7233874
Fix Imagick::convolveImage() proto
remicollet May 31, 2023
a1d8c0b
Fix Imagick::subimageMatch() proto
remicollet May 31, 2023
6d02d99
Fix Imagick::setImageMask() proto
remicollet May 31, 2023
af0634a
unalias next/rewind for return type
remicollet May 31, 2023
8b48dc3
Fix Imagick::resetIterator() proto
remicollet May 31, 2023
0cf0083
unalias next/rewind for return type
remicollet May 31, 2023
d45e478
Fix Imagick::autoGammaImage() and autoOrient() proto
remicollet May 31, 2023
529bb5d
Fix Imagick::localContrastImage proto
remicollet May 31, 2023
a16c885
Fix Imagick::optimizeimagetransparency proto
remicollet May 31, 2023
c4aa095
regen
remicollet May 31, 2023
118db29
remove null case (as exception is raised
remicollet May 31, 2023
2fc8465
fix ImagickDraw
remicollet May 31, 2023
91c6092
handle ZEND_ARG_INFO_WITH_DEFAULT_VALUE in regen script
remicollet May 31, 2023
af1dcbd
try to fix -Werror=unused-parameter
remicollet May 31, 2023
3bd35ea
fix [-Wunused-but-set-variable]
remicollet May 31, 2023
3cbbc56
fix Imagick::convolveImage() proto for IM6
remicollet May 31, 2023
b4ede5d
add IMAGICK_NOT_EMPTY macro
remicollet Jun 1, 2023
d9bf728
Fix MagickPixel
remicollet Jun 1, 2023
dc300a2
Fix ImagickPixelIterator
remicollet Jun 1, 2023
c70071d
Fix ImagickKernel
remicollet Jun 1, 2023
ce164ce
use IMAGICK_NOT_EMPTY for Imagick class
remicollet Jun 1, 2023
797b71c
Fix Imagick class: use RETURN_THROWS after zpp and exception
remicollet Jun 1, 2023
9df9261
Fix [-Werror=unused-parameter]
remicollet Jun 1, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 40 additions & 3 deletions imagick.c
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,9 @@ static zend_object_value php_imagick_object_new_ex(zend_class_entry *class_type,
object_properties_init(&intern->zo, class_type);

#if PHP_VERSION_ID >= 70000
#if PHP_VERSION_ID < 80300
intern->zo.handlers = &imagick_object_handlers;
#endif
return &intern->zo;
#else
retval.handle = zend_objects_store_put(intern, NULL, (zend_objects_free_object_storage_t) php_imagick_object_free_storage, NULL TSRMLS_CC);
Expand Down Expand Up @@ -321,7 +323,9 @@ static zend_object_value php_imagickdraw_object_new_ex(zend_class_entry *class_t

zend_object_std_init(&intern->zo, class_type TSRMLS_CC);
object_properties_init(&intern->zo, class_type);
#if PHP_VERSION_ID < 80300
intern->zo.handlers = &imagickdraw_object_handlers;
#endif
#else
zend_object_value retval;
intern = (php_imagickdraw_object *) emalloc(sizeof(php_imagickdraw_object));
Expand Down Expand Up @@ -398,8 +402,9 @@ static zend_object_value php_imagickpixeliterator_object_new(zend_class_entry *c
object_properties_init(&intern->zo, class_type);

#if PHP_VERSION_ID >= 70000
#if PHP_VERSION_ID < 80300
intern->zo.handlers = &imagickpixeliterator_object_handlers;

#endif
return &intern->zo;
#else
retval.handle = zend_objects_store_put(intern, NULL, (zend_objects_free_object_storage_t) php_imagickpixeliterator_object_free_storage, NULL TSRMLS_CC);
Expand Down Expand Up @@ -439,8 +444,9 @@ static zend_object_value php_imagickpixel_object_new_ex(zend_class_entry *class_
object_properties_init(&intern->zo, class_type);

#if PHP_VERSION_ID >= 70000
#if PHP_VERSION_ID < 80300
intern->zo.handlers = &imagickpixel_object_handlers;

#endif
return &intern->zo;
#else
retval.handle = zend_objects_store_put(intern, NULL, (zend_objects_free_object_storage_t) php_imagickpixel_object_free_storage, NULL TSRMLS_CC);
Expand Down Expand Up @@ -494,8 +500,9 @@ static zend_object_value php_imagickkernel_object_new_ex(zend_class_entry *class
object_properties_init(&intern->zo, class_type);

#if PHP_VERSION_ID >= 70000
#if PHP_VERSION_ID < 80300
intern->zo.handlers = &imagickkernel_object_handlers;

#endif
return &intern->zo;
#else
retval.handle = zend_objects_store_put(intern, NULL, (zend_objects_free_object_storage_t) php_imagickkernel_object_free_storage, NULL TSRMLS_CC);
Expand Down Expand Up @@ -1041,7 +1048,9 @@ PHP_MINIT_FUNCTION(imagick)
Initialize the class (Imagick)
*/
INIT_CLASS_ENTRY(ce, PHP_IMAGICK_SC_NAME, php_imagick_class_methods);
#if PHP_VERSION_ID < 80300
ce.create_object = php_imagick_object_new;
#endif
imagick_object_handlers.clone_obj = php_imagick_clone_imagick_object;
imagick_object_handlers.read_property = php_imagick_read_property;
imagick_object_handlers.count_elements = php_imagick_count_elements;
Expand All @@ -1051,52 +1060,76 @@ PHP_MINIT_FUNCTION(imagick)
#endif

php_imagick_sc_entry = zend_register_internal_class(&ce TSRMLS_CC);
#if PHP_VERSION_ID >= 80300
php_imagick_sc_entry->create_object = php_imagick_object_new;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

create object affectation can be done this way at least since 8.1, just wanted to reduce complexity and avoid additional conditions.

php_imagick_sc_entry->default_object_handlers = &imagick_object_handlers;
#endif
zend_class_implements(php_imagick_sc_entry TSRMLS_CC, 2, zend_ce_iterator, im_ce_countable);

/*
Initialize the class (ImagickDraw)
*/
INIT_CLASS_ENTRY(ce, PHP_IMAGICKDRAW_SC_NAME, php_imagickdraw_class_methods);
#if PHP_VERSION_ID < 80300
ce.create_object = php_imagickdraw_object_new;
#endif
imagickdraw_object_handlers.clone_obj = php_imagick_clone_imagickdraw_object;
#if PHP_VERSION_ID >= 70000
imagickdraw_object_handlers.offset = XtOffsetOf(php_imagickdraw_object, zo);
imagickdraw_object_handlers.free_obj = php_imagickdraw_object_free_storage;
#endif
php_imagickdraw_sc_entry = zend_register_internal_class(&ce TSRMLS_CC);
#if PHP_VERSION_ID >= 80300
php_imagickdraw_sc_entry->create_object = php_imagickdraw_object_new;
php_imagickdraw_sc_entry->default_object_handlers = &imagickdraw_object_handlers;
#endif

/*
Initialize the class (ImagickPixelIterator)
*/
INIT_CLASS_ENTRY(ce, PHP_IMAGICKPIXELITERATOR_SC_NAME, php_imagickpixeliterator_class_methods);
#if PHP_VERSION_ID < 80300
ce.create_object = php_imagickpixeliterator_object_new;
#endif
imagickpixeliterator_object_handlers.clone_obj = NULL;
#if PHP_VERSION_ID >= 70000
imagickpixeliterator_object_handlers.offset = XtOffsetOf(php_imagickpixeliterator_object, zo);
imagickpixeliterator_object_handlers.free_obj = php_imagickpixeliterator_object_free_storage;
#endif
php_imagickpixeliterator_sc_entry = zend_register_internal_class(&ce TSRMLS_CC);
#if PHP_VERSION_ID >= 80300
php_imagickpixeliterator_sc_entry->create_object = php_imagickpixeliterator_object_new;
php_imagickpixeliterator_sc_entry->default_object_handlers = &imagickpixeliterator_object_handlers;
#endif
zend_class_implements(php_imagickpixeliterator_sc_entry TSRMLS_CC, 1, zend_ce_iterator);

/*
Initialize the class (ImagickPixel)
*/
INIT_CLASS_ENTRY(ce, PHP_IMAGICKPIXEL_SC_NAME, php_imagickpixel_class_methods);
#if PHP_VERSION_ID < 80300
ce.create_object = php_imagickpixel_object_new;
#endif
imagickpixel_object_handlers.clone_obj = php_imagick_clone_imagickpixel_object;
#if PHP_VERSION_ID >= 70000
imagickpixel_object_handlers.offset = XtOffsetOf(php_imagickpixel_object, zo);
imagickpixel_object_handlers.free_obj = php_imagickpixel_object_free_storage;
#endif

php_imagickpixel_sc_entry = zend_register_internal_class(&ce TSRMLS_CC);
#if PHP_VERSION_ID >= 80300
php_imagickpixel_sc_entry->create_object = php_imagickpixel_object_new;
php_imagickpixel_sc_entry->default_object_handlers = &imagickpixel_object_handlers;
#endif

#ifdef IMAGICK_WITH_KERNEL
/*
Initialize the class (ImagickKernel)
*/
INIT_CLASS_ENTRY(ce, PHP_IMAGICKKERNEL_SC_NAME, php_imagickkernel_class_methods);
#if PHP_VERSION_ID < 80300
ce.create_object = php_imagickkernel_object_new;
#endif
// Disabled until can be compiled under wall correctly
imagickkernel_object_handlers.get_debug_info = php_imagickkernel_get_debug_info;
imagickkernel_object_handlers.clone_obj = php_imagick_clone_imagickkernel_object;
Expand All @@ -1106,6 +1139,10 @@ PHP_MINIT_FUNCTION(imagick)
#endif

php_imagickkernel_sc_entry = zend_register_internal_class(&ce TSRMLS_CC);
#if PHP_VERSION_ID >= 80300
php_imagickkernel_sc_entry->create_object = php_imagickkernel_object_new;
php_imagickkernel_sc_entry->default_object_handlers = &imagickkernel_object_handlers;
#endif
#endif

php_imagick_initialize_constants (TSRMLS_C);
Expand Down