Compare commits

...
19 Commits
Author SHA1 Message Date
SVN Migration aec3e9a8a4 This commit was manufactured by cvs2svn to create tag 'php_4_0_5RC2'. 2001-03-20 21:59:50 +00:00
Zeev Suraski ad8426b7d3 4.0.5RC2 2001-03-20 21:59:49 +00:00
Andi Gutmans eb2afa6cfb - MFH 2001-03-20 18:15:10 +00:00
foobar d16d5eb9f6 MFH 2001-03-20 01:49:56 +00:00
foobar 3b6a30dd6b MFH 2001-03-20 01:42:40 +00:00
foobar 36393c74f5 MFH 2001-03-20 01:32:28 +00:00
SVN Migration 4a58dd0b64 This commit was manufactured by cvs2svn to create branch 'PHP_4_0_5'. 2001-03-19 11:03:30 +00:00
Fredrik Öhrn 3ab749ce27 Solved compile failure due to clash between IMAP and ClibPDF headers. 2001-03-18 18:45:21 +00:00
Zeev Suraski 5fe65aa136 MFH 2001-03-18 02:36:27 +00:00
Zeev Suraski 5ce1dc591b MFH 2001-03-18 00:11:15 +00:00
Derick Rethans fb5d197a99 - MFH (memleak fix) 2001-03-17 14:55:24 +00:00
Anil Madhavapeddy ab5900f9bb Update libtool to support OpenBSD 2.8+ wrt shared libraries and
library dependencies.  Tested on i386/sparc.
2001-03-17 13:13:55 +00:00
James Moore 45c5791d5e MFH for website team credits. 2001-03-17 12:21:22 +00:00
Zeev Suraski 1ab8f39f47 MFH 2001-03-17 03:05:07 +00:00
Dan Kalowsky 6a6318d4be This is to correct bug #9762, patch submitted by Bug reporter. 2001-03-16 13:24:06 +00:00
Sascha Schumann de3c9594e4 Don't do anything, if the user wants no PDF. 2001-03-16 12:25:34 +00:00
Zeev Suraski 8bb1eb9d01 Update NEWS for the branch... 2001-03-13 16:27:40 +00:00
Zeev Suraski f48c985537 Rebranch 2001-03-13 16:23:53 +00:00
SVN Migration 57293eea0b This commit was manufactured by cvs2svn to create branch 'PHP_4_0_5'. 2001-03-13 11:09:38 +00:00
30 changed files with 273 additions and 868 deletions

No files matched your search

+1 -1
View File
@@ -18,7 +18,7 @@ LTLIBRARY_LIBADD = $(LTLIBRARY_DEPENDENCIES) $(EXTRA_LIBS)
PROGRAM_NAME = php
PROGRAM_SOURCES = stub.c
PROGRAM_LDADD = libphp4.la
PROGRAM_LDADD = libphp4.la $(EXT_PROGRAM_LDADD)
PROGRAM_LDFLAGS = -export-dynamic
PROGRAM_DEPENDENCIES = $(PROGRAM_LDADD)
+2
View File
@@ -2,6 +2,8 @@ PHP 4.0 NEWS
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
?? ??? 200?, Version 4.0.5
- IMPORTANT: removed /F modifier handling from preg_replace(). Instead
one should use new preg_replace_callback() function. (Andrei)
- Added array_reduce(), which allows iterative reduction of an array
to a single value via a callback function. (Andrei)
- The imageloadfont function of the gd extension should be not platform
+97 -128
View File
@@ -1,157 +1,126 @@
Using PHP4 with the Zeus Web Server
-----------------------------------
Zeus fully supports running PHP in combination with our webserver. A
significant improvement in PHP 4 is that you can now run PHP as an
ISAPI module, giving great performance benefits over traditional CGI
code.
Zeus fully supports running PHP in combination with our
webserver. There are three different interfaces that can be used to
enable PHP:
Note that you will need to be running at least version 3.3.8 of the
webserver. If you are running an earlier version, please see our
website (http://www.zeus.com) for upgrade instructions.
Earlier versions of Zeus (3.3.6) can also run PHP, but it is
suggested that you upgrade for full compatibility.
* CGI
* ISAPI
* FastCGI
You should compile PHP using the gcc compiler. Other compilers may
cause build errors.
Of the three, we recommend using FastCGI, which has been tested and
benchmarked as providing the best performance and reliability.
To build the ISAPI version of PHP, start the configuration with:
Full details of how to install PHP are available from our
website, at:
./configure --with-zeus=/usr/local/zeus
http://support.zeus.com/products/php.html
Obviously, replace /usr/local/zeus with the location of where you have
installed Zeus on your machine. For PHP to build successfully, you
need to have 3.3.6 already installed, because the code relies on the
presence of header files provided with the latest version.
You may have to adjust the environment variable LDFLAGS and EXTRA_LIBS
in order to link in extra libraries. This depends on the platform on
which you are building and also on the compiler used (see below). A
standard GNU/Linux install with GCC should build fine with no changes.
If you have any problems, please check the support site for more
up-to-date information and advice.
Configuring the webserver
-------------------------
Quick guide to installing FastCGI with Zeus
-------------------------------------------
After running 'make' and 'make install', you will have a 'libphp4.so'
file. Copy this file into a directory reserved for ISAPI
binaries. Now, perform the following steps for each virtual server
that you wish to run PHP on:
Step 1 - obtain and install FastCGI development kit.
1) On the Admin server, go to 'edit server->path mapping'
2) Add an alias to the directory with libphp4.so in it, mapped to
/isapi/ (or a location of your choice). Make sure you set the alias
type to ISAPI.
3) Click 'update'
4) Add a handler for file extension 'php' to be run by /isapi/libphp4.so
5) Click 'update', then go back to the previous page.
6) Click on the 'module configuration' button, ensure that ISAPI
support is ticked.
7) Click on the ISAPI link. At the bottom of the page, click the
checkbox for running ISAPI extensions 'out of process'.
8) Click 'update'. Then restart the virtual server. Done!
Grab the package from:
http://www.fastcgi.com/dist/devkit_2.2.0.tar.gz
Extract the package and follow the instructions:
./configure
make
make export
(run the last as root)
This will install to /usr/local/lib/libfcgi.a
and /usr/local/include/*fcgi*
Troubleshooting
---------------
*) Why does the compile fail at Zend/zend-scanner-cc.cc
or Zend/zend-parser.c ?
Step 2 - Compile PHP as FastCGI.
These source files are auto-generated from the corresponding .y files.
The default distribution of PHP contains pre-generated versions of these
files that have caused problems for some people. The simplest solution is
to delete the files. They will then be rebuilt correctly. You must have the
following GNU tools to do this:
Compile as follows:
./configure --with-fastcgi
make
bison 1.28 or later
flex 2.5.4 or later
Note that PHP has many options to the configure script -
e.g. --with-mysql. You will probably want to select your usual options
before compiling; the above is just a bare minimum, for illustration.
*) Why does my PHP library fail to load?
After configuring Zeus, if you get a '502 Bad Gateway' error when
accessing a PHP page, there are problems loading the PHP
library. Check the error log ($ZEUSHOME/web/log/errors) for errors.
Failing to load the PHP ISAPI module is likely to be due to unresolved
symbols in the module. A way to check for this is to visit our support
page at http://support.zeus.com/faq/entries/isapi_error.html and run
the program there on your libphp4.so. It will list any unresolved
symbols.
*) My libphp4.so has unresolved symbols. How do I fix this?
You must ensure that the PHP build process links in the appropriate
libraries that contain these symbols! The libraries required will
depend on the platform you are running PHP on.
You may need to set one or two environment variables before running
the 'configure' program to set up PHP; LDFLAGS and EXTRA_LIBS. Make
sure that you also export these variables to the build process.
(Type 'export LDFLAGS EXTRA_LIBS' in the shell to do this.)
If you are using 3rd party tools and libraries which are installed
in non-standard locations, you may need to set the environment
variable LD_LIBRARY_PATH to point to the library's location, prior
to running the Zeus Web Server. For example, if you have compiled
external MySQL support, and mysql is installed in /usr/local/mysql,
you should set LD_LIBRARY_PATH to '/usr/local/mysql/lib/mysql'
and then 'export LD_LIBRARY_PATH'. For convenience, you should add
this to the 'start-zeus' script provided.
Yet another method of ensuring the linked libraries are found is to
set the environment variable LD_RUN_PATH before compiling PHP. This
works in a similar way to LD_LIBRARY_PATH, but at compile-time.
Libraries produced with this envrionment variable set will have its
value 'burned' into the resultant binary, specifying a runtime
search pth to locate other required libraries such as MySQL.
On Linux, you can also tell the dynamic linker where to find the
libraries, by adding '/usr/local/mysql/lib/mysql' to the file
/etc/ld.so.conf - after editting this file, run 'ldconfig' as root,
to use the changes.
After compilation finishes, you will be left with an executable
program called 'php'. Copy this into your document root, under a
dedicated FastCGI directory (e.g. $DOCROOT/fcgi-bin/php)
Specific examples:
Step 3 - configure Zeus
Solaris + gcc:
Ensure you run ./configure with the `--enable-libgcc' parameter. You
may need to set LDFLAGS to '-L/usr/local/egcs/lib' (path depends on
your gcc installation)
Four stages:
- enable FastCGI
- configure FastCGI
- setup alias for FastCGI
- setup alias for PHP
FreeBSD 4:
Some people may find they need to run ./configure with the
'--enable-libgcc' compile option too.
1) Using the admin server, go to the 'module configuration' page for
your virtual server, and ensure that 'fastcgi' is enabled (select the
tickbox to the left).
2) While we can run FastCGI's locally, there are known problems with
some OS's (specifically, the communication between web server and
FastCGI happens over a unix domain socket, and some OS's have trouble
sustaining high connection rates over these sockets). So instead, we
are going to set up the PHP FastCGI to run 'remotely' over localhost
(this uses TCP sockets, which do not suffer this problem). Go to the
'fastcgi configuration' page, and under 'add remote fastcgi':
Add Remote FastCGI
Docroot path /fcgi-bin/php
Remote machine localhost:8002
The first entry is where you saved PHP, above.
The second entry is localhost:<any unused port>
We will start the FastCGI listening on this port shortly.
Click 'update' to commit these changes.
3) Go to the path mapping module and add an alias for FastCGI:
Add Alias
Docroot path /fcgi-bin
Filesystem directory /path/to/docroot/fcgi-bin
Alias type fastcgi
Click 'update' to commit these changes
4) Also on the path mapping module, add a handler for PHP:
Add handler
File extension php
Handler /fcgi-bin/php
Click 'update' to commit these changes
Finally restart your virtual server for these changes to take effect.
Performance issues
==================
Step 4 - start PHP as a FastCGI runner
To make PHP run fast under Zeus, check the following points:
When you start PHP, it will pre-fork a given number of child processes
to handle incoming PHP requests. Each process will handle a given
number of requests before exiting (and being replaced by a newly
forked process). You can control these two parameters by setting the
following environment variables BEFORE starting the FastCGI runner:
1) Run PHP as an ISAPI module, not a CGI - compile it with the --with-zeus=...
flag!
PHP_FCGI_CHILDREN - the number of child processes to pre-fork. If not
set, defaults to 8.
2) Tune the ISAPI runner to your required workload. There are several
tuneables that can be given. These are set by adding the appropriate
lines to the $ZEUSHOME/web/global.cfg file. Changes to this file will only
be picked up after the web server is restarted (run stop-zeus ; start-zeus)
PHP_FCGI_MAX_REQUESTS - the number of requests each PHP child process
handles before exiting. If not set, defaults to 500.
tuning!modules!isapi!external!maxthreads xxx
To start the FastCGI runner, execute '$ZEUSHOME/web/bin/fcgirunner
8002 $DOCROOT/fcgi-bin/php'. Substitute the appropriate values for
$ZEUSHOME and $DOCROOT; also substitute for 8002 the port you chose,
above.
- Sets the maximum number of threads that the ISAPI runner will spawn. If
further PHP page requests arrive, they will be queued until a current
page is finished. For busy websites, we suggest increasing this value
(defaults to 16). Replace the 'xxx' in the above line with the required
number of threads. Note that the threads are equally shared between
ISAPI extensions and filters, so if you want to handle 100 concurrent
PHP page requests, set this tuneable to 200.
tuning!modules!isapi!external!minthreads xxx
- Sets the minimum number of threads. Idle threads will be kept in a pool,
which avoids costly thread creation/deletion.
For more information and help with Zeus, please visit our website:
http://support.zeus.com
To stop the runner (e.g. to experiment with the above environment
variables) you will need to manually stop and running PHP
processes. (Use 'ps' and 'kill'). As it is PHP which is forking lots
of children and not the runner, Zeus unfortunately cannot keep track
of what processes are running, sorry. A typical command line may look
like 'ps -efl | grep $DOCROOT/fcgi-bin/php | grep -v grep | awk
'{print $4}' | xargs kill'
+7 -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.5-dev, nodefine)
AM_INIT_AUTOMAKE(php, 4.0.5RC2, nodefine)
PHP_VERSION=$VERSION
echo "/* automatically generated by configure */" > php_version.h.new
@@ -389,6 +389,7 @@ putenv \
random \
rand_r \
regcomp \
res_search \
setitimer \
setlocale \
localeconv \
@@ -644,6 +645,11 @@ if test "$PHP_SAPI" = "cgi"; then
PHP_PROGRAM=php
fi
if test "$PHP_SAPI" = "fastcgi"; then
PHP_PROGRAM=php
fi
PHP_REGEX
PHP_CONFIGURE_PART(Configuring Zend)
+7
View File
@@ -33,6 +33,13 @@
#if HAVE_CPDFLIB
/* The macro T is defined in the IMAP headers and clashes with a function
declaration here. Get rid of it. */
#ifdef T
#undef T
#endif
#include <cpdflib.h>
extern zend_module_entry cpdf_module_entry;
+12 -10
View File
@@ -108,11 +108,13 @@ static void phpi_FDFClose(zend_rsrc_list_entry *rsrc)
(void)FDFClose(fdf);
}
static sapi_post_entry supported_post_entries[] = {
#if HAVE_FDFLIB
{ "application/vnd.fdf", sizeof("application/vnd.fdf")-1, php_default_post_reader, fdf_post_handler},
#endif
{ NULL, 0, NULL }
#define FDF_POST_CONTENT_TYPE "application/vnd.fdf"
static sapi_post_entry php_fdf_post_entry = {
FDF_POST_CONTENT_TYPE,
sizeof(FDF_POST_CONTENT_TYPE)-1,
sapi_read_standard_form_data,
fdf_post_handler
};
@@ -123,9 +125,9 @@ PHP_MINIT_FUNCTION(fdf)
FDF_GLOBAL(le_fdf) = zend_register_list_destructors_ex(phpi_FDFClose, NULL, "fdf", module_number);
/* add handler for Acrobat FDF form post requests */
sapi_add_post_entry("application/vnd.fdf", php_default_post_reader, fdf_post_handler);
sapi_register_post_entry(&php_fdf_post_entry);
/* Constants used by fdf_set_opt() */
/* Constants used by fdf_set_opt() */
REGISTER_LONG_CONSTANT("FDFValue", FDFValue, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("FDFStatus", FDFStatus, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("FDFFile", FDFFile, CONST_CS | CONST_PERSISTENT);
@@ -176,7 +178,7 @@ PHP_MSHUTDOWN_FUNCTION(fdf)
FDFErc err;
/* remove handler for Acrobat FDF form post requests */
sapi_remove_post_entry("application/vnd.fdf");
sapi_unregister_post_entry(&php_fdf_post_entry);
#ifdef PHP_WIN32
return SUCCESS;
@@ -769,10 +771,9 @@ SAPI_POST_HANDLER_FUNC(fdf_post_handler)
char *name=NULL,*value=NULL,*p;
int name_len=0,value_len=0;
char *lastfieldname =NULL;
char *strtok_buf = NULL;
char *filename = NULL;
FDFErc err;
ASInt32 nBytes, datalen;
ASInt32 nBytes;
zval *array_ptr = (zval *) arg;
ELS_FETCH();
PLS_FETCH();
@@ -811,6 +812,7 @@ SAPI_POST_HANDLER_FUNC(fdf_post_handler)
err = FDFGetValue(theFDF,name,value,value_len-1,&nBytes);
if(err == FDFErcOK && nBytes != 0) {
for(p=value;*p;p++) if(*p=='\r') *p='\n';
if(lastfieldname) efree(lastfieldname);
lastfieldname = estrdup(name);
php_register_variable(name, value, array_ptr ELS_CC PLS_CC);
}
-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
+5
View File
@@ -22,6 +22,7 @@
| Andrew Skalski <askalski@chekinc.com> |
| Hartmut Holzgraefe <hartmut@six.de> |
| Jani Taskinen <sniper@iki.fi> |
| Daniel R Kalowsky <dank@deadmime.org> |
| PHP 4.0 updates: Zeev Suraski <zeev@zend.com> |
+----------------------------------------------------------------------+
*/
@@ -366,6 +367,8 @@ MESSAGELIST *mail_newmessagelist(void)
*/
void mail_getquota(MAILSTREAM *stream, char *qroot,QUOTALIST *qlist)
{
IMAPLS_FETCH();
/* this should only be run through once */
for (; qlist; qlist = qlist->next)
{
@@ -1022,6 +1025,8 @@ PHP_FUNCTION(imap_get_quota)
int ind, ind_type;
pils *imap_le_struct;
IMAPLS_FETCH();
if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &streamind, &qroot) == FAILURE) {
ZEND_WRONG_PARAM_COUNT();
}
+3 -1
View File
@@ -1211,7 +1211,7 @@ static void php_mcrypt_do_crypt (char* cipher, zval **key, zval **data, char *mo
int block_size, max_key_length, use_key_length, i, count, iv_size;
unsigned long int data_size;
int *key_length_sizes;
char *key_s, *iv_s;
char *key_s = NULL, *iv_s;
char *data_s;
MCRYPT td;
MCLS_FETCH();
@@ -1309,6 +1309,8 @@ static void php_mcrypt_do_crypt (char* cipher, zval **key, zval **data, char *mo
mcrypt_generic_end (td);
if (iv_s != NULL)
efree (iv_s);
if (key_s != NULL)
efree (key_s);
efree (data_s);
mcrypt_module_close (td);
}
-62
View File
@@ -1,62 +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
CPPFLAGS="$CPPFLAGS -DSUPPORT_UTF8"
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, [ ])])
+2
View File
@@ -26,6 +26,8 @@ PHP_ARG_WITH(pdflib,whether to include PDFlib support,
AC_ADD_LIBRARY(jpeg)
AC_ADD_LIBRARY(z)
;;
no)
;;
*)
test -f $withval/include/pdflib.h && PDFLIB_INCLUDE="$withval/include"
if test -n "$PDFLIB_INCLUDE" ; then
+1 -1
View File
@@ -247,7 +247,7 @@ function_entry basic_functions[] = {
PHP_FE(gethostbyaddr, NULL)
PHP_FE(gethostbyname, NULL)
PHP_FE(gethostbynamel, NULL)
#if HAVE_LIBBIND && !(defined(__BEOS__)||defined(PHP_WIN32))
#if HAVE_RES_SEARCH && !(defined(__BEOS__)||defined(PHP_WIN32))
PHP_FE(checkdnsrr, NULL)
PHP_FE(getmxrr, second_and_third_args_force_ref)
#else
+8
View File
@@ -98,6 +98,14 @@ PHPAPI void php_print_credits(int flag)
php_info_print_table_end();
}
if (flag & PHP_CREDITS_WEB) {
/* Website Team */
php_info_print_table_start();
php_info_print_table_header(1, "PHP Website Team");
php_info_print_table_row(1, "Hojtsy Gabor, Colin Viebrock, Jim Winstead");
php_info_print_table_end();
}
if (flag & PHP_CREDITS_FULLPAGE) {
PUTS("</body></html>\n");
}
+10
View File
@@ -19,6 +19,11 @@
/* $Id$ */
#ifndef CREDITS_H
#define CREDITS_H
#ifndef HAVE_CREDITS_DEFS
#define HAVE_CREDITS_DEFS
#define PHP_CREDITS_GROUP (1<<0)
#define PHP_CREDITS_GENERAL (1<<1)
@@ -26,7 +31,12 @@
#define PHP_CREDITS_MODULES (1<<3)
#define PHP_CREDITS_DOCS (1<<4)
#define PHP_CREDITS_FULLPAGE (1<<5)
#define PHP_CREDITS_QA (1<<6)
#define PHP_CREDITS_WEB (1<<7)
#define PHP_CREDITS_ALL 0xFFFFFFFF
#endif /* HAVE_CREDITS_DEFS */
PHPAPI void php_print_credits(int flag);
#endif
+1 -1
View File
@@ -167,7 +167,7 @@ char *php_gethostbyname(char *name)
return estrdup(inet_ntoa(in));
}
#if HAVE_LIBBIND && !(defined(__BEOS__)||defined(PHP_WIN32))
#if HAVE_RES_SEARCH && !(defined(__BEOS__)||defined(PHP_WIN32))
/* {{{ proto int checkdnsrr(string host [, string type])
Check DNS records corresponding to a given Internet host name or IP address */
+2 -1
View File
@@ -25,7 +25,8 @@
PHP_FUNCTION(gethostbyaddr);
PHP_FUNCTION(gethostbyname);
PHP_FUNCTION(gethostbynamel);
#if !defined(PHP_WIN32)||(HAVE_LIBBIND)
#if HAVE_RES_SEARCH && !(defined(__BEOS__)||defined(PHP_WIN32))
PHP_FUNCTION(checkdnsrr);
PHP_FUNCTION(getmxrr);
#endif
+5
View File
@@ -35,6 +35,8 @@
#define PHP_INFO_LICENSE (1<<6)
#define PHP_INFO_ALL 0xFFFFFFFF
#ifndef HAVE_CREDITS_DEFS
#define HAVE_CREDITS_DEFS
#define PHP_CREDITS_GROUP (1<<0)
#define PHP_CREDITS_GENERAL (1<<1)
@@ -43,8 +45,11 @@
#define PHP_CREDITS_DOCS (1<<4)
#define PHP_CREDITS_FULLPAGE (1<<5)
#define PHP_CREDITS_QA (1<<6)
#define PHP_CREDITS_WEB (1<<7)
#define PHP_CREDITS_ALL 0xFFFFFFFF
#endif /* HAVE_CREDITS_DEFS */
#define PHP_LOGO_GUID "PHPE9568F34-D428-11d2-A769-00AA001ACF42"
#define PHP_EGG_LOGO_GUID "PHPE9568F36-D428-11d2-A769-00AA001ACF42"
#define ZEND_LOGO_GUID "PHPE9568F35-D428-11d2-A769-00AA001ACF42"
+1
View File
@@ -157,6 +157,7 @@ PHPAPI void php_end_ob_buffer(zend_bool send_buffer, zend_bool just_flush)
orig_buffer->value.str.len = OG(active_ob_buffer).text_length;
orig_buffer->type = IS_STRING;
orig_buffer->refcount=2; /* don't let call_user_function() destroy our buffer */
orig_buffer->is_ref=1;
ALLOC_INIT_ZVAL(z_status);
Z_TYPE_P(z_status) = IS_LONG;
+17 -6
View File
@@ -1105,6 +1105,9 @@ cygwin* | mingw*)
with_gnu_ld=no
fi
;;
openbsd*)
with_gnu_ld=no
;;
esac
@@ -1402,10 +1405,21 @@ else
;;
openbsd*)
archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linkopts'
hardcode_libdir_flag_spec='-R$libdir'
hardcode_direct=yes
hardcode_shlibpath_var=no
case "$host_os" in
openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*)
archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linkopts'
hardcode_libdir_flag_spec='-R$libdir'
;;
*)
archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $linkopts'
hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
if [ "`/usr/bin/file /usr/lib/libc.so.* | grep ELF`" != "" ]; then
export_dynamic_flag_spec='${wl}-E'
fi
;;
esac
;;
os2*)
@@ -2019,13 +2033,10 @@ netbsd*)
openbsd*)
version_type=sunos
if test "$with_gnu_ld" = yes; then
need_lib_prefix=no
need_version=no
fi
library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix'
finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
shlibpath_var=LD_LIBRARY_PATH
deplibs_check_method='pass_all'
;;
os2*)
+1 -44
View File
@@ -97,7 +97,7 @@ SAPI_API void sapi_free_header(sapi_header_struct *sapi_header)
SAPI_API void sapi_handle_post(void *arg SLS_DC)
{
if (SG(request_info).post_entry) {
if (SG(request_info).post_entry && SG(request_info).content_type_dup) {
SG(request_info).post_entry->post_handler(SG(request_info).content_type_dup, arg SLS_CC);
if (SG(request_info).post_data) {
efree(SG(request_info).post_data);
@@ -538,49 +538,6 @@ SAPI_API void sapi_unregister_post_entry(sapi_post_entry *post_entry)
zend_hash_del(&known_post_content_types, post_entry->content_type, post_entry->content_type_len+1);
}
SAPI_API int sapi_add_post_entry(char *content_type
, void (*post_reader)(SLS_D)
, void (*post_handler)(char *content_type_dup
, void *arg SLS_DC)) {
sapi_post_entry *post_entry = (sapi_post_entry *)malloc(sizeof(sapi_post_entry));
if(!post_entry) return 0;
post_entry->content_type = strdup(content_type);
if(post_entry->content_type == NULL) return 0;
post_entry->content_type_len = strlen(content_type);
post_entry->post_reader = post_reader;
post_entry->post_handler = post_handler;
return zend_hash_add(&known_post_content_types
, post_entry->content_type
, post_entry->content_type_len+1
, (void *) post_entry
, sizeof(sapi_post_entry)
, NULL
);
}
SAPI_API void sapi_remove_post_entry(char *content_type) {
sapi_post_entry *post_entry;
zend_hash_find(&known_post_content_types
,content_type
,strlen(content_type)+1
,(void **)&post_entry
);
if(post_entry != NULL) {
zend_hash_del(&known_post_content_types
,content_type
,strlen(content_type)+1
);
free(post_entry->content_type);
free(post_entry);
} else {
php_error(E_WARNING,"unregister post handler failed in fdf");
}
}
SAPI_API int sapi_register_default_post_reader(void (*default_post_reader)(SLS_D))
{
-4
View File
@@ -146,10 +146,6 @@ SAPI_API void sapi_handle_post(void *arg SLS_DC);
SAPI_API int sapi_register_post_entries(sapi_post_entry *post_entry);
SAPI_API int sapi_register_post_entry(sapi_post_entry *post_entry);
SAPI_API int sapi_add_post_entry(char *content_type
, void (*post_reader)(SLS_D)
, void (*post_handler)(char *content_type_dup, void *arg SLS_DC));
SAPI_API void sapi_remove_post_entry(char *content_type);
SAPI_API void sapi_unregister_post_entry(sapi_post_entry *post_entry);
SAPI_API int sapi_register_default_post_reader(void (*default_post_reader)(SLS_D));
+1 -4
View File
@@ -870,10 +870,7 @@ int php_module_startup(sapi_module_struct *sf)
which is always an internal extension and to be initialized
ahead of all other internals
*/
if (php_startup_loaded_extensions() == FAILURE) {
php_printf("Unable to start loaded modules\n");
return FAILURE;
}
php_ini_delayed_modules_startup();
/* disable certain functions as requested by php.ini */
php_disable_functions();
+1
View File
@@ -157,6 +157,7 @@ PHPAPI void php_end_ob_buffer(zend_bool send_buffer, zend_bool just_flush)
orig_buffer->value.str.len = OG(active_ob_buffer).text_length;
orig_buffer->type = IS_STRING;
orig_buffer->refcount=2; /* don't let call_user_function() destroy our buffer */
orig_buffer->is_ref=1;
ALLOC_INIT_ZVAL(z_status);
Z_TYPE_P(z_status) = IS_LONG;
+39 -64
View File
@@ -1,18 +1,18 @@
/*
+----------------------------------------------------------------------+
| PHP version 4.0 |
| PHP version 4.0 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2001 The PHP Group |
| Copyright (c) 1997-2001 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. |
| 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. |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Author: Zeev Suraski <zeev@zend.com> |
| Author: Zeev Suraski <zeev@zend.com> |
+----------------------------------------------------------------------+
*/
@@ -24,15 +24,19 @@
#include "ext/standard/dl.h"
#include "zend_extensions.h"
/* True globals */
static HashTable configuration_hash;
PHPAPI char *php_ini_opened_path=NULL;
typedef struct _php_extension_lists {
zend_llist engine;
zend_llist functions;
} php_extension_lists;
/* True globals */
static HashTable configuration_hash;
PHPAPI char *php_ini_opened_path=NULL;
static php_extension_lists extension_lists;
static void php_ini_displayer_cb(zend_ini_entry *ini_entry, int type)
{
if (ini_entry->displayer) {
@@ -121,9 +125,8 @@ static void pvalue_config_destructor(zval *pvalue)
}
}
static void php_config_ini_parser_cb(zval *arg1, zval *arg2, int callback_type, void *arg_list)
static void php_config_ini_parser_cb(zval *arg1, zval *arg2, int callback_type, void *arg)
{
php_extension_lists *extension_lists =(php_extension_lists * )arg_list;
switch (callback_type) {
case ZEND_INI_PARSER_ENTRY: {
zval *entry;
@@ -132,12 +135,16 @@ static void php_config_ini_parser_cb(zval *arg1, zval *arg2, int callback_type,
break;
}
if (!strcasecmp(Z_STRVAL_P(arg1), "extension")) { /* load function module */
char *extension_name = estrndup(Z_STRVAL_P(arg2), Z_STRLEN_P(arg2));
zend_llist_add_element(&extension_lists->functions, &extension_name);
zval copy;
copy = *arg2;
zval_copy_ctor(&copy);
copy.refcount = 0;
zend_llist_add_element(&extension_lists.functions, &copy);
} else if (!strcasecmp(Z_STRVAL_P(arg1), ZEND_EXTENSION_TOKEN)) { /* load Zend extension */
char *extension_name = estrndup(Z_STRVAL_P(arg2), Z_STRLEN_P(arg2));
zend_llist_add_element(&extension_lists->engine, &extension_name);
zend_llist_add_element(&extension_lists.engine, &extension_name);
} else {
zend_hash_update(&configuration_hash, Z_STRVAL_P(arg1), Z_STRLEN_P(arg1)+1, arg2, sizeof(zval), (void **) &entry);
Z_STRVAL_P(entry) = zend_strndup(Z_STRVAL_P(entry), Z_STRLEN_P(entry));
@@ -150,35 +157,12 @@ static void php_config_ini_parser_cb(zval *arg1, zval *arg2, int callback_type,
}
static zend_llist *php_load_extension_list = NULL;
static void php_startup_loaded_extension_cb(void *arg){
zval *extension, ret;
MAKE_STD_ZVAL(extension);
ZVAL_STRING(extension,*((char **) arg),0);
php_dl(extension, MODULE_PERSISTENT, &ret);
FREE_ZVAL(extension);
}
int php_startup_loaded_extensions(void)
{
if(php_load_extension_list) {
zend_llist_apply(php_load_extension_list, php_startup_loaded_extension_cb);
}
return SUCCESS;
}
static void php_load_function_extension_cb(void *arg)
{
char *extension = estrdup(*((char **)arg));
zval *extension = (zval *) arg;
zval zval;
if(! php_load_extension_list) {
php_load_extension_list=(zend_llist*)malloc(sizeof(zend_llist));
zend_llist_init(php_load_extension_list, sizeof(char **), (void(*)(void *))free_estring, 1);
}
zend_llist_add_element(php_load_extension_list, &extension);
php_dl(extension, MODULE_PERSISTENT, &zval);
}
@@ -195,24 +179,14 @@ int php_init_config(char *php_ini_path_override)
char *open_basedir;
int free_ini_search_path=0;
zend_file_handle fh;
php_extension_lists extension_lists;
PLS_FETCH();
if (zend_hash_init(&configuration_hash, 0, NULL, (dtor_func_t) pvalue_config_destructor, 1)==FAILURE) {
return FAILURE;
}
/* some extensions may be configured by ini entries
if we would load them right away upon finding an extension
entry we would have to use the config cache directly as
the ini mechanism is not finaly initialized yet and we
would introduce a order dependency in the ini file.
to avoid this we temporarily store the extensions to
be loaded in linked lists and process theese immediately
*after* we have finished setting up the ini mechanism
*/
zend_llist_init(&extension_lists.engine , sizeof(char **), (void(*)(void *))free_estring, 1);
zend_llist_init(&extension_lists.functions, sizeof(char **), (void(*)(void *))free_estring, 1);
zend_llist_init(&extension_lists.engine, sizeof(zval), free_estring, 1);
zend_llist_init(&extension_lists.functions, sizeof(zval), ZVAL_DESTRUCTOR, 1);
safe_mode_state = PG(safe_mode);
open_basedir = PG(open_basedir);
@@ -268,15 +242,6 @@ int php_init_config(char *php_ini_path_override)
fh.filename = php_ini_opened_path;
zend_parse_ini_file(&fh, 1, php_config_ini_parser_cb, &extension_lists);
/* now that we are done with the configuration settings
we can load all requested extensions
*/
zend_llist_apply(&extension_lists.engine, php_load_zend_extension_cb);
zend_llist_apply(&extension_lists.functions, php_load_function_extension_cb);
zend_llist_destroy(&extension_lists.engine);
zend_llist_destroy(&extension_lists.functions);
if (php_ini_opened_path) {
zval tmp;
@@ -302,6 +267,16 @@ int php_shutdown_config(void)
}
void php_ini_delayed_modules_startup(void)
{
zend_llist_apply(&extension_lists.engine, php_load_zend_extension_cb);
zend_llist_apply(&extension_lists.functions, php_load_function_extension_cb);
zend_llist_destroy(&extension_lists.engine);
zend_llist_destroy(&extension_lists.functions);
}
zval *cfg_get_entry(char *name, uint name_length)
{
zval *tmp;
+1 -1
View File
@@ -23,7 +23,7 @@
int php_init_config(char *php_ini_path_override);
int php_shutdown_config(void);
int php_startup_loaded_extensions(void);
void php_ini_delayed_modules_startup(void);
zval *cfg_get_entry(char *name, uint name_length);
#define PHP_INI_USER ZEND_INI_USER
-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.5-dev"
#define PHP_VERSION "4.0.5RC2"
+46 -37
View File
@@ -25,12 +25,16 @@ require_once "Cache/Error.php";
*
* TODO: Simple usage example goes here.
*
* WARNING: No File/DB-Table-Row locking is implemented yet,
* it's possible, that you get corrupted data-entries under
* bad circumstances (especially with the file container)
*
* @author Ulf Wendel <ulf.wendel@phpdoc.de>
* @version $Id$
* @package Cache
* @access public
* @access public
*/
class Cache {
class Cache extends PEAR {
/**
* Disables the caching.
@@ -45,8 +49,8 @@ class Cache {
/**
* Garbage collection: probability in seconds
*
* If set to a value above 0 a garbage collection will
* flush all cache entries older than the specified number
* If set to a value above 0 a garbage collection will
* flush all cache entries older than the specified number
* of seconds.
*
* @var integer
@@ -68,35 +72,40 @@ class Cache {
/**
* Storage container object.
*
*
* @var object Cache_Container
*/
*/
var $container;
//
// public methods
//
/**
/**
*
* @param string Name of storage container class
* @param array Array with storage class dependend config options
*/
function Cache($storage_driver, $storage_options = "")
{
$this->PEAR();
$storage_driver = strtolower($storage_driver);
$storage_class = 'Cache_Container_' . $storage_driver;
$storage_classfile = 'Cache/Container/' . $storage_driver . '.php';
include_once $storage_classfile;
$this->container = new $storage_class($storage_options);
}
//deconstructor
function _Cache()
{
$this->garbageCollection();
}
/**
* Returns the requested dataset it if exists and is not expired
*
*
* @param string dataset ID
* @param string cache group
* @return mixed cached data or NULL on failure
@@ -105,16 +114,16 @@ class Cache {
function get($id, $group = "default") {
if ($this->no_cache)
return "";
if ($this->isCached($id, $group) && !$this->isExpired($id, $group))
return $this->load($id, $group);
return NULL;
return NULL;
} // end func get
/**
* Stores the given data in the cache.
*
*
* @param string dataset ID used as cache identifier
* @param mixed data to cache
* @param integer lifetime of the cached data in seconds - 0 for endless
@@ -125,13 +134,13 @@ class Cache {
function save($id, $data, $expires = 0, $group = "default") {
if ($this->no_cache)
return true;
return $this->container->save($id, $data, $expires, $group, "");
} // end func save
/**
* Stores a dataset without additional userdefined data.
*
*
* @param string dataset ID
* @param mixed data to store
* @param string additional userdefined data
@@ -151,16 +160,16 @@ class Cache {
/**
* Loads the given ID from the cache.
*
*
* @param string dataset ID
* @param string cache group
* @return mixed cached data or NULL on failure
* @return mixed cached data or NULL on failure
* @access public
*/
function load($id, $group = "default") {
if ($this->no_cache)
return "";
return $this->container->load($id, $group);
} // end func load
@@ -176,13 +185,13 @@ class Cache {
function getUserdata($id, $group = "default") {
if ($this->no_cache)
return "";
return $this->container->getUserdata($id, $group);
} // end func getUserdata
/**
* Removes the specified dataset from the cache.
*
*
* @param string dataset ID
* @param string cache group
* @return boolean
@@ -191,28 +200,28 @@ class Cache {
function delete($id, $group = "default") {
if ($this->no_cache)
return true;
return $this->container->delete($id, $group);
} // end func delete
/**
* Flushes the cache - removes all data from it
*
*
* @param string cache group, if empty all groups will be flashed
* @return integer number of removed datasets
*/
function flush($group = "") {
if ($this->no_cache)
return true;
return $this->container->flush($group);
} // end func flush
/**
* Checks if a dataset exists.
*
*
* Note: this does not say that the cached data is not expired!
*
*
* @param string dataset ID
* @param string cache group
* @return boolean
@@ -221,20 +230,20 @@ class Cache {
function isCached($id, $group = "default") {
if ($this->no_cache)
return false;
return $this->container->isCached($id, $group);
} // end func isCached
/**
* Checks if a dataset is expired
*
*
* @param string dataset ID
* @param string cache group
* @param integer maximum age for the cached data in seconds - 0 for endless
* If the cached data is older but the given lifetime it will
* be removed from the cache. You don't have to provide this
* argument if you call isExpired(). Every dataset knows
* it's expire date and will be removed automatically. Use
* be removed from the cache. You don't have to provide this
* argument if you call isExpired(). Every dataset knows
* it's expire date and will be removed automatically. Use
* this only if you know what you're doing...
* @return boolean
* @access public
@@ -242,13 +251,13 @@ class Cache {
function isExpired($id, $group = "default", $max_age = 0) {
if ($this->no_cache)
return true;
return $this->container->isExpired($id, $group, $max_age);
} // end func isExpired
/**
* Generates a "unique" ID for the given value
*
*
* This is a quick but dirty hack to get a "unique" ID for a any kind of variable.
* ID clashes might occur from time to time although they are extreme unlikely!
*
@@ -263,24 +272,24 @@ class Cache {
/**
* Calls the garbage collector of the storage object with a certain probability
*
*
* @param boolean Force a garbage collection run?
* @see $gc_probability, $gc_time
*/
function garbageCollection($force = false) {
static $last_run = 0;
if ($this->no_cache)
return;
srand((double) microtime() * 1000000);
// time and probability based
if (($force) || ($last_run && $last_run < time() + $this->gc_time) || (rand(1, 100) < $this->gc_probability)) {
$this->container->garbageCollection();
$last_run = time();
}
} // end func garbageCollection
} // end class cache
} // end class cache
?>
+2 -2
View File
@@ -2,8 +2,8 @@ dnl ## $Id$ -*- sh -*-
RESULT=no
AC_MSG_CHECKING(for Zeus ISAPI support)
AC_ARG_WITH(zeus,
[ --with-zeus=DIR Build PHP as an ISAPI module for use with Zeus.],
AC_ARG_WITH(isapi,
[ --with-isapi=DIR Build PHP as an ISAPI module for use with Zeus.],
[
if test "$withval" = "yes"; then
ZEUSPATH=/usr/local/zeus # the default
-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