fprintf(stderr, "\n%3d: %3d PRIOR: size=%7lu,\tfree=%7lu,\tused=%7lu,\tavail_in=%7lu,\tavail_out=%7lu\n", round, status, buffer.size, buffer.free, buffer.used, Z->avail_in, Z->avail_out);
#endif
status = inflate(Z, flush);
-
- buffer.used += buffer.free - Z->avail_out;
- buffer.free = Z->avail_out;
+ php_http_buffer_account(&buffer, buffer.free - Z->avail_out);
#if 0
fprintf(stderr, "%3d: %3d AFTER: size=%7lu,\tfree=%7lu,\tused=%7lu,\tavail_in=%7lu,\tavail_out=%7lu\n", round, status, buffer.size, buffer.free, buffer.used, Z->avail_in, Z->avail_out);
#endif
status = inflateInit2(&Z, wbits);
if (Z_OK == status) {
Z.next_in = (Bytef *) data;
- Z.avail_in = data_len;
+ Z.avail_in = data_len + 1; /* include the terminating NULL, see #61287 */
switch (status = php_http_inflate_rounds(&Z, Z_NO_FLUSH, decoded, decoded_len)) {
case Z_STREAM_END:
PHP_HTTP_EMPTY_ARGS(done);
PHP_HTTP_EMPTY_ARGS(finish);
-zend_class_entry *php_http_encoding_stream_class_entry;
-zend_function_entry php_http_encoding_stream_method_entry[] = {
+static zend_class_entry *php_http_encoding_stream_class_entry;
+
+zend_class_entry *php_http_encoding_stream_get_class_entry(void)
+{
+ return php_http_encoding_stream_class_entry;
+}
+
+static zend_function_entry php_http_encoding_stream_method_entry[] = {
PHP_HTTP_ENCSTREAM_ME(__construct, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR)
PHP_HTTP_ENCSTREAM_ME(update, ZEND_ACC_PUBLIC)
PHP_HTTP_ENCSTREAM_ME(flush, ZEND_ACC_PUBLIC)
o = ecalloc(1, sizeof(*o));
zend_object_std_init((zend_object *) o, ce TSRMLS_CC);
+#if PHP_VERSION_ID < 50339
+ zend_hash_copy(((zend_object *) o)->properties, &(ce->default_properties), (copy_ctor_func_t) zval_add_ref, NULL, sizeof(zval*));
+#else
object_properties_init((zend_object *) o, ce);
+#endif
if (ptr) {
*ptr = o;
PHP_METHOD(HttpEncodingStream, __construct)
{
- with_error_handling(EH_THROW, php_http_exception_class_entry) {
+ with_error_handling(EH_THROW, php_http_exception_get_class_entry()) {
long flags = 0;
if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &flags)) {
- with_error_handling(EH_THROW, php_http_exception_class_entry) {
+ with_error_handling(EH_THROW, php_http_exception_get_class_entry()) {
php_http_encoding_stream_object_t *obj = zend_object_store_get_object(getThis() TSRMLS_CC);
if (!obj->stream) {
php_http_encoding_stream_ops_t *ops = NULL;
- if (instanceof_function(obj->zo.ce, php_http_deflate_stream_class_entry TSRMLS_CC)) {
+ if (instanceof_function(obj->zo.ce, php_http_deflate_stream_get_class_entry() TSRMLS_CC)) {
ops = &php_http_encoding_deflate_ops;
- } else if (instanceof_function(obj->zo.ce, php_http_inflate_stream_class_entry TSRMLS_CC)) {
+ } else if (instanceof_function(obj->zo.ce, php_http_inflate_stream_get_class_entry() TSRMLS_CC)) {
ops = &php_http_encoding_inflate_ops;
- } else if (instanceof_function(obj->zo.ce, php_http_dechunk_stream_class_entry TSRMLS_CC)) {
+ } else if (instanceof_function(obj->zo.ce, php_http_dechunk_stream_get_class_entry() TSRMLS_CC)) {
ops = &php_http_encoding_dechunk_ops;
}
PHP_HTTP_ARG_VAL(flags, 0)
PHP_HTTP_END_ARGS;
-zend_class_entry *php_http_deflate_stream_class_entry;
-zend_function_entry php_http_deflate_stream_method_entry[] = {
+static zend_class_entry *php_http_deflate_stream_class_entry;
+
+zend_class_entry *php_http_deflate_stream_get_class_entry(void)
+{
+ return php_http_deflate_stream_class_entry;
+}
+
+static zend_function_entry php_http_deflate_stream_method_entry[] = {
PHP_HTTP_DEFLATE_ME(encode, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
EMPTY_FUNCTION_ENTRY
PHP_HTTP_ARG_VAL(data, 0)
PHP_HTTP_END_ARGS;
-zend_class_entry *php_http_inflate_stream_class_entry;
-zend_function_entry php_http_inflate_stream_method_entry[] = {
+static zend_class_entry *php_http_inflate_stream_class_entry;
+
+zend_class_entry *php_http_inflate_stream_get_class_entry(void)
+{
+ return php_http_inflate_stream_class_entry;
+}
+
+static zend_function_entry php_http_inflate_stream_method_entry[] = {
PHP_HTTP_INFLATE_ME(decode, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
EMPTY_FUNCTION_ENTRY
PHP_HTTP_ARG_VAL(decoded_len, 1)
PHP_HTTP_END_ARGS;
-zend_class_entry *php_http_dechunk_stream_class_entry;
-zend_function_entry php_http_dechunk_stream_method_entry[] = {
+static zend_class_entry *php_http_dechunk_stream_class_entry;
+
+zend_class_entry *php_http_dechunk_stream_get_class_entry(void)
+{
+ return php_http_dechunk_stream_class_entry;
+}
+
+static zend_function_entry php_http_dechunk_stream_method_entry[] = {
PHP_HTTP_DECHUNK_ME(decode, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
EMPTY_FUNCTION_ENTRY
PHP_MINIT_FUNCTION(http_encoding)
{
- PHP_HTTP_REGISTER_CLASS(http\\Encoding, Stream, http_encoding_stream, php_http_object_class_entry, ZEND_ACC_EXPLICIT_ABSTRACT_CLASS);
+ PHP_HTTP_REGISTER_CLASS(http\\Encoding, Stream, http_encoding_stream, php_http_object_get_class_entry(), ZEND_ACC_EXPLICIT_ABSTRACT_CLASS);
php_http_encoding_stream_class_entry->create_object = php_http_encoding_stream_object_new;
memcpy(&php_http_encoding_stream_object_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers));
php_http_encoding_stream_object_handlers.clone_obj = php_http_encoding_stream_object_clone;