[PHP-CVS] cvs: php4 /ext/dba dba.c
helly Sun Dec 29 10:31:00 2002 EDT Modified files: /php4/ext/dba dba.c Log: Add a default handler that makes handler parameter to open functions optional. @Improved dba extension (Marcus) @-Made handler parameter of dba_(p)open() optional. @-Added php.ini option 'dba.default_handler' to specify a default handler. Index: php4/ext/dba/dba.c diff -u php4/ext/dba/dba.c:1.74 php4/ext/dba/dba.c:1.75 --- php4/ext/dba/dba.c:1.74 Fri Dec 20 20:09:27 2002 +++ php4/ext/dba/dba.c Sun Dec 29 10:31:00 2002 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: dba.c,v 1.74 2002/12/21 01:09:27 andrei Exp $ */ +/* $Id: dba.c,v 1.75 2002/12/29 15:31:00 helly Exp $ */ #ifdef HAVE_CONFIG_H #include config.h @@ -27,6 +27,7 @@ #if HAVE_DBA +#include php_ini.h #include ext/standard/flock_compat.h #include stdio.h #include fcntl.h @@ -71,6 +72,7 @@ /* }}} */ PHP_MINIT_FUNCTION(dba); +PHP_MSHUTDOWN_FUNCTION(dba); PHP_MINFO_FUNCTION(dba); zend_module_entry dba_module_entry = { @@ -78,7 +80,7 @@ dba, dba_functions, PHP_MINIT(dba), - NULL, + PHP_MSHUTDOWN(dba), NULL, NULL, PHP_MINFO(dba), @@ -208,6 +210,37 @@ { NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL } }; +#if DBA_FLATFILE +#define DBA_DEFAULT flatfile +#elif DBA_DB4 +#define DBA_DEFAULT db4 +#elif DBA_DB3 +#define DBA_DEFAULT db3 +#elif DBA_DB2 +#define DBA_DEFAULT db2 +#elif DBA_GDBM +#define DBA_DEFAULT gdbm +#elif DBA_NBBM +#define DBA_DEFAULT ndbm +#elif DBA_DBM +#define DBA_DEFAULT dbm +#else +#define DBA_DEFAULT +#endif + +ZEND_BEGIN_MODULE_GLOBALS(dba) + char *default_handler; + dba_handler *default_hptr; +ZEND_END_MODULE_GLOBALS(dba) + +ZEND_DECLARE_MODULE_GLOBALS(dba) + +#ifdef ZTS +#define DBA_G(v) TSRMG(dba_globals_id, zend_dba_globals *, v) +#else +#define DBA_G(v) (dba_globals.v) +#endif + static int le_db; static int le_pdb; /* }}} */ @@ -240,10 +273,47 @@ } /* }}} */ +/* {{{ PHP_INI + */ +ZEND_API ZEND_INI_MH(OnUpdateDefaultHandler) +{ + dba_handler *hptr; + + if (!strlen(new_value)) { + DBA_G(default_hptr) = NULL; + return OnUpdateString(entry, new_value, new_value_length, mh_arg1, +mh_arg2, mh_arg3, stage TSRMLS_CC); + } + + for (hptr = handler; hptr-name strcasecmp(hptr-name, new_value); hptr++); + + if (!hptr-name) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, No such handler: %s, +new_value); + return FAILURE; + } + DBA_G(default_hptr) = hptr; + return OnUpdateString(entry, new_value, new_value_length, mh_arg1, mh_arg2, +mh_arg3, stage TSRMLS_CC); +} + +PHP_INI_BEGIN() +STD_PHP_INI_ENTRY(dba.default_handler, DBA_DEFAULT, PHP_INI_ALL, +OnUpdateDefaultHandler, default_handler,zend_dba_globals, dba_globals) +PHP_INI_END() +/* }}} */ + +/* {{{ php_dba_init_globals + */ +static void php_dba_init_globals(zend_dba_globals *dba_globals) +{ + dba_globals-default_handler = ; + dba_globals-default_hptr= NULL; +} +/* }}} */ + /* {{{ PHP_MINIT_FUNCTION */ PHP_MINIT_FUNCTION(dba) { + ZEND_INIT_MODULE_GLOBALS(dba, php_dba_init_globals, NULL); + REGISTER_INI_ENTRIES(); le_db = zend_register_list_destructors_ex(dba_close_rsrc, NULL, dba, module_number); le_pdb = zend_register_list_destructors_ex(NULL, dba_close_rsrc, dba persistent, module_number); return SUCCESS; @@ -254,6 +324,7 @@ */ PHP_MSHUTDOWN_FUNCTION(dba) { + UNREGISTER_INI_ENTRIES(); return SUCCESS; } /* }}} */ @@ -361,9 +432,9 @@ int i; int lock_mode, lock_flag, lock_dbf = 0; char *file_mode; - char mode[4], *pmode, *lock_file_mode; + char mode[4], *pmode, *lock_file_mode = NULL; - if(ac 3) { + if(ac 2) { WRONG_PARAM_COUNT; } @@ -407,7 +478,16 @@ } } - for (hptr = handler; hptr-name strcasecmp(hptr-name, Z_STRVAL_PP(args[2])); hptr++); + if (ac==2) { + hptr = DBA_G(default_hptr); + if (!hptr) { + php_error_docref2(NULL TSRMLS_CC, Z_STRVAL_PP(args[0]), +Z_STRVAL_PP(args[1]), E_WARNING, No default handler selected); + FREENOW; + RETURN_FALSE; + } + } else { + for (hptr = handler; hptr-name strcasecmp(hptr-name, +Z_STRVAL_PP(args[2])); hptr++); + } if (!hptr-name) { php_error_docref2(NULL TSRMLS_CC, Z_STRVAL_PP(args[0]), Z_STRVAL_PP(args[1]), E_WARNING, No such handler: %s, Z_STRVAL_PP(args[2])); @@ -587,7 +667,7 @@ if (error || hptr-open(info, error TSRMLS_CC) != SUCCESS) { dba_close(info TSRMLS_CC); - php_error_docref2(NULL TSRMLS_CC,
[PHP-CVS] cvs: php4 /ext/dba dba_db3.c dba_db4.c
helly Sun Dec 29 10:32:38 2002 EDT Modified files: /php4/ext/dba dba_db3.c dba_db4.c Log: Added support for db3/db4 error handling/information Index: php4/ext/dba/dba_db3.c diff -u php4/ext/dba/dba_db3.c:1.23 php4/ext/dba/dba_db3.c:1.24 --- php4/ext/dba/dba_db3.c:1.23 Fri Dec 20 12:47:58 2002 +++ php4/ext/dba/dba_db3.c Sun Dec 29 10:32:38 2002 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: dba_db3.c,v 1.23 2002/12/20 17:47:58 helly Exp $ */ +/* $Id: dba_db3.c,v 1.24 2002/12/29 15:32:38 helly Exp $ */ #ifdef HAVE_CONFIG_H #include config.h @@ -35,6 +35,13 @@ #include db.h #endif +static void php_dba_db3_errcall_fcn(const char *errpfx, char *msg) +{ + TSRMLS_FETCH(); + + php_error_docref(NULL TSRMLS_CC, E_NOTICE, %s%s, errpfx?errpfx:, msg); +} + #define DB3_DATA dba_db3_data *dba = info-dbf #define DB3_GKEY \ DBT gkey; \ @@ -50,7 +57,7 @@ { DB *dbp = NULL; DBTYPE type; - int gmode = 0; + int gmode = 0, err; int filemode = 0644; struct stat check_stat; int s = VCWD_STAT(info-path, check_stat); @@ -65,30 +72,37 @@ info-mode == DBA_WRITER ? 0 : info-mode == DBA_TRUNC ? DB_CREATE | DB_TRUNCATE : -1; - if (gmode == -1) + if (gmode == -1) { return FAILURE; /* not possible */ + } if (info-argc 0) { convert_to_long_ex(info-argv[0]); filemode = Z_LVAL_PP(info-argv[0]); } - if (db_create(dbp, NULL, 0) == 0 + if ((err=db_create(dbp, NULL, 0)) == 0) { + dbp-set_errcall(dbp, php_dba_db3_errcall_fcn); + if ( #if (DB_VERSION_MAJOR == 4 DB_VERSION_MINOR = 1) - dbp-open(dbp, 0, info-path, NULL, type, gmode, filemode) == 0) { + (err=dbp-open(dbp, 0, info-path, NULL, type, gmode, +filemode)) == 0) { #else - dbp-open(dbp, info-path, NULL, type, gmode, filemode) == 0) { + (err=dbp-open(dbp, info-path, NULL, type, gmode, filemode)) +== 0) { #endif - dba_db3_data *data; + dba_db3_data *data; - data = pemalloc(sizeof(*data), info-flagsDBA_PERSISTENT); - data-dbp = dbp; - data-cursor = NULL; - info-dbf = data; + data = pemalloc(sizeof(*data), info-flagsDBA_PERSISTENT); + data-dbp = dbp; + data-cursor = NULL; + info-dbf = data; - return SUCCESS; - } else if (dbp != NULL) { - dbp-close(dbp, 0); + return SUCCESS; + } else { + dbp-close(dbp, 0); + *error = db_strerror(err); + } + } else { + *error = db_strerror(err); } return FAILURE; Index: php4/ext/dba/dba_db4.c diff -u php4/ext/dba/dba_db4.c:1.2 php4/ext/dba/dba_db4.c:1.3 --- php4/ext/dba/dba_db4.c:1.2 Fri Dec 20 12:47:58 2002 +++ php4/ext/dba/dba_db4.c Sun Dec 29 10:32:38 2002 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: dba_db4.c,v 1.2 2002/12/20 17:47:58 helly Exp $ */ +/* $Id: dba_db4.c,v 1.3 2002/12/29 15:32:38 helly Exp $ */ #ifdef HAVE_CONFIG_H #include config.h @@ -35,6 +35,13 @@ #include db.h #endif +static void php_dba_db4_errcall_fcn(const char *errpfx, char *msg) +{ + TSRMLS_FETCH(); + + php_error_docref(NULL TSRMLS_CC, E_NOTICE, %s%s, errpfx?errpfx:, msg); +} + #define DB4_DATA dba_db4_data *dba = info-dbf #define DB4_GKEY \ DBT gkey; \ @@ -50,7 +57,7 @@ { DB *dbp = NULL; DBTYPE type; - int gmode = 0; + int gmode = 0, err; int filemode = 0644; struct stat check_stat; int s = VCWD_STAT(info-path, check_stat); @@ -73,22 +80,28 @@ filemode = Z_LVAL_PP(info-argv[0]); } - if (db_create(dbp, NULL, 0) == 0 + if ((err=db_create(dbp, NULL, 0)) == 0) { + dbp-set_errcall(dbp, php_dba_db4_errcall_fcn); + if ( #if (DB_VERSION_MAJOR == 4 DB_VERSION_MINOR = 1) - dbp-open(dbp, 0, info-path, NULL, type, gmode, filemode) == 0) { + (err=dbp-open(dbp, 0, info-path, NULL, type, gmode, +filemode)) == 0) { #else - dbp-open(dbp, info-path, NULL, type, gmode, filemode) == 0) { + (err=dbp-open(dbp, info-path, NULL, type, gmode, filemode)) +== 0) { #endif - dba_db4_data *data; + dba_db4_data *data; - data = pemalloc(sizeof(*data), info-flagsDBA_PERSISTENT); - data-dbp = dbp; - data-cursor = NULL;
[PHP-CVS] cvs: php4 /win32 php4dllts.dsp
zeevSun Dec 29 10:41:45 2002 EDT Modified files: /php4/win32 php4dllts.dsp Log: Update .dsp's Index: php4/win32/php4dllts.dsp diff -u php4/win32/php4dllts.dsp:1.91 php4/win32/php4dllts.dsp:1.92 --- php4/win32/php4dllts.dsp:1.91 Thu Dec 26 08:40:32 2002 +++ php4/win32/php4dllts.dspSun Dec 29 10:41:44 2002 @@ -45,7 +45,7 @@ # PROP Ignore_Export_Lib 0 # PROP Target_Dir # ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D WIN32 /D _DEBUG /D _WINDOWS /D _MBCS /D _USRDLL /D PHP4DLLTS_EXPORTS /YX /FD /GZ /c -# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I .. /I ..\main /I ..\regex /I ..\..\bindlib_w32 /I ..\Zend /I ..\TSRM /I ..\ext\mysql\libmysql /I ..\ext\xml\expat /D _DEBUG /D ZEND_DEBUG=1 /D _WINDOWS /D _USRDLL /D PHP4DLLTS_EXPORTS /D PHP_EXPORTS /D LIBZEND_EXPORTS /D TSRM_EXPORTS /D SAPI_EXPORTS /D MSVC5 /D ZTS /D ZEND_WIN32 /D PHP_WIN32 /D WIN32 /D _MBCS /FR /YX /FD /GZ /c +# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I ..\..\zlib /I .. /I ..\main /I +..\regex /I ..\..\bindlib_w32 /I ..\Zend /I ..\TSRM /I +..\ext\mysql\libmysql /I ..\ext\xml\expat /D _DEBUG /D ZEND_DEBUG=1 /D +_WINDOWS /D _USRDLL /D PHP4DLLTS_EXPORTS /D PHP_EXPORTS /D LIBZEND_EXPORTS +/D TSRM_EXPORTS /D SAPI_EXPORTS /D MSVC5 /D ZTS /D ZEND_WIN32 /D +PHP_WIN32 /D WIN32 /D _MBCS /FR /YX /FD /GZ /c # ADD BASE MTL /nologo /D _DEBUG /mktyplib203 /win32 # ADD MTL /nologo /D _DEBUG /mktyplib203 /win32 # ADD BASE RSC /l 0x40d /d _DEBUG @@ -55,7 +55,7 @@ # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib wsock32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ZendTS.lib TSRM.lib resolv.lib libmysql.lib zlib.lib /nologo /version:4.0 /dll /debug /machine:I386 /nodefaultlib:libcmt /nodefaultlib:libc /out:..\Debug_TS\php4ts_debug.dll /pdbtype:sept /libpath:..\TSRM\Debug_TS /libpath:..\Zend\Debug_TS /libpath:..\..\bindlib_w32\Debug /libpath:..\ext\mysql\libmysql\Debug_TS /libpath:Debug_TS +# ADD LINK32 kernel32.lib user32.lib gdi32.lib wsock32.lib winspool.lib comdlg32.lib +advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib +ZendTS.lib TSRM.lib resolv.lib libmysql.lib zlib.lib /nologo /version:4.0 /dll /debug +/machine:I386 /out:..\Debug_TS\php4ts_debug.dll /pdbtype:sept +/libpath:..\TSRM\Debug_TS /libpath:..\Zend\Debug_TS +/libpath:..\..\bindlib_w32\Debug /libpath:..\ext\mysql\libmysql\Debug_TS +/libpath:Debug_TS /libpath:..\..\zlib\Debug !ELSEIF $(CFG) == php4dllts - Win32 Release_TS @@ -71,7 +71,7 @@ # PROP Ignore_Export_Lib 0 # PROP Target_Dir # ADD BASE CPP /nologo /MT /W3 /GX /O2 /D WIN32 /D NDEBUG /D _WINDOWS /D _MBCS /D _USRDLL /D PHP4DLLTS_EXPORTS /YX /FD /c -# ADD CPP /nologo /MD /W3 /GX /O2 /I .. /I ..\main /I ..\regex /I ..\..\bindlib_w32 /I ..\Zend /I ..\TSRM /I ..\ext\mysql\libmysql /I ..\ext\xml\expat /D NDEBUG /D ZEND_DEBUG=0 /D _WINDOWS /D _USRDLL /D PHP4DLLTS_EXPORTS /D PHP_EXPORTS /D LIBZEND_EXPORTS /D TSRM_EXPORTS /D SAPI_EXPORTS /D MSVC5 /D ZTS /D ZEND_WIN32 /D PHP_WIN32 /D WIN32 /D _MBCS /FR /YX /FD /c +# ADD CPP /nologo /MD /W3 /GX /O2 /I .. /I ..\main /I ..\regex /I +..\..\bindlib_w32 /I ..\..\zlib /I ..\Zend /I ..\TSRM /I +..\ext\mysql\libmysql /I ..\ext\xml\expat /D NDEBUG /D ZEND_DEBUG=0 /D +_WINDOWS /D _USRDLL /D PHP4DLLTS_EXPORTS /D PHP_EXPORTS /D LIBZEND_EXPORTS +/D TSRM_EXPORTS /D SAPI_EXPORTS /D MSVC5 /D ZTS /D ZEND_WIN32 /D +PHP_WIN32 /D WIN32 /D _MBCS /FR /YX /FD /c # ADD BASE MTL /nologo /D NDEBUG /mktyplib203 /win32 # ADD MTL /nologo /D NDEBUG /mktyplib203 /win32 # ADD BASE RSC /l 0x40d /d NDEBUG @@ -81,7 +81,7 @@ # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib wsock32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ZendTS.lib TSRM.lib resolv.lib libmysql.lib zlib.lib /nologo /version:4.0 /dll /machine:I386 /nodefaultlib:libc.lib /nodefaultlib:libcmt.lib /out:..\Release_TS\php4ts.dll /libpath:..\TSRM\Release_TS /libpath:..\Zend\Release_TS /libpath:..\..\bindlib_w32\Release /libpath:..\ext\mysql\libmysql\Release_TS /libpath:Release_TS +# ADD LINK32 kernel32.lib user32.lib gdi32.lib wsock32.lib winspool.lib comdlg32.lib +advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib +ZendTS.lib TSRM.lib resolv.lib libmysql.lib zlib.lib /nologo /version:4.0 /dll +/machine:I386 /nodefaultlib:libc.lib /nodefaultlib:libcmt.lib +/out:..\Release_TS\php4ts.dll
[PHP-CVS] cvs: php4 /ext/session session.c
iliaa Sun Dec 29 13:50:56 2002 EDT Modified files: /php4/ext/session session.c Log: Fixed bug #21268 (session_decode() returned FALSE on success). Index: php4/ext/session/session.c diff -u php4/ext/session/session.c:1.340 php4/ext/session/session.c:1.341 --- php4/ext/session/session.c:1.340Thu Dec 5 15:41:55 2002 +++ php4/ext/session/session.c Sun Dec 29 13:50:55 2002 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: session.c,v 1.340 2002/12/05 20:41:55 helly Exp $ */ +/* $Id: session.c,v 1.341 2002/12/29 18:50:55 iliaa Exp $ */ #ifdef HAVE_CONFIG_H #include config.h @@ -1433,15 +1433,19 @@ { zval **str; - if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, str) == FAILURE) + if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, str) == FAILURE) { WRONG_PARAM_COUNT; + } - if (PS(session_status) == php_session_none) + if (PS(session_status) == php_session_none) { RETURN_FALSE; + } convert_to_string_ex(str); php_session_decode(Z_STRVAL_PP(str), Z_STRLEN_PP(str) TSRMLS_CC); + + RETURN_TRUE; } /* }}} */ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php4 /ext/standard http_fopen_wrapper.c
iliaa Sun Dec 29 15:01:34 2002 EDT Modified files: /php4/ext/standard http_fopen_wrapper.c Log: Fixed bug #21267 (opening URLs that result in redirection to a relative path was failing). Index: php4/ext/standard/http_fopen_wrapper.c diff -u php4/ext/standard/http_fopen_wrapper.c:1.54 php4/ext/standard/http_fopen_wrapper.c:1.55 --- php4/ext/standard/http_fopen_wrapper.c:1.54 Thu Dec 5 15:59:49 2002 +++ php4/ext/standard/http_fopen_wrapper.c Sun Dec 29 15:01:33 2002 @@ -18,7 +18,7 @@ | Wez Furlong [EMAIL PROTECTED] | +--+ */ -/* $Id: http_fopen_wrapper.c,v 1.54 2002/12/05 20:59:49 helly Exp $ */ +/* $Id: http_fopen_wrapper.c,v 1.55 2002/12/29 20:01:33 iliaa Exp $ */ #include php.h #include php_globals.h @@ -339,19 +339,25 @@ zval *entry, **entryp; char new_path[HTTP_HEADER_BLOCK_SIZE]; + char loc_path[HTTP_HEADER_BLOCK_SIZE]; *new_path='\0'; - if (strlen(location)8 || (strncasecmp(location, http://;, 7) strncasecmp(location, https://;, 8))) { - strcpy(new_path, resource-scheme); - strlcat(new_path, resource-host, sizeof(new_path)); - if ((use_ssl resource-port != 443) || (!use_ssl resource-port != 80)) { - snprintf(new_path+strlen(new_path), sizeof(new_path)-strlen(new_path)-1, :%d, resource-port); - } + if (strlen(location)8 || (strncasecmp(location, http://;, +sizeof(http://;)-1) strncasecmp(location, https://;, sizeof(https://;)-1))) { if (*location != '/') { - php_dirname(resource-path, strlen(resource-path)); - snprintf (new_path+strlen(new_path), sizeof(new_path)-strlen(new_path)-1, %s/, resource-path); + if (*(location+1) != '\0') { + + php_dirname(resource-path, +strlen(resource-path)); + snprintf(loc_path, sizeof(loc_path) - +1, %s%s, resource-path, location); + } else { + snprintf(loc_path, sizeof(loc_path) - +1, /%s, location); + } + } else { + strlcpy(loc_path, location, sizeof(loc_path)); + } + if ((use_ssl resource-port != 443) || (!use_ssl +resource-port != 80)) { + snprintf(new_path, sizeof(new_path) - 1, +%s://%s:%d%s, resource-scheme, resource-host, resource-port, loc_path); + } else { + snprintf(new_path, sizeof(new_path) - 1, +%s://%s%s, resource-scheme, resource-host, loc_path); } - strlcat(new_path, location, sizeof(new_path)); } else { strlcpy(new_path, location, sizeof(new_path)); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php4 /main php_variables.c rfc1867.c
iliaa Sun Dec 29 16:02:17 2002 EDT Modified files: /php4/main php_variables.c rfc1867.c Log: Fixed bug #21149 (fixed handling of unterminated '['). Index: php4/main/php_variables.c diff -u php4/main/php_variables.c:1.46 php4/main/php_variables.c:1.47 --- php4/main/php_variables.c:1.46 Sat Dec 7 11:05:27 2002 +++ php4/main/php_variables.c Sun Dec 29 16:02:17 2002 @@ -16,7 +16,7 @@ | Zeev Suraski [EMAIL PROTECTED]| +--+ */ -/* $Id: php_variables.c,v 1.46 2002/12/07 16:05:27 iliaa Exp $ */ +/* $Id: php_variables.c,v 1.47 2002/12/29 21:02:17 iliaa Exp $ */ #include stdio.h #include php.h @@ -120,7 +120,28 @@ while (1) { if (is_array) { - char *escaped_index; + char *escaped_index = NULL, *index_s; + int new_idx_len = 0; + + ip++; + index_s = ip; + if (isspace(*ip)) { + ip++; + } + if (*ip==']') { + index_s = NULL; + } else { + ip = strchr(ip, ']'); + if (!ip) { + /* PHP variables cannot contain '[' in their +names, so we replace the character with a '_' */ + *(index_s - 1) = '_'; + index_len = var_len = strlen(var); + goto plain_var; + return; + } + *ip = 0; + new_idx_len = strlen(index_s); + } if (!index) { MAKE_STD_ZVAL(gpc_element); @@ -148,22 +169,9 @@ } symtable1 = Z_ARRVAL_PP(gpc_element_p); /* ip pointed to the '[' character, now obtain the key */ - index = ++ip; - index_len = 0; - if (*ip=='\n' || *ip=='\r' || *ip=='\t' || *ip==' ') { - ip++; - } - if (*ip==']') { - index = NULL; - } else { - ip = strchr(ip, ']'); - if (!ip) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, Missing ] in %s variable, var); - return; - } - *ip = 0; - index_len = strlen(index); - } + index = index_s; + index_len = new_idx_len; + ip++; if (*ip=='[') { is_array = 1; @@ -172,6 +180,7 @@ is_array = 0; } } else { +plain_var: MAKE_STD_ZVAL(gpc_element); gpc_element-value = val-value; Z_TYPE_P(gpc_element) = Z_TYPE_P(val); Index: php4/main/rfc1867.c diff -u php4/main/rfc1867.c:1.128 php4/main/rfc1867.c:1.129 --- php4/main/rfc1867.c:1.128 Sat Dec 14 05:45:25 2002 +++ php4/main/rfc1867.c Sun Dec 29 16:02:17 2002 @@ -16,7 +16,7 @@ | Jani Taskinen [EMAIL PROTECTED] | +--+ */ -/* $Id: rfc1867.c,v 1.128 2002/12/14 10:45:25 sesser Exp $ */ +/* $Id: rfc1867.c,v 1.129 2002/12/29 21:02:17 iliaa Exp $ */ /* * This product includes software developed by the Apache Group @@ -104,7 +104,7 @@ /* done? */ while (index) { - + while (*index == ' ' || *index == '\r' || *index == '\n' || *index=='\t') { index++; } @@ -891,8 +891,11 @@ * ends in [.*] * start_arr is set to point to 1st [ */ - is_arr_upload = (start_arr = strchr(param,'[')) - (param[strlen(param)-1] == ']'); + is_arr_upload = (start_arr = strchr(param,'[')) +(param[strlen(param)-1] == ']'); + /* handle unterminated [ */ + if (!is_arr_upload start_arr) { + *start_arr = '_'; + } if (is_arr_upload) { array_len =
Re: [PHP-CVS] cvs: php4 /ext/standard http_fopen_wrapper.c
Are you going to merge this into PHP_4_3? On Sun, 29 Dec 2002, Ilia Alshanetsky wrote: iliaa Sun Dec 29 15:01:34 2002 EDT Modified files: /php4/ext/standardhttp_fopen_wrapper.c Log: Fixed bug #21267 (opening URLs that result in redirection to a relative path was failing). -Andrei http://www.gravitonic.com/ For every complex problem, there is a solution that is simple, neat, and wrong. -- H. L. Mencken -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] cvs: php4 /main php_variables.c rfc1867.c
Are you going to merge this into PHP_4_3? On Sun, 29 Dec 2002, Ilia Alshanetsky wrote: iliaa Sun Dec 29 16:02:17 2002 EDT Modified files: /php4/mainphp_variables.c rfc1867.c Log: Fixed bug #21149 (fixed handling of unterminated '['). -Andrei http://www.gravitonic.com/ * http://www.zend.com/comm_person.php?id=24 * -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php