- switch (Z_TYPE_PP(tmp)) {
- case IS_LONG:
- list->expires = Z_LVAL_PP(tmp);
- break;
- case IS_DOUBLE:
- list->expires = (long) Z_DVAL_PP(tmp);
- break;
- case IS_STRING:
- cpy = php_http_ztyp(IS_LONG, *tmp);
- if (Z_LVAL_P(cpy)) {
- list->expires = Z_LVAL_P(cpy);
- } else {
- time_t expires = php_parse_date(Z_STRVAL_PP(tmp), NULL);
- if (expires > 0) {
- list->expires = expires;
- }
- }
- zval_ptr_dtor(&cpy);
- break;
- default:
- break;
+ if (Z_TYPE_PP(tmp) == IS_LONG) {
+ list->expires = Z_LVAL_PP(tmp);
+ } else {
+ long lval;
+
+ cpy = php_http_ztyp(IS_STRING, *tmp);
+ if (IS_LONG == is_numeric_string(Z_STRVAL_P(cpy), Z_STRLEN_P(cpy), &lval, NULL, 0)) {
+ list->expires = lval;
+ } else {
+ list->expires = php_parse_date(Z_STRVAL_P(cpy), NULL);
+ }
+
+ zval_ptr_dtor(&cpy);
+ }
+ }
+ if (SUCCESS == zend_hash_find(ht, "max-age", sizeof("max-age"), (void *) &tmp)) {
+ if (Z_TYPE_PP(tmp) == IS_LONG) {
+ list->max_age = Z_LVAL_PP(tmp);
+ } else {
+ long lval;
+
+ cpy = php_http_ztyp(IS_STRING, *tmp);
+ if (IS_LONG == is_numeric_string(Z_STRVAL_P(cpy), Z_STRLEN_P(cpy), &lval, NULL, 0)) {
+ list->max_age = lval;
+ }
+
+ zval_ptr_dtor(&cpy);