fix Bug #15497 HttpInflateStream::finish segfaults when passing NULL
[m6w6/ext-http] / http_message_object.c
index acb8a1d624dfccef96de6f27a252858e6081e7e3..81f31a409fdb9d46350e3707d3321f07302bbc82 100644 (file)
@@ -418,7 +418,7 @@ static zval *_http_message_object_read_prop(zval *object, zval *member, int type
 #else
        zend_property_info *pinfo = zend_get_property_info(obj->zo.ce, member, 1 TSRMLS_CC);
        
-       if (!pinfo || ACC_PROP_PUBLIC(pinfo->flags)) {
+       if (!pinfo) {
                return zend_get_std_object_handlers()->read_property(object, member, type TSRMLS_CC);
        }
 #endif
@@ -511,11 +511,8 @@ static zval *_http_message_object_read_prop(zval *object, zval *member, int type
                        break;
                
                default:
-#ifdef WONKY
+                       FREE_ZVAL(return_value);
                        return zend_get_std_object_handlers()->read_property(object, member, type TSRMLS_CC);
-#else
-                       RETVAL_NULL();
-#endif
        }
 
        return return_value;
@@ -531,7 +528,7 @@ static void _http_message_object_write_prop(zval *object, zval *member, zval *va
 #else
        zend_property_info *pinfo = zend_get_property_info(obj->zo.ce, member, 1 TSRMLS_CC);
        
-       if (!pinfo || ACC_PROP_PUBLIC(pinfo->flags)) {
+       if (!pinfo) {
                zend_get_std_object_handlers()->write_property(object, member, value TSRMLS_CC);
                return;
        }
@@ -617,9 +614,7 @@ static void _http_message_object_write_prop(zval *object, zval *member, zval *va
                        break;
                
                default:
-#ifdef WONKY
                        zend_get_std_object_handlers()->write_property(object, member, value TSRMLS_CC);
-#endif
                        break;
        }
        if (cpy != value) {
@@ -1137,9 +1132,9 @@ PHP_METHOD(HttpMessage, setHttpVersion)
        }
 
        convert_to_double(zv);
-       sprintf(v, "%1.1lf", Z_DVAL_P(zv));
+       snprintf(v, sizeof(v), "%1.1f", Z_DVAL_P(zv));
        if (strcmp(v, "1.0") && strcmp(v, "1.1")) {
-               http_error_ex(HE_WARNING, HTTP_E_INVALID_PARAM, "Invalid HTTP protocol version (1.0 or 1.1): %s", v);
+               http_error_ex(HE_WARNING, HTTP_E_INVALID_PARAM, "Invalid HTTP protocol version (1.0 or 1.1): %g", Z_DVAL_P(zv));
                RETURN_FALSE;
        }
 
@@ -1401,8 +1396,8 @@ PHP_METHOD(HttpMessage, unserialize)
                if ((msg = http_message_parse_ex(obj->message, serialized, (size_t) length))) {
                        obj->message = msg;
                } else {
-                       http_error(HE_ERROR, HTTP_E_RUNTIME, "Could not unserialize HttpMessage");
                        http_message_init(obj->message);
+                       http_error(HE_ERROR, HTTP_E_RUNTIME, "Could not unserialize HttpMessage");
                }
        }
 }