Skip to content

Commit e643ee8

Browse files
committed
ext/spl: Remove spl_engine.h header
This doesn't really make the calling code clearer and it is barely used on top of that.
1 parent 8b1bb91 commit e643ee8

14 files changed

+58
-67
lines changed

UPGRADING.INTERNALS

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,17 @@ PHP 8.4 INTERNALS UPGRADE NOTES
261261
- The ext/session/php_session.h doesn't transitively include the
262262
ext/hash/php_hash.h header anymore.
263263

264+
i. ext/spl
265+
- The spl_engine.h header has been removed, this includes the following 3
266+
functions it was defining:
267+
- spl_instantiate_arg_ex1
268+
- spl_instantiate_arg_ex2
269+
- spl_instantiate_arg_n
270+
Instead manually instantiate the object with object_init_ex() and call
271+
the constructor via one of the zend_call_known_instance_method*()
272+
API. E.g. zend_call_known_instance_method_with_1_params(
273+
ce->constructor, Z_OBJ_P(return_value), NULL, &arg1);
274+
264275
========================
265276
4. OpCode changes
266277
========================

ext/phar/phar_internal.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@
5252
#include "Zend/zend_virtual_cwd.h"
5353
#include "ext/spl/spl_array.h"
5454
#include "ext/spl/spl_directory.h"
55-
#include "ext/spl/spl_engine.h"
5655
#include "ext/spl/spl_exceptions.h"
5756
#include "ext/spl/spl_iterators.h"
5857
#include "php_phar.h"

ext/phar/phar_object.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3576,7 +3576,10 @@ PHP_METHOD(Phar, offsetGet)
35763576

35773577
sfname = strpprintf(0, "phar://%s/%s", phar_obj->archive->fname, fname);
35783578
ZVAL_NEW_STR(&zfname, sfname);
3579-
spl_instantiate_arg_ex1(phar_obj->spl.info_class, return_value, &zfname);
3579+
3580+
/* Instantiate object and call constructor */
3581+
object_init_ex(return_value, phar_obj->spl.info_class);
3582+
zend_call_known_instance_method_with_1_params(phar_obj->spl.info_class->constructor, Z_OBJ_P(return_value), NULL, &zfname);
35803583
zval_ptr_dtor(&zfname);
35813584
}
35823585
}

ext/spl/config.m4

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
PHP_NEW_EXTENSION(spl, php_spl.c spl_functions.c spl_iterators.c spl_array.c spl_directory.c spl_exceptions.c spl_observer.c spl_dllist.c spl_heap.c spl_fixedarray.c, no,, -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1)
2-
PHP_INSTALL_HEADERS([ext/spl], [php_spl.h spl_array.h spl_directory.h spl_engine.h spl_exceptions.h spl_functions.h spl_iterators.h spl_observer.h spl_dllist.h spl_heap.h spl_fixedarray.h])
2+
PHP_INSTALL_HEADERS([ext/spl], [php_spl.h spl_array.h spl_directory.h spl_exceptions.h spl_functions.h spl_iterators.h spl_observer.h spl_dllist.h spl_heap.h spl_fixedarray.h])
33
PHP_ADD_EXTENSION_DEP(spl, pcre, true)
44
PHP_ADD_EXTENSION_DEP(spl, standard, true)
55
PHP_ADD_EXTENSION_DEP(spl, json)

ext/spl/config.w32

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33
EXTENSION("spl", "php_spl.c spl_functions.c spl_iterators.c spl_array.c spl_directory.c spl_exceptions.c spl_observer.c spl_dllist.c spl_heap.c spl_fixedarray.c", false /*never shared */, "/DZEND_ENABLE_STATIC_TSRMLS_CACHE=1");
44
PHP_SPL="yes";
5-
PHP_INSTALL_HEADERS("ext/spl", "php_spl.h spl_array.h spl_directory.h spl_engine.h spl_exceptions.h spl_functions.h spl_iterators.h spl_observer.h spl_dllist.h spl_heap.h spl_fixedarray.h");
5+
PHP_INSTALL_HEADERS("ext/spl", "php_spl.h spl_array.h spl_directory.h spl_exceptions.h spl_functions.h spl_iterators.h spl_observer.h spl_dllist.h spl_heap.h spl_fixedarray.h");

ext/spl/php_spl.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
#include "php_spl.h"
2626
#include "php_spl_arginfo.h"
2727
#include "spl_functions.h"
28-
#include "spl_engine.h"
2928
#include "spl_array.h"
3029
#include "spl_directory.h"
3130
#include "spl_iterators.h"

ext/spl/spl_directory.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030

3131
#include "php_spl.h"
3232
#include "spl_functions.h"
33-
#include "spl_engine.h"
3433
#include "spl_iterators.h"
3534
#include "spl_directory.h"
3635
#include "spl_directory_arginfo.h"
@@ -1532,7 +1531,9 @@ PHP_METHOD(RecursiveDirectoryIterator, getChildren)
15321531

15331532
ZVAL_LONG(&zflags, intern->flags);
15341533
ZVAL_STR_COPY(&zpath, intern->file_name);
1535-
spl_instantiate_arg_ex2(Z_OBJCE_P(ZEND_THIS), return_value, &zpath, &zflags);
1534+
/* Instantiate object and call constructor */
1535+
object_init_ex(return_value, Z_OBJCE_P(ZEND_THIS));
1536+
zend_call_known_instance_method_with_2_params(Z_OBJCE_P(ZEND_THIS)->constructor, Z_OBJ_P(return_value), NULL, &zpath, &zflags);
15361537
zval_ptr_dtor(&zpath);
15371538

15381539
subdir = spl_filesystem_from_obj(Z_OBJ_P(return_value));

ext/spl/spl_dllist.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#endif
2020

2121
#include "php.h"
22+
#include "zend_interfaces.h"
2223
#include "zend_exceptions.h"
2324
#include "zend_hash.h"
2425

@@ -27,7 +28,6 @@
2728
#include "ext/standard/php_var.h"
2829
#include "zend_smart_str.h"
2930
#include "spl_functions.h"
30-
#include "spl_engine.h"
3131
#include "spl_iterators.h"
3232
#include "spl_dllist.h"
3333
#include "spl_dllist_arginfo.h"

ext/spl/spl_engine.h

Lines changed: 0 additions & 45 deletions
This file was deleted.

ext/spl/spl_exceptions.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727

2828
#include "php_spl.h"
2929
#include "spl_functions.h"
30-
#include "spl_engine.h"
3130
#include "spl_exceptions.h"
3231

3332
PHPAPI zend_class_entry *spl_ce_LogicException;

0 commit comments

Comments
 (0)