Skip to content

Commit a5cacba

Browse files
authored
ext/spl: Remove spl_engine.h header (#14418)
And convert calls to spl_instantiate_arg_* to the new object_init_with_constructor() API
1 parent d8795a3 commit a5cacba

File tree

12 files changed

+98
-110
lines changed

12 files changed

+98
-110
lines changed

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: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3540,9 +3540,7 @@ PHP_METHOD(Phar, offsetGet)
35403540
{
35413541
char *fname, *error;
35423542
size_t fname_len;
3543-
zval zfname;
35443543
phar_entry_info *entry;
3545-
zend_string *sfname;
35463544

35473545
if (zend_parse_parameters(ZEND_NUM_ARGS(), "p", &fname, &fname_len) == FAILURE) {
35483546
RETURN_THROWS();
@@ -3574,10 +3572,16 @@ PHP_METHOD(Phar, offsetGet)
35743572
efree(entry);
35753573
}
35763574

3577-
sfname = strpprintf(0, "phar://%s/%s", phar_obj->archive->fname, fname);
3575+
zend_string *sfname = strpprintf(0, "phar://%s/%s", phar_obj->archive->fname, fname);
3576+
zval zfname;
35783577
ZVAL_NEW_STR(&zfname, sfname);
3579-
spl_instantiate_arg_ex1(phar_obj->spl.info_class, return_value, &zfname);
3578+
3579+
/* Instantiate object and call constructor */
3580+
zend_result is_initialized = object_init_with_constructor(return_value, phar_obj->spl.info_class, 1, &zfname, NULL);
35803581
zval_ptr_dtor(&zfname);
3582+
if (is_initialized == FAILURE) {
3583+
RETURN_THROWS();
3584+
}
35813585
}
35823586
}
35833587
/* }}} */

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
@@ -24,7 +24,6 @@
2424
#include "php_spl.h"
2525
#include "php_spl_arginfo.h"
2626
#include "spl_functions.h"
27-
#include "spl_engine.h"
2827
#include "spl_array.h"
2928
#include "spl_directory.h"
3029
#include "spl_iterators.h"

ext/spl/spl_directory.c

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929

3030
#include "php_spl.h"
3131
#include "spl_functions.h"
32-
#include "spl_engine.h"
3332
#include "spl_iterators.h"
3433
#include "spl_directory.h"
3534
#include "spl_directory_arginfo.h"
@@ -1516,7 +1515,6 @@ PHP_METHOD(RecursiveDirectoryIterator, hasChildren)
15161515
/* {{{ Returns an iterator for the current entry if it is a directory */
15171516
PHP_METHOD(RecursiveDirectoryIterator, getChildren)
15181517
{
1519-
zval zpath, zflags;
15201518
spl_filesystem_object *intern = spl_filesystem_from_obj(Z_OBJ_P(ZEND_THIS));
15211519
spl_filesystem_object *subdir;
15221520
char slash = SPL_HAS_FLAG(intern->flags, SPL_FILE_DIR_UNIXPATHS) ? '/' : DEFAULT_SLASH;
@@ -1529,10 +1527,15 @@ PHP_METHOD(RecursiveDirectoryIterator, getChildren)
15291527
RETURN_THROWS();
15301528
}
15311529

1532-
ZVAL_LONG(&zflags, intern->flags);
1533-
ZVAL_STR_COPY(&zpath, intern->file_name);
1534-
spl_instantiate_arg_ex2(Z_OBJCE_P(ZEND_THIS), return_value, &zpath, &zflags);
1535-
zval_ptr_dtor(&zpath);
1530+
zval params[2];
1531+
ZVAL_STR_COPY(&params[0], intern->file_name);
1532+
ZVAL_LONG(&params[1], intern->flags);
1533+
1534+
zend_result is_initialized = object_init_with_constructor(return_value, Z_OBJCE_P(ZEND_THIS), 2, params, NULL);
1535+
zval_ptr_dtor_str(&params[0]);
1536+
if (is_initialized == FAILURE) {
1537+
RETURN_THROWS();
1538+
}
15361539

15371540
subdir = spl_filesystem_from_obj(Z_OBJ_P(return_value));
15381541
if (subdir) {

ext/spl/spl_dllist.c

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

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

2526
#include "php_spl.h"
2627
#include "ext/standard/php_var.h"
2728
#include "zend_smart_str.h"
2829
#include "spl_functions.h"
29-
#include "spl_engine.h"
3030
#include "spl_iterators.h"
3131
#include "spl_dllist.h"
3232
#include "spl_dllist_arginfo.h"

ext/spl/spl_engine.h

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

ext/spl/spl_fixedarray.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@
2020
#endif
2121

2222
#include "php.h"
23+
#include "zend_interfaces.h"
2324
#include "zend_exceptions.h"
2425

2526
#include "php_spl.h"
2627
#include "spl_fixedarray_arginfo.h"
2728
#include "spl_functions.h"
28-
#include "spl_engine.h"
2929
#include "spl_fixedarray.h"
3030
#include "spl_exceptions.h"
3131
#include "spl_iterators.h"

ext/spl/spl_heap.c

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

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

2425
#include "php_spl.h"
2526
#include "spl_functions.h"
26-
#include "spl_engine.h"
2727
#include "spl_iterators.h"
2828
#include "spl_heap.h"
2929
#include "spl_heap_arginfo.h"

0 commit comments

Comments
 (0)