summaryrefslogtreecommitdiffstats
path: root/pecl_http-php81.patch
blob: a6517339c0332771cf8919fa8bc7b1599d261ea0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
From a4f66fb42bb5203e9d1897a6cf554aa702ce0380 Mon Sep 17 00:00:00 2001
From: Thomas Deutschmann <whissi@gentoo.org>
Date: Tue, 18 May 2021 19:55:47 +0200
Subject: [PATCH 01/11] tests: use getenv() to access environment variable

Fixes

  Warning: Undefined array key "PATH" in pecl-http-4.1.0/work/php8.0/tests/skipif.inc on line 56
---
 tests/skipif.inc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/skipif.inc b/tests/skipif.inc
index 51272fb..76c3bd7 100644
--- a/tests/skipif.inc
+++ b/tests/skipif.inc
@@ -53,7 +53,7 @@ function skip_http2_test($message = "skip need http2 support") {
 	if (!(http\Client\Curl\FEATURES & http\Client\Curl\Features\HTTP2)) {
 		die("$message (FEATURES & HTTP2)\n");
 	}
-	foreach (explode(":", $_ENV["PATH"]) as $path) {
+	foreach (explode(":", getenv("PATH")) as $path) {
 		if (is_executable($path . "/nghttpd")) {
 			return;
 		}
-- 
2.31.1

From b63ba83de3d26c61062b72a8d5675225297302db Mon Sep 17 00:00:00 2001
From: Michael Wallner <mike@php.net>
Date: Mon, 2 Aug 2021 16:15:09 +0200
Subject: [PATCH 02/11] PHP-8.1 compat

---
 src/php_http_client.c       |  2 +-
 src/php_http_header.c       | 39 ++++++++++++++++-
 src/php_http_message.c      | 85 ++++++++++++++++++++++++++++++-------
 src/php_http_message_body.c | 46 ++++++++++++++++++++
 src/php_http_params.c       |  8 ++--
 src/php_http_querystring.c  | 43 +++++++++++++++----
 6 files changed, 193 insertions(+), 30 deletions(-)

diff --git a/src/php_http_client.c b/src/php_http_client.c
index 4e1ed37..f1ef55d 100644
--- a/src/php_http_client.c
+++ b/src/php_http_client.c
@@ -804,7 +804,7 @@ static PHP_METHOD(HttpClient, requeue)
 	RETVAL_ZVAL(getThis(), 1, 0);
 }
 
-ZEND_BEGIN_ARG_INFO_EX(ai_HttpClient_count, 0, 0, 0)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(ai_HttpClient_count, 0, 0, IS_LONG, 0)
 ZEND_END_ARG_INFO();
 static PHP_METHOD(HttpClient, count)
 {
diff --git a/src/php_http_header.c b/src/php_http_header.c
index 76b2f68..c9b1e0d 100644
--- a/src/php_http_header.c
+++ b/src/php_http_header.c
@@ -191,6 +191,41 @@ PHP_METHOD(HttpHeader, __construct)
 	}
 }
 
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(ai_HttpHeader___serialize, 0, 0, IS_ARRAY, 0)
+ZEND_END_ARG_INFO();
+PHP_METHOD(HttpHeader, __serialize)
+{
+	zval name, value, *ptr;
+
+	zend_parse_parameters_none();
+
+	array_init(return_value);
+	ptr = zend_read_property(php_http_header_class_entry, Z_OBJ_P(ZEND_THIS), ZEND_STRL("name"), 0, &name);
+	Z_TRY_ADDREF_P(ptr);
+	add_next_index_zval(return_value, ptr);
+	ptr = zend_read_property(php_http_header_class_entry, Z_OBJ_P(ZEND_THIS), ZEND_STRL("value"), 0, &value);
+	Z_TRY_ADDREF_P(ptr);
+	add_next_index_zval(return_value, ptr);
+}
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(ai_HttpHeader___unserialize, 0, 1, IS_VOID, 0)
+	ZEND_ARG_TYPE_INFO(0, data, IS_ARRAY, 0)
+ZEND_END_ARG_INFO();
+PHP_METHOD(HttpHeader, __unserialize)
+{
+	HashTable *ha;
+	zval *name, *value;
+
+	php_http_expect(SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS(), "h", &ha), invalid_arg, return);
+	name = zend_hash_index_find(ha, 0);
+	value = zend_hash_index_find(ha, 1);
+
+	if (name && value) {
+		zend_update_property(php_http_header_class_entry, Z_OBJ_P(ZEND_THIS), ZEND_STRL("name"), name);
+		zend_update_property(php_http_header_class_entry, Z_OBJ_P(ZEND_THIS), ZEND_STRL("value"), value);
+	}
+}
+
 ZEND_BEGIN_ARG_INFO_EX(ai_HttpHeader_serialize, 0, 0, 0)
 ZEND_END_ARG_INFO();
 PHP_METHOD(HttpHeader, serialize)
@@ -399,10 +434,12 @@ PHP_METHOD(HttpHeader, parse)
 
 static zend_function_entry php_http_header_methods[] = {
 	PHP_ME(HttpHeader, __construct,   ai_HttpHeader___construct, ZEND_ACC_PUBLIC)
+	PHP_ME(HttpHeader, __unserialize, ai_HttpHeader___unserialize, ZEND_ACC_PUBLIC)
+	PHP_ME(HttpHeader, __serialize,   ai_HttpHeader___serialize, ZEND_ACC_PUBLIC)
+	PHP_ME(HttpHeader, unserialize,   ai_HttpHeader_unserialize, ZEND_ACC_PUBLIC)
 	PHP_ME(HttpHeader, serialize,     ai_HttpHeader_serialize, ZEND_ACC_PUBLIC)
 	ZEND_MALIAS(HttpHeader, __toString, serialize, ai_HttpHeader_serialize, ZEND_ACC_PUBLIC)
 	ZEND_MALIAS(HttpHeader, toString, serialize, ai_HttpHeader_serialize, ZEND_ACC_PUBLIC)
-	PHP_ME(HttpHeader, unserialize,   ai_HttpHeader_unserialize, ZEND_ACC_PUBLIC)
 	PHP_ME(HttpHeader, match,         ai_HttpHeader_match, ZEND_ACC_PUBLIC)
 	PHP_ME(HttpHeader, negotiate,     ai_HttpHeader_negotiate, ZEND_ACC_PUBLIC)
 	PHP_ME(HttpHeader, getParams,     ai_HttpHeader_getParams, ZEND_ACC_PUBLIC)
diff --git a/src/php_http_message.c b/src/php_http_message.c
index 1b8ecd2..d09b0b4 100644
--- a/src/php_http_message.c
+++ b/src/php_http_message.c
@@ -647,15 +647,15 @@ static void php_http_message_object_prophandler_set_headers(php_http_message_obj
 	}
 }
 static void php_http_message_object_prophandler_get_body(php_http_message_object_t *obj, zval *return_value) {
-	if (obj->body) {
-		zval tmp;
+	zval tmp;
 
-		ZVAL_COPY_VALUE(&tmp, return_value);
-		RETVAL_OBJECT(&obj->body->zo, 1);
-		zval_ptr_dtor(&tmp);
-	} else {
-		RETVAL_NULL();
+	if (!obj->body) {
+		RETURN_NULL();
 	}
+
+	ZVAL_COPY_VALUE(&tmp, return_value);
+	RETVAL_OBJECT(&obj->body->zo, 1);
+	zval_ptr_dtor(&tmp);
 }
 static void php_http_message_object_prophandler_set_body(php_http_message_object_t *obj, zval *value) {
 	php_http_message_object_set_body(obj, value);
@@ -931,14 +931,16 @@ static zval *php_http_message_object_write_prop(zend_object *object, zend_string
 
 static HashTable *php_http_message_object_get_debug_info(zend_object *object, int *is_temp)
 {
-	zval tmp;
 	php_http_message_object_t *obj = PHP_HTTP_OBJ(object, NULL);
 	HashTable *props = zend_get_std_object_handlers()->get_properties(object);
 	char *ver_str, *url_str = NULL;
 	size_t ver_len, url_len = 0;
+	zval tmp;
 
 	PHP_HTTP_MESSAGE_OBJECT_INIT(obj);
-	*is_temp = 0;
+	if (is_temp) {
+		*is_temp = 0;
+	}
 
 #define UPDATE_PROP(name_str, action_with_tmp) \
 	do { \
@@ -1762,6 +1764,57 @@ static PHP_METHOD(HttpMessage, toCallback)
 	}
 }
 
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(ai_HttpMessage___serialize, 0, 0, IS_ARRAY, 0)
+ZEND_END_ARG_INFO();
+static PHP_METHOD(HttpMessage, __serialize)
+{
+	zend_ulong num_index;
+	zend_string *str_index;
+	zend_property_info *pi;
+	php_http_message_object_t *obj = PHP_HTTP_OBJ(NULL, getThis());
+	HashTable *props = php_http_message_object_get_debug_info(&obj->zo, NULL);
+
+	zend_parse_parameters_none();
+
+	array_init(return_value);
+
+	ZEND_HASH_FOREACH_KEY_PTR(&obj->zo.ce->properties_info, num_index, str_index, pi)
+	{
+		zval *val;
+		if (str_index && (val = zend_hash_find_ind(props, pi->name))) {
+			Z_TRY_ADDREF_P(val);
+			zend_hash_update(Z_ARRVAL_P(return_value), str_index, val);
+		}
+	}
+	ZEND_HASH_FOREACH_END();
+}
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(ai_HttpMessage___unserialize, 0, 1, IS_VOID, 0)
+	ZEND_ARG_TYPE_INFO(0, data, IS_ARRAY, 0)
+ZEND_END_ARG_INFO();
+static PHP_METHOD(HttpMessage, __unserialize)
+{
+	HashTable *arr;
+	zend_string *key;
+	zval *val;
+	php_http_message_object_t *obj = PHP_HTTP_OBJ(NULL, getThis());
+
+	php_http_expect(SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS(), "h", &arr), invalid_arg, return);
+
+	PHP_HTTP_MESSAGE_OBJECT_INIT(obj);
+
+	ZEND_HASH_FOREACH_STR_KEY_VAL(arr, key, val)
+	{
+		php_http_message_object_prophandler_t *ph = php_http_message_object_get_prophandler(key);
+		if (ph) {
+			ph->write(obj, val);
+		} else {
+			zend_update_property_ex(php_http_message_class_entry, &obj->zo, key, val);
+		}
+	}
+	ZEND_HASH_FOREACH_END();
+}
+
 ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessage_serialize, 0, 0, 0)
 ZEND_END_ARG_INFO();
 static PHP_METHOD(HttpMessage, serialize)
@@ -1916,7 +1969,7 @@ static PHP_METHOD(HttpMessage, splitMultipartBody)
 	RETURN_OBJ(&php_http_message_object_new_ex(obj->zo.ce, msg)->zo);
 }
 
-ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessage_count, 0, 0, 0)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(ai_HttpMessage_count, 0, 0, IS_LONG, 0)
 ZEND_END_ARG_INFO();
 static PHP_METHOD(HttpMessage, count)
 {
@@ -1931,7 +1984,7 @@ static PHP_METHOD(HttpMessage, count)
 	}
 }
 
-ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessage_rewind, 0, 0, 0)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(ai_HttpMessage_rewind, 0, 0, IS_VOID, 0)
 ZEND_END_ARG_INFO();
 static PHP_METHOD(HttpMessage, rewind)
 {
@@ -1946,7 +1999,7 @@ static PHP_METHOD(HttpMessage, rewind)
 	}
 }
 
-ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessage_valid, 0, 0, 0)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(ai_HttpMessage_valid, 0, 0, _IS_BOOL, 0)
 ZEND_END_ARG_INFO();
 static PHP_METHOD(HttpMessage, valid)
 {
@@ -1957,7 +2010,7 @@ static PHP_METHOD(HttpMessage, valid)
 	}
 }
 
-ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessage_next, 0, 0, 0)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(ai_HttpMessage_next, 0, 0, IS_VOID, 0)
 ZEND_END_ARG_INFO();
 static PHP_METHOD(HttpMessage, next)
 {
@@ -1981,7 +2034,7 @@ static PHP_METHOD(HttpMessage, next)
 	}
 }
 
-ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessage_key, 0, 0, 0)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(ai_HttpMessage_key, 0, 0, IS_LONG, 0)
 ZEND_END_ARG_INFO();
 static PHP_METHOD(HttpMessage, key)
 {
@@ -1992,7 +2045,7 @@ static PHP_METHOD(HttpMessage, key)
 	}
 }
 
-ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessage_current, 0, 0, 0)
+ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(ai_HttpMessage_current, 0, 0, http\\Message, 0)
 ZEND_END_ARG_INFO();
 static PHP_METHOD(HttpMessage, current)
 {
@@ -2041,6 +2094,8 @@ static zend_function_entry php_http_message_methods[] = {
 	/* implements Serializable */
 	PHP_ME(HttpMessage, serialize,          ai_HttpMessage_serialize,          ZEND_ACC_PUBLIC)
 	PHP_ME(HttpMessage, unserialize,        ai_HttpMessage_unserialize,        ZEND_ACC_PUBLIC)
+	PHP_ME(HttpMessage, __serialize,        ai_HttpMessage___serialize,        ZEND_ACC_PUBLIC)
+	PHP_ME(HttpMessage, __unserialize,      ai_HttpMessage___unserialize,      ZEND_ACC_PUBLIC)
 
 	/* implements Iterator */
 	PHP_ME(HttpMessage, rewind,             ai_HttpMessage_rewind,             ZEND_ACC_PUBLIC)
diff --git a/src/php_http_message_body.c b/src/php_http_message_body.c
index 70fd587..72cfa4a 100644
--- a/src/php_http_message_body.c
+++ b/src/php_http_message_body.c
@@ -704,6 +704,50 @@ PHP_METHOD(HttpMessageBody, unserialize)
 	}
 }
 
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(ai_HttpMessageBody___unserialize, 0, 1, IS_VOID, 0)
+	ZEND_ARG_TYPE_INFO(0, data, IS_ARRAY, 0)
+ZEND_END_ARG_INFO();
+PHP_METHOD(HttpMessageBody, __unserialize)
+{
+	HashTable *arr;
+
+	if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS(), "h", &arr)) {
+		zval *zv = zend_hash_index_find(arr, 0);
+
+		if (0 && zv) {
+			zend_string *zs = zval_get_string(zv);
+			php_stream *s = php_http_mem_stream_open(0, zs);
+			php_http_message_body_object_t *obj = PHP_HTTP_OBJ(NULL, getThis());
+
+			obj->body = php_http_message_body_init(NULL, s);
+			php_stream_to_zval(s, obj->gc);
+			zend_string_release(zs);
+		}
+	}
+}
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(ai_HttpMessageBody___serialize, 0, 0, IS_ARRAY, 0)
+ZEND_END_ARG_INFO();
+PHP_METHOD(HttpMessageBody, __serialize)
+{
+
+	php_http_message_body_object_t *obj = PHP_HTTP_OBJ(NULL, getThis());
+	zend_string *zs;
+
+	zend_parse_parameters_none();
+
+	PHP_HTTP_MESSAGE_BODY_OBJECT_INIT(obj);
+
+	array_init(return_value);
+	zs = php_http_message_body_to_string(obj->body, 0, 0);
+	if (zs) {
+		add_index_str(return_value, 0, zs);
+		zend_string_release(zs);
+	}
+}
+
+
+
 ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessageBody_toStream, 0, 0, 1)
 	ZEND_ARG_INFO(0, stream)
 	ZEND_ARG_INFO(0, offset)
@@ -914,6 +958,8 @@ static zend_function_entry php_http_message_body_methods[] = {
 	PHP_MALIAS(HttpMessageBody, toString, __toString, ai_HttpMessageBody___toString, ZEND_ACC_PUBLIC)
 	PHP_MALIAS(HttpMessageBody, serialize, __toString, ai_HttpMessageBody___toString, ZEND_ACC_PUBLIC)
 	PHP_ME(HttpMessageBody, unserialize,  ai_HttpMessageBody_unserialize,  ZEND_ACC_PUBLIC)
+	PHP_ME(HttpMessageBody, __serialize,  ai_HttpMessageBody___serialize,  ZEND_ACC_PUBLIC)
+	PHP_ME(HttpMessageBody, __unserialize,ai_HttpMessageBody___unserialize,ZEND_ACC_PUBLIC)
 	PHP_ME(HttpMessageBody, toStream,     ai_HttpMessageBody_toStream,     ZEND_ACC_PUBLIC)
 	PHP_ME(HttpMessageBody, toCallback,   ai_HttpMessageBody_toCallback,   ZEND_ACC_PUBLIC)
 	PHP_ME(HttpMessageBody, getResource,  ai_HttpMessageBody_getResource,  ZEND_ACC_PUBLIC)
diff --git a/src/php_http_params.c b/src/php_http_params.c
index 8ac4f8f..4a523cc 100644
--- a/src/php_http_params.c
+++ b/src/php_http_params.c
@@ -1181,7 +1181,7 @@ PHP_METHOD(HttpParams, toString)
 	RETVAL_STR(php_http_cs2zs(buf.data, buf.used));
 }
 
-ZEND_BEGIN_ARG_INFO_EX(ai_HttpParams_offsetExists, 0, 0, 1)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(ai_HttpParams_offsetExists, 0, 1, _IS_BOOL, 0)
 	ZEND_ARG_INFO(0, name)
 ZEND_END_ARG_INFO();
 PHP_METHOD(HttpParams, offsetExists)
@@ -1202,7 +1202,7 @@ PHP_METHOD(HttpParams, offsetExists)
 	}
 }
 
-ZEND_BEGIN_ARG_INFO_EX(ai_HttpParams_offsetGet, 0, 0, 1)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(ai_HttpParams_offsetGet, 0, 1, IS_MIXED, 1)
 	ZEND_ARG_INFO(0, name)
 ZEND_END_ARG_INFO();
 PHP_METHOD(HttpParams, offsetGet)
@@ -1221,7 +1221,7 @@ PHP_METHOD(HttpParams, offsetGet)
 	}
 }
 
-ZEND_BEGIN_ARG_INFO_EX(ai_HttpParams_offsetUnset, 0, 0, 1)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(ai_HttpParams_offsetUnset, 0, 1, IS_VOID, 0)
 	ZEND_ARG_INFO(0, name)
 ZEND_END_ARG_INFO();
 PHP_METHOD(HttpParams, offsetUnset)
@@ -1240,7 +1240,7 @@ PHP_METHOD(HttpParams, offsetUnset)
 	}
 }
 
-ZEND_BEGIN_ARG_INFO_EX(ai_HttpParams_offsetSet, 0, 0, 2)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(ai_HttpParams_offsetSet, 0, 2, IS_VOID, 0)
 	ZEND_ARG_INFO(0, name)
 	ZEND_ARG_INFO(0, value)
 ZEND_END_ARG_INFO();
diff --git a/src/php_http_querystring.c b/src/php_http_querystring.c
index f2d73a4..541937e 100644
--- a/src/php_http_querystring.c
+++ b/src/php_http_querystring.c
@@ -395,7 +395,7 @@ PHP_METHOD(HttpQueryString, getGlobalInstance)
 
 }
 
-ZEND_BEGIN_ARG_INFO_EX(ai_HttpQueryString_getIterator, 0, 0, 0)
+ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(ai_HttpQueryString_getIterator, 0, 0, Traversable, 0)
 ZEND_END_ARG_INFO();
 PHP_METHOD(HttpQueryString, getIterator)
 {
@@ -566,6 +566,29 @@ PHP_METHOD(HttpQueryString, xlate)
 }
 #endif /* HAVE_ICONV */
 
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(ai_HttpQueryString___serialize, 0, 0, IS_ARRAY, 0)
+ZEND_END_ARG_INFO();
+PHP_METHOD(HttpQueryString, __serialize)
+{
+	zval *zqa, zqa_tmp;
+
+	zend_parse_parameters_none();
+
+	zqa = zend_read_property(php_http_querystring_class_entry, Z_OBJ_P(ZEND_THIS), ZEND_STRL("queryArray"), 0, &zqa_tmp);
+	RETURN_ZVAL(zqa, 1, 0);
+}
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(ai_HttpQueryString___unserialize, 0, 1, IS_VOID, 0)
+	ZEND_ARG_TYPE_INFO(0, data, IS_ARRAY, 0)
+ZEND_END_ARG_INFO();
+PHP_METHOD(HttpQueryString, __unserialize)
+{
+	zval *qa;
+
+	php_http_expect(SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS(), "a", &qa), invalid_arg, return);
+	php_http_querystring_set(getThis(), qa, 0);
+}
+
 ZEND_BEGIN_ARG_INFO_EX(ai_HttpQueryString_serialize, 0, 0, 0)
 ZEND_END_ARG_INFO();
 PHP_METHOD(HttpQueryString, serialize)
@@ -594,8 +617,8 @@ PHP_METHOD(HttpQueryString, unserialize)
 	}
 }
 
-ZEND_BEGIN_ARG_INFO_EX(ai_HttpQueryString_offsetGet, 0, 0, 1)
-	ZEND_ARG_INFO(0, offset)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(ai_HttpQueryString_offsetGet, 0, 1, IS_MIXED, 1)
+	ZEND_ARG_INFO(0, name)
 ZEND_END_ARG_INFO();
 PHP_METHOD(HttpQueryString, offsetGet)
 {
@@ -616,8 +639,8 @@ PHP_METHOD(HttpQueryString, offsetGet)
 	}
 }
 
-ZEND_BEGIN_ARG_INFO_EX(ai_HttpQueryString_offsetSet, 0, 0, 2)
-	ZEND_ARG_INFO(0, offset)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(ai_HttpQueryString_offsetSet, 0, 2, IS_VOID, 0)
+	ZEND_ARG_INFO(0, name)
 	ZEND_ARG_INFO(0, value)
 ZEND_END_ARG_INFO();
 PHP_METHOD(HttpQueryString, offsetSet)
@@ -641,8 +664,8 @@ PHP_METHOD(HttpQueryString, offsetSet)
 	zval_ptr_dtor(&param);
 }
 
-ZEND_BEGIN_ARG_INFO_EX(ai_HttpQueryString_offsetExists, 0, 0, 1)
-	ZEND_ARG_INFO(0, offset)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(ai_HttpQueryString_offsetExists, 0, 1, _IS_BOOL, 0)
+	ZEND_ARG_INFO(0, name)
 ZEND_END_ARG_INFO();
 PHP_METHOD(HttpQueryString, offsetExists)
 {
@@ -664,8 +687,8 @@ PHP_METHOD(HttpQueryString, offsetExists)
 	RETURN_FALSE;
 }
 
-ZEND_BEGIN_ARG_INFO_EX(ai_HttpQueryString_offsetUnset, 0, 0, 1)
-	ZEND_ARG_INFO(0, offset)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(ai_HttpQueryString_offsetUnset, 0, 1, IS_VOID, 0)
+	ZEND_ARG_INFO(0, name)
 ZEND_END_ARG_INFO();
 PHP_METHOD(HttpQueryString, offsetUnset)
 {
@@ -711,6 +734,8 @@ static zend_function_entry php_http_querystring_methods[] = {
 	/* Implements Serializable */
 	PHP_ME(HttpQueryString, serialize, ai_HttpQueryString_serialize, ZEND_ACC_PUBLIC)
 	PHP_ME(HttpQueryString, unserialize, ai_HttpQueryString_unserialize, ZEND_ACC_PUBLIC)
+	PHP_ME(HttpQueryString, __serialize, ai_HttpQueryString___serialize, ZEND_ACC_PUBLIC)
+	PHP_ME(HttpQueryString, __unserialize, ai_HttpQueryString___unserialize, ZEND_ACC_PUBLIC)
 
 	/* Implements ArrayAccess */
 	PHP_ME(HttpQueryString, offsetGet, ai_HttpQueryString_offsetGet, ZEND_ACC_PUBLIC)
-- 
2.31.1

From 22c2da5a45dfeefc3c32fbb5ff1b1129341a2001 Mon Sep 17 00:00:00 2001
From: Michael Wallner <mike@php.net>
Date: Mon, 2 Aug 2021 16:42:23 +0200
Subject: [PATCH 04/11] curl: ssl/falsestart: ignore rc

---
 src/php_http_client_curl.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/src/php_http_client_curl.c b/src/php_http_client_curl.c
index 915b8fc..89ae5e0 100644
--- a/src/php_http_client_curl.c
+++ b/src/php_http_client_curl.c
@@ -812,6 +812,7 @@ static php_http_options_t php_http_curle_options, php_http_curlm_options;
 #define PHP_HTTP_CURLE_OPTION_CHECK_STRLEN		0x0001
 #define PHP_HTTP_CURLE_OPTION_CHECK_BASEDIR		0x0002
 #define PHP_HTTP_CURLE_OPTION_TRANSFORM_MS		0x0004
+#define PHP_HTTP_CURLE_OPTION_IGNORE_RC			0x0008
 
 static ZEND_RESULT_CODE php_http_curle_option_set_ssl_verifyhost(php_http_option_t *opt, zval *val, void *userdata)
 {
@@ -1582,7 +1583,9 @@ static void php_http_curle_options_init(php_http_options_t *registry)
 			}
 #endif
 #if PHP_HTTP_CURL_VERSION(7,42,0) && (PHP_HTTP_HAVE_LIBCURL_NSS || PHP_HTTP_HAVE_LIBCURL_SECURETRANSPORT)
-			php_http_option_register(ssl_registry, ZEND_STRL("falsestart"), CURLOPT_SSL_FALSESTART, _IS_BOOL);
+			if ((opt = php_http_option_register(ssl_registry, ZEND_STRL("falsestart"), CURLOPT_SSL_FALSESTART, _IS_BOOL))) {
+				opt->flags |= PHP_HTTP_CURLE_OPTION_IGNORE_RC;
+			}
 #endif
 #if PHP_HTTP_CURL_VERSION(7,61,0)
 			if ((opt = php_http_option_register(ssl_registry, ZEND_STRL("tls13_ciphers"), CURLOPT_TLS13_CIPHERS, IS_STRING))) {
@@ -1805,7 +1808,11 @@ static ZEND_RESULT_CODE php_http_curle_set_option(php_http_option_t *opt, zval *
 		break;
 	}
 	if (rv != SUCCESS) {
-		php_error_docref(NULL, E_NOTICE, "Could not set option %s (%s)", opt->name->val, curl_easy_strerror(rc));
+		if (opt->flags & PHP_HTTP_CURLE_OPTION_IGNORE_RC) {
+			rv = SUCCESS;
+		} else {
+			php_error_docref(NULL, E_NOTICE, "Could not set option %s (%s)", opt->name->val, curl_easy_strerror(rc));
+		}
 	}
 	return rv;
 }
-- 
2.31.1

From e49f2f1ff5f4aa5f3a96444e8a677f64a45f0d6f Mon Sep 17 00:00:00 2001
From: Michael Wallner <mike@php.net>
Date: Mon, 2 Aug 2021 16:42:58 +0200
Subject: [PATCH 05/11] tests: skip ~E_DEPRECATED

---
 tests/client024.phpt | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tests/client024.phpt b/tests/client024.phpt
index ac29865..4e8fe2f 100644
--- a/tests/client024.phpt
+++ b/tests/client024.phpt
@@ -4,6 +4,8 @@ client deprecated methods
 <?php
 include "skipif.inc";
 skip_client_test();
+if (!(error_reporting() & E_DEPRECATED))
+	die("skip error_reporting() & ~E_DEPRECATED\n");
 ?>
 --FILE--
 <?php
-- 
2.31.1

From 39b377795b0cc7b0add6c6b43b3c8b92eb85767c Mon Sep 17 00:00:00 2001
From: Michael Wallner <mike@php.net>
Date: Mon, 2 Aug 2021 16:43:55 +0200
Subject: [PATCH 06/11] tests: skip SecureTransport

---
 tests/client012.phpt | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/tests/client012.phpt b/tests/client012.phpt
index bb599db..0e72628 100644
--- a/tests/client012.phpt
+++ b/tests/client012.phpt
@@ -6,6 +6,8 @@ include "skipif.inc";
 skip_online_test();
 skip_client_test();
 skip_curl_test("7.34.0");
+if (strpos(http\Client\Curl\Versions\SSL, "SecureTransport") !== false)
+	die("skip SecureTransport\n");
 ?>
 --FILE--
 <?php 
@@ -43,7 +45,9 @@ switch ($client->getTransferInfo($req)->tls_session["backend"]) {
 	case "openssl":
 	case "gnutls":
 		if (count($observer->data) < 1) {
-			die("failed count(ssl.internals) >= 1\n");
+			printf("%s: failed count(ssl.internals) >= 1\n", $client->getTransferInfo($req)->tls_session["backend"]);
+			var_dump($observer);
+			exit;
 		}
 		break;
 	default:
-- 
2.31.1

From c941e27c8f668f5dc8d7f6a8a5ec3986534d1a29 Mon Sep 17 00:00:00 2001
From: Michael Wallner <mike@php.net>
Date: Mon, 2 Aug 2021 16:57:20 +0200
Subject: [PATCH 07/11] tests: skip Darwin

---
 tests/urlparser010.phpt | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/tests/urlparser010.phpt b/tests/urlparser010.phpt
index e2e36db..c7f800a 100644
--- a/tests/urlparser010.phpt
+++ b/tests/urlparser010.phpt
@@ -7,7 +7,9 @@ if (!defined("http\\Url::PARSE_MBLOC") or
 	!utf8locale()) {
 	die("skip need http\\Url::PARSE_MBLOC support and LC_CTYPE=*.UTF-8");
 }
-
+if (PHP_OS == "Darwin") {
+  die("skip Darwin\n");
+}
 ?>
 --FILE--
 <?php
-- 
2.31.1

From ccd8182038d5a58e6d8f0eb6b3921ebb66baeed0 Mon Sep 17 00:00:00 2001
From: Michael Wallner <mike@php.net>
Date: Mon, 2 Aug 2021 16:58:59 +0200
Subject: [PATCH 08/11] fix #116: cookies fail with libcurl >= 7.77

---
 src/php_http_client_curl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/php_http_client_curl.c b/src/php_http_client_curl.c
index 89ae5e0..0e79f19 100644
--- a/src/php_http_client_curl.c
+++ b/src/php_http_client_curl.c
@@ -856,7 +856,7 @@ static ZEND_RESULT_CODE php_http_curle_option_set_cookiestore(php_http_option_t
 	} else {
 		storage->cookiestore = NULL;
 	}
-	if (	CURLE_OK != curl_easy_setopt(ch, CURLOPT_COOKIEFILE, storage->cookiestore)
+	if (	CURLE_OK != curl_easy_setopt(ch, CURLOPT_COOKIEFILE, storage->cookiestore ? storage->cookiestore : "")
 		||	CURLE_OK != curl_easy_setopt(ch, CURLOPT_COOKIEJAR, storage->cookiestore)
 	) {
 		return FAILURE;
-- 
2.31.1

From 114dee054de7fd8b5921b406c5fb69e2cbade9d6 Mon Sep 17 00:00:00 2001
From: Michael Wallner <mike@php.net>
Date: Wed, 4 Aug 2021 10:02:39 +0200
Subject: [PATCH 09/11] fixup message/body serialization

---
 src/php_http_message.c      | 2 ++
 src/php_http_message_body.c | 3 +--
 tests/message002.phpt       | 3 ++-
 3 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/php_http_message.c b/src/php_http_message.c
index d09b0b4..7287031 100644
--- a/src/php_http_message.c
+++ b/src/php_http_message.c
@@ -688,6 +688,8 @@ static void php_http_message_object_prophandler_set_parent_message(php_http_mess
 	do { \
 		if (!obj->message) { \
 			obj->message = php_http_message_init(NULL, 0, NULL); \
+		} else if (!obj->body && php_http_message_body_size(obj->message->body)) { \
+			php_http_message_object_init_body_object(obj); \
 		} \
 	} while(0)
 
diff --git a/src/php_http_message_body.c b/src/php_http_message_body.c
index 72cfa4a..90714d9 100644
--- a/src/php_http_message_body.c
+++ b/src/php_http_message_body.c
@@ -714,7 +714,7 @@ PHP_METHOD(HttpMessageBody, __unserialize)
 	if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS(), "h", &arr)) {
 		zval *zv = zend_hash_index_find(arr, 0);
 
-		if (0 && zv) {
+		if (zv) {
 			zend_string *zs = zval_get_string(zv);
 			php_stream *s = php_http_mem_stream_open(0, zs);
 			php_http_message_body_object_t *obj = PHP_HTTP_OBJ(NULL, getThis());
@@ -742,7 +742,6 @@ PHP_METHOD(HttpMessageBody, __serialize)
 	zs = php_http_message_body_to_string(obj->body, 0, 0);
 	if (zs) {
 		add_index_str(return_value, 0, zs);
-		zend_string_release(zs);
 	}
 }
 
diff --git a/tests/message002.phpt b/tests/message002.phpt
index 573fdbd..da0b799 100644
--- a/tests/message002.phpt
+++ b/tests/message002.phpt
@@ -42,7 +42,8 @@ object(%s)#%d (13) {
   ["type":protected]=>
   int(1)
   ["body":protected]=>
-  NULL
+  object(http\Message\Body)#3 (0) {
+  }
   ["requestMethod":protected]=>
   string(4) "POST"
   ["requestUrl":protected]=>
-- 
2.31.1

From 4b0b09b0dae0c24296d4e51ea31863f228657f84 Mon Sep 17 00:00:00 2001
From: Remi Collet <remi@remirepo.net>
Date: Wed, 4 Aug 2021 15:27:53 +0200
Subject: [PATCH 10/11] fix proto for 8.1.0beta2

---
 src/php_http_client.c     | 12 ++++++++++++
 tests/client002.phpt      |  1 +
 tests/client012.phpt      |  1 +
 tests/client013.phpt      |  3 +++
 tests/client030.phpt      |  3 ++-
 tests/envresponse016.phpt |  1 +
 6 files changed, 20 insertions(+), 1 deletion(-)

diff --git a/src/php_http_client.c b/src/php_http_client.c
index f1ef55d..0c06cd2 100644
--- a/src/php_http_client.c
+++ b/src/php_http_client.c
@@ -984,7 +984,11 @@ static int notify(zend_object_iterator *iter, void *puser)
 	return ZEND_HASH_APPLY_STOP;
 }
 
+#if PHP_VERSION_ID < 80100
 ZEND_BEGIN_ARG_INFO_EX(ai_HttpClient_notify, 0, 0, 0)
+#else
+ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(ai_HttpClient_notify, 0, 0, IS_VOID, 0)
+#endif
 	ZEND_ARG_OBJ_INFO(0, request, http\\Client\\Request, 1)
 	ZEND_ARG_INFO(0, progress)
 ZEND_END_ARG_INFO();
@@ -1032,7 +1036,11 @@ static PHP_METHOD(HttpClient, notify)
 	RETVAL_ZVAL(getThis(), 1, 0);
 }
 
+#if PHP_VERSION_ID < 80100
 ZEND_BEGIN_ARG_INFO_EX(ai_HttpClient_attach, 0, 0, 1)
+#else
+ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(ai_HttpClient_attach, 0, 1, IS_VOID, 0)
+#endif
 	ZEND_ARG_OBJ_INFO(0, observer, SplObserver, 0)
 ZEND_END_ARG_INFO();
 static PHP_METHOD(HttpClient, attach)
@@ -1061,7 +1069,11 @@ static PHP_METHOD(HttpClient, attach)
 	RETVAL_ZVAL(getThis(), 1, 0);
 }
 
+#if PHP_VERSION_ID < 80100
 ZEND_BEGIN_ARG_INFO_EX(ai_HttpClient_detach, 0, 0, 1)
+#else
+ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(ai_HttpClient_detach, 0, 1, IS_VOID, 0)
+#endif
 	ZEND_ARG_OBJ_INFO(0, observer, SplObserver, 0)
 ZEND_END_ARG_INFO();
 static PHP_METHOD(HttpClient, detach)
diff --git a/tests/client002.phpt b/tests/client002.phpt
index 6f01a44..0da72d0 100644
--- a/tests/client002.phpt
+++ b/tests/client002.phpt
@@ -14,6 +14,7 @@ echo "Test\n";
 
 class Observer implements SplObserver
 {
+	#[ReturnTypeWillChange]
 	function update(SplSubject $client, http\Client\Request $request = null, StdClass $progress = null) {
 		echo "P";
 		if ($progress->info !== "prepare" && $client->getProgressInfo($request) != $progress) {
diff --git a/tests/client012.phpt b/tests/client012.phpt
index 0e72628..9b4dde7 100644
--- a/tests/client012.phpt
+++ b/tests/client012.phpt
@@ -26,6 +26,7 @@ var_dump(
 
 $client->attach($observer = new class implements SplObserver { 
 	public $data = [];
+	#[ReturnTypeWillChange]
 	function update(SplSubject $client, $req = null, $progress = null) {
 		$ti = $client->getTransferInfo($req);
 		if (isset($ti->tls_session["internals"])) {
diff --git a/tests/client013.phpt b/tests/client013.phpt
index 477edf7..962d448 100644
--- a/tests/client013.phpt
+++ b/tests/client013.phpt
@@ -16,11 +16,13 @@ class Client extends http\Client {
 	public $pi;
 }
 class ProgressObserver1 implements SplObserver {
+	#[ReturnTypeWillChange]
 	function update(SplSubject $c, $r = null) {
 		if ($c->getProgressInfo($r)) $c->pi .= "-";
 	}
 }
 class ProgressObserver2 implements SplObserver {
+	#[ReturnTypeWillChange]
 	function update(SplSubject $c, $r = null) {
 		if ($c->getProgressInfo($r)) $c->pi .= ".";
 	}
@@ -30,6 +32,7 @@ class CallbackObserver implements SplObserver {
 	function __construct($callback) {
 		$this->callback = $callback;
 	}
+	#[ReturnTypeWillChange]
 	function update(SplSubject $c, $r = null) {
 		call_user_func($this->callback, $c, $r);
 	}
diff --git a/tests/client030.phpt b/tests/client030.phpt
index 8514b4e..156469f 100644
--- a/tests/client030.phpt
+++ b/tests/client030.phpt
@@ -12,6 +12,7 @@ echo "Test\n";
 include "helper/server.inc";
 
 class test implements SplObserver {
+	#[ReturnTypeWillChange]
 	function update(SplSubject $client) {
 		$client->once();
 	}
@@ -33,4 +34,4 @@ server("proxy.inc", function($port) {
 --EXPECTF--
 Test
 int(200)
-===DONE===
\ No newline at end of file
+===DONE===
diff --git a/tests/envresponse016.phpt b/tests/envresponse016.phpt
index 8d48c93..e8b7a61 100644
--- a/tests/envresponse016.phpt
+++ b/tests/envresponse016.phpt
@@ -10,6 +10,7 @@ include "skipif.inc";
 echo "Test\n";
 
 class closer extends php_user_filter {
+	#[ReturnTypeWillChange]
 	function filter ($in, $out, &$consumed, $closing) {
 		while ($bucket = stream_bucket_make_writeable($in)) {
 			stream_bucket_append($out, $bucket);
-- 
2.31.1