mirror of
https://github.com/php/php-src.git
synced 2026-03-24 08:12:21 +01:00
- Added backward compability wrapper "php_parse_date()".
- Changed WDDX extension to use new date parsing code. - Removed all remnants to the old parser. #- I hope that I didn't break the .dsp's...
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
- Port over my 200 test cases to .phpt format.
|
||||
- Write an error handler for unexpected characters while parsing dates.
|
||||
- Remove old parsedate.* code from ext/standard
|
||||
- Move all date/time related functions from ext/standard to ext/date
|
||||
- Move all date/time related tests from ext/standard/tests to ext/data/tests
|
||||
|
||||
@@ -85,6 +85,22 @@ PHP_MINFO_FUNCTION(date)
|
||||
php_info_print_table_end();
|
||||
}
|
||||
|
||||
signed long php_parse_date(char *string, signed long *now)
|
||||
{
|
||||
timelib_time *parsed_time;
|
||||
int error;
|
||||
signed long retval;
|
||||
|
||||
parsed_time = timelib_strtotime(string);
|
||||
timelib_update_ts(parsed_time, NULL);
|
||||
retval = timelib_date_to_int(parsed_time, &error);
|
||||
timelib_time_dtor(parsed_time);
|
||||
if (error) {
|
||||
return -1;
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
|
||||
static char* guess_timezone(TSRMLS_D)
|
||||
{
|
||||
char *env;
|
||||
|
||||
@@ -40,4 +40,7 @@ ZEND_END_MODULE_GLOBALS(date)
|
||||
#define DATEG(v) (date_globals.v)
|
||||
#endif
|
||||
|
||||
/* Backwards compability wrapper */
|
||||
signed long php_parse_date(char *string, signed long *now);
|
||||
|
||||
#endif /* PHP_DATE_H */
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
|
||||
$(srcdir)/parsedate.c: $(srcdir)/parsedate.y
|
||||
$(YACC) $(srcdir)/parsedate.y -o $@
|
||||
|
||||
$(srcdir)/var_unserializer.c: $(srcdir)/var_unserializer.re
|
||||
$(RE2C) -b $(srcdir)/var_unserializer.re > $@
|
||||
|
||||
|
||||
@@ -483,7 +483,7 @@ PHP_NEW_EXTENSION(standard, array.c base64.c basic_functions.c browscap.c crc32.
|
||||
cyr_convert.c datetime.c dir.c dl.c dns.c exec.c file.c filestat.c \
|
||||
flock_compat.c formatted_print.c fsock.c head.c html.c image.c \
|
||||
info.c iptc.c lcg.c link.c mail.c math.c md5.c metaphone.c \
|
||||
microtime.c pack.c pageinfo.c parsedate.c quot_print.c rand.c \
|
||||
microtime.c pack.c pageinfo.c quot_print.c rand.c \
|
||||
reg.c soundex.c string.c scanf.c syslog.c type.c uniqid.c url.c \
|
||||
url_scanner.c var.c versioning.c assert.c strnatcmp.c levenshtein.c \
|
||||
incomplete_class.c url_scanner_ex.c ftp_fopen_wrapper.c \
|
||||
|
||||
@@ -8,7 +8,7 @@ EXTENSION("standard", "array.c base64.c basic_functions.c browscap.c \
|
||||
crc32.c crypt.c cyr_convert.c datetime.c dir.c dl.c dns.c exec.c \
|
||||
file.c filestat.c formatted_print.c fsock.c head.c html.c image.c \
|
||||
info.c iptc.c lcg.c link.c mail.c math.c md5.c metaphone.c microtime.c \
|
||||
pack.c pageinfo.c parsedate.c quot_print.c rand.c reg.c soundex.c \
|
||||
pack.c pageinfo.c quot_print.c rand.c reg.c soundex.c \
|
||||
string.c scanf.c syslog.c type.c uniqid.c url.c url_scanner.c var.c \
|
||||
versioning.c assert.c strnatcmp.c levenshtein.c incomplete_class.c \
|
||||
url_scanner_ex.c ftp_fopen_wrapper.c http_fopen_wrapper.c \
|
||||
|
||||
@@ -35,8 +35,6 @@
|
||||
#endif
|
||||
#include <stdio.h>
|
||||
|
||||
#include "php_parsedate.h"
|
||||
|
||||
char *mon_full_names[] = {
|
||||
"January", "February", "March", "April",
|
||||
"May", "June", "July", "August",
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,28 +0,0 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| PHP Version 5 |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1997-2004 The PHP Group |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 3.0 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: |
|
||||
| http://www.php.net/license/3_0.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. |
|
||||
+----------------------------------------------------------------------+
|
||||
| Author: Sascha Schumann <sascha@schumann.cx> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
#ifndef PHP_PARSEDATE_H
|
||||
#define PHP_PARSEDATE_H
|
||||
|
||||
#include <time.h>
|
||||
|
||||
PHPAPI time_t php_parse_date(char *p, time_t *now);
|
||||
|
||||
#endif
|
||||
@@ -34,7 +34,7 @@
|
||||
#include "ext/standard/php_smart_str.h"
|
||||
#include "ext/standard/html.h"
|
||||
#include "ext/standard/php_string.h"
|
||||
#include "ext/standard/php_parsedate.h"
|
||||
#include "ext/date/php_date.h"
|
||||
|
||||
#define WDDX_BUF_LEN 256
|
||||
#define PHP_CLASS_NAME_VAR "php_class_name"
|
||||
|
||||
1
genfiles
1
genfiles
@@ -5,7 +5,6 @@ STD='make -f Makefile.frag LEX="flex -L" YACC="bison -y -l" srcdir=Zend builddir
|
||||
(eval "$STD Zend/zend_language_parser.c Zend/zend_language_scanner.c Zend/zend_ini_parser.c Zend/zend_ini_scanner.c")
|
||||
|
||||
set -x
|
||||
bison -d -y -l ext/standard/parsedate.y -o ext/standard/parsedate.c
|
||||
|
||||
for f in ext/standard/url_scanner_ex.c ext/standard/var_unserializer.c; do
|
||||
cp $f $f.orig
|
||||
|
||||
@@ -1,3 +1,2 @@
|
||||
@echo off
|
||||
|
||||
bison --output=ext\standard\parsedate.c -v -d -p phplib ext\standard\parsedate.y
|
||||
|
||||
@@ -105,7 +105,6 @@ C_SRC = ext/bcmath/bcmath.c \
|
||||
ext/standard/microtime.c \
|
||||
ext/standard/pack.c \
|
||||
ext/standard/pageinfo.c \
|
||||
ext/standard/parsedate.c \
|
||||
ext/standard/php_fopen_wrapper.c \
|
||||
ext/standard/quot_print.c \
|
||||
ext/standard/rand.c \
|
||||
@@ -368,9 +367,6 @@ cleand:
|
||||
.PHONY: cleansrc
|
||||
cleansrc:
|
||||
@echo Deleting all generated source files...
|
||||
-@del "ext\standard\parsedate.c"
|
||||
-@del "ext\standard\parsedate.h"
|
||||
-@del "ext\standard\parsedate.output"
|
||||
|
||||
.PHONY: cleanobj
|
||||
cleanobj:
|
||||
|
||||
@@ -30,7 +30,6 @@ build_dirs: $(BUILD_DIR) $(BUILD_DIRS_SUB)
|
||||
generated_files: build_dirs Zend\zend_ini_parser.c \
|
||||
Zend\zend_language_parser.c Zend\zend_ini_scanner.c \
|
||||
Zend\zend_language_scanner.c \
|
||||
ext\standard\parsedate.c \
|
||||
$(PHPDEF) $(MCFILE)
|
||||
|
||||
$(BUILD_DIR)\$(PHPDLL).def: $(PHP_DLL_DEF_SOURCES)
|
||||
@@ -48,9 +47,6 @@ Zend\zend_ini_scanner.c: Zend\flex.skl Zend\zend_ini_scanner.l
|
||||
Zend\zend_language_scanner.c: Zend\flex.skl Zend\zend_language_scanner.l
|
||||
$(FLEX) -i -SZend/flex.skl -Pzend -oZend/zend_language_scanner.c Zend/zend_language_scanner.l
|
||||
|
||||
ext\standard\parsedate.c ext\standard\parsedate.h: ext\standard\parsedate.y
|
||||
$(BISON) --output=ext/standard/parsedate.c -v -d ext/standard/parsedate.y
|
||||
|
||||
PHPDLL_RES=$(BUILD_DIR)\$(PHPDLL).res
|
||||
|
||||
$(MCFILE): win32\build\wsyslog.mc
|
||||
|
||||
@@ -500,10 +500,6 @@ SOURCE=..\ext\standard\pageinfo.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\ext\standard\parsedate.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\ext\standard\php_fopen_wrapper.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
@@ -1664,50 +1660,6 @@ SOURCE=..\win32\wfile.h
|
||||
# End Source File
|
||||
# End Group
|
||||
# End Group
|
||||
# Begin Group "Parsers"
|
||||
|
||||
# PROP Default_Filter ""
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\ext\standard\parsedate.y
|
||||
|
||||
!IF "$(CFG)" == "php5dll - Win32 Debug"
|
||||
|
||||
# Begin Custom Build - Generating ext/standard/parsedate.c
|
||||
InputPath=..\ext\standard\parsedate.y
|
||||
|
||||
"..\ext\standard\parsedate.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
|
||||
cd ..\ext\standard
|
||||
bison --output=parsedate.c -v -d parsedate.y
|
||||
|
||||
# End Custom Build
|
||||
|
||||
!ELSEIF "$(CFG)" == "php5dll - Win32 Release"
|
||||
|
||||
# Begin Custom Build - Generating ext/standard/parsedate.c
|
||||
InputPath=..\ext\standard\parsedate.y
|
||||
|
||||
"..\ext\standard\parsedate.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
|
||||
cd ..\ext\standard
|
||||
bison --output=parsedate.c -v -d parsedate.y
|
||||
|
||||
# End Custom Build
|
||||
|
||||
!ELSEIF "$(CFG)" == "php5dll - Win32 Release_inline"
|
||||
|
||||
# Begin Custom Build - Generating ext/standard/parsedate.c
|
||||
InputPath=..\ext\standard\parsedate.y
|
||||
|
||||
"..\ext\standard\parsedate.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
|
||||
cd ..\ext\standard
|
||||
bison --output=parsedate.c -v -d parsedate.y
|
||||
|
||||
# End Custom Build
|
||||
|
||||
!ENDIF
|
||||
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Text Files"
|
||||
|
||||
# PROP Default_Filter ""
|
||||
|
||||
@@ -1704,10 +1704,6 @@ SOURCE=..\ext\standard\pageinfo.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\ext\standard\parsedate.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\ext\standard\php_fopen_wrapper.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
@@ -2148,61 +2144,6 @@ SOURCE=.\winutil.h
|
||||
# End Source File
|
||||
# End Group
|
||||
# End Group
|
||||
# Begin Group "Parsers"
|
||||
|
||||
# PROP Default_Filter ""
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\ext\standard\parsedate.y
|
||||
|
||||
!IF "$(CFG)" == "php5dllts - Win32 Debug_TS"
|
||||
|
||||
# Begin Custom Build - Generating ext/standard/parsedate.c
|
||||
InputPath=..\ext\standard\parsedate.y
|
||||
|
||||
"..\ext\standard\parsedate.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
|
||||
cd ..\ext\standard
|
||||
bison --output=parsedate.c -v -d parsedate.y
|
||||
|
||||
# End Custom Build
|
||||
|
||||
!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TS"
|
||||
|
||||
# Begin Custom Build - Generating ext/standard/parsedate.c
|
||||
InputPath=..\ext\standard\parsedate.y
|
||||
|
||||
"..\ext\standard\parsedate.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
|
||||
cd ..\ext\standard
|
||||
bison --output=parsedate.c -v -d parsedate.y
|
||||
|
||||
# End Custom Build
|
||||
|
||||
!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TS_inline"
|
||||
|
||||
# Begin Custom Build - Generating ext/standard/parsedate.c
|
||||
InputPath=..\ext\standard\parsedate.y
|
||||
|
||||
"..\ext\standard\parsedate.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
|
||||
cd ..\ext\standard
|
||||
bison --output=parsedate.c -v -d parsedate.y
|
||||
|
||||
# End Custom Build
|
||||
|
||||
!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TSDbg"
|
||||
|
||||
# Begin Custom Build - Generating ext/standard/parsedate.c
|
||||
InputPath=..\ext\standard\parsedate.y
|
||||
|
||||
"..\ext\standard\parsedate.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
|
||||
cd ..\ext\standard
|
||||
bison --output=parsedate.c -v -d parsedate.y
|
||||
|
||||
# End Custom Build
|
||||
|
||||
!ENDIF
|
||||
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Text Files"
|
||||
|
||||
# PROP Default_Filter ""
|
||||
|
||||
Reference in New Issue
Block a user