zval_ptr_dtor(&h);
}
}
+ } else if ((h = php_http_message_header(msg, ZEND_STRL("Content-Length"), 1))) {
+ zval *h_cpy = php_http_ztyp(IS_LONG, h);
+
+ zval_ptr_dtor(&h);
+ if (Z_LVAL_P(h_cpy)) {
+ zend_hash_del(&msg->hdrs, "Content-Length", sizeof("Content-Length"));
+ }
+ zval_ptr_dtor(&h_cpy);
}
}
--- /dev/null
+--TEST--
+reset content length when resetting body
+--SKIPIF--
+<?php
+include "skipif.inc";
+?>
+--FILE--
+<?php
+
+echo "Test\n";
+
+$client = new http\Client;
+$request = new http\Client\Request("PUT", "put.php");
+$request->setBody(new http\Message\Body(fopen(__FILE__, "r")));
+$client->enqueue($request);
+var_dump($request->getHeader("Content-Length"));
+$request->setBody(new http\Message\Body);
+$client->requeue($request);
+var_dump($request->getHeader("Content-Length"));
+?>
+===DONE===
+--EXPECTF--
+Test
+int(379)
+bool(false)
+===DONE===