return FAILURE;
}
} else {
- char *encoded_val;
- int encoded_len;
zval *cpy, *val = convert_to_type_ex(IS_STRING, *data, &cpy);
if (PHPSTR_LEN(str)) {
phpstr_append(str, PHPSTR_VAL(&new_prefix), PHPSTR_LEN(&new_prefix));
phpstr_appends(str, "=");
- encoded_val = php_url_encode(Z_STRVAL_P(val), Z_STRLEN_P(val), &encoded_len);
- phpstr_append(str, encoded_val, encoded_len);
- efree(encoded_val);
+ if (Z_STRLEN_P(val)) {
+ char *encoded_val;
+ int encoded_len;
+
+ encoded_val = php_url_encode(Z_STRVAL_P(val), Z_STRLEN_P(val), &encoded_len);
+ phpstr_append(str, encoded_val, encoded_len);
+ efree(encoded_val);
+ }
if (cpy) {
zval_ptr_dtor(&cpy);