Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
8 changes: 4 additions & 4 deletions ext/spl/php_spl.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ static zend_class_entry * spl_find_ce_by_name(zend_string *name, bool autoload)
PHP_FUNCTION(class_parents)
{
zval *obj;
zend_class_entry *parent_class, *ce;
zend_class_entry *ce;
bool autoload = true;

/* We do not use Z_PARAM_OBJ_OR_STR here to be able to exclude int, float, and bool which are bogus class names */
Expand All @@ -86,7 +86,7 @@ PHP_FUNCTION(class_parents)
}

array_init(return_value);
parent_class = ce->parent;
const zend_class_entry *parent_class = ce->parent;
while (parent_class) {
spl_add_class_name(return_value, parent_class, 0, 0);
parent_class = parent_class->parent;
Expand All @@ -99,7 +99,7 @@ PHP_FUNCTION(class_implements)
{
zval *obj;
bool autoload = true;
zend_class_entry *ce;
const zend_class_entry *ce;

/* We do not use Z_PARAM_OBJ_OR_STR here to be able to exclude int, float, and bool which are bogus class names */
if (zend_parse_parameters(ZEND_NUM_ARGS(), "z|b", &obj, &autoload) == FAILURE) {
Expand Down Expand Up @@ -128,7 +128,7 @@ PHP_FUNCTION(class_uses)
{
zval *obj;
bool autoload = true;
zend_class_entry *ce;
const zend_class_entry *ce;

/* We do not use Z_PARAM_OBJ_OR_STR here to be able to exclude int, float, and bool which are bogus class names */
if (zend_parse_parameters(ZEND_NUM_ARGS(), "z|b", &obj, &autoload) == FAILURE) {
Expand Down
2 changes: 1 addition & 1 deletion ext/spl/spl_array.c
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ static void spl_array_object_free_storage(zend_object *object)
static zend_object *spl_array_object_new_ex(zend_class_entry *class_type, zend_object *orig, int clone_orig)
{
spl_array_object *intern;
zend_class_entry *parent = class_type;
const zend_class_entry *parent = class_type;
int inherited = 0;

intern = zend_object_alloc(sizeof(spl_array_object), parent);
Expand Down
4 changes: 2 additions & 2 deletions ext/spl/spl_dllist.c
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ static void spl_dllist_object_free_storage(zend_object *object) /* {{{ */
static zend_object *spl_dllist_object_new_ex(zend_class_entry *class_type, zend_object *orig, int clone_orig) /* {{{ */
{
spl_dllist_object *intern;
zend_class_entry *parent = class_type;
const zend_class_entry *parent = class_type;
int inherited = 0;

intern = zend_object_alloc(sizeof(spl_dllist_object), parent);
Expand All @@ -316,7 +316,7 @@ static zend_object *spl_dllist_object_new_ex(zend_class_entry *class_type, zend_
intern->traverse_position = 0;

if (orig) {
spl_dllist_object *other = spl_dllist_from_obj(orig);
const spl_dllist_object *other = spl_dllist_from_obj(orig);

if (clone_orig) {
intern->llist = spl_ptr_llist_init();
Expand Down
16 changes: 7 additions & 9 deletions ext/spl/spl_functions.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@
#include "php.h"

/* {{{ spl_add_class_name */
void spl_add_class_name(zval *list, zend_class_entry *pce, int allow, int ce_flags)
void spl_add_class_name(zval *list, const zend_class_entry *pce, int allow, int ce_flags)
{
if (!allow || (allow > 0 && (pce->ce_flags & ce_flags)) || (allow < 0 && !(pce->ce_flags & ce_flags))) {
zval *tmp;
const zval *tmp = zend_hash_find(Z_ARRVAL_P(list), pce->name);

if ((tmp = zend_hash_find(Z_ARRVAL_P(list), pce->name)) == NULL) {
if (tmp == NULL) {
zval t;
ZVAL_STR_COPY(&t, pce->name);
zend_hash_add(Z_ARRVAL_P(list), pce->name, &t);
Expand All @@ -36,7 +36,7 @@ void spl_add_class_name(zval *list, zend_class_entry *pce, int allow, int ce_fla
/* }}} */

/* {{{ spl_add_interfaces */
void spl_add_interfaces(zval *list, zend_class_entry * pce, int allow, int ce_flags)
void spl_add_interfaces(zval *list, const zend_class_entry *pce, int allow, int ce_flags)
{
if (pce->num_interfaces) {
ZEND_ASSERT(pce->ce_flags & ZEND_ACC_LINKED);
Expand All @@ -48,12 +48,10 @@ void spl_add_interfaces(zval *list, zend_class_entry * pce, int allow, int ce_fl
/* }}} */

/* {{{ spl_add_traits */
void spl_add_traits(zval *list, zend_class_entry * pce, int allow, int ce_flags)
void spl_add_traits(zval *list, const zend_class_entry *pce, int allow, int ce_flags)
{
zend_class_entry *trait;

for (uint32_t num_traits = 0; num_traits < pce->num_traits; num_traits++) {
trait = zend_fetch_class_by_name(pce->trait_names[num_traits].name,
const zend_class_entry *trait = zend_fetch_class_by_name(pce->trait_names[num_traits].name,
pce->trait_names[num_traits].lc_name, ZEND_FETCH_CLASS_TRAIT);
ZEND_ASSERT(trait);
spl_add_class_name(list, trait, allow, ce_flags);
Expand All @@ -63,7 +61,7 @@ void spl_add_traits(zval *list, zend_class_entry * pce, int allow, int ce_flags)


/* {{{ spl_add_classes */
void spl_add_classes(zend_class_entry *pce, zval *list, bool sub, int allow, int ce_flags)
void spl_add_classes(const zend_class_entry *pce, zval *list, bool sub, int allow, int ce_flags)
{
ZEND_ASSERT(pce);
spl_add_class_name(list, pce, allow, ce_flags);
Expand Down
8 changes: 4 additions & 4 deletions ext/spl/spl_functions.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@
allow > 0: allow all that match and mask ce_flags
allow < 0: disallow all that match and mask ce_flags
*/
void spl_add_class_name(zval * list, zend_class_entry * pce, int allow, int ce_flags);
void spl_add_interfaces(zval * list, zend_class_entry * pce, int allow, int ce_flags);
void spl_add_traits(zval * list, zend_class_entry * pce, int allow, int ce_flags);
void spl_add_classes(zend_class_entry *pce, zval *list, bool sub, int allow, int ce_flags);
void spl_add_class_name(zval * list, const zend_class_entry *pce, int allow, int ce_flags);
void spl_add_interfaces(zval * list, const zend_class_entry *pce, int allow, int ce_flags);
void spl_add_traits(zval * list, const zend_class_entry *pce, int allow, int ce_flags);
void spl_add_classes(const zend_class_entry *pce, zval *list, bool sub, int allow, int ce_flags);

void spl_set_private_debug_info_property(const zend_class_entry *ce, const char *property, size_t property_len, HashTable *debug_info, zval *value);

Expand Down
2 changes: 1 addition & 1 deletion ext/spl/spl_heap.c
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ static void spl_heap_object_free_storage(zend_object *object) /* {{{ */
static zend_object *spl_heap_object_new_ex(zend_class_entry *class_type, zend_object *orig, int clone_orig) /* {{{ */
{
spl_heap_object *intern;
zend_class_entry *parent = class_type;
const zend_class_entry *parent = class_type;
int inherited = 0;

intern = zend_object_alloc(sizeof(spl_heap_object), parent);
Expand Down
2 changes: 1 addition & 1 deletion ext/spl/spl_observer.c
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ static void spl_object_storage_addall(spl_SplObjectStorage *intern, spl_SplObjec
static zend_object *spl_object_storage_new_ex(zend_class_entry *class_type, zend_object *orig) /* {{{ */
{
spl_SplObjectStorage *intern;
zend_class_entry *parent = class_type;
const zend_class_entry *parent = class_type;

intern = zend_object_alloc(sizeof(spl_SplObjectStorage), parent);
intern->pos = 0;
Expand Down
Loading