Skip to content

Commit ba04525

Browse files
committed
Remove get_constructor object handler
1 parent ddd472b commit ba04525

8 files changed

Lines changed: 7 additions & 19 deletions

File tree

NEWS

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,9 +126,8 @@ PHP NEWS
126126
- PGSQL:
127127
. Enabled 64 bits support for pg_lo_truncate()/pg_lo_tell()
128128
if the server supports it. (KentarouTakeda)
129-
. pg_fetch_object() now surfaces non-instantiable class errors
130-
before fetching, resolves the constructor via the get_constructor
131-
handler, and reports the empty-constructor ValueError on the
129+
. pg_fetch_object() now surfaces non-instantiable class errorsv before
130+
fetching, and reports the empty-constructor ValueError on the
132131
$constructor_args argument. (David Carlier)
133132

134133
- Phar:

UPGRADING.INTERNALS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,10 @@ PHP 8.6 INTERNALS UPGRADE NOTES
110110
. Added ZEND_CONTAINER_OF().
111111
. The OPENBASEDIR_CHECKPATH() compatibility macro has been removed, instead
112112
use php_check_open_basedir() directly.
113+
. The get_constructor object handler has been removed.
114+
Instead to mark an internal class as not instantiable the new
115+
#[\NonInstantiableClass("Reason")] attribute should be attached to the
116+
class definition in the stubs.
113117

114118
========================
115119
2. Build system changes

Zend/Optimizer/escape_analysis.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,6 @@ static bool is_allocation_def(zend_op_array *op_array, zend_ssa *ssa, int def, i
165165
if (ce
166166
&& !ce->parent
167167
&& !ce->create_object
168-
&& ce->default_object_handlers->get_constructor == zend_std_get_constructor
169168
&& ce->default_object_handlers->dtor_obj == zend_objects_destroy_object
170169
&& !ce->constructor
171170
&& !ce->destructor
@@ -234,7 +233,6 @@ static bool is_local_def(zend_op_array *op_array, zend_ssa *ssa, int def, int va
234233
script, op_array, opline);
235234
if (ce
236235
&& !ce->create_object
237-
&& ce->default_object_handlers->get_constructor == zend_std_get_constructor
238236
&& ce->default_object_handlers->dtor_obj == zend_objects_destroy_object
239237
&& !ce->constructor
240238
&& !ce->destructor

Zend/Optimizer/zend_inference.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3394,8 +3394,7 @@ static zend_always_inline zend_result _zend_update_type_info(
33943394
/* New objects without constructors cannot escape. */
33953395
if (ce
33963396
&& !ce->constructor
3397-
&& !ce->create_object
3398-
&& ce->default_object_handlers->get_constructor == zend_std_get_constructor) {
3397+
&& !ce->create_object) {
33993398
tmp &= ~MAY_BE_RCN;
34003399
}
34013400
UPDATE_SSA_TYPE(tmp, ssa_op->result_def);

Zend/zend_iterators.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ static const zend_object_handlers iterator_object_handlers = {
4242
NULL, /* unset dim */
4343
NULL, /* props get */
4444
NULL, /* method get */
45-
NULL, /* get ctor */
4645
NULL, /* get class name */
4746
NULL, /* cast */
4847
NULL, /* count */

Zend/zend_object_handlers.c

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2173,12 +2173,6 @@ ZEND_API ZEND_COLD bool zend_std_unset_static_property(const zend_class_entry *c
21732173
}
21742174
/* }}} */
21752175

2176-
ZEND_API zend_function *zend_std_get_constructor(zend_object *zobj) /* {{{ */
2177-
{
2178-
return NULL;
2179-
}
2180-
/* }}} */
2181-
21822176
ZEND_API int zend_std_compare_objects(zval *o1, zval *o2) /* {{{ */
21832177
{
21842178
zend_object *zobj1, *zobj2;
@@ -2637,7 +2631,6 @@ ZEND_API const zend_object_handlers std_object_handlers = {
26372631
zend_std_unset_dimension, /* unset_dimension */
26382632
zend_std_get_properties, /* get_properties */
26392633
zend_std_get_method, /* get_method */
2640-
zend_std_get_constructor, /* get_constructor */
26412634
zend_std_get_class_name, /* get_class_name */
26422635
zend_std_cast_object_tostring, /* cast_object */
26432636
NULL, /* count_elements */

Zend/zend_object_handlers.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,6 @@ typedef zend_array *(*zend_object_get_properties_for_t)(zend_object *object, zen
153153
/* Andi - EX(fbc) (function being called) needs to be initialized already in the INIT fcall opcode so that the parameters can be parsed the right way. We need to add another callback for this.
154154
*/
155155
typedef zend_function *(*zend_object_get_method_t)(zend_object **object, zend_string *method, const zval *key);
156-
typedef zend_function *(*zend_object_get_constructor_t)(zend_object *object);
157156

158157
/* free_obj should release any resources the object holds, without freeing the
159158
* object structure itself. The object does not need to be in a valid state after
@@ -221,7 +220,6 @@ struct _zend_object_handlers {
221220
zend_object_unset_dimension_t unset_dimension; /* required */
222221
zend_object_get_properties_t get_properties; /* required */
223222
zend_object_get_method_t get_method; /* required */
224-
zend_object_get_constructor_t get_constructor; /* required */
225223
zend_object_get_class_name_t get_class_name; /* required */
226224
zend_object_cast_t cast_object; /* required */
227225
zend_object_count_elements_t count_elements; /* optional */
@@ -251,7 +249,6 @@ ZEND_API zend_function *zend_std_get_static_method(const zend_class_entry *ce, z
251249
ZEND_API zval *zend_std_get_static_property_with_info(zend_class_entry *ce, zend_string *property_name, int type, struct _zend_property_info **prop_info);
252250
ZEND_API zval *zend_std_get_static_property(zend_class_entry *ce, zend_string *property_name, int type);
253251
ZEND_API ZEND_COLD bool zend_std_unset_static_property(const zend_class_entry *ce, const zend_string *property_name);
254-
ZEND_API zend_function *zend_std_get_constructor(zend_object *object);
255252
ZEND_API struct _zend_property_info *zend_get_property_info(const zend_class_entry *ce, zend_string *member, int silent);
256253
ZEND_API HashTable *zend_std_get_properties(zend_object *object);
257254
ZEND_API HashTable *zend_get_properties_no_lazy_init(zend_object *zobj);

ext/com_dotnet/com_handlers.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -524,7 +524,6 @@ zend_object_handlers php_com_object_handlers = {
524524
com_dimension_delete,
525525
com_properties_get,
526526
com_method_get,
527-
zend_std_get_constructor,
528527
com_class_name_get,
529528
com_object_cast,
530529
com_object_count,

0 commit comments

Comments
 (0)