]> granicus.if.org Git - php/commitdiff
Implemented FR #52555 (Ability to get HTTP response code)
authorKalle Sommer Nielsen <kalle@php.net>
Mon, 9 Aug 2010 13:10:32 +0000 (13:10 +0000)
committerKalle Sommer Nielsen <kalle@php.net>
Mon, 9 Aug 2010 13:10:32 +0000 (13:10 +0000)
 - Patch by Paul Dragoonis

NEWS
ext/standard/basic_functions.c
ext/standard/head.c
ext/standard/head.h

diff --git a/NEWS b/NEWS
index 52552be556cd25ad90346dbdd25880dcdcf07c71..5804f369a9a1bb6cac1869673b1a52f46e140748 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,4 +1,4 @@
-PHP                                                                        NEWS
+PHP                                                                        NEWS
 |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
 ?? ??? 201?, PHP 5.3.99
 - Upgraded bundled sqlite to version 3.6.23.1. (Ilia)
@@ -89,6 +89,7 @@ PHP                                                                        NEWS
 - Removed support for linking against MySQL client libraries older 4.1 from
   PDO_mysql. (Johannes)
 
+- Implemented FR #52555 (Ability to get HTTP response code). (Paul Dragoonis)
 - Implemented FR #51295 (SQLite3::busyTimeout not existing). (Mark)
 - Implemented FR #48632 (OpenSSL AES support). (yonas dot y
    at gmail dot com, Pierre)
index 1a745a43b4133343c6a79e9281fbbcf401232a89..8d9f5e1b4f842cb0d266094f1c9af3baff207974 100644 (file)
@@ -1470,6 +1470,9 @@ ZEND_END_ARG_INFO()
 
 ZEND_BEGIN_ARG_INFO(arginfo_headers_list, 0)
 ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO(arginfo_http_response_code, 0)
+ZEND_END_ARG_INFO()
 /* }}} */
 /* {{{ html.c */
 ZEND_BEGIN_ARG_INFO_EX(arginfo_htmlspecialchars, 0, 0, 1)
@@ -2983,6 +2986,7 @@ const zend_function_entry basic_functions[] = { /* {{{ */
        PHP_FE(header_remove,                                                                                                   arginfo_header_remove)
        PHP_FE(headers_sent,                                                                                                    arginfo_headers_sent)
        PHP_FE(headers_list,                                                                                                    arginfo_headers_list)
+       PHP_FE(http_response_code,                                                                                              arginfo_http_response_code)
 
        PHP_FE(connection_aborted,                                                                                              arginfo_connection_aborted)
        PHP_FE(connection_status,                                                                                               arginfo_connection_status)
index 229398587f633b7073fc3f014cc6f9433623f49b..7c0192c4cb34740d62ab66d5c31de3fb69579d34 100644 (file)
@@ -281,6 +281,18 @@ PHP_FUNCTION(headers_list)
 }
 /* }}} */
 
+/* {{{ proto long http_response_code()
+   Returns the current HTTP response code */
+PHP_FUNCTION(http_response_code)
+{
+       if (zend_parse_parameters_none() == FAILURE) {
+               return;
+       }
+
+       RETURN_LONG(SG(sapi_headers).http_response_code);
+}
+/* }}} */
+
 /*
  * Local variables:
  * tab-width: 4
index e221799227da7ad5be81ecd849cb8a33b6128642..e38fbf6d8961126446866cb4481491a93fce7291 100644 (file)
@@ -28,6 +28,7 @@ PHP_FUNCTION(setcookie);
 PHP_FUNCTION(setrawcookie);
 PHP_FUNCTION(headers_sent);
 PHP_FUNCTION(headers_list);
+PHP_FUNCTION(http_response_code);
 
 PHPAPI int php_header(TSRMLS_D);
 PHPAPI int php_setcookie(char *name, int name_len, char *value, int value_len, time_t expires, char *path, int path_len, char *domain, int domain_len, int secure, int url_encode, int httponly TSRMLS_DC);