@@ -188,9 +188,9 @@ typedef struct php_ion_unserializer {
188188
189189 ION_TYPE type ; // FIXME: there's already `php_ion_obj(reader, rdr)->state`
190190 php_ion_annotations annotations ;
191-
191+
192192 zend_object * rdr , std ;
193-
193+
194194} php_ion_unserializer ;
195195
196196ZEND_BEGIN_MODULE_GLOBALS (ion )
@@ -1284,7 +1284,7 @@ static void php_ion_reader_ctor(php_ion_reader *obj)
12841284 obj -> options .chunk_threshold );
12851285 zend_update_property_bool (ce_Reader_Reader , & obj -> std , ZEND_STRL ("skipCharacterValidation" ),
12861286 obj -> options .skip_character_validation );
1287-
1287+
12881288 if (obj -> type == STREAM_READER ) {
12891289 obj -> stream .buf .length = obj -> options .chunk_threshold ? obj -> options .chunk_threshold : 0x4000 ;
12901290 obj -> stream .buf .value = emalloc (obj -> stream .buf .length );
@@ -1861,17 +1861,7 @@ static void php_ion_serialize_object(php_ion_serializer *ser, zend_object *zobje
18611861 return ;
18621862 }
18631863
1864- if (can_call_magic_serialize (ser , ce )) {
1865- php_ion_serialize_object_magic (ser , zobject , NULL );
1866- } else if (can_call_iface_serialize (ser , ce )) {
1867- php_ion_serialize_object_iface (ser , zobject );
1868- } else if (can_call_custom_serialize (ser , zobject , & fn )) {
1869- php_ion_serialize_object_magic (ser , zobject , fn );
1870- } else if (zobject -> ce -> ce_flags & ZEND_ACC_ENUM ) {
1871- php_ion_serialize_object_enum (ser , zobject );
1872- } else if (!is_special_class (ce , & special_ce )) {
1873- php_ion_serialize_object_std (ser , zobject );
1874- } else {
1864+ if (is_special_class (ce , & special_ce )) {
18751865 if (can_serialize_fast (ser ) || special_ce == ce_LOB ) {
18761866 if (special_ce == ce_Symbol ) {
18771867 ION_CHECK (ion_writer_write_ion_symbol (php_ion_obj (writer , ser -> wri )-> writer , & php_ion_obj (symbol , zobject )-> sym ));
@@ -1902,6 +1892,16 @@ static void php_ion_serialize_object(php_ion_serializer *ser, zend_object *zobje
19021892 }
19031893 zend_call_method (ser -> wri , NULL , NULL , method , strlen (method ), NULL , 1 , & z_param , NULL );
19041894 }
1895+ } else if (can_call_magic_serialize (ser , ce )) {
1896+ php_ion_serialize_object_magic (ser , zobject , NULL );
1897+ } else if (can_call_iface_serialize (ser , ce )) {
1898+ php_ion_serialize_object_iface (ser , zobject );
1899+ } else if (can_call_custom_serialize (ser , zobject , & fn )) {
1900+ php_ion_serialize_object_magic (ser , zobject , fn );
1901+ } else if (zobject -> ce -> ce_flags & ZEND_ACC_ENUM ) {
1902+ php_ion_serialize_object_enum (ser , zobject );
1903+ } else {
1904+ php_ion_serialize_object_std (ser , zobject );
19051905 }
19061906}
19071907
0 commit comments