Test: /ext/standard/tests/http/bug38802.phpt - Version 5.4.0RC2-dev        

Bug #38802 'max_redirects' context options doesn't work when value is 1
Submitted: 2006-09-13 07:36:04 Modified: 2010-02-17 00:35:40
From: datibbaw Assigned:
Status: Closed Package: HTTP related
PHP Version: 5.2.9 OS: Linux Gentoo

There is 1 diff reported by users for this test.

Count Diff
1 (100%)
002+ output=[]
003- array(7) {
004- [0]=>
005- string(30) "HTTP/1.0 302 Moved Temporarily"
006- [1]=>
007- string(41) "Location: http://127.0.0.1:12342/foo/bar2"
008- [2]=>
009- string(30) "HTTP/1.0 301 Moved Permanently"
010- [3]=>
011- string(41) "Location: http://127.0.0.1:12342/foo/bar3"
012- [4]=>
013- string(30) "HTTP/1.0 302 Moved Temporarily"
014- [5]=>
015- string(41) "Location: http://127.0.0.1:12342/foo/bar4"
016- [6]=>
017- string(15) "HTTP/1.0 200 OK"
018- }
019- string(5) "done."
020- string(195) "GET /foo/bar HTTP/1.0
021- Host: 127.0.0.1:12342
004+ array(2) {
005+ ["headers"]=>
006+ array(0) {
007+ }
008+ ["readbuf"]=>
009+ resource(10) of type (stream)
010+ }
011+ HERE1
012+ HERE2
013+ HERE3
014+ line=[GET /foo/bar HTTP/1.1]
015+ HERE2
016+ HERE3
017+ line=[User-Agent: PHP/5.4.0RC2-dev]
018+ HERE2
019+ HERE3
020+ line=[Host: 127.0.0.1:12342]
021+ HERE2
022+ HERE3
023+ line=[Accept: */*]
024+ HERE2
025+ HERE3
026+ line=[]
027+ HERE4 file=[data://text/plain,HTTP/1.0 302 Moved Temporarily
028+ Location: http://127.0.0.1:12342/foo/bar2
023- GET /foo/bar2 HTTP/1.0
024- Host: 127.0.0.1:12342
026- GET /foo/bar3 HTTP/1.0
027- Host: 127.0.0.1:12342
028-
029- GET /foo/bar4 HTTP/1.0
030- Host: 127.0.0.1:12342
031-
032- "
033- -- Test: fail after 2 redirections --
034-
035- Warning: fopen(http://127.0.0.1:12342/foo/bar): failed to open stream: Redirection limit reached, aborting in %s
036- bool(false)
037- string(97) "GET /foo/bar HTTP/1.0
038- Host: 127.0.0.1:12342
030+ 1]
031+ HTTP/1.0 302 Moved Temporarily
032+ Location: http://127.0.0.1:12342/foo/bar2
034+ 1***
035+ HERE1
036+ HERE2
037+ HERE3
038+ line=[GET /foo/bar2 HTTP/1.0]
039+ HERE2
040+ HERE3
041+ line=[User-Agent: PHP/5.4.0RC2-dev]
042+ HERE2
043+ HERE3
044+ line=[Host: 127.0.0.1:12342]
045+ HERE2
046+ HERE3
047+ line=[Accept: */*]
048+ HERE2
049+ HERE3
050+ line=[]
051+ HERE4 file=[data://text/plain,HTTP/1.0 301 Moved Permanently
052+ Location: http://127.0.0.1:12342/foo/bar3
040- GET /foo/bar2 HTTP/1.0
041- Host: 127.0.0.1:12342
043- "
044- -- Test: fail at first redirection --
045-
046- Warning: fopen(http://127.0.0.1:12342/foo/bar): failed to open stream: Redirection limit reached, aborting in %s
047- bool(false)
048- string(48) "GET /foo/bar HTTP/1.0
049- Host: 127.0.0.1:12342
050-
051- "
052- -- Test: fail at first redirection (2) --
054+ ]
055+ HTTP/1.0 301 Moved Permanently
056+ Location: http://127.0.0.1:12342/foo/bar3
054- Warning: fopen(http://127.0.0.1:12342/foo/bar): failed to open stream: Redirection limit reached, aborting in %s
055- bool(false)
056- string(48) "GET /foo/bar HTTP/1.0
057- Host: 127.0.0.1:12342
058+ ***
059+ HERE1
060+ HERE2
061+ HERE3
062+ line=[GET /foo/bar3 HTTP/1.0]
063+ HERE2
064+ HERE3
065+ line=[User-Agent: PHP/5.4.0RC2-dev]
066+ HERE2
067+ HERE3
068+ line=[Host: 127.0.0.1:12342]
069+ HERE2
070+ HERE3
071+ line=[Accept: */*]
072+ HERE2
073+ HERE3
074+ line=[]
075+ HERE4 file=[data://text/plain,HTTP/1.0 302 Moved Temporarily
076+ Location: http://127.0.0.1:12342/foo/bar4
059- "
060- -- Test: return at first redirection --
061- resource(%d) of type (stream)
062- array(2) {
063- [0]=>
064- string(30) "HTTP/1.0 302 Moved Temporarily"
065- [1]=>
066- string(41) "Location: http://127.0.0.1:12342/foo/bar2"
067- }
068- string(1) "1"
069- string(48) "GET /foo/bar HTTP/1.0
072- "
073- -- Test: return at first redirection (2) --
074- resource(%d) of type (stream)
075- array(2) {
076- [0]=>
077- string(30) "HTTP/1.0 302 Moved Temporarily"
078- [1]=>
079- string(41) "Location: http://127.0.0.1:12342/foo/bar2"
080- }
081- string(1) "1"
082- string(48) "GET /foo/bar HTTP/1.0
078+ 3]
079+ HTTP/1.0 302 Moved Temporarily
080+ Location: http://127.0.0.1:12342/foo/bar4
082+ 3***
083+ HERE1
084+ HERE2
085+ HERE3
086+ line=[GET /foo/bar4 HTTP/1.0]
087+ HERE2
088+ HERE3
089+ line=[User-Agent: PHP/5.4.0RC2-dev]
090+ HERE2
091+ HERE3
092+ line=[Host: 127.0.0.1:12342]
093+ HERE2
094+ HERE3
095+ line=[Accept: */*]
096+ HERE2
097+ HERE3
098+ line=[]
099+ HERE4 file=[data://text/plain,HTTP/1.0 200 OK
100+
101+ done.]
102+ HTTP/1.0 200 OK
103+
104+ done.***
105+ string(5) "done."
106+ string(367) "GET /foo/bar HTTP/1.1
107+ User-Agent: PHP/5.4.0RC2-dev
086- -- Test: return at second redirection --
088- array(4) {
089- [0]=>
090- string(30) "HTTP/1.0 302 Moved Temporarily"
091- [1]=>
092- string(41) "Location: http://127.0.0.1:12342/foo/bar2"
093- [2]=>
094- string(30) "HTTP/1.0 301 Moved Permanently"
095- [3]=>
096- string(41) "Location: http://127.0.0.1:12342/foo/bar3"
098- string(0) ""
099- string(97) "GET /foo/bar HTTP/1.0
100- Host: 127.0.0.1:12342
101-
102- GET /foo/bar2 HTTP/1.0
103- Host: 127.0.0.1:12342
104-
105- "
109+ Accept: */*
111+ GET /foo/bar2 HTTP/1.0
112+ User-Agent: PHP/5.4.0RC2-dev
113+ Host: 127.0.0.1:12342
114+ Accept: */*
115+
116+ GET /foo/bar3 HTTP/1.0
117+ User-Agent: PHP/5.4.0RC2-dev
119+ Accept: */*
121+ GET /foo/bar4 HTTP/1.0
122+ User-Agent: PHP/5.4.0RC2-dev
123+ Host: 127.0.0.1:12342
124+ Accept: */*
125+
127+ -- Test: fail after 2 redirections --
128+ output=[]
130+ array(2) {
131+ ["headers"]=>
132+ array(0) {
133+ }
134+ ["readbuf"]=>
135+ resource(16) of type (stream)
137+ HERE1
138+ HERE2
139+ HERE3
140+ line=[GET /foo/bar HTTP/1.1]
141+ HERE2
142+ HERE3
143+ line=[User-Agent: PHP/5.4.0RC2-dev]
144+ HERE2
145+ HERE3
146+ line=[Host: 127.0.0.1:12342]
147+ HERE2
148+ HERE3
149+ line=[Accept: */*]
150+ HERE2
151+ HERE3
152+ line=[]
153+ HERE4 file=[data://text/plain,HTTP/1.0 302 Moved Temporarily
154+ Location: http://127.0.0.1:12342/foo/bar2
155+
156+ 1]
157+ HTTP/1.0 302 Moved Temporarily
158+ Location: http://127.0.0.1:12342/foo/bar2
159+
160+ 1***
161+ HERE1
162+ HERE2
163+ HERE3
164+ line=[GET /foo/bar2 HTTP/1.0]
165+ HERE2
166+ HERE3
167+ line=[User-Agent: PHP/5.4.0RC2-dev]
168+ HERE2
169+ HERE3
170+ line=[Host: 127.0.0.1:12342]
171+ HERE2
172+ HERE3
173+ line=[Accept: */*]
174+ HERE2
175+ HERE3
176+ line=[]
177+ HERE4 file=[data://text/plain,HTTP/1.0 301 Moved Permanently
178+ Location: http://127.0.0.1:12342/foo/bar3
179+
180+ ]
181+ HTTP/1.0 301 Moved Permanently
182+ Location: http://127.0.0.1:12342/foo/bar3
183+
184+ ***
185+ HERE1
186+ HERE2
187+ HERE3
188+ line=[GET /foo/bar3 HTTP/1.0]
189+ HERE2
190+ HERE3
191+ line=[User-Agent: PHP/5.4.0RC2-dev]
192+ HERE2
193+ HERE3
194+ line=[Host: 127.0.0.1:12342]
195+ HERE2
196+ HERE3
197+ line=[Accept: */*]
198+ HERE2
199+ HERE3
200+ line=[]
201+ HERE4 file=[data://text/plain,HTTP/1.0 302 Moved Temporarily
202+ Location: http://127.0.0.1:12342/foo/bar4
203+
204+ 3]
205+ HTTP/1.0 302 Moved Temporarily
206+ Location: http://127.0.0.1:12342/foo/bar4
207+
208+ 3***
209+ string(0) ""
210+ string(275) "GET /foo/bar HTTP/1.1
211+ User-Agent: PHP/5.4.0RC2-dev
212+ Host: 127.0.0.1:12342
213+ Accept: */*
214+
215+ GET /foo/bar2 HTTP/1.0
216+ User-Agent: PHP/5.4.0RC2-dev
217+ Host: 127.0.0.1:12342
218+ Accept: */*
219+
220+ GET /foo/bar3 HTTP/1.0
221+ User-Agent: PHP/5.4.0RC2-dev
222+ Host: 127.0.0.1:12342
223+ Accept: */*
224+
225+ "
226+ -- Test: fail at first redirection --
227+ output=[]
228+ resource(21) of type (stream)
229+ array(2) {
230+ ["headers"]=>
231+ array(0) {
232+ }
233+ ["readbuf"]=>
234+ resource(22) of type (stream)
235+ }
236+ HERE1
237+ HERE2
238+ HERE3
239+ line=[GET /foo/bar HTTP/1.1]
240+ HERE2
241+ HERE3
242+ line=[User-Agent: PHP/5.4.0RC2-dev]
243+ HERE2
244+ HERE3
245+ line=[Host: 127.0.0.1:12342]
246+ HERE2
247+ HERE3
248+ line=[Accept: */*]
249+ HERE2
250+ HERE3
251+ line=[]
252+ HERE4 file=[data://text/plain,HTTP/1.0 302 Moved Temporarily
253+ Location: http://127.0.0.1:12342/foo/bar2
254+
255+ 1]
256+ HTTP/1.0 302 Moved Temporarily
257+ Location: http://127.0.0.1:12342/foo/bar2
258+
259+ 1***
260+ string(1) "1"
261+ string(91) "GET /foo/bar HTTP/1.1
262+ User-Agent: PHP/5.4.0RC2-dev
263+ Host: 127.0.0.1:12342
264+ Accept: */*
265+
266+ "
267+ -- Test: fail at first redirection (2) --
268+ output=[]
269+ resource(27) of type (stream)
270+ array(2) {
271+ ["headers"]=>
272+ array(0) {
273+ }
274+ ["readbuf"]=>
275+ resource(28) of type (stream)
276+ }
277+ HERE1
278+ HERE2
279+ HERE3
280+ line=[GET /foo/bar HTTP/1.1]
281+ HERE2
282+ HERE3
283+ line=[User-Agent: PHP/5.4.0RC2-dev]
284+ HERE2
285+ HERE3
286+ line=[Host: 127.0.0.1:12342]
287+ HERE2
288+ HERE3
289+ line=[Accept: */*]
290+ HERE2
291+ HERE3
292+ line=[]
293+ HERE4 file=[data://text/plain,HTTP/1.0 302 Moved Temporarily
294+ Location: http://127.0.0.1:12342/foo/bar2
295+
296+ 1]
297+ HTTP/1.0 302 Moved Temporarily
298+ Location: http://127.0.0.1:12342/foo/bar2
299+
300+ 1***
301+ string(1) "1"
302+ string(91) "GET /foo/bar HTTP/1.1
303+ User-Agent: PHP/5.4.0RC2-dev
304+ Host: 127.0.0.1:12342
305+ Accept: */*
306+
307+ "
308+ -- Test: return at first redirection --
309+ output=[]
310+ resource(33) of type (stream)
311+ array(2) {
312+ ["headers"]=>
313+ array(0) {
314+ }
315+ ["readbuf"]=>
316+ resource(34) of type (stream)
317+ }
318+ HERE1
319+ HERE2
320+ HERE3
321+ line=[GET /foo/bar HTTP/1.1]
322+ HERE2
323+ HERE3
324+ line=[User-Agent: PHP/5.4.0RC2-dev]
325+ HERE2
326+ HERE3
327+ line=[Host: 127.0.0.1:12342]
328+ HERE2
329+ HERE3
330+ line=[Accept: */*]
331+ HERE2
332+ HERE3
333+ line=[]
334+ HERE4 file=[data://text/plain,HTTP/1.0 302 Moved Temporarily
335+ Location: http://127.0.0.1:12342/foo/bar2
336+
337+ 1]
338+ HTTP/1.0 302 Moved Temporarily
339+ Location: http://127.0.0.1:12342/foo/bar2
340+
341+ 1***
342+ string(1) "1"
343+ string(91) "GET /foo/bar HTTP/1.1
344+ User-Agent: PHP/5.4.0RC2-dev
345+ Host: 127.0.0.1:12342
346+ Accept: */*
347+
348+ "
349+ -- Test: return at first redirection (2) --
350+ output=[]
351+ resource(39) of type (stream)
352+ array(2) {
353+ ["headers"]=>
354+ array(0) {
355+ }
356+ ["readbuf"]=>
357+ resource(40) of type (stream)
358+ }
359+ HERE1
360+ HERE2
361+ HERE3
362+ line=[GET /foo/bar HTTP/1.1]
363+ HERE2
364+ HERE3
365+ line=[User-Agent: PHP/5.4.0RC2-dev]
366+ HERE2
367+ HERE3
368+ line=[Host: 127.0.0.1:12342]
369+ HERE2
370+ HERE3
371+ line=[Accept: */*]
372+ HERE2
373+ HERE3
374+ line=[]
375+ HERE4 file=[data://text/plain,HTTP/1.0 302 Moved Temporarily
376+ Location: http://127.0.0.1:12342/foo/bar2
377+
378+ 1]
379+ HTTP/1.0 302 Moved Temporarily
380+ Location: http://127.0.0.1:12342/foo/bar2
381+
382+ 1***
383+ string(1) "1"
384+ string(91) "GET /foo/bar HTTP/1.1
385+ User-Agent: PHP/5.4.0RC2-dev
386+ Host: 127.0.0.1:12342
387+ Accept: */*
388+
389+ "
390+ -- Test: return at second redirection --
391+ output=[]
392+ resource(45) of type (stream)
393+ array(2) {
394+ ["headers"]=>
395+ array(0) {
396+ }
397+ ["readbuf"]=>
398+ resource(46) of type (stream)
399+ }
400+ HERE1
401+ HERE2
402+ HERE3
403+ line=[GET /foo/bar HTTP/1.1]
404+ HERE2
405+ HERE3
406+ line=[User-Agent: PHP/5.4.0RC2-dev]
407+ HERE2
408+ HERE3
409+ line=[Host: 127.0.0.1:12342]
410+ HERE2
411+ HERE3
412+ line=[Accept: */*]
413+ HERE2
414+ HERE3
415+ line=[]
416+ HERE4 file=[data://text/plain,HTTP/1.0 302 Moved Temporarily
417+ Location: http://127.0.0.1:12342/foo/bar2
418+
419+ 1]
420+ HTTP/1.0 302 Moved Temporarily
421+ Location: http://127.0.0.1:12342/foo/bar2
422+
423+ 1***
424+ HERE1
425+ HERE2
426+ HERE3
427+ line=[GET /foo/bar2 HTTP/1.0]
428+ HERE2
429+ HERE3
430+ line=[User-Agent: PHP/5.4.0RC2-dev]
431+ HERE2
432+ HERE3
433+ line=[Host: 127.0.0.1:12342]
434+ HERE2
435+ HERE3
436+ line=[Accept: */*]
437+ HERE2
438+ HERE3
439+ line=[]
440+ HERE4 file=[data://text/plain,HTTP/1.0 301 Moved Permanently
441+ Location: http://127.0.0.1:12342/foo/bar3
442+
443+ ]
444+ HTTP/1.0 301 Moved Permanently
445+ Location: http://127.0.0.1:12342/foo/bar3
446+
447+ ***
448+ HERE1
449+ HERE2
450+ HERE3
451+ line=[GET /foo/bar3 HTTP/1.0]
452+ HERE2
453+ HERE3
454+ line=[User-Agent: PHP/5.4.0RC2-dev]
455+ HERE2
456+ HERE3
457+ line=[Host: 127.0.0.1:12342]
458+ HERE2
459+ HERE3
460+ line=[Accept: */*]
461+ HERE2
462+ HERE3
463+ line=[]
464+ HERE4 file=[data://text/plain,HTTP/1.0 302 Moved Temporarily
465+ Location: http://127.0.0.1:12342/foo/bar4
466+
467+ 3]
468+ HTTP/1.0 302 Moved Temporarily
469+ Location: http://127.0.0.1:12342/foo/bar4
470+
471+ 3***
472+ string(0) ""
473+ string(275) "GET /foo/bar HTTP/1.1
474+ User-Agent: PHP/5.4.0RC2-dev
475+ Host: 127.0.0.1:12342
476+ Accept: */*
477+
478+ GET /foo/bar2 HTTP/1.0
479+ User-Agent: PHP/5.4.0RC2-dev
480+ Host: 127.0.0.1:12342
481+ Accept: */*
482+
483+ GET /foo/bar3 HTTP/1.0
484+ User-Agent: PHP/5.4.0RC2-dev
485+ Host: 127.0.0.1:12342
486+ Accept: */*
487+
488+ "