kalle                                    Mon, 09 Aug 2010 13:10:32 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=302033

Log:
Implemented FR #52555 (Ability to get HTTP response code)
 - Patch by Paul Dragoonis

Bug: http://bugs.php.net/52555 (Assigned) Headers_List not returning HTTP 
Status Code
      
Changed paths:
    U   php/php-src/trunk/NEWS
    U   php/php-src/trunk/ext/standard/basic_functions.c
    U   php/php-src/trunk/ext/standard/head.c
    U   php/php-src/trunk/ext/standard/head.h

Modified: php/php-src/trunk/NEWS
===================================================================
--- php/php-src/trunk/NEWS      2010-08-09 11:22:09 UTC (rev 302032)
+++ php/php-src/trunk/NEWS      2010-08-09 13:10:32 UTC (rev 302033)
@@ -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 @@
 - 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)

Modified: php/php-src/trunk/ext/standard/basic_functions.c
===================================================================
--- php/php-src/trunk/ext/standard/basic_functions.c    2010-08-09 11:22:09 UTC 
(rev 302032)
+++ php/php-src/trunk/ext/standard/basic_functions.c    2010-08-09 13:10:32 UTC 
(rev 302033)
@@ -1470,6 +1470,9 @@

 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 @@
        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)

Modified: php/php-src/trunk/ext/standard/head.c
===================================================================
--- php/php-src/trunk/ext/standard/head.c       2010-08-09 11:22:09 UTC (rev 
302032)
+++ php/php-src/trunk/ext/standard/head.c       2010-08-09 13:10:32 UTC (rev 
302033)
@@ -281,6 +281,18 @@
 }
 /* }}} */

+/* {{{ 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

Modified: php/php-src/trunk/ext/standard/head.h
===================================================================
--- php/php-src/trunk/ext/standard/head.h       2010-08-09 11:22:09 UTC (rev 
302032)
+++ php/php-src/trunk/ext/standard/head.h       2010-08-09 13:10:32 UTC (rev 
302033)
@@ -28,6 +28,7 @@
 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);

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to