mirror of
https://github.com/php/php-src.git
synced 2026-03-24 00:02:20 +01:00
standard: Remove php_std_date() C API (#18522)
This function is unused and trivially replaced by `php_format_date()` (which is already used to format date headers in the CLI server and ext/session). Remove it to slim down the codebase, allowing to remove an entire header (and a source file once the deprecated `strptime()` userland function is removed).
This commit is contained in:
@@ -64,6 +64,8 @@ PHP 8.5 INTERNALS UPGRADE NOTES
|
||||
- ext/standard
|
||||
. Added php_url_decode_ex() and php_raw_url_decode_ex() that unlike their
|
||||
non-ex counterparts do not work in-place.
|
||||
. The php_std_date() function has been removed. Use php_format_date() with
|
||||
the "D, d M Y H:i:s \\G\\M\\T" format instead.
|
||||
|
||||
========================
|
||||
4. OpCode changes
|
||||
|
||||
@@ -17,50 +17,12 @@
|
||||
*/
|
||||
|
||||
#include "php.h"
|
||||
#include "zend_operators.h"
|
||||
#include "datetime.h"
|
||||
#include "php_globals.h"
|
||||
|
||||
#include <time.h>
|
||||
#ifdef HAVE_SYS_TIME_H
|
||||
# include <sys/time.h>
|
||||
#endif
|
||||
#include <stdio.h>
|
||||
|
||||
static const char * const mon_short_names[] = {
|
||||
"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
|
||||
};
|
||||
|
||||
static const char * const day_short_names[] = {
|
||||
"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"
|
||||
};
|
||||
|
||||
/* {{{ PHPAPI char *php_std_date(time_t t)
|
||||
Return date string in standard format for http headers */
|
||||
PHPAPI char *php_std_date(time_t t)
|
||||
{
|
||||
struct tm *tm1, tmbuf;
|
||||
char *str;
|
||||
|
||||
tm1 = php_gmtime_r(&t, &tmbuf);
|
||||
str = emalloc(81);
|
||||
str[0] = '\0';
|
||||
|
||||
if (!tm1) {
|
||||
return str;
|
||||
}
|
||||
|
||||
snprintf(str, 80, "%s, %02d %s %04d %02d:%02d:%02d GMT",
|
||||
day_short_names[tm1->tm_wday],
|
||||
tm1->tm_mday,
|
||||
mon_short_names[tm1->tm_mon],
|
||||
tm1->tm_year + 1900,
|
||||
tm1->tm_hour, tm1->tm_min, tm1->tm_sec);
|
||||
|
||||
str[79] = 0;
|
||||
return (str);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
#ifdef HAVE_STRPTIME
|
||||
#ifndef HAVE_DECL_STRPTIME
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) The PHP Group |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 3.01 of the PHP license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
| available through the world-wide-web at the following url: |
|
||||
| https://www.php.net/license/3_01.txt |
|
||||
| If you did not receive a copy of the PHP license and are unable to |
|
||||
| obtain it through the world-wide-web, please send a note to |
|
||||
| license@php.net so we can mail you a copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
| Authors: Andi Gutmans <andi@php.net> |
|
||||
| Zeev Suraski <zeev@php.net> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
#ifndef DATETIME_H
|
||||
#define DATETIME_H
|
||||
|
||||
PHPAPI char *php_std_date(time_t t);
|
||||
|
||||
#endif /* DATETIME_H */
|
||||
@@ -30,7 +30,6 @@
|
||||
#include "php_filestat.h"
|
||||
#include "php_browscap.h"
|
||||
#include "pack.h"
|
||||
#include "datetime.h"
|
||||
#include "url.h"
|
||||
#include "pageinfo.h"
|
||||
#include "fsock.h"
|
||||
|
||||
Reference in New Issue
Block a user