Compare commits

...
18 Commits
Author SHA1 Message Date
SVN Migration 38dd82955c This commit was manufactured by cvs2svn to create tag 'php_4_0_4RC4'. 2000-12-14 14:18:38 +00:00
Andi Gutmans a574e24080 - Update 4.0.4 branches NEWS file 2000-12-05 17:12:30 +00:00
Sascha Schumann d812632083 Merge from HEAD 2000-12-05 11:07:11 +00:00
Sascha Schumann ad39ef1462 Merge entries manually 2000-12-04 18:00:25 +00:00
foobar c0446845b9 Merge changes from head branch. 2000-12-04 17:26:11 +00:00
Sascha Schumann 326dcb9e79 Merged with HEAD, 1.21 2000-12-04 16:15:39 +00:00
Sascha Schumann 26a0663044 Merged with HEAD, 1.8 2000-12-04 16:15:26 +00:00
Sascha Schumann 9b4e521b9c Merged with HEAD, 1.35 2000-12-04 16:14:09 +00:00
Sascha Schumann 449ddbccb1 Merge from HEAD 2000-12-04 12:27:47 +00:00
Sascha Schumann fa077c7be9 Merge changes from HEAD. 2000-12-04 10:24:06 +00:00
Zeev Suraski 786eacfd45 Import the MySQL updates from the main branch 2000-12-03 21:25:28 +00:00
Hartmut Holzgraefe 46cdd040e2 changed run-tests.php to use 'php -q' instead of 'php -f' 2000-12-03 10:45:57 +00:00
Zeev Suraski 6f164ad7dc Fix the bug with -f not filling in the $argv[] arguments.
I'm not sure what used to be the behavior - but the new code puts the -f
argument as $argv[0], which is the Right Thing to do IMHO...  Comments
welcome
2000-12-03 01:09:13 +00:00
Zeev Suraski 58f0cbd534 Don't mislead people... 2000-12-03 00:39:56 +00:00
Zeev Suraski 594b7989cc Commit the fix to the 4.0.4 branch 2000-12-03 00:26:35 +00:00
Sascha Schumann 44294ada47 Merge changes from HEAD 2000-12-02 13:46:08 +00:00
Sascha Schumann c277e3f98d 4.0.4RC3 is coming. 2000-12-02 08:14:57 +00:00
SVN Migration cd14d04924 This commit was manufactured by cvs2svn to create branch 'php_4_0_4'. 2000-12-02 02:09:18 +00:00
29 changed files with 365 additions and 884 deletions

No files matched your search

+17
View File
@@ -2,6 +2,23 @@ PHP 4.0 NEWS
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
?? ??? 2000, Version 4.0.4
- Allow for three expression types to be sent to functions which are requesting
the function argument to be passed by reference (only c. was previously
supported):
a. func(new myclass());
b. func(func2()); where func2() returns a reference, i.e. is defined as
function &func2(...)
{
...
}
c. func($var); where func() is defined as function func(&$var) {...}
You CAN'T count on any other expressions to be passable by reference.
(Andi, Zend Engine)
- Made ldap_get_entries() return an array even if there are no entries
in search result. (Jani)
- Fixed bad mod_perl interaction which caused segfaults when using LFS (Sascha)
- const CONSTNAME now gets recognized. Before the patch only @const CONSTNAME
description was recognized.
- Added the is_null() function that will return true if a variable is of
type null. (Sterling)
- Fixed a bug which made readdir() unusable in some systems. (Jani)
+5 -16
View File
@@ -1,17 +1,6 @@
How to install PHP with the BCMath arbitrary precision math library?
--------------------------------------------------------------------
As of PHP 4.0.4, the BC math library routines are bundled in the
standard PHP distribution. There is no need to install any additional
files.
Due to license restrictions, the BC math library can no longer be distributed
along with PHP. The BC math library is distributed under the restrictive
GNU Public License, and PHP is no longer distributed under that license, but
under a less restrictive license, the PHP License.
If you want to enable BC math support (recommended), all you have to do is
simply download http://www.php.net/extra/number4.tar.gz, and untar it on the
top level php4 directory.
A typical way of doing this would be (assuming that you have lynx):
cd ~/php4
lynx -dump -source http://www.php.net/extra/number4.tar.gz | gzip -d | tar xvf -
The PHP Group
Thanks goes to Phil Nelson, for releasing the BC math library routines
under the LGPL.
-4
View File
@@ -14,11 +14,7 @@
#define TSRM_H
#ifdef HAVE_CONFIG_H
# undef PACKAGE
# undef VERSION
# include "tsrm_config.h"
# undef PACKAGE
# undef VERSION
#endif
/* Only compile multi-threading functions if we're in ZTS mode */
+1 -1
View File
@@ -4,7 +4,7 @@ dnl Minimalistic configure.in for TSRM.
dnl
AC_INIT(TSRM.c)
AM_INIT_AUTOMAKE(TSRM, 1.0)
AM_INIT_AUTOMAKE(TSRM, 1.0, nodefine)
AM_CONFIG_HEADER(tsrm_config.h)
sinclude(tsrm.m4)
-4
View File
@@ -3,10 +3,6 @@
@TOP@
/* these are defined by automake */
#undef PACKAGE
#undef VERSION
#undef uint
#undef ulong
+1 -1
View File
@@ -2,7 +2,7 @@ dnl $Id$
dnl Process this file with autoconf to produce a configure script.
AC_INIT(zend.c)
AM_INIT_AUTOMAKE(zend, 0.80A)
AM_INIT_AUTOMAKE(zend, 0.80A, nodefine)
AM_CONFIG_HEADER(zend_config.h)
AM_SANITY_CHECK
AM_MAINTAINER_MODE
+2 -2
View File
@@ -139,8 +139,8 @@ ZEND_API char *zend_get_executed_filename(ELS_D);
ZEND_API uint zend_get_executed_lineno(ELS_D);
ZEND_API zend_bool zend_is_executing(void);
void zend_set_timeout(long seconds);
void zend_unset_timeout(void);
ZEND_API void zend_set_timeout(long seconds);
ZEND_API void zend_unset_timeout(void);
ZEND_API void zend_timeout(int dummy);
#ifdef ZEND_WIN32
+1
View File
@@ -419,6 +419,7 @@ expr_without_variable:
| cvar '=' expr { zend_do_end_variable_parse(BP_VAR_W, 0 CLS_CC); zend_do_assign(&$$, &$1, &$3 CLS_CC); }
| cvar '=' '&' w_cvar { zend_do_end_variable_parse(BP_VAR_W, 0 CLS_CC); zend_do_assign_ref(&$$, &$1, &$4 CLS_CC); }
| cvar '=' '&' function_call { zend_do_end_variable_parse(BP_VAR_W, 0 CLS_CC); zend_do_assign_ref(&$$, &$1, &$4 CLS_CC); }
| cvar '=' '&' T_NEW class_name { zend_do_extended_fcall_begin(CLS_C); zend_do_begin_new_object(&$4, &$5 CLS_CC); } ctor_arguments { zend_do_end_new_object(&$3, &$5, &$4, &$7 CLS_CC); zend_do_extended_fcall_end(CLS_C); zend_do_end_variable_parse(BP_VAR_W, 0 CLS_CC); zend_do_assign_ref(&$$, &$1, &$3 CLS_CC); }
| T_NEW class_name { zend_do_extended_fcall_begin(CLS_C); zend_do_begin_new_object(&$1, &$2 CLS_CC); } ctor_arguments { zend_do_end_new_object(&$$, &$2, &$1, &$4 CLS_CC); zend_do_extended_fcall_end(CLS_C);}
| cvar T_PLUS_EQUAL expr { zend_do_end_variable_parse(BP_VAR_RW, 0 CLS_CC); zend_do_binary_assign_op(ZEND_ASSIGN_ADD, &$$, &$1, &$3 CLS_CC); }
| cvar T_MINUS_EQUAL expr { zend_do_end_variable_parse(BP_VAR_RW, 0 CLS_CC); zend_do_binary_assign_op(ZEND_ASSIGN_SUB, &$$, &$1, &$3 CLS_CC); }
+1 -1
View File
@@ -54,7 +54,7 @@ distclean: distclean-recursive clean-x
php_config.h stamp-h Makefile build-defs.h php4.spec libphp4.module
test: $(top_builddir)/php
@$(top_builddir)/php -f $(top_srcdir)/run-tests.php `pwd`
@$(top_builddir)/php -q $(top_srcdir)/run-tests.php `pwd`
include $(builddir)/.deps
+1 -1
View File
@@ -51,7 +51,7 @@ dnl ## All of these are normally in the extension directories.
dnl ## Diversion 5 is the last one. Here we generate files and clean up.
dnl ## This is where the version number is changed from now on!
AM_INIT_AUTOMAKE(php, 4.0.4-dev)
AM_INIT_AUTOMAKE(php, 4.0.4RC3, nodefine)
PHP_VERSION=$VERSION
echo "/* automatically generated by configure */" > php_version.h.new
+1 -1
View File
@@ -52,7 +52,7 @@ typedef struct dbm_info {
#endif
dbm_info *php_find_dbm(pval *id);
int php_dbm_close(dbm_info *info);
int php_dbm_close(zend_rsrc_list_entry *rsrc);
dbm_info *php_dbm_open(char *filename, char *mode);
int php_dbm_insert(dbm_info *info, char *key, char *value);
char *php_dbm_fetch(dbm_info *info, char *key);
+7 -2
View File
@@ -220,9 +220,14 @@ static PHP_MINFO_FUNCTION(dba)
php_info_print_table_start();
php_info_print_table_row(2, "DBA support", "enabled");
php_info_print_table_row(2, "Supported handlers", handlers.c);
if (handlers.c) {
smart_str_0(&handlers);
php_info_print_table_row(2, "Supported handlers", handlers.c);
smart_str_free(&handlers);
} else {
php_info_print_table_row(2, "Supported handlers", "none");
}
php_info_print_table_end();
smart_str_free(&handlers);
}
-103
View File
@@ -1,103 +0,0 @@
#ifndef _INCLUDED_IMAP_H
#define _INCLUDED_IMAP_H
#if COMPILE_DL
#undef HAVE_IMAP
#define HAVE_IMAP 1
#endif
#if HAVE_IMAP
#ifndef PHP_WIN32
#include "build-defs.h"
#endif
/* Functions accessable to PHP */
extern zend_module_entry imap_module_entry;
#define imap_module_ptr &imap_module_entry
extern PHP_MINIT_FUNCTION(imap);
extern PHP_RINIT_FUNCTION(imap);
extern PHP_RSHUTDOWN_FUNCTION(imap);
PHP_MINFO_FUNCTION(imap);
PHP_FUNCTION(imap_open);
PHP_FUNCTION(imap_popen);
PHP_FUNCTION(imap_reopen);
PHP_FUNCTION(imap_num_msg);
PHP_FUNCTION(imap_num_recent);
PHP_FUNCTION(imap_headers);
PHP_FUNCTION(imap_headerinfo);
PHP_FUNCTION(imap_rfc822_parse_headers);
PHP_FUNCTION(imap_body);
PHP_FUNCTION(imap_fetchstructure);
PHP_FUNCTION(imap_fetchbody);
PHP_FUNCTION(imap_expunge);
PHP_FUNCTION(imap_delete);
PHP_FUNCTION(imap_undelete);
PHP_FUNCTION(imap_check);
PHP_FUNCTION(imap_close);
PHP_FUNCTION(imap_mail_copy);
PHP_FUNCTION(imap_mail_move);
PHP_FUNCTION(imap_createmailbox);
PHP_FUNCTION(imap_renamemailbox);
PHP_FUNCTION(imap_deletemailbox);
PHP_FUNCTION(imap_listmailbox);
PHP_FUNCTION(imap_scanmailbox);
PHP_FUNCTION(imap_subscribe);
PHP_FUNCTION(imap_unsubscribe);
PHP_FUNCTION(imap_append);
PHP_FUNCTION(imap_ping);
PHP_FUNCTION(imap_base64);
PHP_FUNCTION(imap_qprint);
PHP_FUNCTION(imap_8bit);
PHP_FUNCTION(imap_binary);
PHP_FUNCTION(imap_mailboxmsginfo);
PHP_FUNCTION(imap_rfc822_write_address);
PHP_FUNCTION(imap_rfc822_parse_adrlist);
PHP_FUNCTION(imap_setflag_full);
PHP_FUNCTION(imap_clearflag_full);
PHP_FUNCTION(imap_sort);
PHP_FUNCTION(imap_fetchheader);
PHP_FUNCTION(imap_fetchtext);
PHP_FUNCTION(imap_uid);
PHP_FUNCTION(imap_msgno);
PHP_FUNCTION(imap_list);
PHP_FUNCTION(imap_list_full);
PHP_FUNCTION(imap_listscan);
PHP_FUNCTION(imap_lsub);
PHP_FUNCTION(imap_lsub_full);
PHP_FUNCTION(imap_create);
PHP_FUNCTION(imap_rename);
PHP_FUNCTION(imap_status);
PHP_FUNCTION(imap_bodystruct);
PHP_FUNCTION(imap_fetch_overview);
PHP_FUNCTION(imap_mail_compose);
PHP_FUNCTION(imap_alerts);
PHP_FUNCTION(imap_errors);
PHP_FUNCTION(imap_last_error);
PHP_FUNCTION(imap_mail);
PHP_FUNCTION(imap_search);
PHP_FUNCTION(imap_utf8);
PHP_FUNCTION(imap_utf7_decode);
PHP_FUNCTION(imap_utf7_encode);
PHP_FUNCTION(imap_mime_header_decode);
#else
#define imap_module_ptr NULL
#endif /* HAVE_IMAP */
#endif
#define phpext_imap_ptr imap_module_ptr
+4 -2
View File
@@ -851,11 +851,13 @@ PHP_FUNCTION(ldap_get_entries)
if (ldap_result == NULL) RETURN_FALSE;
num_entries = ldap_count_entries(ldap, ldap_result);
if (num_entries == 0) RETURN_FALSE;
array_init(return_value);
add_assoc_long(return_value, "count", num_entries);
if (num_entries == 0) return;
num_entries = 0;
ldap_result_entry = ldap_first_entry(ldap, ldap_result);
if (ldap_result_entry == NULL) RETURN_FALSE;
+152 -130
View File
@@ -32,7 +32,7 @@
#ifdef PHP_WIN32
#include <winsock.h>
#define signal(a,b) NULL
#define signal(a, b) NULL
#else
#include "build-defs.h"
#if HAVE_SIGNAL_H
@@ -47,7 +47,7 @@
#endif
/* True globals, no need for thread safety */
static int le_result,le_link,le_plink;
static int le_result, le_link, le_plink;
#include "php_ini.h"
@@ -161,7 +161,7 @@ ZEND_GET_MODULE(mysql)
void timeout(int sig);
#define CHECK_LINK(link) { if (link==-1) { php_error(E_WARNING,"MySQL: A link to the server could not be established"); RETURN_FALSE; } }
#define CHECK_LINK(link) { if (link==-1) { php_error(E_WARNING, "MySQL: A link to the server could not be established"); RETURN_FALSE; } }
/*
* This wrapper is required since mysql_free_result() returns an integer, and
@@ -194,7 +194,7 @@ static void _close_mysql_link(zend_rsrc_list_entry *rsrc)
handler = signal(SIGPIPE, SIG_IGN);
mysql_close(link);
signal(SIGPIPE,handler);
signal(SIGPIPE, handler);
efree(link);
MySG(num_links)--;
}
@@ -207,7 +207,7 @@ static void _close_mysql_plink(zend_rsrc_list_entry *rsrc)
handler = signal(SIGPIPE, SIG_IGN);
mysql_close(link);
signal(SIGPIPE,handler);
signal(SIGPIPE, handler);
free(link);
MySG(num_persistent)--;
@@ -320,13 +320,24 @@ PHP_MINFO_FUNCTION(mysql)
}
static void php_mysql_do_connect(INTERNAL_FUNCTION_PARAMETERS,int persistent)
#define MYSQL_DO_CONNECT_CLEANUP() \
if (free_host) { \
efree(host); \
}
#define MYSQL_DO_CONNECT_RETURN_FALSE() \
MYSQL_DO_CONNECT_CLEANUP(); \
RETURN_FALSE;
static void php_mysql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
{
char *user,*passwd,*host,*socket,*tmp;
char *user, *passwd, *host_and_port, *socket, *tmp, *host=NULL;
char *hashed_details;
int hashed_details_length,port = MYSQL_PORT;
int hashed_details_length, port = MYSQL_PORT;
MYSQL *mysql;
void (*handler) (int);
zval **z_host=NULL, **z_user=NULL, **z_passwd=NULL;
zend_bool free_host=0;
MySLS_FETCH();
PLS_FETCH();
@@ -334,76 +345,78 @@ static void php_mysql_do_connect(INTERNAL_FUNCTION_PARAMETERS,int persistent)
if (PG(sql_safe_mode)) {
if (ZEND_NUM_ARGS()>0) {
php_error(E_NOTICE,"SQL safe mode in effect - ignoring host/user/password information");
php_error(E_NOTICE, "SQL safe mode in effect - ignoring host/user/password information");
}
host=passwd=NULL;
host_and_port=passwd=NULL;
user=php_get_current_user();
hashed_details_length = strlen(user)+5+3;
hashed_details = (char *) emalloc(hashed_details_length+1);
sprintf(hashed_details,"mysql__%s_",user);
sprintf(hashed_details, "mysql__%s_", user);
} else {
host = MySG(default_host);
host_and_port = MySG(default_host);
user = MySG(default_user);
passwd = MySG(default_password);
switch(ZEND_NUM_ARGS()) {
case 0: /* defaults */
break;
case 1: {
pval **yyhost;
if (zend_get_parameters_ex(1, &yyhost)==FAILURE) {
RETURN_FALSE;
case 1: {
if (zend_get_parameters_ex(1, &z_host)==FAILURE) {
MYSQL_DO_CONNECT_RETURN_FALSE();
}
convert_to_string_ex(yyhost);
host = (*yyhost)->value.str.val;
}
break;
case 2: {
pval **yyhost, **yyuser;
if (zend_get_parameters_ex(2, &yyhost, &yyuser)==FAILURE) {
RETURN_FALSE;
if (zend_get_parameters_ex(2, &z_host, &z_user)==FAILURE) {
MYSQL_DO_CONNECT_RETURN_FALSE();
}
convert_to_string_ex(yyhost);
convert_to_string_ex(yyuser);
host = (*yyhost)->value.str.val;
user = (*yyuser)->value.str.val;
convert_to_string_ex(z_user);
user = (*z_user)->value.str.val;
}
break;
case 3: {
pval **yyhost,**yyuser,**yypasswd;
if (zend_get_parameters_ex(3, &yyhost, &yyuser, &yypasswd) == FAILURE) {
RETURN_FALSE;
if (zend_get_parameters_ex(3, &z_host, &z_user, &z_passwd) == FAILURE) {
MYSQL_DO_CONNECT_RETURN_FALSE();
}
convert_to_string_ex(yyhost);
convert_to_string_ex(yyuser);
convert_to_string_ex(yypasswd);
host = (*yyhost)->value.str.val;
user = (*yyuser)->value.str.val;
passwd = (*yypasswd)->value.str.val;
convert_to_string_ex(z_user);
convert_to_string_ex(z_passwd);
user = (*z_user)->value.str.val;
passwd = (*z_passwd)->value.str.val;
}
break;
default:
WRONG_PARAM_COUNT;
break;
}
hashed_details_length = sizeof("mysql___")-1 + strlen(SAFE_STRING(host))+strlen(SAFE_STRING(user))+strlen(SAFE_STRING(passwd));
if (z_host) {
SEPARATE_ZVAL(z_host); /* We may modify z_host if it contains a port, separate */
convert_to_string_ex(z_host);
host_and_port = Z_STRVAL_PP(z_host);
if (z_user) {
convert_to_string_ex(z_user);
user = Z_STRVAL_PP(z_user);
if (z_passwd) {
convert_to_string_ex(z_passwd);
passwd = Z_STRVAL_PP(z_passwd);
}
}
}
hashed_details_length = sizeof("mysql___")-1 + strlen(SAFE_STRING(host_and_port))+strlen(SAFE_STRING(user))+strlen(SAFE_STRING(passwd));
hashed_details = (char *) emalloc(hashed_details_length+1);
sprintf(hashed_details,"mysql_%s_%s_%s",SAFE_STRING(host), SAFE_STRING(user), SAFE_STRING(passwd));
sprintf(hashed_details, "mysql_%s_%s_%s", SAFE_STRING(host_and_port), SAFE_STRING(user), SAFE_STRING(passwd));
}
/* We cannot use mysql_port anymore in windows, need to use
* mysql_real_connect() to set the port.
*/
if (host && (tmp=strchr(host,':'))) {
*tmp=0;
if (host_and_port && (tmp=strchr(host_and_port, ':'))) {
host = estrndup(host_and_port, tmp-host_and_port);
free_host = 1;
tmp++;
if (tmp[0] != '/') {
port = atoi(tmp);
if ((tmp=strchr(tmp, ':'))) {
*tmp=0;
tmp++;
socket=tmp;
}
@@ -411,6 +424,7 @@ static void php_mysql_do_connect(INTERNAL_FUNCTION_PARAMETERS,int persistent)
socket = tmp;
}
} else {
host = host_and_port;
port = MySG(default_port);
}
@@ -429,27 +443,27 @@ static void php_mysql_do_connect(INTERNAL_FUNCTION_PARAMETERS,int persistent)
list_entry new_le;
if (MySG(max_links)!=-1 && MySG(num_links)>=MySG(max_links)) {
php_error(E_WARNING,"MySQL: Too many open links (%d)",MySG(num_links));
php_error(E_WARNING, "MySQL: Too many open links (%d)", MySG(num_links));
efree(hashed_details);
RETURN_FALSE;
MYSQL_DO_CONNECT_RETURN_FALSE();
}
if (MySG(max_persistent)!=-1 && MySG(num_persistent)>=MySG(max_persistent)) {
php_error(E_WARNING,"MySQL: Too many open persistent links (%d)",MySG(num_persistent));
php_error(E_WARNING, "MySQL: Too many open persistent links (%d)", MySG(num_persistent));
efree(hashed_details);
RETURN_FALSE;
MYSQL_DO_CONNECT_RETURN_FALSE();
}
/* create the link */
mysql = (MYSQL *) malloc(sizeof(MYSQL));
#if MYSQL_VERSION_ID > 32199 /* this lets us set the port number */
mysql_init(mysql);
if (mysql_real_connect(mysql,host,user,passwd,NULL,port,socket,0)==NULL) {
if (mysql_real_connect(mysql, host, user, passwd, NULL, port, socket, 0)==NULL) {
#else
if (mysql_connect(mysql,host,user,passwd)==NULL) {
if (mysql_connect(mysql, host, user, passwd)==NULL) {
#endif
php_error(E_WARNING, "%s", mysql_error(mysql));
free(mysql);
efree(hashed_details);
RETURN_FALSE;
MYSQL_DO_CONNECT_RETURN_FALSE();
}
/* hash it up */
@@ -458,52 +472,52 @@ static void php_mysql_do_connect(INTERNAL_FUNCTION_PARAMETERS,int persistent)
if (zend_hash_update(&EG(persistent_list), hashed_details, hashed_details_length+1, (void *) &new_le, sizeof(list_entry), NULL)==FAILURE) {
free(mysql);
efree(hashed_details);
RETURN_FALSE;
MYSQL_DO_CONNECT_RETURN_FALSE();
}
MySG(num_persistent)++;
MySG(num_links)++;
} else { /* we do */
if (le->type != le_plink) {
RETURN_FALSE;
MYSQL_DO_CONNECT_RETURN_FALSE();
}
/* ensure that the link did not die */
handler=signal(SIGPIPE,SIG_IGN);
handler=signal(SIGPIPE, SIG_IGN);
#if defined(HAVE_MYSQL_ERRNO) && defined(CR_SERVER_GONE_ERROR)
mysql_stat(le->ptr);
if (mysql_errno((MYSQL *)le->ptr) == CR_SERVER_GONE_ERROR) {
#else
if (!strcasecmp(mysql_stat(le->ptr),"mysql server has gone away")) { /* the link died */
if (!strcasecmp(mysql_stat(le->ptr), "mysql server has gone away")) { /* the link died */
#endif
signal(SIGPIPE,handler);
signal(SIGPIPE, handler);
#if MYSQL_VERSION_ID > 32199 /* this lets us set the port number */
if (mysql_real_connect(le->ptr,host,user,passwd,NULL,port,socket,0)==NULL) {
if (mysql_real_connect(le->ptr, host, user, passwd, NULL, port, socket, 0)==NULL) {
#else
if (mysql_connect(le->ptr,host,user,passwd)==NULL) {
if (mysql_connect(le->ptr, host, user, passwd)==NULL) {
#endif
php_error(E_WARNING,"MySQL: Link to server lost, unable to reconnect");
php_error(E_WARNING, "MySQL: Link to server lost, unable to reconnect");
zend_hash_del(&EG(persistent_list), hashed_details, hashed_details_length+1);
efree(hashed_details);
RETURN_FALSE;
MYSQL_DO_CONNECT_RETURN_FALSE();
}
}
signal(SIGPIPE,handler);
signal(SIGPIPE, handler);
mysql = (MYSQL *) le->ptr;
}
ZEND_REGISTER_RESOURCE(return_value, mysql, le_plink);
} else { /* non persistent */
list_entry *index_ptr,new_index_ptr;
list_entry *index_ptr, new_index_ptr;
/* first we check the hash for the hashed_details key. if it exists,
* it should point us to the right offset where the actual mysql link sits.
* if it doesn't, open a new mysql link, add it to the resource list,
* and add a pointer to it with hashed_details as the key.
*/
if (zend_hash_find(&EG(regular_list),hashed_details,hashed_details_length+1,(void **) &index_ptr)==SUCCESS) {
int type,link;
if (zend_hash_find(&EG(regular_list), hashed_details, hashed_details_length+1,(void **) &index_ptr)==SUCCESS) {
int type, link;
void *ptr;
if (index_ptr->type != le_index_ptr) {
RETURN_FALSE;
MYSQL_DO_CONNECT_RETURN_FALSE();
}
link = (int) index_ptr->ptr;
ptr = zend_list_find(link,&type); /* check if the link is still there */
@@ -513,28 +527,29 @@ static void php_mysql_do_connect(INTERNAL_FUNCTION_PARAMETERS,int persistent)
php_mysql_set_default_link(link);
return_value->type = IS_RESOURCE;
efree(hashed_details);
MYSQL_DO_CONNECT_CLEANUP();
return;
} else {
zend_hash_del(&EG(regular_list),hashed_details,hashed_details_length+1);
zend_hash_del(&EG(regular_list), hashed_details, hashed_details_length+1);
}
}
if (MySG(max_links)!=-1 && MySG(num_links)>=MySG(max_links)) {
php_error(E_WARNING,"MySQL: Too many open links (%d)",MySG(num_links));
php_error(E_WARNING, "MySQL: Too many open links (%d)", MySG(num_links));
efree(hashed_details);
RETURN_FALSE;
MYSQL_DO_CONNECT_RETURN_FALSE();
}
mysql = (MYSQL *) emalloc(sizeof(MYSQL));
#if MYSQL_VERSION_ID > 32199 /* this lets us set the port number */
mysql_init(mysql);
if (mysql_real_connect(mysql,host,user,passwd,NULL,port,socket,0)==NULL) {
if (mysql_real_connect(mysql, host, user, passwd, NULL, port, socket, 0)==NULL) {
#else
if (mysql_connect(mysql,host,user,passwd)==NULL) {
if (mysql_connect(mysql, host, user, passwd)==NULL) {
#endif
php_error(E_WARNING,"MySQL Connection Failed: %s\n",mysql_error(mysql));
php_error(E_WARNING, "MySQL Connection Failed: %s\n", mysql_error(mysql));
efree(hashed_details);
efree(mysql);
RETURN_FALSE;
MYSQL_DO_CONNECT_RETURN_FALSE();
}
/* add it to the list */
@@ -543,15 +558,16 @@ static void php_mysql_do_connect(INTERNAL_FUNCTION_PARAMETERS,int persistent)
/* add it to the hash */
new_index_ptr.ptr = (void *) return_value->value.lval;
new_index_ptr.type = le_index_ptr;
if (zend_hash_update(&EG(regular_list),hashed_details,hashed_details_length+1,(void *) &new_index_ptr, sizeof(list_entry), NULL)==FAILURE) {
if (zend_hash_update(&EG(regular_list), hashed_details, hashed_details_length+1,(void *) &new_index_ptr, sizeof(list_entry), NULL)==FAILURE) {
efree(hashed_details);
RETURN_FALSE;
MYSQL_DO_CONNECT_RETURN_FALSE();
}
MySG(num_links)++;
}
efree(hashed_details);
php_mysql_set_default_link(return_value->value.lval);
MYSQL_DO_CONNECT_CLEANUP();
}
@@ -587,7 +603,7 @@ PHP_FUNCTION(mysql_pconnect)
Close a MySQL connection */
PHP_FUNCTION(mysql_close)
{
pval **mysql_link=NULL;
zval **mysql_link=NULL;
int id;
MYSQL *mysql;
MySLS_FETCH();
@@ -628,7 +644,7 @@ PHP_FUNCTION(mysql_close)
Select a MySQL database */
PHP_FUNCTION(mysql_select_db)
{
pval **db, **mysql_link;
zval **db, **mysql_link;
int id;
MYSQL *mysql;
MySLS_FETCH();
@@ -670,7 +686,7 @@ PHP_FUNCTION(mysql_select_db)
Create a MySQL database */
PHP_FUNCTION(mysql_create_db)
{
pval **db,**mysql_link;
zval **db, **mysql_link;
int id;
MYSQL *mysql;
MySLS_FETCH();
@@ -710,7 +726,7 @@ PHP_FUNCTION(mysql_create_db)
Drop (delete) a MySQL database */
PHP_FUNCTION(mysql_drop_db)
{
pval **db, **mysql_link;
zval **db, **mysql_link;
int id;
MYSQL *mysql;
MySLS_FETCH();
@@ -751,8 +767,11 @@ PHP_FUNCTION(mysql_drop_db)
Send an SQL query to MySQL */
PHP_FUNCTION(mysql_query)
{
pval **query, **mysql_link, **store_result;
int id,use_store=MYSQL_STORE_RESULT;
zval **query, **mysql_link;
#if 0
zval **store_result;
#endif
int id, use_store=MYSQL_STORE_RESULT;
MYSQL *mysql;
MYSQL_RES *mysql_result;
MySLS_FETCH();
@@ -823,8 +842,11 @@ PHP_FUNCTION(mysql_query)
Send an SQL query to MySQL */
PHP_FUNCTION(mysql_db_query)
{
pval **db, **query, **mysql_link, **store_result;
int id,use_store=MYSQL_STORE_RESULT;
zval **db, **query, **mysql_link;
#if 0
zval **store_result;
#endif
int id, use_store=MYSQL_STORE_RESULT;
MYSQL *mysql;
MYSQL_RES *mysql_result;
MySLS_FETCH();
@@ -900,7 +922,7 @@ PHP_FUNCTION(mysql_db_query)
List databases available on a MySQL server */
PHP_FUNCTION(mysql_list_dbs)
{
pval **mysql_link;
zval **mysql_link;
int id;
MYSQL *mysql;
MYSQL_RES *mysql_result;
@@ -925,7 +947,7 @@ PHP_FUNCTION(mysql_list_dbs)
ZEND_FETCH_RESOURCE2(mysql, MYSQL *, mysql_link, id, "MySQL-Link", le_link, le_plink);
if ((mysql_result=mysql_list_dbs(mysql, NULL))==NULL) {
php_error(E_WARNING,"Unable to save MySQL query result");
php_error(E_WARNING, "Unable to save MySQL query result");
RETURN_FALSE;
}
ZEND_REGISTER_RESOURCE(return_value, mysql_result, le_result);
@@ -937,7 +959,7 @@ PHP_FUNCTION(mysql_list_dbs)
List tables in a MySQL database */
PHP_FUNCTION(mysql_list_tables)
{
pval **db, **mysql_link;
zval **db, **mysql_link;
int id;
MYSQL *mysql;
MYSQL_RES *mysql_result;
@@ -969,7 +991,7 @@ PHP_FUNCTION(mysql_list_tables)
RETURN_FALSE;
}
if ((mysql_result=mysql_list_tables(mysql, NULL))==NULL) {
php_error(E_WARNING,"Unable to save MySQL query result");
php_error(E_WARNING, "Unable to save MySQL query result");
RETURN_FALSE;
}
ZEND_REGISTER_RESOURCE(return_value, mysql_result, le_result);
@@ -981,7 +1003,7 @@ PHP_FUNCTION(mysql_list_tables)
List MySQL result fields */
PHP_FUNCTION(mysql_list_fields)
{
pval **db, **table, **mysql_link;
zval **db, **table, **mysql_link;
int id;
MYSQL *mysql;
MYSQL_RES *mysql_result;
@@ -1013,8 +1035,8 @@ PHP_FUNCTION(mysql_list_fields)
RETURN_FALSE;
}
convert_to_string_ex(table);
if ((mysql_result=mysql_list_fields(mysql, (*table)->value.str.val,NULL))==NULL) {
php_error(E_WARNING,"Unable to save MySQL query result");
if ((mysql_result=mysql_list_fields(mysql, (*table)->value.str.val, NULL))==NULL) {
php_error(E_WARNING, "Unable to save MySQL query result");
RETURN_FALSE;
}
ZEND_REGISTER_RESOURCE(return_value, mysql_result, le_result);
@@ -1026,7 +1048,7 @@ PHP_FUNCTION(mysql_list_fields)
Returns the text of the error message from previous MySQL operation */
PHP_FUNCTION(mysql_error)
{
pval **mysql_link;
zval **mysql_link;
int id;
MYSQL *mysql;
MySLS_FETCH();
@@ -1051,7 +1073,7 @@ PHP_FUNCTION(mysql_error)
ZEND_FETCH_RESOURCE2(mysql, MYSQL *, mysql_link, id, "MySQL-Link", le_link, le_plink);
RETURN_STRING(mysql_error(mysql),1);
RETURN_STRING(mysql_error(mysql), 1);
}
/* }}} */
@@ -1061,7 +1083,7 @@ PHP_FUNCTION(mysql_error)
#ifdef HAVE_MYSQL_ERRNO
PHP_FUNCTION(mysql_errno)
{
pval **mysql_link;
zval **mysql_link;
int id;
MYSQL *mysql;
MySLS_FETCH();
@@ -1096,7 +1118,7 @@ PHP_FUNCTION(mysql_errno)
Get number of affected rows in previous MySQL operation */
PHP_FUNCTION(mysql_affected_rows)
{
pval **mysql_link;
zval **mysql_link;
int id;
MYSQL *mysql;
MySLS_FETCH();
@@ -1151,7 +1173,7 @@ PHP_FUNCTION(mysql_escape_string)
Get the id generated from the previous INSERT operation */
PHP_FUNCTION(mysql_insert_id)
{
pval **mysql_link;
zval **mysql_link;
int id;
MYSQL *mysql;
MySLS_FETCH();
@@ -1185,7 +1207,7 @@ PHP_FUNCTION(mysql_insert_id)
Get result data */
PHP_FUNCTION(mysql_result)
{
pval **result, **row, **field=NULL;
zval **result, **row, **field=NULL;
MYSQL_RES *mysql_result;
MYSQL_ROW sql_row;
mysql_row_length_type *sql_row_lengths;
@@ -1212,7 +1234,7 @@ PHP_FUNCTION(mysql_result)
convert_to_long_ex(row);
if ((*row)->value.lval<0 || (*row)->value.lval>=(int)mysql_num_rows(mysql_result)) {
php_error(E_WARNING,"Unable to jump to row %d on MySQL result index %d", (*row)->value.lval, (*result)->value.lval);
php_error(E_WARNING, "Unable to jump to row %d on MySQL result index %d", (*row)->value.lval, (*result)->value.lval);
RETURN_FALSE;
}
mysql_data_seek(mysql_result, (*row)->value.lval);
@@ -1228,23 +1250,23 @@ PHP_FUNCTION(mysql_result)
MYSQL_FIELD *tmp_field;
char *table_name, *field_name, *tmp;
if ((tmp=strchr((*field)->value.str.val,'.'))) {
if ((tmp=strchr((*field)->value.str.val, '.'))) {
table_name = estrndup((*field)->value.str.val, tmp-(*field)->value.str.val);
field_name = estrdup(tmp+1);
} else {
table_name = NULL;
field_name = estrndup((*field)->value.str.val,(*field)->value.str.len);
}
mysql_field_seek(mysql_result,0);
mysql_field_seek(mysql_result, 0);
while ((tmp_field=mysql_fetch_field(mysql_result))) {
if ((!table_name || !strcasecmp(tmp_field->table,table_name)) && !strcasecmp(tmp_field->name,field_name)) {
if ((!table_name || !strcasecmp(tmp_field->table, table_name)) && !strcasecmp(tmp_field->name, field_name)) {
field_offset = i;
break;
}
i++;
}
if (!tmp_field) { /* no match found */
php_error(E_WARNING,"%s%s%s not found in MySQL result index %d",
php_error(E_WARNING, "%s%s%s not found in MySQL result index %d",
(table_name?table_name:""), (table_name?".":""), field_name, (*result)->value.lval);
efree(field_name);
if (table_name) {
@@ -1262,7 +1284,7 @@ PHP_FUNCTION(mysql_result)
convert_to_long_ex(field);
field_offset = (*field)->value.lval;
if (field_offset<0 || field_offset>=(int)mysql_num_fields(mysql_result)) {
php_error(E_WARNING,"Bad column offset specified");
php_error(E_WARNING, "Bad column offset specified");
RETURN_FALSE;
}
break;
@@ -1273,10 +1295,10 @@ PHP_FUNCTION(mysql_result)
return_value->type = IS_STRING;
if (PG(magic_quotes_runtime)) {
return_value->value.str.val = php_addslashes(sql_row[field_offset],sql_row_lengths[field_offset],&return_value->value.str.len,0);
return_value->value.str.val = php_addslashes(sql_row[field_offset], sql_row_lengths[field_offset],&return_value->value.str.len, 0);
} else {
return_value->value.str.len = sql_row_lengths[field_offset];
return_value->value.str.val = (char *) safe_estrndup(sql_row[field_offset],return_value->value.str.len);
return_value->value.str.val = (char *) safe_estrndup(sql_row[field_offset], return_value->value.str.len);
}
} else {
return_value->type = IS_NULL;
@@ -1289,7 +1311,7 @@ PHP_FUNCTION(mysql_result)
Get number of rows in a result */
PHP_FUNCTION(mysql_num_rows)
{
pval **result;
zval **result;
MYSQL_RES *mysql_result;
if (ZEND_NUM_ARGS()!=1 || zend_get_parameters_ex(1, &result)==FAILURE) {
@@ -1308,7 +1330,7 @@ PHP_FUNCTION(mysql_num_rows)
Get number of fields in a result */
PHP_FUNCTION(mysql_num_fields)
{
pval **result;
zval **result;
MYSQL_RES *mysql_result;
if (ZEND_NUM_ARGS()!=1 || zend_get_parameters_ex(1, &result)==FAILURE) {
@@ -1325,7 +1347,7 @@ PHP_FUNCTION(mysql_num_fields)
static void php_mysql_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, int result_type)
{
pval **result, **arg2;
zval **result, **arg2;
MYSQL_RES *mysql_result;
MYSQL_ROW mysql_row;
MYSQL_FIELD *mysql_field;
@@ -1368,15 +1390,15 @@ static void php_mysql_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, int result_type)
RETURN_FALSE;
}
mysql_field_seek(mysql_result,0);
for (mysql_field=mysql_fetch_field(mysql_result),i=0; mysql_field; mysql_field=mysql_fetch_field(mysql_result),i++) {
mysql_field_seek(mysql_result, 0);
for (mysql_field=mysql_fetch_field(mysql_result), i=0; mysql_field; mysql_field=mysql_fetch_field(mysql_result), i++) {
if (mysql_row[i]) {
char *data;
int data_len;
int should_copy;
if (PG(magic_quotes_runtime)) {
data = php_addslashes(mysql_row[i],mysql_row_lengths[i],&data_len,0);
data = php_addslashes(mysql_row[i], mysql_row_lengths[i],&data_len, 0);
should_copy = 0;
} else {
data = mysql_row[i];
@@ -1447,7 +1469,7 @@ PHP_FUNCTION(mysql_fetch_assoc)
Move internal result pointer */
PHP_FUNCTION(mysql_data_seek)
{
pval **result, **offset;
zval **result, **offset;
MYSQL_RES *mysql_result;
if (ZEND_NUM_ARGS()!=2 || zend_get_parameters_ex(2, &result, &offset)==FAILURE) {
@@ -1458,7 +1480,7 @@ PHP_FUNCTION(mysql_data_seek)
convert_to_long_ex(offset);
if ((*offset)->value.lval<0 || (*offset)->value.lval>=(int)mysql_num_rows(mysql_result)) {
php_error(E_WARNING,"Offset %d is invalid for MySQL result index %d", (*offset)->value.lval, (*result)->value.lval);
php_error(E_WARNING, "Offset %d is invalid for MySQL result index %d", (*offset)->value.lval, (*result)->value.lval);
RETURN_FALSE;
}
mysql_data_seek(mysql_result, (*offset)->value.lval);
@@ -1471,7 +1493,7 @@ PHP_FUNCTION(mysql_data_seek)
Get max data size of each column in a result */
PHP_FUNCTION(mysql_fetch_lengths)
{
pval **result;
zval **result;
MYSQL_RES *mysql_result;
mysql_row_length_type *lengths;
int num_fields;
@@ -1552,7 +1574,7 @@ static char *php_mysql_get_field_name(int field_type)
Get column information from a result and return as an object */
PHP_FUNCTION(mysql_fetch_field)
{
pval **result, **field=NULL;
zval **result, **field=NULL;
MYSQL_RES *mysql_result;
MYSQL_FIELD *mysql_field;
@@ -1576,7 +1598,7 @@ PHP_FUNCTION(mysql_fetch_field)
if (field) {
if ((*field)->value.lval<0 || (*field)->value.lval>=(int)mysql_num_fields(mysql_result)) {
php_error(E_WARNING,"MySQL: Bad field offset");
php_error(E_WARNING, "MySQL: Bad field offset");
RETURN_FALSE;
}
mysql_field_seek(mysql_result, (*field)->value.lval);
@@ -1591,14 +1613,14 @@ PHP_FUNCTION(mysql_fetch_field)
add_property_string(return_value, "name",(mysql_field->name?mysql_field->name:empty_string), 1);
add_property_string(return_value, "table",(mysql_field->table?mysql_field->table:empty_string), 1);
add_property_string(return_value, "def",(mysql_field->def?mysql_field->def:empty_string), 1);
add_property_long(return_value, "max_length",mysql_field->max_length);
add_property_long(return_value, "not_null",IS_NOT_NULL(mysql_field->flags)?1:0);
add_property_long(return_value, "primary_key",IS_PRI_KEY(mysql_field->flags)?1:0);
add_property_long(return_value, "max_length", mysql_field->max_length);
add_property_long(return_value, "not_null", IS_NOT_NULL(mysql_field->flags)?1:0);
add_property_long(return_value, "primary_key", IS_PRI_KEY(mysql_field->flags)?1:0);
add_property_long(return_value, "multiple_key",(mysql_field->flags&MULTIPLE_KEY_FLAG?1:0));
add_property_long(return_value, "unique_key",(mysql_field->flags&UNIQUE_KEY_FLAG?1:0));
add_property_long(return_value, "numeric",IS_NUM(mysql_field->type)?1:0);
add_property_long(return_value, "blob",IS_BLOB(mysql_field->flags)?1:0);
add_property_string(return_value, "type",php_mysql_get_field_name(mysql_field->type), 1);
add_property_long(return_value, "numeric", IS_NUM(mysql_field->type)?1:0);
add_property_long(return_value, "blob", IS_BLOB(mysql_field->flags)?1:0);
add_property_string(return_value, "type", php_mysql_get_field_name(mysql_field->type), 1);
add_property_long(return_value, "unsigned",(mysql_field->flags&UNSIGNED_FLAG?1:0));
add_property_long(return_value, "zerofill",(mysql_field->flags&ZEROFILL_FLAG?1:0));
}
@@ -1609,7 +1631,7 @@ PHP_FUNCTION(mysql_fetch_field)
Set result pointer to a specific field offset */
PHP_FUNCTION(mysql_field_seek)
{
pval **result, **offset;
zval **result, **offset;
MYSQL_RES *mysql_result;
if (ZEND_NUM_ARGS()!=2 || zend_get_parameters_ex(2, &result, &offset)==FAILURE) {
@@ -1620,7 +1642,7 @@ PHP_FUNCTION(mysql_field_seek)
convert_to_long_ex(offset);
if ((*offset)->value.lval<0 || (*offset)->value.lval>=(int)mysql_num_fields(mysql_result)) {
php_error(E_WARNING,"Field %d is invalid for MySQL result index %d", (*offset)->value.lval, (*result)->value.lval);
php_error(E_WARNING, "Field %d is invalid for MySQL result index %d", (*offset)->value.lval, (*result)->value.lval);
RETURN_FALSE;
}
mysql_field_seek(mysql_result, (*offset)->value.lval);
@@ -1638,7 +1660,7 @@ PHP_FUNCTION(mysql_field_seek)
static void php_mysql_field_info(INTERNAL_FUNCTION_PARAMETERS, int entry_type)
{
pval **result, **field;
zval **result, **field;
MYSQL_RES *mysql_result;
MYSQL_FIELD *mysql_field;
char buf[512];
@@ -1652,7 +1674,7 @@ static void php_mysql_field_info(INTERNAL_FUNCTION_PARAMETERS, int entry_type)
convert_to_long_ex(field);
if ((*field)->value.lval<0 || (*field)->value.lval>=(int)mysql_num_fields(mysql_result)) {
php_error(E_WARNING,"Field %d is invalid for MySQL result index %d", (*field)->value.lval, (*result)->value.lval);
php_error(E_WARNING, "Field %d is invalid for MySQL result index %d", (*field)->value.lval, (*result)->value.lval);
RETURN_FALSE;
}
mysql_field_seek(mysql_result, (*field)->value.lval);
@@ -1663,12 +1685,12 @@ static void php_mysql_field_info(INTERNAL_FUNCTION_PARAMETERS, int entry_type)
switch (entry_type) {
case PHP_MYSQL_FIELD_NAME:
return_value->value.str.len = strlen(mysql_field->name);
return_value->value.str.val = estrndup(mysql_field->name,return_value->value.str.len);
return_value->value.str.val = estrndup(mysql_field->name, return_value->value.str.len);
return_value->type = IS_STRING;
break;
case PHP_MYSQL_FIELD_TABLE:
return_value->value.str.len = strlen(mysql_field->table);
return_value->value.str.val = estrndup(mysql_field->table,return_value->value.str.len);
return_value->value.str.val = estrndup(mysql_field->table, return_value->value.str.len);
return_value->type = IS_STRING;
break;
case PHP_MYSQL_FIELD_LEN:
@@ -1760,7 +1782,7 @@ static void php_mysql_field_info(INTERNAL_FUNCTION_PARAMETERS, int entry_type)
Get the name of the specified field in a result */
PHP_FUNCTION(mysql_field_name)
{
php_mysql_field_info(INTERNAL_FUNCTION_PARAM_PASSTHRU,PHP_MYSQL_FIELD_NAME);
php_mysql_field_info(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_MYSQL_FIELD_NAME);
}
/* }}} */
@@ -1769,7 +1791,7 @@ PHP_FUNCTION(mysql_field_name)
Get name of the table the specified field is in */
PHP_FUNCTION(mysql_field_table)
{
php_mysql_field_info(INTERNAL_FUNCTION_PARAM_PASSTHRU,PHP_MYSQL_FIELD_TABLE);
php_mysql_field_info(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_MYSQL_FIELD_TABLE);
}
/* }}} */
@@ -1778,7 +1800,7 @@ PHP_FUNCTION(mysql_field_table)
Returns the length of the specified field */
PHP_FUNCTION(mysql_field_len)
{
php_mysql_field_info(INTERNAL_FUNCTION_PARAM_PASSTHRU,PHP_MYSQL_FIELD_LEN);
php_mysql_field_info(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_MYSQL_FIELD_LEN);
}
/* }}} */
@@ -1787,7 +1809,7 @@ PHP_FUNCTION(mysql_field_len)
Get the type of the specified field in a result */
PHP_FUNCTION(mysql_field_type)
{
php_mysql_field_info(INTERNAL_FUNCTION_PARAM_PASSTHRU,PHP_MYSQL_FIELD_TYPE);
php_mysql_field_info(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_MYSQL_FIELD_TYPE);
}
/* }}} */
@@ -1796,7 +1818,7 @@ PHP_FUNCTION(mysql_field_type)
Get the flags associated with the specified field in a result */
PHP_FUNCTION(mysql_field_flags)
{
php_mysql_field_info(INTERNAL_FUNCTION_PARAM_PASSTHRU,PHP_MYSQL_FIELD_FLAGS);
php_mysql_field_info(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_MYSQL_FIELD_FLAGS);
}
/* }}} */
@@ -1805,7 +1827,7 @@ PHP_FUNCTION(mysql_field_flags)
Free result memory */
PHP_FUNCTION(mysql_free_result)
{
pval **result;
zval **result;
MYSQL_RES *mysql_result;
if (ZEND_NUM_ARGS()!=1 || zend_get_parameters_ex(1, &result)==FAILURE) {
-61
View File
@@ -1,61 +0,0 @@
dnl $Id$
dnl config.m4 for extension pcre
dnl By default we'll compile and link against the bundled PCRE library
dnl if DIR is supplied, we'll use that for linking
PHP_ARG_WITH(pcre-regex,whether to include PCRE support,
[ --without-pcre-regex Do not include Perl Compatible Regular Expressions
support. Use --with-pcre-regex=DIR to specify DIR
where PCRE's include and library files are located,
if not using bundled library.],yes)
if test "$PHP_PCRE_REGEX" != "no"; then
PHP_EXTENSION(pcre, $ext_shared)
if test "$PHP_PCRE_REGEX" = "yes"; then
PCRE_LIBADD=pcrelib/libpcre.la
PCRE_SHARED_LIBADD=pcrelib/libpcre.la
PCRE_SUBDIRS=pcrelib
PHP_SUBST(PCRE_LIBADD)
PHP_SUBST(PCRE_SUBDIRS)
AC_DEFINE(HAVE_BUNDLED_PCRE, 1, [ ])
PHP_FAST_OUTPUT($ext_builddir/pcrelib/Makefile)
LIB_BUILD($ext_builddir/pcrelib,$ext_shared,yes)
else
test -f $PHP_PCRE_REGEX/pcre.h && PCRE_INCDIR=$PHP_PCRE_REGEX
test -f $PHP_PCRE_REGEX/include/pcre.h && PCRE_INCDIR=$PHP_PCRE_REGEX/include
if test -z "$PCRE_INCDIR"; then
AC_MSG_RESULT(Could not find pcre.h in $PHP_PCRE_REGEX)
fi
changequote({,})
pcre_major=`grep PCRE_MAJOR $PCRE_INCDIR/pcre.h | sed -e 's/[^0-9]//g'`
pcre_minor=`grep PCRE_MINOR $PCRE_INCDIR/pcre.h | sed -e 's/[^0-9]//g'`
changequote([,])
pcre_minor_length=`echo "$pcre_minor" | wc -c | sed -e 's/[^0-9]//g'`
if test "$pcre_minor_length" -eq 2 ; then
pcre_minor="$pcre_minor"0
fi
pcre_version=$pcre_major$pcre_minor
if test "$pcre_version" -lt 208; then
AC_MSG_ERROR(The PCRE extension requires PCRE library version >= 2.08)
fi
test -f $PHP_PCRE_REGEX/libpcre.a && PCRE_LIBDIR="$PHP_PCRE_REGEX"
test -f $PHP_PCRE_REGEX/lib/libpcre.a && PCRE_LIBDIR="$PHP_PCRE_REGEX/lib"
if test -z "$PCRE_LIBDIR" ; then
AC_MSG_ERROR(Could not find libpcre.a in $PHP_PCRE_REGEX)
fi
AC_ADD_LIBRARY_WITH_PATH(pcre, $PCRE_LIBDIR, PCRE_SHARED_LIBADD)
AC_ADD_INCLUDE($PCRE_INCDIR)
AC_DEFINE(HAVE_PCRE, 1, [ ])
fi
fi
PHP_SUBST(PCRE_SHARED_LIBADD)
AC_CHECK_FUNC(memmove, [], [AC_DEFINE(USE_BCOPY, 1, [ ])])
+3 -1
View File
@@ -34,9 +34,11 @@ extern zend_module_entry sablot_module_entry;
/* Module functions */
PHP_MINIT_FUNCTION(sablot);
PHP_MSHUTDOWN_FUNCTION(sablot);
PHP_MINFO_FUNCTION(sablot);
/* Request functions */
PHP_RSHUTDOWN_FUNCTION(sablot);
/* Output transformation functions */
PHP_FUNCTION(xslt_output_begintransform);
PHP_FUNCTION(xslt_output_endtransform);
+7 -6
View File
@@ -160,9 +160,9 @@ zend_module_entry sablot_module_entry = {
"sablot",
sablot_functions,
PHP_MINIT(sablot),
PHP_MSHUTDOWN(sablot),
NULL,
NULL,
NULL,
PHP_RSHUTDOWN(sablot),
PHP_MINFO(sablot),
STANDARD_MODULE_PROPERTIES
};
@@ -180,15 +180,15 @@ PHP_MINIT_FUNCTION(sablot)
return SUCCESS;
}
PHP_MSHUTDOWN_FUNCTION(sablot)
PHP_RSHUTDOWN_FUNCTION(sablot)
{
SABLOTLS_FETCH();
if (SABLOTG(processor)) {
SablotUnregHandler(SABLOTG(processor), HLR_MESSAGE, NULL, NULL);
SablotDestroyProcessor(SABLOTG(processor));
}
return SUCCESS;
}
@@ -252,7 +252,7 @@ PHP_FUNCTION(xslt_output_endtransform)
buffer = estrndup(OG(active_ob_buffer).buffer, OG(active_ob_buffer).text_length);
/* Nake sure there is data to send */
if (strlen(buffer)) {
if (OG(active_ob_buffer).text_length) {
char *args[] = {"/_xmlinput", buffer,
"/_output", NULL};
@@ -1344,6 +1344,7 @@ static void _php_sablot_free_processor(zend_rsrc_list_entry *rsrc)
FUNCH_FREE(handle->endDocHandler);
SABLOT_FREE_ERROR_HANDLE(*handle);
efree(handle);
}
/* }}} */
+2
View File
@@ -25,6 +25,8 @@
#if HAVE_SHMOP
#include "ext/standard/info.h"
#ifdef ZTS
int shmop_globals_id;
#else
+74 -64
View File
@@ -1,4 +1,4 @@
/* Generated by re2c 0.5 on Fri Nov 17 17:26:38 2000 */
/* Generated by re2c 0.5 on Tue Dec 5 11:55:45 2000 */
#line 1 "/home/sas/src/php4/ext/standard/url_scanner_ex.re"
/*
+----------------------------------------------------------------------+
@@ -163,18 +163,23 @@ enum {
#define YYMARKER q
#define STATE ctx->state
#define PASSTHRU() {\
smart_str_appendl(&ctx->result, start, YYCURSOR - start); \
#define STD_PARA url_adapt_state_ex_t *ctx, char *start, char *YYCURSOR PLS_DC
#define STD_ARGS ctx, start, xp PLS_CC
static inline void passthru(STD_PARA)
{
smart_str_appendl(&ctx->result, start, YYCURSOR - start);
}
#define HANDLE_FORM() {\
if (ctx->tag.len == 4 && strncasecmp(ctx->tag.c, "form", 4) == 0) {\
smart_str_appends(&ctx->result, "<INPUT TYPE=\"HIDDEN\" NAME=\""); \
smart_str_append(&ctx->result, &ctx->q_name); \
smart_str_appends(&ctx->result, "\" VALUE=\""); \
smart_str_append(&ctx->result, &ctx->q_value); \
smart_str_appends(&ctx->result, "\">"); \
} \
static inline void handle_form(STD_PARA)
{
if (ctx->tag.len == 4 && strncasecmp(ctx->tag.c, "form", 4) == 0) {
smart_str_appends(&ctx->result, "<INPUT TYPE=\"HIDDEN\" NAME=\"");
smart_str_append(&ctx->result, &ctx->q_name);
smart_str_appends(&ctx->result, "\" VALUE=\"");
smart_str_append(&ctx->result, &ctx->q_value);
smart_str_appends(&ctx->result, "\">");
}
}
/*
@@ -184,25 +189,30 @@ enum {
* HTML stuff to the result buffer.
*/
#define HANDLE_TAG() {\
int ok = 0; \
int i; \
ctx->tag.len = 0; \
smart_str_appendl(&ctx->tag, start, YYCURSOR - start); \
for (i = 0; i < ctx->tag.len; i++) \
ctx->tag.c[i] = tolower(ctx->tag.c[i]); \
if (zend_hash_find(ctx->tags, ctx->tag.c, ctx->tag.len, (void **) &ctx->lookup_data) == SUCCESS) \
ok = 1; \
STATE = ok ? STATE_NEXT_ARG : STATE_PLAIN; \
static inline void handle_tag(STD_PARA)
{
int ok = 0;
int i;
ctx->tag.len = 0;
smart_str_appendl(&ctx->tag, start, YYCURSOR - start);
for (i = 0; i < ctx->tag.len; i++)
ctx->tag.c[i] = tolower(ctx->tag.c[i]);
if (zend_hash_find(ctx->tags, ctx->tag.c, ctx->tag.len, (void **) &ctx->lookup_data) == SUCCESS)
ok = 1;
STATE = ok ? STATE_NEXT_ARG : STATE_PLAIN;
}
#define HANDLE_ARG() {\
ctx->arg.len = 0; \
smart_str_appendl(&ctx->arg, start, YYCURSOR - start); \
static inline void handle_arg(STD_PARA)
{
ctx->arg.len = 0;
smart_str_appendl(&ctx->arg, start, YYCURSOR - start);
}
#define HANDLE_VAL(quotes, type) {\
smart_str_setl(&ctx->val, start + quotes, YYCURSOR - start - quotes * 2); \
tag_arg(ctx, type PLS_CC); \
static inline void handle_val(STD_PARA, char quotes, char type)
{
smart_str_setl(&ctx->val, start + quotes, YYCURSOR - start - quotes * 2);
tag_arg(ctx, type PLS_CC);
}
#ifdef SCANNER_DEBUG
@@ -224,7 +234,7 @@ static inline void mainloop(url_adapt_state_ex_t *ctx, const char *newdata, size
YYCURSOR = ctx->buf.c;
YYLIMIT = ctx->buf.c + ctx->buf.len;
#line 228
#line 238
while(1) {
@@ -244,14 +254,14 @@ yy0:
if(yych != '<') goto yy4;
yy2: yych = *++YYCURSOR;
yy3:
#line 237
{ PASSTHRU(); STATE = STATE_TAG; continue; }
#line 247
{ passthru(STD_ARGS); STATE = STATE_TAG; continue; }
yy4: yych = *++YYCURSOR;
yy5:
#line 238
{ PASSTHRU(); continue; }
#line 248
{ passthru(STD_ARGS); continue; }
}
#line 239
#line 249
break;
@@ -305,19 +315,19 @@ yy6:
yy8: yych = *++YYCURSOR;
goto yy13;
yy9:
#line 244
{ HANDLE_TAG() /* Sets STATE */; PASSTHRU(); continue; }
#line 254
{ handle_tag(STD_ARGS); /* Sets STATE */; passthru(STD_ARGS); continue; }
yy10: yych = *++YYCURSOR;
yy11:
#line 245
{ PASSTHRU(); STATE = STATE_PLAIN; continue; }
#line 255
{ passthru(STD_ARGS); STATE = STATE_PLAIN; continue; }
yy12: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
yy13: if(yybm[0+yych] & 128) goto yy12;
goto yy9;
}
#line 246
#line 256
break;
@@ -351,22 +361,22 @@ yy14:
}
yy16: yych = *++YYCURSOR;
yy17:
#line 251
{ PASSTHRU(); HANDLE_FORM(); STATE = STATE_PLAIN; continue; }
#line 261
{ passthru(STD_ARGS); handle_form(STD_ARGS); STATE = STATE_PLAIN; continue; }
yy18: yych = *++YYCURSOR;
yy19:
#line 252
{ PASSTHRU(); continue; }
#line 262
{ passthru(STD_ARGS); continue; }
yy20: yych = *++YYCURSOR;
yy21:
#line 253
#line 263
{ YYCURSOR--; STATE = STATE_ARG; continue; }
yy22: yych = *++YYCURSOR;
yy23:
#line 254
{ PASSTHRU(); STATE = STATE_PLAIN; continue; }
#line 264
{ passthru(STD_ARGS); STATE = STATE_PLAIN; continue; }
}
#line 255
#line 265
break;
@@ -420,19 +430,19 @@ yy24:
yy26: yych = *++YYCURSOR;
goto yy31;
yy27:
#line 260
{ PASSTHRU(); HANDLE_ARG(); STATE = STATE_BEFORE_VAL; continue; }
#line 270
{ passthru(STD_ARGS); handle_arg(STD_ARGS); STATE = STATE_BEFORE_VAL; continue; }
yy28: yych = *++YYCURSOR;
yy29:
#line 261
{ PASSTHRU(); STATE = STATE_NEXT_ARG; continue; }
#line 271
{ passthru(STD_ARGS); STATE = STATE_NEXT_ARG; continue; }
yy30: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
yy31: if(yybm[0+yych] & 128) goto yy30;
goto yy27;
}
#line 262
#line 272
case STATE_BEFORE_VAL:
@@ -486,13 +496,13 @@ yy34: yyaccept = 0;
if(yych == ' ') goto yy41;
if(yych == '=') goto yy39;
yy35:
#line 267
#line 277
{ YYCURSOR--; STATE = STATE_NEXT_ARG; continue; }
yy36: yych = *++YYCURSOR;
goto yy40;
yy37:
#line 266
{ PASSTHRU(); STATE = STATE_VAL; continue; }
#line 276
{ passthru(STD_ARGS); STATE = STATE_VAL; continue; }
yy38: yych = *++YYCURSOR;
goto yy35;
yy39: ++YYCURSOR;
@@ -510,7 +520,7 @@ yy43: YYCURSOR = YYMARKER;
case 0: goto yy35;
}
}
#line 268
#line 278
break;
@@ -579,14 +589,14 @@ yy46: yyaccept = 0;
yych = *(YYMARKER = ++YYCURSOR);
if(yych != '>') goto yy63;
yy47:
#line 276
{ PASSTHRU(); STATE = STATE_NEXT_ARG; continue; }
#line 286
{ passthru(STD_ARGS); STATE = STATE_NEXT_ARG; continue; }
yy48: yyaccept = 1;
yych = *(YYMARKER = ++YYCURSOR);
goto yy55;
yy49:
#line 275
{ HANDLE_VAL(0, '"'); STATE = STATE_NEXT_ARG; continue; }
#line 285
{ handle_val(STD_ARGS, 0, '"'); STATE = STATE_NEXT_ARG; continue; }
yy50: yych = *++YYCURSOR;
goto yy53;
yy51: yych = *++YYCURSOR;
@@ -606,8 +616,8 @@ yy55: if(yybm[0+yych] & 32) goto yy54;
yy56: yych = *++YYCURSOR;
if(yybm[0+yych] & 16) goto yy52;
yy57:
#line 274
{ HANDLE_VAL(1, '\''); STATE = STATE_NEXT_ARG; continue; }
#line 284
{ handle_val(STD_ARGS, 1, '\''); STATE = STATE_NEXT_ARG; continue; }
yy58: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
@@ -627,10 +637,10 @@ yy63: if(yybm[0+yych] & 128) goto yy62;
if(yych >= '>') goto yy60;
yy64: yych = *++YYCURSOR;
yy65:
#line 273
{ HANDLE_VAL(1, '"'); STATE = STATE_NEXT_ARG; continue; }
#line 283
{ handle_val(STD_ARGS, 1, '"'); STATE = STATE_NEXT_ARG; continue; }
}
#line 277
#line 287
break;
}
+50 -40
View File
@@ -161,18 +161,23 @@ enum {
#define YYMARKER q
#define STATE ctx->state
#define PASSTHRU() {\
smart_str_appendl(&ctx->result, start, YYCURSOR - start); \
#define STD_PARA url_adapt_state_ex_t *ctx, char *start, char *YYCURSOR PLS_DC
#define STD_ARGS ctx, start, xp PLS_CC
static inline void passthru(STD_PARA)
{
smart_str_appendl(&ctx->result, start, YYCURSOR - start);
}
#define HANDLE_FORM() {\
if (ctx->tag.len == 4 && strncasecmp(ctx->tag.c, "form", 4) == 0) {\
smart_str_appends(&ctx->result, "<INPUT TYPE=\"HIDDEN\" NAME=\""); \
smart_str_append(&ctx->result, &ctx->q_name); \
smart_str_appends(&ctx->result, "\" VALUE=\""); \
smart_str_append(&ctx->result, &ctx->q_value); \
smart_str_appends(&ctx->result, "\">"); \
} \
static inline void handle_form(STD_PARA)
{
if (ctx->tag.len == 4 && strncasecmp(ctx->tag.c, "form", 4) == 0) {
smart_str_appends(&ctx->result, "<INPUT TYPE=\"HIDDEN\" NAME=\"");
smart_str_append(&ctx->result, &ctx->q_name);
smart_str_appends(&ctx->result, "\" VALUE=\"");
smart_str_append(&ctx->result, &ctx->q_value);
smart_str_appends(&ctx->result, "\">");
}
}
/*
@@ -182,25 +187,30 @@ enum {
* HTML stuff to the result buffer.
*/
#define HANDLE_TAG() {\
int ok = 0; \
int i; \
ctx->tag.len = 0; \
smart_str_appendl(&ctx->tag, start, YYCURSOR - start); \
for (i = 0; i < ctx->tag.len; i++) \
ctx->tag.c[i] = tolower(ctx->tag.c[i]); \
if (zend_hash_find(ctx->tags, ctx->tag.c, ctx->tag.len, (void **) &ctx->lookup_data) == SUCCESS) \
ok = 1; \
STATE = ok ? STATE_NEXT_ARG : STATE_PLAIN; \
static inline void handle_tag(STD_PARA)
{
int ok = 0;
int i;
ctx->tag.len = 0;
smart_str_appendl(&ctx->tag, start, YYCURSOR - start);
for (i = 0; i < ctx->tag.len; i++)
ctx->tag.c[i] = tolower(ctx->tag.c[i]);
if (zend_hash_find(ctx->tags, ctx->tag.c, ctx->tag.len, (void **) &ctx->lookup_data) == SUCCESS)
ok = 1;
STATE = ok ? STATE_NEXT_ARG : STATE_PLAIN;
}
#define HANDLE_ARG() {\
ctx->arg.len = 0; \
smart_str_appendl(&ctx->arg, start, YYCURSOR - start); \
static inline void handle_arg(STD_PARA)
{
ctx->arg.len = 0;
smart_str_appendl(&ctx->arg, start, YYCURSOR - start);
}
#define HANDLE_VAL(quotes, type) {\
smart_str_setl(&ctx->val, start + quotes, YYCURSOR - start - quotes * 2); \
tag_arg(ctx, type PLS_CC); \
static inline void handle_val(STD_PARA, char quotes, char type)
{
smart_str_setl(&ctx->val, start + quotes, YYCURSOR - start - quotes * 2);
tag_arg(ctx, type PLS_CC);
}
#ifdef SCANNER_DEBUG
@@ -234,46 +244,46 @@ alpha = [a-zA-Z];
case STATE_PLAIN:
/*!re2c
[<] { PASSTHRU(); STATE = STATE_TAG; continue; }
(any\[<]) { PASSTHRU(); continue; }
[<] { passthru(STD_ARGS); STATE = STATE_TAG; continue; }
(any\[<]) { passthru(STD_ARGS); continue; }
*/
break;
case STATE_TAG:
/*!re2c
alpha+ { HANDLE_TAG() /* Sets STATE */; PASSTHRU(); continue; }
any { PASSTHRU(); STATE = STATE_PLAIN; continue; }
alpha+ { handle_tag(STD_ARGS); /* Sets STATE */; passthru(STD_ARGS); continue; }
any { passthru(STD_ARGS); STATE = STATE_PLAIN; continue; }
*/
break;
case STATE_NEXT_ARG:
/*!re2c
">" { PASSTHRU(); HANDLE_FORM(); STATE = STATE_PLAIN; continue; }
[ \n] { PASSTHRU(); continue; }
">" { passthru(STD_ARGS); handle_form(STD_ARGS); STATE = STATE_PLAIN; continue; }
[ \n] { passthru(STD_ARGS); continue; }
alpha { YYCURSOR--; STATE = STATE_ARG; continue; }
any { PASSTHRU(); STATE = STATE_PLAIN; continue; }
any { passthru(STD_ARGS); STATE = STATE_PLAIN; continue; }
*/
break;
case STATE_ARG:
/*!re2c
alpha+ { PASSTHRU(); HANDLE_ARG(); STATE = STATE_BEFORE_VAL; continue; }
any { PASSTHRU(); STATE = STATE_NEXT_ARG; continue; }
alpha+ { passthru(STD_ARGS); handle_arg(STD_ARGS); STATE = STATE_BEFORE_VAL; continue; }
any { passthru(STD_ARGS); STATE = STATE_NEXT_ARG; continue; }
*/
case STATE_BEFORE_VAL:
/*!re2c
[ ]* "=" [ ]* { PASSTHRU(); STATE = STATE_VAL; continue; }
[ ]* "=" [ ]* { passthru(STD_ARGS); STATE = STATE_VAL; continue; }
any { YYCURSOR--; STATE = STATE_NEXT_ARG; continue; }
*/
break;
case STATE_VAL:
/*!re2c
["] (any\[">])* ["] { HANDLE_VAL(1, '"'); STATE = STATE_NEXT_ARG; continue; }
['] (any\['>])* ['] { HANDLE_VAL(1, '\''); STATE = STATE_NEXT_ARG; continue; }
(any\[ \n>"])+ { HANDLE_VAL(0, '"'); STATE = STATE_NEXT_ARG; continue; }
any { PASSTHRU(); STATE = STATE_NEXT_ARG; continue; }
["] (any\[">])* ["] { handle_val(STD_ARGS, 1, '"'); STATE = STATE_NEXT_ARG; continue; }
['] (any\['>])* ['] { handle_val(STD_ARGS, 1, '\''); STATE = STATE_NEXT_ARG; continue; }
(any\[ \n>"])+ { handle_val(STD_ARGS, 0, '"'); STATE = STATE_NEXT_ARG; continue; }
any { passthru(STD_ARGS); STATE = STATE_NEXT_ARG; continue; }
*/
break;
}
-4
View File
@@ -34,10 +34,6 @@
#include "zend.h"
#include "php_compat.h"
/* automake defines PACKAGE and VERSION for Zend too */
#undef PACKAGE
#undef VERSION
#include "zend_API.h"
#if PHP_BROKEN_SPRINTF
-283
View File
@@ -1,283 +0,0 @@
/*
+----------------------------------------------------------------------+
| PHP version 4.0 |
+----------------------------------------------------------------------+
| Copyright (c) 1997, 1998, 1999, 2000 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 2.02 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available at through the world-wide-web at |
| http://www.php.net/license/2_02.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: Sander Steffann (sander@steffann.nl) |
+----------------------------------------------------------------------+
*/
#include "php.h"
#if HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <sys/stat.h>
#ifndef MAXSYMLINKS
#define MAXSYMLINKS 32
#endif
#ifndef S_ISDIR
#define S_ISDIR(mode) (((mode)&S_IFMT) == S_IFDIR)
#endif
char *php_realpath(char *path, char resolved_path[]);
#ifdef PHP_WIN32
#define IS_SLASH(p) ((p) == '/' || (p) == '\\')
#else
#define IS_SLASH(p) ((p) == '/')
#endif
char *php_realpath(char *path, char resolved_path []) {
char path_construction[MAXPATHLEN]; /* We build the result in here */
char *writepos; /* Position to write next char */
char path_copy[MAXPATHLEN]; /* A work-copy of the path */
char *workpos; /* working position in *path */
#if !defined(PHP_WIN32)
char buf[MAXPATHLEN]; /* Buffer for readlink */
int linklength; /* The result from readlink */
#endif
int linkcount = 0; /* Count symlinks to avoid loops */
struct stat filestat; /* result from stat */
#ifdef PHP_WIN32
char *temppos; /* position while counting '.' */
int dotcount; /* number of '.' */
int t; /* counter */
#endif
/* Set the work-position to the beginning of the given path */
strcpy(path_copy, path);
workpos = path_copy;
#ifdef PHP_WIN32
/* Find out where we start - Windows version */
if (IS_SLASH(*workpos)) {
/* We start at the root of the current drive */
/* Get the current directory */
if (V_GETCWD(path_construction, MAXPATHLEN-1) == NULL) {
/* Unable to get cwd */
resolved_path[0] = 0;
return NULL;
}
/* We only need the first three chars (for example "C:\") */
path_construction[3] = 0;
workpos++;
} else if (workpos[1] == ':') {
/* A drive-letter is specified, copy it */
strncpy(path_construction, path, 2);
strcat(path_construction, "\\");
workpos++;
workpos++;
} else {
/* Use the current directory */
if (V_GETCWD(path_construction, MAXPATHLEN-1) == NULL) {
/* Unable to get cwd */
resolved_path[0] = 0;
return NULL;
}
strcat(path_construction, "\\");
}
#else
/* Find out where we start - Unix version */
if (*workpos == '/') {
/* We start at the root */
strcpy(path_construction, "/");
workpos++;
} else {
/* Use the current directory */
if (V_GETCWD(path_construction, MAXPATHLEN-1) == NULL) {
/* Unable to get cwd */
resolved_path[0] = 0;
return NULL;
}
strcat(path_construction, "/");
}
#endif
/* Set the next-char-position */
writepos = &path_construction[strlen(path_construction)];
/* Go to the end, then stop */
while(*workpos != 0) {
/* Strip (back)slashes */
while(IS_SLASH(*workpos)) workpos++;
#ifdef PHP_WIN32
/* reset dotcount */
dotcount = 0;
/* Look for .. */
if ((workpos[0] == '.') && (workpos[1] != 0)) {
/* Windows accepts \...\ as \..\..\, \....\ as \..\..\..\, etc */
/* At least Win98 does */
temppos = workpos;
while(*temppos++ == '.') {
dotcount++;
if (!IS_SLASH(*temppos) && (*temppos != 0) && (*temppos != '.')) {
/* This is not a /../ component, but a filename that starts with '.' */
dotcount = 0;
}
}
/* Go back dotcount-1 times */
for (t=0 ; t<(dotcount-1) ; t++) {
workpos++; /* move to next '.' */
/* Can we still go back? */
if ((writepos-3) <= path_construction) return NULL;
/* Go back */
writepos--; /* move to '\' */
writepos--;
while(!IS_SLASH(*writepos)) writepos--; /* skip until previous '\\' */
}
workpos++;
}
/* No special case */
if (dotcount == 0) {
/* Append */
while(!IS_SLASH(*workpos) && (*workpos != 0)) {
*writepos++ = *workpos++;
}
}
/* Just one '.', go to next element */
if (dotcount == 1) {
while(!IS_SLASH(*workpos) && (*workpos != 0)) {
*workpos++;
}
/* Avoid double \ in the result */
writepos--;
}
/* If it was a directory, append a slash */
if (IS_SLASH(*workpos)) {
*writepos++ = *workpos++;
}
*writepos = 0;
#else /* defined(PHP_WIN32) */
/* Look for .. */
if ((workpos[0] == '.') && (workpos[1] != 0)) {
if ((workpos[1] == '.') && ((workpos[2] == '/') || (workpos[2] == 0))) {
/* One directory back */
/* Set pointers to right position */
workpos++; /* move to second '.' */
workpos++; /* move to '/' */
/* Only apply .. if not in root */
if ((writepos-1) > path_construction) {
writepos--; /* move to '/' */
while(*--writepos != '/') ; /* skip until previous '/' */
}
} else {
if (workpos[1] == '/') {
/* Found a /./ skip it */
workpos++; /* move to '/' */
/* Avoid double / in the result */
writepos--;
} else {
/* No special case, the name just started with a . */
/* Append */
while((*workpos != '/') && (*workpos != 0)) {
*writepos++ = *workpos++;
}
}
}
} else {
/* No special case */
/* Append */
while((*workpos != '/') && (*workpos != 0)) {
*writepos++ = *workpos++;
}
}
#if HAVE_SYMLINK
/* We are going to use path_construction, so close it */
*writepos = 0;
/* Check the current location to see if it is a symlink */
if((linklength = readlink(path_construction, buf, MAXPATHLEN)) != -1) {
/* Check linkcount */
if (linkcount > MAXSYMLINKS) return NULL;
/* Count this symlink */
linkcount++;
/* Set end of buf */
buf[linklength] = 0;
/* Check for overflow */
if ((strlen(workpos) + strlen(buf) + 1) >= MAXPATHLEN) return NULL;
/* Remove the symlink-component wrom path_construction */
writepos--; /* move to '/' */
while(*--writepos != '/') ; /* skip until previous '/' */
*++writepos = 0; /* end of string after '/' */
/* If the symlink starts with a '/', empty path_construction */
if (*buf == '/') {
*path_construction = 0;
writepos = path_construction;
}
/* Insert symlink into path_copy */
strcat(buf, workpos);
strcpy(path_copy, buf);
workpos = path_copy;
}
#endif /* HAVE_SYMLINK */
/* If it was a directory, append a slash */
if (*workpos == '/') {
*writepos++ = *workpos++;
}
*writepos = 0;
#endif /* defined(PHP_WIN32) */
}
/* Check if the resolved path is a directory */
if (V_STAT(path_construction, &filestat) != 0) {
if (errno != ENOENT) return NULL;
} else {
if (S_ISDIR(filestat.st_mode)) {
/* It's a directory, append a / if needed */
if (*(writepos-1) != '/') {
/* Check for overflow */
if ((strlen(workpos) + 2) >= MAXPATHLEN) {
return NULL;
}
*writepos++ = '/';
*writepos = 0;
}
}
}
strcpy(resolved_path, path_construction);
return resolved_path;
}
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* End:
*/
+1 -1
View File
@@ -1,3 +1,3 @@
/* automatically generated by configure */
/* edit configure.in to change version number */
#define PHP_VERSION "4.0.4-dev"
#define PHP_VERSION "4.0.4RC3"
+4 -4
View File
@@ -124,11 +124,11 @@ function do_testing($argc, &$argv) {
global $term, $windows_p, $php, $skip, $testdirs, $tmpfile, $opts,
$skipped, $failed, $passed, $total, $term_bold, $term_norm;
if ($argc > 0) {
if (is_dir($argv[0])) {
$dir = $argv[0];
if ($argc > 1) {
if (is_dir($argv[1])) {
$dir = $argv[1];
} else {
for ($i = 0; $i < $argc; $i++) {
for ($i = 1; $i < $argc; $i++) {
switch (run_test($argv[$i])) {
case TEST_SKIPPED:
case TEST_INTERNAL_ERROR:
+5 -6
View File
@@ -42,13 +42,12 @@ AC_ARG_WITH(apxs,
APXS_LDFLAGS="@SYBASE_LFLAGS@ @SYBASE_LIBS@ @SYBASE_CT_LFLAGS@ @SYBASE_CT_LIBS@"
APXS_INCLUDEDIR=`$APXS -q INCLUDEDIR`
APXS_CFLAGS=`$APXS -q CFLAGS`
for flag in $APXS_CFLAGS; do
case $flag in
-D*) CPPFLAGS="$CPPFLAGS $flag";;
esac
done
AC_ADD_INCLUDE($APXS_INCLUDEDIR)
if `echo $APXS_CFLAGS|grep USE_HSREGEX>/dev/null`; then
APACHE_HAS_REGEX=yes
fi
if `echo $APXS_CFLAGS|grep EAPI>/dev/null`; then
CPPFLAGS="$CPPFLAGS -DEAPI"
fi
PHP_SAPI=apache
APACHE_INSTALL="$APXS -i -a -n php4 $SAPI_SHARED"
PHP_BUILD_SHARED
+23 -30
View File
@@ -372,12 +372,12 @@ int main(int argc, char *argv[])
zend_file_handle file_handle;
char *s;
/* temporary locals */
int cgi_started=0;
int behavior=PHP_MODE_STANDARD;
int no_headers=0;
int orig_optind=ap_php_optind;
char *orig_optarg=ap_php_optarg;
char *argv0=NULL;
char *script_file=NULL;
zend_llist global_vars;
#if SUPPORT_INTERACTIVE
int interactive=0;
@@ -541,18 +541,7 @@ any .htaccess restrictions anywhere on your site you can leave doc_root undefine
break;
case 'f': /* parse file */
if (!cgi_started){
if (php_request_startup(CLS_C ELS_CC PLS_CC SLS_CC)==FAILURE) {
php_module_shutdown();
return FAILURE;
}
}
if (no_headers) {
SG(request_info).no_headers = 1;
SG(headers_sent) = 1;
}
cgi_started=1;
SG(request_info).path_translated = estrdup(ap_php_optarg);
script_file = estrdup(ap_php_optarg);
no_headers = 1;
break;
@@ -575,17 +564,14 @@ any .htaccess restrictions anywhere on your site you can leave doc_root undefine
break;
case 'i': /* php info & quit */
if (!cgi_started) {
if (php_request_startup(CLS_C ELS_CC PLS_CC SLS_CC)==FAILURE) {
php_module_shutdown();
return FAILURE;
}
if (php_request_startup(CLS_C ELS_CC PLS_CC SLS_CC)==FAILURE) {
php_module_shutdown();
return FAILURE;
}
if (no_headers) {
SG(headers_sent) = 1;
SG(request_info).no_headers = 1;
}
cgi_started=1;
php_print_info(0xFFFFFFFF);
exit(1);
break;
@@ -624,11 +610,9 @@ any .htaccess restrictions anywhere on your site you can leave doc_root undefine
case 'v': /* show php version & quit */
no_headers = 1;
if (!cgi_started) {
if (php_request_startup(CLS_C ELS_CC PLS_CC SLS_CC)==FAILURE) {
php_module_shutdown();
return FAILURE;
}
if (php_request_startup(CLS_C ELS_CC PLS_CC SLS_CC)==FAILURE) {
php_module_shutdown();
return FAILURE;
}
if (no_headers) {
SG(headers_sent) = 1;
@@ -655,12 +639,20 @@ any .htaccess restrictions anywhere on your site you can leave doc_root undefine
if (!cgi) {
if (!SG(request_info).query_string) {
for (i = ap_php_optind, len = 0; i < argc; i++) {
len = 0;
if (script_file) {
len += strlen(script_file) + 1;
}
for (i = ap_php_optind; i < argc; i++) {
len += strlen(argv[i]) + 1;
}
s = malloc(len + 1); /* leak - but only for command line version, so ok */
*s = '\0'; /* we are pretending it came from the environment */
if (script_file) {
strcpy(s, script_file);
strcat(s, "+");
}
for (i = ap_php_optind, len = 0; i < argc; i++) {
strcat(s, argv[i]);
if (i < (argc - 1)) {
@@ -671,12 +663,13 @@ any .htaccess restrictions anywhere on your site you can leave doc_root undefine
}
}
if (script_file) {
SG(request_info).path_translated = script_file;
}
if (!cgi_started) {
if (php_request_startup(CLS_C ELS_CC PLS_CC SLS_CC)==FAILURE) {
php_module_shutdown();
return FAILURE;
}
if (php_request_startup(CLS_C ELS_CC PLS_CC SLS_CC)==FAILURE) {
php_module_shutdown();
return FAILURE;
}
if (no_headers) {
SG(headers_sent) = 1;
-113
View File
@@ -1,113 +0,0 @@
#include "php.h"
#ifndef HAVE_STRTOK_R
/*
* Copyright (c) 1998 Softweyr LLC. All rights reserved.
*
* strtok_r, from Berkeley strtok
* Oct 13, 1998 by Wes Peters <wes@softweyr.com>
*
* Copyright (c) 1988, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notices, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notices, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
*
* This product includes software developed by Softweyr LLC, the
* University of California, Berkeley, and its contributors.
*
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY SOFTWEYR LLC, THE REGENTS AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SOFTWEYR LLC, THE
* REGENTS, OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <stddef.h>
#include <string.h>
char *
strtok_r(char *s, const char *delim, char **last)
{
char *spanp;
int c, sc;
char *tok;
if (s == NULL && (s = *last) == NULL)
{
return NULL;
}
/*
* Skip (span) leading delimiters (s += strspn(s, delim), sort of).
*/
cont:
c = *s++;
for (spanp = (char *)delim; (sc = *spanp++) != 0; )
{
if (c == sc)
{
goto cont;
}
}
if (c == 0) /* no non-delimiter characters */
{
*last = NULL;
return NULL;
}
tok = s - 1;
/*
* Scan token (scan for delimiters: s += strcspn(s, delim), sort of).
* Note that delim must have one NUL; we stop if we see that, too.
*/
for (;;)
{
c = *s++;
spanp = (char *)delim;
do
{
if ((sc = *spanp++) == c)
{
if (c == 0)
{
s = NULL;
}
else
{
char *w = s - 1;
*w = '\0';
}
*last = s;
return tok;
}
}
while (sc != 0);
}
/* NOTREACHED */
}
#endif
+3 -3
View File
@@ -2,17 +2,17 @@ PHP Regression Tests
====================
To run the tests, go to the top-level directory and
run "./php -f run-tests.php".
run "./php -q run-tests.php".
Without parameters, "run-tests.php" will recursively scan through the
file tree looking for directories called "tests", and run all the
tests (.phpt files) within (recursively).
To run tests in a single directory, pass the directory as a parameter:
"./php -f run-tests.php tests/lang".
"./php -q run-tests.php tests/lang".
To run one or more single tests, pass them as parameters:
"./php -f run-tests.php tests/lang/015.phpt".
"./php -q run-tests.php tests/lang/015.phpt".
The format of the .phpt files is quite simple. There are 6 possible
sections. Test, Skipif, Post, Get, File and Expect. The Test section