better PHP-5.3 compatibility
[m6w6/ext-http] / tests / message004.phpt
index de2e4e415e10d8fe1990303da9c757273480e378..914a8dab0a29c28161c1899bfc4366f9359a6380 100644 (file)
@@ -8,12 +8,16 @@ include "skip.inc";
 
 use http\Message as HttpMessage;
 
+function newHttpMessage($s) {
+       return new http\Message($s);
+}
+
 $s = "GET /first HTTP/1.1\nHTTP/1.1 200 Ok-first\nGET /second HTTP/1.1\nHTTP/1.1 200 Ok-second\nGET /third HTTP/1.1\nHTTP/1.1 200 Ok-third\n";
-echo (new HttpMessage($s))->toString(true);
+echo newHttpMessage($s)->toString(true);
 echo "===\n";
-echo (new HttpMessage($s))->reverse()->toString(true);
+echo newHttpMessage($s)->reverse()->toString(true);
 
-$m = new HttpMessage($s);
+$m = newHttpMessage($s);
 $r = $m->reverse();
 unset($m);
 var_dump($r->count());