@@ -51,12 +51,12 @@ static const zend_module_dep uri_deps[] = {
51
51
52
52
static zend_array uri_parsers ;
53
53
54
- static HashTable * uri_get_debug_properties (zend_object * object )
54
+ static HashTable * uri_get_debug_properties (uri_object_t * object )
55
55
{
56
- uri_internal_t * internal_uri = uri_internal_from_obj ( object ) ;
56
+ uri_internal_t * internal_uri = & object -> internal ;
57
57
ZEND_ASSERT (internal_uri != NULL );
58
58
59
- HashTable * std_properties = zend_std_get_properties (object );
59
+ const HashTable * std_properties = zend_std_get_properties (& object -> std );
60
60
HashTable * result = zend_array_dup (std_properties );
61
61
62
62
const php_uri_parser * const parser = internal_uri -> parser ;
@@ -317,7 +317,7 @@ static zend_result pass_errors_by_ref_and_free(zval *errors_zv, zval *errors)
317
317
}
318
318
319
319
ZEND_ATTRIBUTE_NONNULL_ARGS (1 , 2 ) PHPAPI void php_uri_instantiate_uri (
320
- INTERNAL_FUNCTION_PARAMETERS , const zend_string * uri_str , const zend_object * base_url_object ,
320
+ INTERNAL_FUNCTION_PARAMETERS , const zend_string * uri_str , const uri_object_t * base_url_object ,
321
321
bool should_throw , bool should_update_this_object , zval * errors_zv
322
322
) {
323
323
@@ -344,8 +344,8 @@ ZEND_ATTRIBUTE_NONNULL_ARGS(1, 2) PHPAPI void php_uri_instantiate_uri(
344
344
345
345
void * base_url = NULL ;
346
346
if (base_url_object != NULL ) {
347
- ZEND_ASSERT (base_url_object -> ce == uri_object -> std .ce );
348
- uri_internal_t * internal_base_url = uri_internal_from_obj ( base_url_object ) ;
347
+ ZEND_ASSERT (base_url_object -> std . ce == uri_object -> std .ce );
348
+ const uri_internal_t * internal_base_url = & base_url_object -> internal ;
349
349
URI_ASSERT_INITIALIZATION (internal_base_url );
350
350
ZEND_ASSERT (internal_base_url -> parser == uri_parser );
351
351
base_url = internal_base_url -> uri ;
@@ -384,7 +384,8 @@ static void create_rfc3986_uri(INTERNAL_FUNCTION_PARAMETERS, bool is_constructor
384
384
Z_PARAM_OBJ_OF_CLASS_OR_NULL (base_url_object , uri_rfc3986_uri_ce )
385
385
ZEND_PARSE_PARAMETERS_END ();
386
386
387
- php_uri_instantiate_uri (INTERNAL_FUNCTION_PARAM_PASSTHRU , uri_str , base_url_object , is_constructor , is_constructor , NULL );
387
+ php_uri_instantiate_uri (INTERNAL_FUNCTION_PARAM_PASSTHRU ,
388
+ uri_str , base_url_object ? uri_object_from_obj (base_url_object ) : NULL, is_constructor , is_constructor , NULL );
388
389
}
389
390
390
391
static bool is_list_of_whatwg_validation_errors (const HashTable * array )
@@ -497,7 +498,8 @@ static void create_whatwg_uri(INTERNAL_FUNCTION_PARAMETERS, bool is_constructor)
497
498
Z_PARAM_ZVAL (errors )
498
499
ZEND_PARSE_PARAMETERS_END ();
499
500
500
- php_uri_instantiate_uri (INTERNAL_FUNCTION_PARAM_PASSTHRU , uri_str , base_url_object , is_constructor , is_constructor , errors );
501
+ php_uri_instantiate_uri (INTERNAL_FUNCTION_PARAM_PASSTHRU ,
502
+ uri_str , base_url_object ? uri_object_from_obj (base_url_object ) : NULL, is_constructor , is_constructor , errors );
501
503
}
502
504
503
505
PHP_METHOD (Uri_WhatWg_Url , parse )
@@ -674,23 +676,23 @@ PHP_METHOD(Uri_Rfc3986_Uri, withFragment)
674
676
uri_write_component_str_or_null (INTERNAL_FUNCTION_PARAM_PASSTHRU , PHP_URI_PROPERTY_NAME_FRAGMENT );
675
677
}
676
678
677
- static void throw_cannot_recompose_uri_to_string (zend_object * object )
679
+ static void throw_cannot_recompose_uri_to_string (uri_object_t * object )
678
680
{
679
- zend_throw_exception_ex (uri_error_ce , 0 , "Cannot recompose %s to a string" , ZSTR_VAL (object -> ce -> name ));
681
+ zend_throw_exception_ex (uri_error_ce , 0 , "Cannot recompose %s to a string" , ZSTR_VAL (object -> std . ce -> name ));
680
682
}
681
683
682
- static void uri_equals (INTERNAL_FUNCTION_PARAMETERS , zend_object * that_object , zend_object * comparison_mode )
684
+ static void uri_equals (INTERNAL_FUNCTION_PARAMETERS , uri_object_t * that_object , zend_object * comparison_mode )
683
685
{
684
- zend_object * this_object = Z_OBJ_P (ZEND_THIS );
685
- uri_internal_t * this_internal_uri = uri_internal_from_obj ( this_object ) ;
686
+ uri_object_t * this_object = Z_URI_OBJECT_P (ZEND_THIS );
687
+ uri_internal_t * this_internal_uri = & this_object -> internal ;
686
688
URI_ASSERT_INITIALIZATION (this_internal_uri );
687
689
688
- uri_internal_t * that_internal_uri = uri_internal_from_obj ( that_object ) ;
690
+ uri_internal_t * that_internal_uri = & that_object -> internal ;
689
691
URI_ASSERT_INITIALIZATION (that_internal_uri );
690
692
691
- if (this_object -> ce != that_object -> ce &&
692
- !instanceof_function (this_object -> ce , that_object -> ce ) &&
693
- !instanceof_function (that_object -> ce , this_object -> ce )
693
+ if (this_object -> std . ce != that_object -> std . ce &&
694
+ !instanceof_function (this_object -> std . ce , that_object -> std . ce ) &&
695
+ !instanceof_function (that_object -> std . ce , this_object -> std . ce )
694
696
) {
695
697
RETURN_FALSE ;
696
698
}
@@ -733,15 +735,15 @@ PHP_METHOD(Uri_Rfc3986_Uri, equals)
733
735
Z_PARAM_OBJ_OF_CLASS (comparison_mode , uri_comparison_mode_ce )
734
736
ZEND_PARSE_PARAMETERS_END ();
735
737
736
- uri_equals (INTERNAL_FUNCTION_PARAM_PASSTHRU , that_object , comparison_mode );
738
+ uri_equals (INTERNAL_FUNCTION_PARAM_PASSTHRU , uri_object_from_obj ( that_object ) , comparison_mode );
737
739
}
738
740
739
741
PHP_METHOD (Uri_Rfc3986_Uri , toRawString )
740
742
{
741
743
ZEND_PARSE_PARAMETERS_NONE ();
742
744
743
- zend_object * this_object = Z_OBJ_P (ZEND_THIS );
744
- uri_internal_t * internal_uri = uri_internal_from_obj ( this_object ) ;
745
+ uri_object_t * this_object = Z_URI_OBJECT_P (ZEND_THIS );
746
+ uri_internal_t * internal_uri = & this_object -> internal ;
745
747
URI_ASSERT_INITIALIZATION (internal_uri );
746
748
747
749
zend_string * uri_str = internal_uri -> parser -> to_string (internal_uri -> uri , PHP_URI_RECOMPOSITION_MODE_RAW_ASCII , false);
@@ -757,8 +759,8 @@ PHP_METHOD(Uri_Rfc3986_Uri, toString)
757
759
{
758
760
ZEND_PARSE_PARAMETERS_NONE ();
759
761
760
- zend_object * this_object = Z_OBJ_P (ZEND_THIS );
761
- uri_internal_t * internal_uri = uri_internal_from_obj ( this_object ) ;
762
+ uri_object_t * this_object = Z_URI_OBJECT_P (ZEND_THIS );
763
+ uri_internal_t * internal_uri = & this_object -> internal ;
762
764
URI_ASSERT_INITIALIZATION (internal_uri );
763
765
764
766
zend_string * uri_str = internal_uri -> parser -> to_string (internal_uri -> uri , PHP_URI_RECOMPOSITION_MODE_NORMALIZED_ASCII , false);
@@ -778,15 +780,16 @@ PHP_METHOD(Uri_Rfc3986_Uri, resolve)
778
780
Z_PARAM_PATH_STR (uri_str )
779
781
ZEND_PARSE_PARAMETERS_END ();
780
782
781
- php_uri_instantiate_uri (INTERNAL_FUNCTION_PARAM_PASSTHRU , uri_str , Z_OBJ_P (ZEND_THIS ), true, false, NULL );
783
+ php_uri_instantiate_uri (INTERNAL_FUNCTION_PARAM_PASSTHRU ,
784
+ uri_str , Z_URI_OBJECT_P (ZEND_THIS ), true, false, NULL );
782
785
}
783
786
784
787
PHP_METHOD (Uri_Rfc3986_Uri , __serialize )
785
788
{
786
789
ZEND_PARSE_PARAMETERS_NONE ();
787
790
788
- zend_object * this_object = Z_OBJ_P (ZEND_THIS );
789
- uri_internal_t * internal_uri = uri_internal_from_obj ( this_object ) ;
791
+ uri_object_t * this_object = Z_URI_OBJECT_P (ZEND_THIS );
792
+ uri_internal_t * internal_uri = & this_object -> internal ;
790
793
URI_ASSERT_INITIALIZATION (internal_uri );
791
794
792
795
/* Serialize state: "uri" key in the first array */
@@ -806,7 +809,7 @@ PHP_METHOD(Uri_Rfc3986_Uri, __serialize)
806
809
zend_hash_next_index_insert (Z_ARRVAL_P (return_value ), & arr );
807
810
808
811
/* Serialize regular properties: second array */
809
- ZVAL_ARR (& arr , this_object -> handlers -> get_properties (this_object ));
812
+ ZVAL_ARR (& arr , this_object -> std . handlers -> get_properties (& this_object -> std ));
810
813
Z_TRY_ADDREF (arr );
811
814
zend_hash_next_index_insert (Z_ARRVAL_P (return_value ), & arr );
812
815
}
@@ -882,9 +885,9 @@ PHP_METHOD(Uri_Rfc3986_Uri, __debugInfo)
882
885
{
883
886
ZEND_PARSE_PARAMETERS_NONE ();
884
887
885
- zend_object * object = Z_OBJ_P (ZEND_THIS );
888
+ uri_object_t * uri_object = Z_URI_OBJECT_P (ZEND_THIS );
886
889
887
- RETURN_ARR (uri_get_debug_properties (object ));
890
+ RETURN_ARR (uri_get_debug_properties (uri_object ));
888
891
}
889
892
890
893
PHP_METHOD (Uri_WhatWg_Url , getScheme )
@@ -933,7 +936,7 @@ PHP_METHOD(Uri_WhatWg_Url, equals)
933
936
Z_PARAM_OBJ_OF_CLASS (comparison_mode , uri_comparison_mode_ce )
934
937
ZEND_PARSE_PARAMETERS_END ();
935
938
936
- uri_equals (INTERNAL_FUNCTION_PARAM_PASSTHRU , that_object , comparison_mode );
939
+ uri_equals (INTERNAL_FUNCTION_PARAM_PASSTHRU , uri_object_from_obj ( that_object ) , comparison_mode );
937
940
}
938
941
939
942
PHP_METHOD (Uri_WhatWg_Url , toUnicodeString )
@@ -969,15 +972,16 @@ PHP_METHOD(Uri_WhatWg_Url, resolve)
969
972
Z_PARAM_ZVAL (errors )
970
973
ZEND_PARSE_PARAMETERS_END ();
971
974
972
- php_uri_instantiate_uri (INTERNAL_FUNCTION_PARAM_PASSTHRU , uri_str , Z_OBJ_P (ZEND_THIS ), true, false, errors );
975
+ php_uri_instantiate_uri (INTERNAL_FUNCTION_PARAM_PASSTHRU ,
976
+ uri_str , Z_URI_OBJECT_P (ZEND_THIS ), true, false, errors );
973
977
}
974
978
975
979
PHP_METHOD (Uri_WhatWg_Url , __serialize )
976
980
{
977
981
ZEND_PARSE_PARAMETERS_NONE ();
978
982
979
- zend_object * this_object = Z_OBJ_P (ZEND_THIS );
980
- uri_internal_t * internal_uri = uri_internal_from_obj ( this_object ) ;
983
+ uri_object_t * this_object = Z_URI_OBJECT_P (ZEND_THIS );
984
+ uri_internal_t * internal_uri = & this_object -> internal ;
981
985
URI_ASSERT_INITIALIZATION (internal_uri );
982
986
983
987
/* Serialize state: "uri" key in the first array */
@@ -997,7 +1001,7 @@ PHP_METHOD(Uri_WhatWg_Url, __serialize)
997
1001
zend_hash_next_index_insert (Z_ARRVAL_P (return_value ), & arr );
998
1002
999
1003
/* Serialize regular properties: second array */
1000
- ZVAL_ARR (& arr , this_object -> handlers -> get_properties (this_object ));
1004
+ ZVAL_ARR (& arr , this_object -> std . handlers -> get_properties (& this_object -> std ));
1001
1005
Z_ADDREF (arr );
1002
1006
zend_hash_next_index_insert (Z_ARRVAL_P (return_value ), & arr );
1003
1007
}
@@ -1011,9 +1015,9 @@ PHP_METHOD(Uri_WhatWg_Url, __debugInfo)
1011
1015
{
1012
1016
ZEND_PARSE_PARAMETERS_NONE ();
1013
1017
1014
- zend_object * object = Z_OBJ_P (ZEND_THIS );
1018
+ uri_object_t * uri_object = Z_URI_OBJECT_P (ZEND_THIS );
1015
1019
1016
- RETURN_ARR (uri_get_debug_properties (object ));
1020
+ RETURN_ARR (uri_get_debug_properties (uri_object ));
1017
1021
}
1018
1022
1019
1023
PHPAPI uri_object_t * php_uri_object_create (zend_class_entry * class_type , const php_uri_parser * parser )
0 commit comments