Compare commits

...
71 Commits
Author SHA1 Message Date
SVN Migration 67f7a9fe85 This commit was manufactured by cvs2svn to create tag 'php_4_0_5'. 2001-04-30 13:37:23 +00:00
Zeev Suraski da252cabf0 Go with 4.0.5 2001-04-30 13:37:22 +00:00
Sterling Hughes 856356afa2 MFH 2001-04-26 15:07:57 +00:00
Zeev Suraski 0c226da31e RC8 2001-04-26 14:45:10 +00:00
Andi Gutmans e2b1d7c2a0 - Due to popular demand merge the foreach() crash fix. 2001-04-24 15:58:58 +00:00
Chuck Hagenbuch 2611b98a91 MFH: fix crash bug in imap_sort (#9908). 2001-04-24 14:17:41 +00:00
Andrei Zmievski 5b9407dbd6 MFH. 2001-04-24 13:47:32 +00:00
Sascha Schumann df6bb0f431 MFH: Accomodate Apache HTTPD 2.0 API change 2001-04-24 12:58:53 +00:00
Andi Gutmans 3deb77848a - MFH. The only real change here is in ts_free_thread() by nuking a race
- condition. The rest are ws fixes which are a result of copying this from
- the head.
2001-04-24 09:26:43 +00:00
foobar 8a19f55900 MFH 2001-04-23 06:36:51 +00:00
Sascha Schumann b318045e53 Merge thttpd-2.21-related changes into 4.0.5 branch 2001-04-22 14:33:09 +00:00
Harald Radi d818b747aa added ext/com/com.h to PHP_4_0_5 branch 2001-04-22 12:14:44 +00:00
Harald Radi 4f06c73aae merged [com] section from main branch 2001-04-22 11:58:49 +00:00
Harald Radi 1a967de79e merging changes from main branch to fix a memory leak
#sorry for being late, but i was on holiday
2001-04-22 11:57:21 +00:00
Andrei Zmievski 118ae69499 This actually made it in. 2001-04-20 16:55:14 +00:00
Derick Rethans 140720a22e - MFH (bug #8839 again) 2001-04-18 22:15:39 +00:00
Derick Rethans 833813478e - MFH (Bug #8839) 2001-04-18 09:48:38 +00:00
Alexander Feldman 750f87ccce Merged the patch of the buffering patch as it fixes a pretty major bug. 2001-04-17 21:54:29 +00:00
Thies C. Arntzen 86c5460229 @- Fixed crash in pathinfo() 2001-04-13 18:23:07 +00:00
Thies C. Arntzen 8fcc3a3140 MFH - never initialize OCI in OCI_THREADED mode 2001-04-11 15:48:06 +00:00
Jason Greene 70376b4b7c MFH, I have tested this thoroughly. 2001-04-10 22:01:57 +00:00
foobar 4e845e50b0 MFH 2001-04-09 15:47:31 +00:00
foobar 2166451472 Support also old arg_separator directive. 2001-04-06 15:18:52 +00:00
foobar 0cae755c9b MFH 2001-04-06 02:09:43 +00:00
Andi Gutmans d73efa9300 Remove README.BCMATH 2001-04-05 13:22:01 +00:00
Thies C. Arntzen daf8ff05d5 MFH - make postgresql compiel against 6.5.x 2001-04-04 21:51:58 +00:00
Andi Gutmans ee759fdf89 - MFH (Very serious and it looks like the arg_separator will force another
RC)
2001-04-04 16:26:02 +00:00
Andi Gutmans eb08e83c37 - RC6 2001-04-02 21:09:21 +00:00
Anil Madhavapeddy 502ca85b9c MFH, rev 1.77 2001-04-02 16:52:13 +00:00
Anil Madhavapeddy af08d51f24 MFH, rev 1.53 2001-04-02 16:48:29 +00:00
Andrei Zmievski c1af6dec32 MFH 2001-04-02 16:12:06 +00:00
foobar 1793776609 MFH 2001-04-02 09:07:22 +00:00
Zeev Suraski 2257654b4f YARC 2001-04-01 16:30:22 +00:00
Sebastian Bergmann e51346cec2 Fixed some glitches in NEWS. (Yes, you may call me pedantic :-) 2001-04-01 14:33:29 +00:00
Zeev Suraski cf52476866 MFH - header handling with output buffering 2001-03-31 22:54:07 +00:00
Zeev Suraski 95be023542 Fix pgsql_set_Default_link() 2001-03-30 15:04:18 +00:00
Zeev Suraski e803bda938 Revert all PostgreSQL patches that were in the branch... 2001-03-30 14:57:02 +00:00
Romolo Manfredini d7c3cd60be pg_close was not closing the connection, making impossible to reopen it. Pls insert in 4.0.5 2001-03-30 07:36:21 +00:00
Zeev Suraski 00ff97638e Yes, RC4 is here too. RC3 had a broken ZTS build. 2001-03-28 23:23:06 +00:00
foobar e4c41cdeb2 MFH 2001-03-28 23:19:51 +00:00
Zeev Suraski ee32b0b4a7 Fix ZTS build 2001-03-28 22:51:34 +00:00
Zeev Suraski 0613e48b8e RC3 2001-03-28 13:36:52 +00:00
Romolo Manfredini 8522d30081 Safe mode check on target introduced in function move_uploaded_file. 2001-03-28 09:05:50 +00:00
Romolo Manfredini 2b82b1c47a Safe mode check for target introduced in function copy. Pls insert in 4_0_5 2001-03-28 09:01:27 +00:00
Derick Rethans daf68d8d91 - MFH (Fix for bug 10002) 2001-03-27 17:24:01 +00:00
Ben Mansell 8f710d827e Changed header handling; before, we were somehow losing
Content-Type: text/html
2001-03-27 16:29:45 +00:00
Thies C. Arntzen 74ffa31da1 MFH 2001-03-27 15:04:26 +00:00
foobar d4b7d08019 MFH 2001-03-27 14:03:03 +00:00
Romolo Manfredini e7875fc20d pg_close was closing connection twice, pls insert in 4_0_5 2001-03-27 10:22:32 +00:00
foobar f446cc2e3f MFH 2001-03-22 13:20:35 +00:00
André Langhorst 715b32f618 synchronizing with CVS 2001-03-21 15:35:07 +00:00
André Langhorst 5fb6dda2fc 1) fixed tests on *both* win32+linux
2) made tests more sophisticated (checking against compiled in modules)
3) minor changes
4) win32 improvements
2001-03-21 06:17:13 +00:00
SVN Migration f00c18ad23 This commit was manufactured by cvs2svn to create branch 'PHP_4_0_5'. 2001-03-20 22:35:31 +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
77 changed files with 1819 additions and 1463 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)
+53 -45
View File
@@ -1,7 +1,13 @@
PHP 4.0 NEWS
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
?? ??? 200?, Version 4.0.5
30 Apr 2001, Version 4.0.5
- IMPORTANT: removed /F modifier handling from preg_replace(). Instead
one should use new preg_replace_callback() function. (Andrei)
- Added new php.ini directive: arg_separator.input which is used to tell
PHP which characters are considered as argument separators in URLs.
Renamed php.ini directive: arg_separator -> arg_separator.output (Jani)
- Added FastCGI SAPI module. (Ben Mansell)
- 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
@@ -12,30 +18,32 @@ PHP 4.0 NEWS
and vice versa. (alex@zend.com)
- Fixed argument checking for call_user_func* functions and allowed
specifying array($obj, 'method') syntax for call_user_func_array. (Andrei)
- Fixed parent::method() to also work with runtime bindings (Zeev, Zend Engine)
- Fixed parent::method() to also work with runtime bindings.
(Zeev, Zend Engine)
- Implemented high-performance zlib-based output compression - see
zlib.output_compression INI directive (Zeev)
- Improved ob_gzhandler() to support chunked output buffering - it's recommended
to use it with 4KB chunks (Zeev)
- Fixed chunked output buffering (Zeev)
zlib.output_compression INI directive. (Zeev)
- Improved ob_gzhandler() to support chunked output buffering - it's
recommended to use it with 4KB chunks. (Zeev)
- Fixed chunked output buffering. (Zeev)
- Forced call_user_method() and call_user_method_array() to take the
object argument by reference. (Andrei)
- Fixed binding of ROWIDs in OCI8. (Thies)
- Added PEAR/Cache as a generic Caching System. (Sebastian, PEAR/Cache)
- IMAP quota support (imap_set_quota, imap_get_quota) enabled/added via
c-client2000 (kalowsky)
- Added IMAP quota support (imap_set_quota, imap_get_quota), enabled/added via
c-client2000. (kalowsky)
- Upgraded PCRE to version 3.4. (Andrei)
- Added array_search which works similar to in_array but returns
the key instead of a boolean. (jason@php.net)
- Fixed pgsql transaction support (Stig, PEAR/DB)
- Fixed pgsql transaction support. (Stig, PEAR/DB)
- Added new object VARIANT() to encapsulate values for use with
the COM and DOTNET module. Therefore it is now possible to pass
values by reference, convert php values to extended variant types (currency,
date, idispatch, iunknown, ...) and define the codepage that should
be used for unicode - conversion.
- Improved overall speed of IRCG, added URL handling to message scanner (Sascha)
- Improved overall speed of IRCG, added URL handling to message scanner.
(Sascha)
- Fixed some modules to allow using output-buffering. (Thies)
- Added the chroot() function (Derick)
- Added the chroot() function. (Derick)
- PostgreSQL now does a rollback at the end of a request on every
persistent connection. This is done by doing an "empty" transaction
on the connection. This was advised by someone from the PostgreSQL
@@ -43,8 +51,8 @@ PHP 4.0 NEWS
- Fixed PostgeSQL pg_connect() bug. We would sometimes close the default
link by accident. (Patch by: aja@nlgroup.ca)
- Improved OCI8 dead-session detection. (Patch by: George Schlossnagle)
- Fixed get_meta_tags() multiline bug #4556 (Sean)
- Prefer random() over *rand48() (JimJag)
- Fixed get_meta_tags() multiline bug #4556. (Sean)
- Prefer random() over *rand48(). (JimJag)
- Sped up WDDX serialization 2x. (Andrei)
- Added a new parameter to mail() which appends aditional command line
parameters to the mail program. (Derick)
@@ -54,7 +62,7 @@ PHP 4.0 NEWS
- Static methods can now be called via call_user_method_* functions, e.g.
call_user_method('method', 'class'), and also array('class', 'method')
constructs (for array_walk(), for example). (Andrei, Zend Engine)
- microtime under windows now returns accurate values (James)
- microtime() under Windows now returns accurate values. (James)
- Added PREG_SPLIT_DELIM_CAPTURE flag to preg_split() that allows for Perl-like
functionality of capturing parenthesized delimiter expression. (Andrei)
- Fixed strip_tags() to not strip a lone > character. (Rasmus)
@@ -68,12 +76,12 @@ PHP 4.0 NEWS
- Major change of the php pdf api. It could break some functions though
backwards compatibility was tried to maintain. Adding some still
missing functions as well. (Uwe)
- Added mnoGoSearch extension - http://search.mnogo.ru (Sergey K)
- Allow url encoding in DB usernames and passwords (Stig, PEAR)
- Added raiseError and setErrorHandling methods to PEAR class (Stig, PEAR)
- Added mnoGoSearch extension - http://search.mnogo.ru. (Sergey K)
- Allow URL encoding in DB usernames and passwords. (Stig, PEAR)
- Added raiseError and setErrorHandling methods to PEAR class. (Stig, PEAR)
- Added support for converting images from JPG/PNG on the fly with the GD
extension, which is usefull for creating dynamic WAP-sites (Derick)
- Updated ext/mysql/libmysql to version 3.23.32; bug fixes (tim@mysql.com)
extension, which is usefull for creating dynamic WAP-sites. (Derick)
- Updated ext/mysql/libmysql to version 3.23.32; bug fixes. (tim@mysql.com)
- Fixed possible crash in all (non-pcre) regex functions. (Thies)
- Improved str_replace() to accept an array for any parameter - similar
to preg_replace(). (Andrei)
@@ -81,32 +89,32 @@ PHP 4.0 NEWS
used. (Andrei)
- Added EXTR_PREFIX_INVALID flag to extract() to automatically prefix
string keys that do not constitute valid variable names. (Andrei)
- BeOS patch from svanegmond@bang.dhs.org modified somewhat by Rasmus
- BeOS patch from svanegmond@bang.dhs.org, modified somewhat by Rasmus.
- Fixed the Apache module to overwrite PATH_TRANSLATED with SCRIPT_FILENAME,
only if PATH_TRANSLATED is not previously set (Zeev)
- Fixed crash bug in highlight_string() (Rasmus)
- Added URL support for getimagesize() function (Jani)
- Added xslt_set_scheme_handler() function (carmelo@akooe.com)
- Added the pg_lolseek and pg_lotell functions (Derick)
- Fixed wrong breaking with the wordwrap function (Derick)
only if PATH_TRANSLATED is not previously set. (Zeev)
- Fixed crash bug in highlight_string(). (Rasmus)
- Added URL support for getimagesize() function. (Jani)
- Added xslt_set_scheme_handler() function. (carmelo@akooe.com)
- Added the pg_lolseek and pg_lotell functions. (Derick)
- Fixed wrong breaking with the wordwrap function. (Derick)
- Fixed 'O' and 'r' flags of date() to have correct sign for timezone
offset. (Andrei)
- Changed 'Z' flag to date() to always return timezone offset with
negative sign if it's west of UTC. (Andrei)
- Added the HTML_Processor class which provides common functions for processing HTML.
(Sterling)
- Added the HTML_Processor class which provides common functions for
processing HTML. (Sterling)
- Added localeconv() and strcoll() functions for localization. (Sean)
- Added the xslt_set_base function. (Sterling)
- Support Zeus 3.3.8
- Added odbc_error() and odbc_errormsg() functions (Stig)
- vpopmail extension updated to working alfa. give it a try but keep in
mind that it is not ready for production environments (Boian Bonev)
- New extension for vpopmail - http://www.inter7.com/vpopmail (David Croft)
- Added sybase_get_last_message() to the Sybase CT module (Jan Fedak)
- Added support for Zeus 3.3.8.
- Added odbc_error() and odbc_errormsg() functions. (Stig)
- New extension for vpopmail - http://www.inter7.com/vpopmail,
give it a try, but keep in mind that it is not ready for production
environments. (David Croft, Boian Bonev)
- Added sybase_get_last_message() to the Sybase CT module. (Jan Fedak)
- Made ldap_list(), ldap_read() and ldap_search() do parallel search when
first parameter is an array of link identifiers (Stig Venaas)
first parameter is an array of link identifiers. (Stig Venaas)
- Made fopen() of HTTP URL follow redirects, $http_response_header will
contain all headers with empty string as delimiter (Stig Venaas)
contain all headers with empty string as delimiter. (Stig Venaas)
- Added Console_Getopt class for parsing command-line args. (Andrei, PEAR)
- Added an experimental version of the ZZipLib extension which provides the
ability to read zip files. (Sterling)
@@ -115,22 +123,22 @@ PHP 4.0 NEWS
right UID and you script won't be able to access that copy. (Thies)
- Changed extract() to check that prefixed name is a valid one. (Andrei)
- Changed extract() to return the number of variables extracted. (Andrei)
- Added ldap_rename() function (Stig Venaas)
- Made ldap_set_option() support controls (Stig Venaas)
- Added ldap_rename() function. (Stig Venaas)
- Made ldap_set_option() support controls. (Stig Venaas)
- Changed ldap_search() and added functions ldap_parse_result(),
ldap_first_reference(), ldap_next_reference() and ldap_parse_reference()
to cope with LDAPv3 stuff like referrals and references. (Stig Venaas)
- Fixed date('r') overflow
- Fixed date('r') overflow.
- Made the php.ini path reported in phpinfo() always point to the absolute
path that was opened (Zeev)
- Made the INI mechanism thread safe (Zeev, Zend engine)
path that was opened. (Zeev)
- Made the INI mechanism thread safe. (Zeev, Zend Engine)
- Changed setlocale() to use LC_* constants. (Jani)
- ctype functions now follow the extension naming conventions (Hartmut)
- Added iconv() function (using libc or libiconv) (Stig)
- Added ODBC_TYPE constant (Stig)
- ctype functions now follow the extension naming conventions. (Hartmut)
- Added iconv() function (using libc or libiconv). (Stig)
- Added ODBC_TYPE constant. (Stig)
- Added the call_user_method_array function which allows you to call a method
with an arbitrary number of parameters. (Sterling)
- ext/odbc: IBM DB2 patch by Walter Franzini <walter@sys-net.it>
- ext/odbc: IBM DB2 patch by Walter Franzini. <walter@sys-net.it>
- Added extension for the cracklib library. (Alexander Feldman)
19 Dec. 2000, Version 4.0.4
-17
View File
@@ -1,17 +0,0 @@
How to install PHP with the BCMath arbitrary precision math library?
--------------------------------------------------------------------
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
+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'
+23 -26
View File
@@ -153,7 +153,7 @@ TSRM_API void tsrm_shutdown(void)
#if defined(GNUPTH)
pth_kill();
#elif defined(PTHREADS)
pthread_key_delete( tls_key );
pthread_key_delete( tls_key );
#endif
}
@@ -225,8 +225,8 @@ static void allocate_new_resource(tsrm_tls_entry **thread_resources_ptr, THREAD_
(*thread_resources_ptr)->next = NULL;
#if defined(PTHREADS)
/* Set thread local storage to this new thread resources structure */
pthread_setspecific( tls_key, (void *)*thread_resources_ptr );
/* Set thread local storage to this new thread resources structure */
pthread_setspecific( tls_key, (void *)*thread_resources_ptr );
#endif
if (tsrm_new_thread_begin_handler) {
@@ -254,23 +254,23 @@ TSRM_API void *ts_resource_ex(ts_rsrc_id id, THREAD_T *th_id)
int hash_value;
tsrm_tls_entry *thread_resources;
if( !th_id ) {
if( !th_id ) {
#if defined(PTHREADS)
/* Fast path for looking up the resources for the current
* thread. Its used by just about every call to
* ts_resource_ex(). This avoids the need for a mutex lock
* and our hashtable lookup.
*/
thread_resources = pthread_getspecific( tls_key );
if( thread_resources ) {
TSRM_ERROR(TSRM_ERROR_LEVEL_INFO, "Fetching resource id %d for current thread %d", id, (long) thread_resources->thread_id );
return ts_resource_read( thread_resources, id );
}
/* Fast path for looking up the resources for the current
* thread. Its used by just about every call to
* ts_resource_ex(). This avoids the need for a mutex lock
* and our hashtable lookup.
*/
thread_resources = pthread_getspecific( tls_key );
if( thread_resources ) {
TSRM_ERROR(TSRM_ERROR_LEVEL_INFO, "Fetching resource id %d for current thread %d", id, (long) thread_resources->thread_id );
return ts_resource_read( thread_resources, id );
}
#endif
thread_id = tsrm_thread_id();
} else {
thread_id = *th_id;
}
}
TSRM_ERROR(TSRM_ERROR_LEVEL_INFO, "Fetching resource id %d for thread %ld", id, (long) thread_id);
tsrm_mutex_lock(tsmm_mutex);
@@ -299,7 +299,7 @@ TSRM_API void *ts_resource_ex(ts_rsrc_id id, THREAD_T *th_id)
} while (thread_resources);
}
tsrm_mutex_unlock(tsmm_mutex);
return ts_resource_read( thread_resources, id );
return ts_resource_read( thread_resources, id );
}
@@ -316,7 +316,7 @@ void *ts_resource_read( tsrm_tls_entry *thread_resources, ts_rsrc_id id )
TSRM_ERROR(TSRM_ERROR_LEVEL_INFO, "Successfully fetched resource id %d for thread id %ld - %x", id, (long) thread_resources->thread_id, (long) resource);
} else {
TSRM_ERROR(TSRM_ERROR_LEVEL_ERROR, "Resource id %d is out of range (%d..%d)", id, TSRM_SHUFFLE_RSRC_ID(0), TSRM_SHUFFLE_RSRC_ID(thread_resources->count-1));
abort();
abort();
}
return resource;
}
@@ -326,7 +326,7 @@ void *ts_resource_read( tsrm_tls_entry *thread_resources, ts_rsrc_id id )
void ts_free_thread(void)
{
tsrm_tls_entry *thread_resources;
int i;
int i;
THREAD_T thread_id = tsrm_thread_id();
int hash_value;
tsrm_tls_entry *last=NULL;
@@ -337,26 +337,23 @@ void ts_free_thread(void)
while (thread_resources) {
if (thread_resources->thread_id == thread_id) {
tsrm_mutex_unlock(tsmm_mutex);
for (i=0; i<thread_resources->count; i++) {
if (resource_types_table[i].dtor) {
resource_types_table[i].dtor(thread_resources->storage[i]);
}
}
}
}
for (i=0; i<thread_resources->count; i++) {
free(thread_resources->storage[i]);
}
tsrm_mutex_lock(tsmm_mutex);
free(thread_resources->storage);
if (last) {
last->next = thread_resources->next;
} else {
tsrm_tls_table[hash_value]=NULL;
tsrm_tls_table[hash_value] = thread_resources->next;
}
#if defined(PTHREADS)
pthread_setspecific( tls_key, 0 );
#endif
pthread_setspecific(tls_key, 0);
#endif
free(thread_resources);
break;
}
+2 -2
View File
@@ -869,9 +869,9 @@ static int copy_function_name(zend_function *func, int num_args, va_list args, z
}
if (func->type == ZEND_INTERNAL_FUNCTION) {
add_next_index_stringl(internal_ar, hash_key->arKey, hash_key->nKeyLength, 1);
add_next_index_stringl(internal_ar, hash_key->arKey, hash_key->nKeyLength-1, 1);
} else if (func->type == ZEND_USER_FUNCTION) {
add_next_index_stringl(user_ar, hash_key->arKey, hash_key->nKeyLength, 1);
add_next_index_stringl(user_ar, hash_key->arKey, hash_key->nKeyLength-1, 1);
}
return 0;
+7 -3
View File
@@ -2141,9 +2141,13 @@ send_by_ref:
if (opline->extended_value) {
array_ptr_ptr = get_zval_ptr_ptr(&opline->op1, Ts, BP_VAR_R);
SEPARATE_ZVAL_IF_NOT_REF(array_ptr_ptr);
array_ptr = *array_ptr_ptr;
array_ptr->refcount++;
if (array_ptr_ptr == NULL) {
MAKE_STD_ZVAL(array_ptr);
} else {
SEPARATE_ZVAL_IF_NOT_REF(array_ptr_ptr);
array_ptr = *array_ptr_ptr;
array_ptr->refcount++;
}
} else {
array_ptr = get_zval_ptr(&opline->op1, Ts, &EG(free_op1), BP_VAR_R);
if (EG(free_op1)) { /* IS_TMP_VAR */
+16 -7
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.5, nodefine)
PHP_VERSION=$VERSION
echo "/* automatically generated by configure */" > php_version.h.new
@@ -107,7 +107,8 @@ case "$host_alias" in
*bsdi*)
BSD_MAKEFILE=yes;;
*beos*)
LIBS="$LIBS -lbe -lroot"
beos_threads=1
LIBS="$LIBS -lbe -lroot";;
esac
AM_PROG_CC_STDC
@@ -249,11 +250,13 @@ dnl The sin may be in a library which need not be specifed
dnl as well as res_search resides in libsocket
AC_CHECK_LIB(m, sin)
AC_CHECK_LIB(bind, inet_aton, [
AC_ADD_LIBRARY(bind)
AC_DEFINE(HAVE_LIBBIND,1,[Whether you have bind]) ], [
AC_CHECK_LIB(resolv, inet_aton)
])
dnl Only include libbind if inet_aton is not found in
dnl libresolv.
AC_CHECK_LIB(resolv, inet_aton, [], [
AC_CHECK_LIB(bind, inet_aton, [], [
AC_CHECK_LIB(bind, __inet_aton)
])
])
dnl The res_search may be in libsocket as well, and if it is
dnl make sure to check for dn_skipname in libresolv, or if res_search
@@ -389,6 +392,7 @@ putenv \
random \
rand_r \
regcomp \
res_search \
setitimer \
setlocale \
localeconv \
@@ -644,6 +648,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)
+2 -2
View File
@@ -19,9 +19,9 @@ AC_ARG_WITH(aspell,
fi
AC_DEFINE(HAVE_ASPELL,1,[Whether you have aspell])
AC_MSG_RESULT(yes)
PHP_EXTENSION(aspell)
PHP_EXTENSION(aspell)
else
AC_MSG_ERROR(no)
AC_MSG_RESULT(no)
fi
],[
AC_MSG_RESULT(no)
+222 -110
View File
@@ -50,27 +50,17 @@
#define _WIN32_DCOM
#ifdef CP_THREAD_ACP
#define PHP_COM_CODEPAGE CP_THREAD_ACP
#else
#define PHP_COM_CODEPAGE CP_ACP
#endif
#include <iostream.h>
#include <math.h>
#include "php.h"
#include "php_ini.h"
#include "com.h"
#include "conversion.h"
#include "unknwn.h"
BEGIN_EXTERN_C()
zend_class_entry com_class_entry;
END_EXTERN_C()
PHP_FUNCTION(COM_load);
PHP_FUNCTION(COM_invoke);
PHP_FUNCTION(com_propget);
@@ -101,27 +91,94 @@ static PHP_MINFO_FUNCTION(COM)
static int php_COM_load_typelib(char *typelib_name, int mode);
PHPAPI HRESULT php_COM_invoke(i_dispatch *obj, DISPID dispIdMember, WORD wFlags, DISPPARAMS FAR* pDispParams, VARIANT FAR* pVarResult)
{
if(obj->typelib) {
return obj->i.dispatch->lpVtbl->Invoke(obj->i.dispatch, dispIdMember, &IID_NULL, LOCALE_SYSTEM_DEFAULT,
wFlags, pDispParams, pVarResult, NULL, NULL);
} else {
return obj->i.typeinfo->lpVtbl->Invoke(obj->i.typeinfo, obj->i.dispatch, dispIdMember,
wFlags, pDispParams, pVarResult, NULL, NULL);
}
}
PHPAPI HRESULT php_COM_get_ids_of_names(i_dispatch *obj, OLECHAR FAR* FAR* rgszNames, DISPID FAR* rgDispId)
{
if(obj->typelib) {
return obj->i.dispatch->lpVtbl->GetIDsOfNames(obj->i.dispatch, &IID_NULL, rgszNames, 1, LOCALE_SYSTEM_DEFAULT, rgDispId);
} else {
return obj->i.typeinfo->lpVtbl->GetIDsOfNames(obj->i.typeinfo, rgszNames, 1, rgDispId);
}
}
PHPAPI HRESULT php_COM_release(i_dispatch *obj)
{
HRESULT hr;
hr = obj->i.dispatch->lpVtbl->Release(obj->i.dispatch);
obj->i.dispatch = NULL;
obj->i.typeinfo = NULL;
obj->typelib = FALSE;
return hr;
}
PHPAPI HRESULT php_COM_set(i_dispatch *obj, IDispatch FAR* pDisp, int cleanup)
{
HRESULT hr;
obj->i.dispatch = pDisp;
obj->typelib = !FAILED(obj->i.dispatch->lpVtbl->GetTypeInfo(obj->i.dispatch, 0, LANG_NEUTRAL, &obj->i.typeinfo));
if(cleanup) {
pDisp = NULL;
} else {
hr = obj->i.dispatch->lpVtbl->AddRef(obj->i.dispatch);
}
return hr;
}
PHPAPI HRESULT php_COM_clone(i_dispatch *obj, i_dispatch *clone, int cleanup)
{
HRESULT hr;
obj->typelib = clone->typelib;
obj->i.dispatch = clone->i.dispatch;
obj->i.typeinfo = clone->i.typeinfo;
if(cleanup) {
obj->i.dispatch = NULL;
obj->i.typeinfo = NULL;
obj->typelib = FALSE;
} else {
hr = obj->i.dispatch->lpVtbl->AddRef(obj->i.dispatch);
}
return hr;
}
PHPAPI char *php_COM_error_message(HRESULT hr)
{
char *pMsgBuf;
void *pMsgBuf;
if (!FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, NULL,
hr, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPTSTR) &pMsgBuf, 0, NULL)) {
char error_string[] = "No description available";
pMsgBuf = (char *) LocalAlloc(LMEM_FIXED, sizeof(error_string));
pMsgBuf = LocalAlloc(LMEM_FIXED, sizeof(error_string));
memcpy(pMsgBuf, error_string, sizeof(error_string));
}
return pMsgBuf;
}
static char *php_string_from_clsid(const CLSID clsid)
static char *php_string_from_clsid(const CLSID *clsid)
{
LPOLESTR ole_clsid;
char *clsid_str;
StringFromCLSID(&clsid, &ole_clsid);
StringFromCLSID(clsid, &ole_clsid);
clsid_str = php_OLECHAR_to_char(ole_clsid, NULL, 0, codepage);
LocalFree(ole_clsid);
@@ -130,9 +187,9 @@ static char *php_string_from_clsid(const CLSID clsid)
static void php_idispatch_destructor(zend_rsrc_list_entry *rsrc)
{
IDispatch *i_dispatch = (IDispatch *)rsrc->ptr;
i_dispatch->lpVtbl->Release(i_dispatch);
i_dispatch *obj = (i_dispatch *)rsrc->ptr;
php_COM_release(obj);
efree(obj);
}
static PHP_INI_MH(OnTypelibFileChange)
@@ -199,12 +256,12 @@ static PHP_INI_MH(OnTypelibFileChange)
PHP_INI_BEGIN()
PHP_INI_ENTRY1_EX("allow_dcom", "0", PHP_INI_SYSTEM, NULL, NULL, php_ini_boolean_displayer_cb)
PHP_INI_ENTRY1("typelib_file", NULL, PHP_INI_SYSTEM, OnTypelibFileChange, NULL)
PHP_INI_ENTRY_EX("com.allow_dcom", "0", PHP_INI_SYSTEM, NULL, php_ini_boolean_displayer_cb)
PHP_INI_ENTRY("com.typelib_file", "", PHP_INI_SYSTEM, OnTypelibFileChange)
PHP_INI_END()
/* {{{ proto int com_load(string module_name)
/* {{{ proto int com_load(string module_name [, string remote_host [, int codepage]])
Loads a COM module */
PHP_FUNCTION(COM_load)
{
@@ -212,7 +269,7 @@ PHP_FUNCTION(COM_load)
CLSID clsid;
HRESULT hr;
OLECHAR *ProgID;
IDispatch *i_dispatch;
i_dispatch *obj;
char *error_message;
char *clsid_str;
@@ -222,7 +279,7 @@ PHP_FUNCTION(COM_load)
codepage = CP_ACP;
break;
case 2:
if (!INI_INT("allow_dcom")) {
if (!INI_INT("com.allow_dcom")) {
php_error(E_WARNING, "DCOM is disabled");
RETURN_FALSE;
}
@@ -237,7 +294,7 @@ PHP_FUNCTION(COM_load)
efree(server_name);
server_name = NULL;
} else {
if (!INI_INT("allow_dcom")) {
if (!INI_INT("com.allow_dcom")) {
php_error(E_WARNING, "DCOM is disabled");
RETURN_FALSE;
}
@@ -254,7 +311,7 @@ PHP_FUNCTION(COM_load)
convert_to_string(module_name);
ProgID = php_char_to_OLECHAR(module_name->value.str.val, module_name->value.str.len, codepage);
hr = CLSIDFromProgID(ProgID, &clsid);
hr=CLSIDFromProgID(ProgID, &clsid);
efree(ProgID);
/* obtain CLSID */
@@ -265,9 +322,12 @@ PHP_FUNCTION(COM_load)
RETURN_FALSE;
}
obj = (i_dispatch *) emalloc(sizeof(i_dispatch));
/* obtain IDispatch */
if (!server_name) {
hr = CoCreateInstance(&clsid, NULL, CLSCTX_SERVER, &IID_IDispatch, (LPVOID *) &i_dispatch);
hr = CoCreateInstance(&clsid, NULL, CLSCTX_SERVER, &IID_IDispatch, (LPVOID *) &(obj->i.dispatch));
php_COM_set(obj, obj->i.dispatch, TRUE);
} else {
COSERVERINFO server_info;
MULTI_QI pResults;
@@ -283,27 +343,28 @@ PHP_FUNCTION(COM_load)
hr=CoCreateInstanceEx(&clsid, NULL, CLSCTX_SERVER, &server_info, 1, &pResults);
if (SUCCEEDED(hr)) {
hr = pResults.hr;
i_dispatch = (IDispatch *) pResults.pItf;
obj->i.dispatch = (IDispatch *) pResults.pItf;
php_COM_set(obj, obj->i.dispatch, TRUE);
}
efree(server_info.pwszName);
}
if (FAILED(hr)) {
error_message = php_COM_error_message(hr);
clsid_str = php_string_from_clsid(clsid);
clsid_str = php_string_from_clsid(&clsid);
php_error(E_WARNING,"Unable to obtain IDispatch interface for CLSID %s: %s",clsid_str,error_message);
LocalFree(error_message);
efree(clsid_str);
efree(obj);
RETURN_FALSE;
}
RETURN_LONG(zend_list_insert(i_dispatch,le_idispatch));
RETURN_LONG(zend_list_insert(obj, le_idispatch));
}
/* }}} */
int do_COM_invoke(IDispatch *i_dispatch, pval *function_name, VARIANTARG *var_result, pval **arguments, int arg_count)
int do_COM_invoke(i_dispatch *obj, pval *function_name, VARIANTARG *var_result, pval **arguments, int arg_count)
{
DISPID dispid;
HRESULT hr;
@@ -315,7 +376,7 @@ int do_COM_invoke(IDispatch *i_dispatch, pval *function_name, VARIANTARG *var_re
funcname = php_char_to_OLECHAR(function_name->value.str.val, function_name->value.str.len, codepage);
hr = i_dispatch->lpVtbl->GetIDsOfNames(i_dispatch, &IID_NULL, &funcname, 1, LOCALE_SYSTEM_DEFAULT, &dispid);
hr = php_COM_get_ids_of_names(obj, &funcname, &dispid);
if (FAILED(hr)) {
error_message = php_COM_error_message(hr);
@@ -337,9 +398,7 @@ int do_COM_invoke(IDispatch *i_dispatch, pval *function_name, VARIANTARG *var_re
dispparams.cArgs = arg_count;
dispparams.cNamedArgs = 0;
hr = i_dispatch->lpVtbl->Invoke(i_dispatch, dispid, &IID_NULL,
LOCALE_SYSTEM_DEFAULT, DISPATCH_METHOD|DISPATCH_PROPERTYGET,
&dispparams, var_result, NULL, NULL);
hr = php_COM_invoke(obj, dispid, DISPATCH_METHOD|DISPATCH_PROPERTYGET, &dispparams, var_result);
if (FAILED(hr)) {
error_message = php_COM_error_message(hr);
@@ -362,7 +421,7 @@ PHP_FUNCTION(COM_invoke)
{
pval **arguments;
pval *object, *function_name;
IDispatch *i_dispatch;
i_dispatch *obj;
int type;
int arg_count = ZEND_NUM_ARGS();
VARIANTARG var_result;
@@ -378,10 +437,10 @@ PHP_FUNCTION(COM_invoke)
object = arguments[0];
function_name = arguments[1];
/* obtain i_dispatch interface */
/* obtain IDispatch interface */
convert_to_long(object);
i_dispatch = (IDispatch *)zend_list_find(object->value.lval, &type);
if (!i_dispatch || (type!=le_idispatch)) {
obj = (i_dispatch *)zend_list_find(object->value.lval, &type);
if (!obj || (type!=le_idispatch)) {
php_error(E_WARNING,"%d is not a COM object handler", function_name->value.str.val);
RETURN_FALSE;
}
@@ -389,7 +448,7 @@ PHP_FUNCTION(COM_invoke)
/* obtain property/method handler */
convert_to_string(function_name);
if (do_COM_invoke(i_dispatch, function_name, &var_result, arguments+2, arg_count-2)==FAILURE) {
if (do_COM_invoke(obj, function_name, &var_result, arguments+2, arg_count-2)==FAILURE) {
RETURN_FALSE;
}
efree(arguments);
@@ -403,16 +462,21 @@ static int do_COM_offget(VARIANTARG *var_result, VARIANTARG *array, pval *arg_pr
switch (array->vt) {
case VT_DISPATCH: { /* a Collection, possibly */
pval function_name;
IDispatch *i_dispatch = array->pdispVal;
i_dispatch *obj;
int retval;
obj = (i_dispatch *) emalloc(sizeof(i_dispatch));
php_COM_set(obj, array->pdispVal, TRUE);
function_name.value.str.val = "Item";
function_name.value.str.len = 4;
function_name.type = IS_STRING;
retval = do_COM_invoke(i_dispatch, &function_name, var_result, &arg_property, 1);
retval = do_COM_invoke(obj, &function_name, var_result, &arg_property, 1);
if (cleanup) {
i_dispatch->lpVtbl->Release(i_dispatch);
php_COM_release(obj);
}
efree(obj);
return retval;
}
}
@@ -420,7 +484,7 @@ static int do_COM_offget(VARIANTARG *var_result, VARIANTARG *array, pval *arg_pr
}
static int do_COM_propget(VARIANTARG *var_result, IDispatch *i_dispatch, pval *arg_property, int cleanup)
static int do_COM_propget(VARIANTARG *var_result, i_dispatch *obj, pval *arg_property, int cleanup)
{
DISPID dispid;
HRESULT hr;
@@ -432,7 +496,7 @@ static int do_COM_propget(VARIANTARG *var_result, IDispatch *i_dispatch, pval *a
/* obtain property handler */
propname = php_char_to_OLECHAR(arg_property->value.str.val, arg_property->value.str.len, codepage);
hr = i_dispatch->lpVtbl->GetIDsOfNames(i_dispatch, &IID_NULL, &propname, 1, LOCALE_SYSTEM_DEFAULT, &dispid);
hr = php_COM_get_ids_of_names(obj, &propname, &dispid);
if (FAILED(hr)) {
error_message = php_COM_error_message(hr);
@@ -440,7 +504,7 @@ static int do_COM_propget(VARIANTARG *var_result, IDispatch *i_dispatch, pval *a
LocalFree(error_message);
efree(propname);
if (cleanup) {
i_dispatch->lpVtbl->Release(i_dispatch);
php_COM_release(obj);
}
return FAILURE;
}
@@ -448,7 +512,7 @@ static int do_COM_propget(VARIANTARG *var_result, IDispatch *i_dispatch, pval *a
dispparams.cArgs = 0;
dispparams.cNamedArgs = 0;
hr = i_dispatch->lpVtbl->Invoke(i_dispatch, dispid, &IID_NULL, LOCALE_SYSTEM_DEFAULT, DISPATCH_PROPERTYGET, &dispparams, var_result, NULL, 0);
hr = php_COM_invoke(obj, dispid, DISPATCH_PROPERTYGET, &dispparams, var_result);
if (FAILED(hr)) {
error_message = php_COM_error_message(hr);
@@ -456,35 +520,37 @@ static int do_COM_propget(VARIANTARG *var_result, IDispatch *i_dispatch, pval *a
LocalFree(error_message);
efree(propname);
if (cleanup) {
i_dispatch->lpVtbl->Release(i_dispatch);
php_COM_release(obj);
}
return FAILURE;
}
efree(propname);
if (cleanup) {
i_dispatch->lpVtbl->Release(i_dispatch);
php_COM_release(obj);
}
return SUCCESS;
}
static void do_COM_propput(pval *return_value, IDispatch *i_dispatch, pval *arg_property, pval *value)
static void do_COM_propput(pval *return_value, i_dispatch *obj, pval *arg_property, pval *value)
{
DISPID dispid;
HRESULT hr;
OLECHAR *propname;
char *error_message;
VARIANTARG var_result;
VARIANT *var_result;
DISPPARAMS dispparams;
VARIANTARG new_value;
DISPID mydispid = DISPID_PROPERTYPUT;
var_result = emalloc(sizeof(VARIANT));
/* obtain property handler */
propname = php_char_to_OLECHAR(arg_property->value.str.val, arg_property->value.str.len, codepage);
hr = i_dispatch->lpVtbl->GetIDsOfNames(i_dispatch, &IID_NULL, &propname, 1, LOCALE_SYSTEM_DEFAULT, &dispid);
hr = php_COM_get_ids_of_names(obj, &propname, &dispid);
if (FAILED(hr)) {
error_message = php_COM_error_message(hr);
@@ -494,16 +560,14 @@ static void do_COM_propput(pval *return_value, IDispatch *i_dispatch, pval *arg_
RETURN_FALSE;
}
php_pval_to_variant(value, &new_value, codepage);
dispparams.rgvarg = &new_value;
dispparams.rgdispidNamedArgs = &mydispid;
dispparams.cArgs = 1;
dispparams.cNamedArgs = 1;
hr = i_dispatch->lpVtbl->Invoke(i_dispatch, dispid, &IID_NULL,
LOCALE_SYSTEM_DEFAULT, DISPATCH_PROPERTYPUT,
&dispparams, NULL, NULL, 0);
hr = php_COM_invoke(obj, dispid, DISPATCH_PROPERTYPUT, &dispparams, NULL);
if (FAILED(hr)) {
error_message = php_COM_error_message(hr);
php_error(E_WARNING,"PropPut() failed: %s\n", error_message);
@@ -515,18 +579,16 @@ static void do_COM_propput(pval *return_value, IDispatch *i_dispatch, pval *arg_
dispparams.cArgs = 0;
dispparams.cNamedArgs = 0;
hr = i_dispatch->lpVtbl->Invoke(i_dispatch, dispid, &IID_NULL,
LOCALE_SYSTEM_DEFAULT, DISPATCH_PROPERTYGET,
&dispparams, &var_result, NULL, 0);
hr = php_COM_invoke(obj, dispid, DISPATCH_PROPERTYGET, &dispparams, var_result);
if (SUCCEEDED(hr)) {
php_variant_to_pval(&var_result, return_value, 0, codepage);
php_variant_to_pval(var_result, return_value, 0, codepage);
} else {
*return_value = *value;
zval_copy_ctor(return_value);
}
efree(var_result);
efree(propname);
}
@@ -537,23 +599,22 @@ PHP_FUNCTION(com_propget)
{
pval *arg_idispatch, *arg_property;
int type;
IDispatch *i_dispatch;
i_dispatch *obj;
VARIANTARG var_result;
if (ZEND_NUM_ARGS()!=2 || getParameters(ht, 2, &arg_idispatch, &arg_property)==FAILURE) {
WRONG_PARAM_COUNT;
}
/* obtain i_dispatch interface */
/* obtain IDispatch interface */
convert_to_long(arg_idispatch);
/* obtain i_dispatch interface */
i_dispatch = (IDispatch *)zend_list_find(arg_idispatch->value.lval,&type);
if (!i_dispatch || (type!=le_idispatch)) {
obj = (i_dispatch *)zend_list_find(arg_idispatch->value.lval,&type);
if (!obj || (type!=le_idispatch)) {
php_error(E_WARNING,"%d is not a COM object handler", arg_idispatch->value.lval);
}
convert_to_string(arg_property);
if (do_COM_propget(&var_result, i_dispatch, arg_property, 0)==FAILURE) {
if (do_COM_propget(&var_result, obj, arg_property, 0)==FAILURE) {
RETURN_FALSE;
}
php_variant_to_pval(&var_result, return_value, 0, codepage);
@@ -567,7 +628,7 @@ PHP_FUNCTION(com_propput)
{
pval *arg_idispatch, *arg_property, *arg_value;
int type;
IDispatch *i_dispatch;
i_dispatch *obj;
if (ZEND_NUM_ARGS()!=3 || getParameters(ht, 3, &arg_idispatch, &arg_property, &arg_value)==FAILURE) {
WRONG_PARAM_COUNT;
@@ -576,62 +637,72 @@ PHP_FUNCTION(com_propput)
/* obtain i_dispatch interface */
convert_to_long(arg_idispatch);
/* obtain i_dispatch interface */
i_dispatch = (IDispatch *)zend_list_find(arg_idispatch->value.lval,&type);
if (!i_dispatch || (type!=le_idispatch)) {
obj = (i_dispatch *)zend_list_find(arg_idispatch->value.lval,&type);
if (!obj || (type!=le_idispatch)) {
php_error(E_WARNING,"%d is not a COM object handler", arg_idispatch->value.lval);
}
convert_to_string(arg_property);
do_COM_propput(return_value, i_dispatch, arg_property, arg_value);
do_COM_propput(return_value, obj, arg_property, arg_value);
}
/* }}} */
VARIANTARG _php_COM_get_property_handler(zend_property_reference *property_reference)
VARIANT *_php_COM_get_property_handler(zend_property_reference *property_reference)
{
zend_overloaded_element *overloaded_property;
zend_llist_element *element;
pval **idispatch_handle;
pval *object = property_reference->object;
IDispatch *i_dispatch;
int type;
VARIANTARG var_result;
VARIANT *var_result;
i_dispatch *obj, *obj_prop;
/* fetch the IDispatch interface */
zend_hash_index_find(object->value.obj.properties, 0, (void **) &idispatch_handle);
i_dispatch = (IDispatch *)zend_list_find((*idispatch_handle)->value.lval,&type);
if (!i_dispatch || (type!=le_idispatch)) {
var_result.vt = VT_EMPTY;
return var_result;
obj = (i_dispatch *) zend_list_find((*idispatch_handle)->value.lval, &type);
if (!obj || (type!=le_idispatch)) {
return NULL;
}
var_result.vt = VT_DISPATCH;
var_result.pdispVal = i_dispatch;
obj_prop = (i_dispatch *) emalloc(sizeof(i_dispatch));
php_COM_clone(obj_prop, obj, FALSE);
var_result = (VARIANT *) emalloc(sizeof(VARIANT));
var_result->vt = VT_DISPATCH;
var_result->pdispVal = obj_prop->i.dispatch;
for (element=property_reference->elements_list->head; element; element=element->next) {
overloaded_property = (zend_overloaded_element *) element->data;
switch (overloaded_property->type) {
case OE_IS_ARRAY:
if (do_COM_offget(&var_result, &var_result, &overloaded_property->element, element!=property_reference->elements_list->head)==FAILURE) {
var_result.vt = VT_EMPTY;
if (do_COM_offget(var_result, var_result, &overloaded_property->element, element!=property_reference->elements_list->head)==FAILURE) {
var_result->vt = VT_EMPTY;
efree(obj_prop);
return var_result;
}
/*printf("Array offset: ");*/
break;
case OE_IS_OBJECT:
if (var_result.vt != VT_DISPATCH) {
var_result.vt = VT_EMPTY;
if (var_result->vt != VT_DISPATCH) {
var_result->vt = VT_EMPTY;
efree(obj_prop);
return var_result;
} else {
if (do_COM_propget(&var_result, var_result.pdispVal, &overloaded_property->element, element!=property_reference->elements_list->head)==FAILURE) {
var_result.vt = VT_EMPTY;
php_COM_set(obj_prop, var_result->pdispVal, TRUE);
if (do_COM_propget(var_result, obj_prop, &overloaded_property->element, element!=property_reference->elements_list->head)==FAILURE) {
var_result->vt = VT_EMPTY;
efree(obj_prop);
return var_result;
}
/*printf("Object property: ");*/
}
break;
case OE_IS_METHOD:
var_result->pdispVal = obj_prop->i.dispatch;
efree(obj_prop);
return var_result;
break;
}
@@ -647,15 +718,17 @@ VARIANTARG _php_COM_get_property_handler(zend_property_reference *property_refer
*/
pval_destructor(&overloaded_property->element);
}
efree(obj_prop);
return var_result;
}
PHPAPI pval php_COM_get_property_handler(zend_property_reference *property_reference)
{
pval result;
VARIANTARG var_result = _php_COM_get_property_handler(property_reference);
VARIANT *var_result = _php_COM_get_property_handler(property_reference);
php_variant_to_pval(&var_result, &result, 0, codepage);
php_variant_to_pval(var_result, &result, 0, codepage);
efree(var_result);
return result;
}
@@ -667,19 +740,19 @@ PHPAPI int php_COM_set_property_handler(zend_property_reference *property_refere
zend_llist_element *element;
pval **idispatch_handle;
pval *object = property_reference->object;
IDispatch *i_dispatch;
i_dispatch *obj;
int type;
VARIANTARG var_result;
/* fetch the IDispatch interface */
zend_hash_index_find(object->value.obj.properties, 0, (void **) &idispatch_handle);
i_dispatch = (IDispatch *)zend_list_find((*idispatch_handle)->value.lval,&type);
if (!i_dispatch || (type!=le_idispatch)) {
obj = (i_dispatch *)zend_list_find((*idispatch_handle)->value.lval,&type);
if (!obj || (type!=le_idispatch)) {
return FAILURE;
}
var_result.vt = VT_DISPATCH;
var_result.pdispVal = i_dispatch;
var_result.pdispVal = obj->i.dispatch;
for (element=property_reference->elements_list->head; element && element!=property_reference->elements_list->tail; element=element->next) {
overloaded_property = (zend_overloaded_element *) element->data;
@@ -691,7 +764,8 @@ PHPAPI int php_COM_set_property_handler(zend_property_reference *property_refere
if (var_result.vt != VT_DISPATCH) {
return FAILURE;
} else {
do_COM_propget(&var_result, i_dispatch, &overloaded_property->element, element!=property_reference->elements_list->head);
// ??????
do_COM_propget(&var_result, obj, &overloaded_property->element, element!=property_reference->elements_list->head);
/*printf("Object property: ");*/
}
break;
@@ -715,9 +789,15 @@ PHPAPI int php_COM_set_property_handler(zend_property_reference *property_refere
if (var_result.vt != VT_DISPATCH) {
return FAILURE;
}
obj = (i_dispatch *) emalloc(sizeof(i_dispatch));
obj->typelib = FALSE;
obj->i.dispatch = var_result.pdispVal;
overloaded_property = (zend_overloaded_element *) element->data;
do_COM_propput(&result, var_result.pdispVal, &overloaded_property->element, value);
do_COM_propput(&result, obj, &overloaded_property->element, value);
pval_destructor(&overloaded_property->element);
efree(obj);
return SUCCESS;
}
@@ -745,24 +825,26 @@ PHPAPI void php_COM_call_function_handler(INTERNAL_FUNCTION_PARAMETERS, zend_pro
zend_hash_index_update(object->value.obj.properties, 0, &object_handle, sizeof(pval *), NULL);
pval_destructor(&function_name->element);
} else {
VARIANTARG object_handle = _php_COM_get_property_handler(property_reference);
i_dispatch *obj;
pval **arguments;
int arg_count = ZEND_NUM_ARGS();
VARIANTARG var_result;
var_result.vt = VT_EMPTY;
if (object_handle.vt != VT_DISPATCH) {
/* that shouldn't happen */
return;
}
obj = (i_dispatch *) emalloc(sizeof(i_dispatch));
php_COM_set(obj, _php_COM_get_property_handler(property_reference)->pdispVal, TRUE);
arguments = (pval **) emalloc(sizeof(pval *)*arg_count);
getParametersArray(ht, arg_count, arguments);
if (do_COM_invoke((IDispatch *) object_handle.pdispVal, &function_name->element, &var_result, arguments, arg_count)==FAILURE) {
if (do_COM_invoke(obj , &function_name->element, &var_result, arguments, arg_count)==FAILURE) {
RETVAL_FALSE;
}
pval_destructor(&function_name->element);
php_COM_release(obj);
efree(obj);
efree(arguments);
php_variant_to_pval(&var_result, return_value, 0, codepage);
}
@@ -788,18 +870,52 @@ static int php_COM_load_typelib(char *typelib_name, int mode)
ITypeLib *TypeLib;
ITypeComp *TypeComp;
OLECHAR *p;
CLSID clsid;
char *strtok_buf, *major, *minor;
int i;
int interfaces;
ELS_FETCH();
typelib_name = php_strtok_r(typelib_name, ",", &strtok_buf);
major = php_strtok_r(NULL, ",", &strtok_buf);
minor = php_strtok_r(NULL, ",", &strtok_buf);
p = php_char_to_OLECHAR(typelib_name, strlen(typelib_name), codepage);
if (FAILED(LoadTypeLib(p, &TypeLib))) {
efree(p);
return FAILURE;
if (!FAILED(CLSIDFromString(p, &clsid))) {
HRESULT hr;
if (major && minor) {
hr = LoadRegTypeLib((REFGUID) &clsid, 1, 0, LANG_NEUTRAL, &TypeLib);
}
if (!major || !minor || FAILED(hr)) {
IDispatch *i_dispatch;
ITypeInfo *TypeInfo;
int idx;
if (FAILED(CoCreateInstance(&clsid, NULL, CLSCTX_SERVER, &IID_IDispatch, (LPVOID *) &i_dispatch))) {
efree(p);
return FAILURE;
}
if (FAILED(i_dispatch->lpVtbl->GetTypeInfo(i_dispatch, 0, LANG_NEUTRAL, &TypeInfo))) {
efree(p);
return FAILURE;
}
if (FAILED(TypeInfo->lpVtbl->GetContainingTypeLib(TypeInfo, &TypeLib, &idx))) {
efree(p);
return FAILURE;
}
}
} else {
if (FAILED(LoadTypeLib(p, &TypeLib))) {
efree(p);
return FAILURE;
}
}
interfaces = TypeLib->lpVtbl->GetTypeInfoCount(TypeLib);
interfaces = TypeLib->lpVtbl->GetTypeInfoCount(TypeLib);
TypeLib->lpVtbl->GetTypeComp(TypeLib, &TypeComp);
for (i=0; i<interfaces; i++) {
@@ -865,7 +981,6 @@ void php_register_COM_class()
zend_register_internal_class(&com_class_entry);
}
PHP_MINIT_FUNCTION(COM)
{
CoInitialize(NULL);
@@ -883,7 +998,6 @@ PHP_MSHUTDOWN_FUNCTION(COM)
return SUCCESS;
}
BEGIN_EXTERN_C()
// exports for external object creation
zend_module_entry COM_module_entry = {
@@ -894,6 +1008,4 @@ PHPAPI int php_COM_get_le_idispatch() {
return le_idispatch;
}
END_EXTERN_C()
#endif
+30 -30
View File
@@ -69,38 +69,38 @@ PHP_MINIT_FUNCTION(VARIANT)
le_variant = zend_register_list_destructors_ex(php_variant_destructor, NULL, "VARIANT", module_number);
/* variant datatypes */
REGISTER_LONG_CONSTANT("VT_NULL", VT_NULL, 0);
REGISTER_LONG_CONSTANT("VT_EMPTY", VT_EMPTY, 0);
REGISTER_LONG_CONSTANT("VT_UI1", VT_UI1, 0);
REGISTER_LONG_CONSTANT("VT_I2", VT_I2, 0);
REGISTER_LONG_CONSTANT("VT_I4", VT_I4, 0);
REGISTER_LONG_CONSTANT("VT_R4", VT_R4, 0);
REGISTER_LONG_CONSTANT("VT_R8", VT_R8, 0);
REGISTER_LONG_CONSTANT("VT_BOOL", VT_BOOL, 0);
REGISTER_LONG_CONSTANT("VT_ERROR", VT_ERROR, 0);
REGISTER_LONG_CONSTANT("VT_CY", VT_CY, 0);
REGISTER_LONG_CONSTANT("VT_DATE", VT_CY, 0);
REGISTER_LONG_CONSTANT("VT_BSTR", VT_BSTR, 0);
REGISTER_LONG_CONSTANT("VT_DECIMAL", VT_DECIMAL, 0);
REGISTER_LONG_CONSTANT("VT_UNKNOWN", VT_UNKNOWN, 0);
REGISTER_LONG_CONSTANT("VT_DISPATCH", VT_DISPATCH, 0);
REGISTER_LONG_CONSTANT("VT_VARIANT", VT_VARIANT, 0);
REGISTER_LONG_CONSTANT("VT_I1", VT_I1, 0);
REGISTER_LONG_CONSTANT("VT_UI2", VT_UI2, 0);
REGISTER_LONG_CONSTANT("VT_UI4", VT_UI4, 0);
REGISTER_LONG_CONSTANT("VT_INT", VT_INT, 0);
REGISTER_LONG_CONSTANT("VT_UINT", VT_UINT, 0);
REGISTER_LONG_CONSTANT("VT_ARRAY", VT_ARRAY, 0);
REGISTER_LONG_CONSTANT("VT_BYREF", VT_BYREF, 0);
REGISTER_LONG_CONSTANT("VT_NULL", VT_NULL, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("VT_EMPTY", VT_EMPTY, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("VT_UI1", VT_UI1, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("VT_I2", VT_I2, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("VT_I4", VT_I4, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("VT_R4", VT_R4, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("VT_R8", VT_R8, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("VT_BOOL", VT_BOOL, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("VT_ERROR", VT_ERROR, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("VT_CY", VT_CY, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("VT_DATE", VT_CY, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("VT_BSTR", VT_BSTR, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("VT_DECIMAL", VT_DECIMAL, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("VT_UNKNOWN", VT_UNKNOWN, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("VT_DISPATCH", VT_DISPATCH, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("VT_VARIANT", VT_VARIANT, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("VT_I1", VT_I1, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("VT_UI2", VT_UI2, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("VT_UI4", VT_UI4, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("VT_INT", VT_INT, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("VT_UINT", VT_UINT, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("VT_ARRAY", VT_ARRAY, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("VT_BYREF", VT_BYREF, CONST_CS | CONST_PERSISTENT);
/* codepages */
REGISTER_LONG_CONSTANT("CP_ACP", CP_ACP, 0);
REGISTER_LONG_CONSTANT("CP_MACCP", CP_MACCP, 0);
REGISTER_LONG_CONSTANT("CP_OEMCP", CP_OEMCP, 0);
REGISTER_LONG_CONSTANT("CP_SYMBOL", CP_SYMBOL, 0);
REGISTER_LONG_CONSTANT("CP_THREAD_ACP", CP_THREAD_ACP, 0);
REGISTER_LONG_CONSTANT("CP_UTF7", CP_UTF7, 0);
REGISTER_LONG_CONSTANT("CP_UTF8", CP_UTF8, 0);
REGISTER_LONG_CONSTANT("CP_ACP", CP_ACP, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("CP_MACCP", CP_MACCP, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("CP_OEMCP", CP_OEMCP, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("CP_SYMBOL", CP_SYMBOL, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("CP_THREAD_ACP", CP_THREAD_ACP, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("CP_UTF7", CP_UTF7, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("CP_UTF8", CP_UTF8, CONST_CS | CONST_PERSISTENT);
php_register_VARIANT_class();
return SUCCESS;
+24
View File
@@ -0,0 +1,24 @@
#ifndef COM_H
#define COM_H
#if PHP_WIN32
#include "unknwn.h"
typedef struct i_dispatch_ {
int typelib;
struct {
IDispatch *dispatch;
ITypeInfo *typeinfo;
} i;
} i_dispatch;
PHPAPI HRESULT php_COM_invoke(i_dispatch *obj, DISPID dispIdMember, WORD wFlags, DISPPARAMS FAR* pDispParams, VARIANT FAR* pVarResult);
PHPAPI HRESULT php_COM_get_ids_of_names(i_dispatch *obj, OLECHAR FAR* FAR* rgszNames, DISPID FAR* rgDispId);
PHPAPI HRESULT php_COM_release(i_dispatch *obj);
PHPAPI HRESULT php_COM_set(i_dispatch *obj, IDispatch FAR* pDisp, int cleanup);
PHPAPI HRESULT php_COM_clone(i_dispatch *obj, i_dispatch *clone, int cleanup);
#endif /* PHP_WIN32 */
#endif /* COM_H */
+1 -7
View File
@@ -3,7 +3,7 @@
#if PHP_WIN32
BEGIN_EXTERN_C()
#include "com.h"
extern PHP_MINIT_FUNCTION(COM);
extern PHP_MSHUTDOWN_FUNCTION(COM);
@@ -13,17 +13,11 @@ extern int php_COM_get_le_idispatch();
extern zend_module_entry COM_module_entry;
extern zend_class_entry com_class_entry;
END_EXTERN_C()
#ifdef __cplusplus
extern pval php_COM_get_property_handler(zend_property_reference *property_reference);
extern int php_COM_set_property_handler(zend_property_reference *property_reference, pval *value);
extern char *php_COM_error_message(HRESULT hr);
extern void php_COM_call_function_handler(INTERNAL_FUNCTION_PARAMETERS, zend_property_reference *property_reference);
#endif
#define COM_module_ptr &COM_module_entry
#else
+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
+14 -3
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();
}
@@ -2743,12 +2748,18 @@ PHP_FUNCTION(imap_sort)
mypgm->next = NIL;
slst = mail_sort(imap_le_struct->imap_stream, NIL, spg, mypgm, myargc >= 4 ? Z_LVAL_PP(flags) : NIL);
if (spg) {
mail_free_searchpgm(&spg);
}
array_init(return_value);
for (sl = slst; *sl; sl++) {
add_next_index_long(return_value, *sl);
if (slst != NIL && slst != 0) {
for (sl = slst; *sl; sl++) {
add_next_index_long(return_value, *sl);
}
fs_give ((void **) &slst);
}
fs_give ((void **) &slst);
}
/* }}} */
+39 -33
View File
@@ -339,36 +339,37 @@ static PHP_MSHUTDOWN_FUNCTION(mcrypt)
return SUCCESS;
}
#include "ext/standard/php_smart_str.h"
PHP_MINFO_FUNCTION(mcrypt)
{
#if HAVE_LIBMCRYPT24
char **modules;
int i, count;
char *tmp, *tmp2;
smart_str tmp1 = {0};
smart_str tmp2 = {0};
MCLS_FETCH();
tmp = emalloc (2048);
memset (tmp, 0, sizeof(tmp));
modules = mcrypt_list_algorithms (MCG(algorithms_dir), &count);
if (count == 0) {
strcpy (tmp, "none");
smart_str_appends (&tmp1, "none");
}
for (i = 0; i < count; i++) {
strcat (tmp, modules[i]);
strcat (tmp, " ");
smart_str_appends (&tmp1, modules[i]);
smart_str_appendc (&tmp1, ' ');
}
smart_str_0 (&tmp1);
mcrypt_free_p (modules, count);
tmp2 = emalloc (2048);
memset (tmp2, 0, sizeof(tmp2));
modules = mcrypt_list_modes (MCG(modes_dir), &count);
if (count == 0) {
strcpy (tmp2, "none");
smart_str_appends (&tmp2, "none");
}
for (i = 0; i < count; i++) {
strcat (tmp2, modules[i]);
strcat (tmp2, " ");
smart_str_appends (&tmp2, modules[i]);
smart_str_appendc (&tmp2, ' ');
}
smart_str_0 (&tmp2);
mcrypt_free_p (modules, count);
#endif
@@ -379,10 +380,10 @@ PHP_MINFO_FUNCTION(mcrypt)
#endif
#if HAVE_LIBMCRYPT24
php_info_print_table_row(2, "version", "2.4.x");
php_info_print_table_row(2, "Supported ciphers", tmp);
php_info_print_table_row(2, "Supported modes", tmp2);
efree (tmp2);
efree (tmp);
php_info_print_table_row(2, "Supported ciphers", tmp1.c);
php_info_print_table_row(2, "Supported modes", tmp2.c);
smart_str_free (&tmp1);
smart_str_free (&tmp2);
#endif
php_info_print_table_end();
@@ -436,9 +437,9 @@ PHP_FUNCTION(mcrypt_generic_init)
{
zval **key, **iv;
zval **mcryptind;
char *key_s, *iv_s;
unsigned char *key_s, *iv_s;
char dummy[256];
int key_size, iv_size;
int max_key_size, iv_size;
MCRYPT td;
int argc;
MCLS_FETCH();
@@ -451,29 +452,30 @@ PHP_FUNCTION(mcrypt_generic_init)
convert_to_string_ex (key);
convert_to_string_ex (iv);
key_size = mcrypt_enc_get_key_size (td);
key_s = emalloc (key_size + 1);
memset (key_s, 0, key_size + 1);
max_key_size = mcrypt_enc_get_key_size (td);
iv_size = mcrypt_enc_get_iv_size (td);
key_s = emalloc (Z_STRLEN_PP(key));
memset (key_s, 0, Z_STRLEN_PP(key));
iv_s = emalloc (iv_size + 1);
memset (iv_s, 0, iv_size + 1);
if (Z_STRLEN_PP(key) != key_size) {
sprintf (dummy, "key size incorrect; supplied length: %d, needed: %d",
Z_STRLEN_PP(key), key_size);
if (Z_STRLEN_PP(key) > max_key_size) {
sprintf (dummy, "key size too large; supplied length: %d, max: %d",
Z_STRLEN_PP(key), max_key_size);
php_error (E_NOTICE, dummy);
}
strncpy (key_s, Z_STRVAL_PP(key), key_size);
memcpy (key_s, Z_STRVAL_PP(key), Z_STRLEN_PP(key));
if (Z_STRLEN_PP(iv) != iv_size) {
sprintf (dummy, "iv size incorrect; supplied length: %d, needed: %d",
Z_STRLEN_PP(iv), iv_size);
php_error (E_WARNING, dummy);
}
strncpy (iv_s, Z_STRVAL_PP(iv), iv_size);
memcpy (iv_s, Z_STRVAL_PP(iv), iv_size);
RETVAL_LONG (mcrypt_generic_init (td, key_s, key_size, iv_s));
RETVAL_LONG (mcrypt_generic_init (td, key_s, Z_STRLEN_PP(key), iv_s));
efree (iv_s);
efree (key_s);
}
@@ -487,7 +489,7 @@ PHP_FUNCTION(mcrypt_generic)
zval **data, **mcryptind;
MCRYPT td;
int argc;
char* data_s;
unsigned char* data_s;
int block_size, data_size;
MCLS_FETCH();
@@ -1211,7 +1213,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();
@@ -1234,13 +1236,15 @@ static void php_mcrypt_do_crypt (char* cipher, zval **key, zval **data, char *mo
}
key_length_sizes = mcrypt_enc_get_supported_key_sizes (td, &count);
if (count == 0 && key_length_sizes == NULL) { /* all lengths 1 - k_l_s = OK */
key_s = estrdup (Z_STRVAL_PP(key));
use_key_length = Z_STRLEN_PP(key);
key_s = emalloc (use_key_length);
memset (key_s, 0, use_key_length);
memcpy (key_s, Z_STRVAL_PP(key), use_key_length);
}
else if (count == 1) { /* only m_k_l = OK */
key_s = emalloc (key_length_sizes[0]);
memset (key_s, 0, key_length_sizes[0]);
strcpy (key_s, Z_STRVAL_PP(key));
memcpy (key_s, Z_STRVAL_PP(key), Z_STRLEN_PP(key));
use_key_length = key_length_sizes[0];
}
else { /* derterminating smallest supported key > length of requested key */
@@ -1254,7 +1258,7 @@ static void php_mcrypt_do_crypt (char* cipher, zval **key, zval **data, char *mo
}
key_s = emalloc (use_key_length);
memset (key_s, 0, use_key_length);
strcpy (key_s, Z_STRVAL_PP(key));
memcpy (key_s, Z_STRVAL_PP(key), Z_STRLEN_PP(key));
}
mcrypt_free (key_length_sizes);
@@ -1294,7 +1298,7 @@ static void php_mcrypt_do_crypt (char* cipher, zval **key, zval **data, char *mo
memset (data_s, 0, data_size);
memcpy (data_s, Z_STRVAL_PP(data), Z_STRLEN_PP(data));
}
if (mcrypt_generic_init (td, key_s, use_key_length, iv_s) < 0) {
php_error (E_ERROR, "generic_init failed");
}
@@ -1307,6 +1311,8 @@ static void php_mcrypt_do_crypt (char* cipher, zval **key, zval **data, char *mo
/* freeing vars */
mcrypt_generic_end (td);
if (key_s != NULL)
efree (key_s);
if (iv_s != NULL)
efree (iv_s);
efree (data_s);
+11 -9
View File
@@ -1,15 +1,12 @@
dnl $Id$
dnl config.m4 for extension libming
dnl don't forget to call PHP_EXTENSION(ming)
dnl This file is a modified version of config.m4
dnl in php4/ext/mcrypt
PHP_ARG_WITH(ming, for ming support,
PHP_ARG_WITH(ming, whether to include ming support,
[ --with-ming[=DIR] Include ming support])
if test "$PHP_MING" != "no"; then
for i in /usr/lib /usr/local /usr $PHP_MING; do
if test -r $i/libming.so; then
for i in $PHP_MING /usr/local /usr; do
if test -r $i/lib/libming.so; then
MING_DIR=$i
fi
done
@@ -18,11 +15,16 @@ if test "$PHP_MING" != "no"; then
AC_MSG_ERROR(Please reinstall libming.so - I cannot find libming.so)
fi
AC_ADD_INCLUDE($MING_DIR)
AC_ADD_INCLUDE($MING_DIR/include)
PHP_SUBST(MING_SHARED_LIBADD)
AC_ADD_LIBRARY_WITH_PATH(ming, $MING_DIR, MING_SHARED_LIBADD)
AC_DEFINE(HAVE_MING,1,[ ])
AC_ADD_LIBRARY_WITH_PATH(ming, $MING_DIR/lib, MING_SHARED_LIBADD)
AC_CHECK_LIB(ming, Ming_setScale, [
AC_DEFINE(HAVE_MING,1,[ ])
],[
AC_MSG_ERROR(Ming library 0.1.0 or greater required.)
])
PHP_EXTENSION(ming, $ext_shared)
fi
+3
View File
@@ -23,6 +23,7 @@
#if HAVE_MING
#include "ext/standard/info.h"
#include "ext/standard/file.h"
#include "php_ming.h"
static zend_function_entry ming_functions[] = {
@@ -2955,7 +2956,9 @@ PHP_MINIT_FUNCTION(ming)
CONSTANT("SWFTEXTFIELD_WORDWRAP", SWFTEXTFIELD_WORDWRAP);
CONSTANT("SWFTEXTFIELD_DRAWBOX", SWFTEXTFIELD_DRAWBOX);
CONSTANT("SWFTEXTFIELD_NOSELECT", SWFTEXTFIELD_NOSELECT);
#ifdef SWFTEXTFIELD_HTML
CONSTANT("SWFTEXTFIELD_HTML", SWFTEXTFIELD_HTML);
#endif
/* flags for SWFTextField_align */
CONSTANT("SWFTEXTFIELD_ALIGN_LEFT", SWFTEXTFIELD_ALIGN_LEFT);
+5
View File
@@ -342,11 +342,16 @@ PHP_MINIT_FUNCTION(oci)
{
zend_class_entry oci_lob_class_entry;
/* XXX Joe Brown says OCI_THREADED breaks windows, assuming the same is true for unix - tc
#ifdef ZTS
#define PHP_OCI_INIT_MODE OCI_THREADED
#else
*/
#define PHP_OCI_INIT_MODE OCI_DEFAULT
/*
#endif
*/
#if OCI_USE_EMALLOC
OCIInitialize(PHP_OCI_INIT_MODE, NULL, ocimalloc, ocirealloc, ocifree);
+2 -2
View File
@@ -158,7 +158,7 @@ if test "$PHP_ORACLE" != "no"; then
PHP_EXTENSION(oracle, $ext_shared)
AC_DEFINE(HAVE_ORACLE,1,[ ])
PHP_SUBST(ORACLE_SHARED_LIBADD)
PHP_SUBST(ORACLE_DIR)
PHP_SUBST_OLD(ORACLE_SHARED_LIBADD)
PHP_SUBST_OLD(ORACLE_DIR)
PHP_SUBST_OLD(ORACLE_VERSION)
fi
-3
View File
@@ -1710,7 +1710,6 @@ int ora_set_param_values(oraCursor *cursor, int isout)
if (zend_hash_find(&EG(symbol_table), paramname, strlen(paramname) + 1, (void **)&pdata) == FAILURE){
php_error(E_WARNING, "Can't find variable for parameter");
efree(paramname);
return 0;
}
@@ -1725,8 +1724,6 @@ int ora_set_param_values(oraCursor *cursor, int isout)
strncpy(param->progv, (*pdata)->value.str.val, len);
param->progv[len] = '\0';
efree(paramname);
}
return 1;
-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
+24 -13
View File
@@ -117,14 +117,14 @@ static void php_pgsql_set_default_link(int id)
{
PGLS_FETCH();
zend_list_addref(id); /* increase refcount for the new default link */
if (PGG(default_link) != -1) {
/* decrease refcount for the old default link */
zend_list_delete(PGG(default_link));
}
if (PGG(default_link) != id) {
PGG(default_link) = id;
zend_list_addref(id);
}
PGG(default_link) = id;
}
@@ -148,23 +148,25 @@ static void _close_pgsql_plink(zend_rsrc_list_entry *rsrc)
PGG(num_links)--;
}
static void _be_quiet(void * arg, const char * message)
static void
_notice_handler(void *arg, const char *message)
{
PGLS_FETCH();
if (! PGG(ignore_notices)) {
php_log_err(message);
}
}
static int _rollback_transactions(zend_rsrc_list_entry *rsrc)
{
PGconn *link = (PGconn *)rsrc->ptr;
PQnoticeProcessor old_notice_hook;
/* we set the PQsetNoticeProcessor to avoid the stupid
* "NOTICE: BEGIN: already a transaction in progress"
* message
*/
old_notice_hook = PQsetNoticeProcessor(link, _be_quiet, NULL);
PGG(ignore_notices) = 1;
PQexec(link,"BEGIN;ROLLBACK;");
PQsetNoticeProcessor(link, old_notice_hook, NULL);
PGG(ignore_notices) = 0;
return 0;
}
@@ -194,6 +196,7 @@ PHP_INI_END()
static void php_pgsql_init_globals(PGLS_D)
{
PGG(num_persistent) = 0;
PGG(ignore_notices) = 0;
}
PHP_MINIT_FUNCTION(pgsql)
@@ -262,6 +265,8 @@ PHP_MINFO_FUNCTION(pgsql)
DISPLAY_INI_ENTRIES();
}
void php_pgsql_do_connect(INTERNAL_FUNCTION_PARAMETERS,int persistent)
{
char *host=NULL,*port=NULL,*options=NULL,*tty=NULL,*dbname=NULL,*connstring=NULL;
@@ -377,6 +382,8 @@ void php_pgsql_do_connect(INTERNAL_FUNCTION_PARAMETERS,int persistent)
RETURN_FALSE;
}
PQsetNoticeProcessor(pgsql, _notice_handler, NULL);
/* hash it up */
new_le.type = le_plink;
new_le.ptr = pgsql;
@@ -405,6 +412,8 @@ void php_pgsql_do_connect(INTERNAL_FUNCTION_PARAMETERS,int persistent)
}
}
pgsql = (PGconn *) le->ptr;
PQsetNoticeProcessor(pgsql, _notice_handler, NULL);
}
ZEND_REGISTER_RESOURCE(return_value, pgsql, le_plink);
} else {
@@ -451,6 +460,8 @@ void php_pgsql_do_connect(INTERNAL_FUNCTION_PARAMETERS,int persistent)
RETURN_FALSE;
}
PQsetNoticeProcessor(pgsql, _notice_handler, NULL);
/* add it to the list */
ZEND_REGISTER_RESOURCE(return_value, pgsql, le_link);
+1
View File
@@ -119,6 +119,7 @@ typedef struct {
long max_links,max_persistent;
long allow_persistent;
int le_lofp,le_string;
int ignore_notices;
} php_pgsql_globals;
+222 -110
View File
@@ -50,27 +50,17 @@
#define _WIN32_DCOM
#ifdef CP_THREAD_ACP
#define PHP_COM_CODEPAGE CP_THREAD_ACP
#else
#define PHP_COM_CODEPAGE CP_ACP
#endif
#include <iostream.h>
#include <math.h>
#include "php.h"
#include "php_ini.h"
#include "com.h"
#include "conversion.h"
#include "unknwn.h"
BEGIN_EXTERN_C()
zend_class_entry com_class_entry;
END_EXTERN_C()
PHP_FUNCTION(COM_load);
PHP_FUNCTION(COM_invoke);
PHP_FUNCTION(com_propget);
@@ -101,27 +91,94 @@ static PHP_MINFO_FUNCTION(COM)
static int php_COM_load_typelib(char *typelib_name, int mode);
PHPAPI HRESULT php_COM_invoke(i_dispatch *obj, DISPID dispIdMember, WORD wFlags, DISPPARAMS FAR* pDispParams, VARIANT FAR* pVarResult)
{
if(obj->typelib) {
return obj->i.dispatch->lpVtbl->Invoke(obj->i.dispatch, dispIdMember, &IID_NULL, LOCALE_SYSTEM_DEFAULT,
wFlags, pDispParams, pVarResult, NULL, NULL);
} else {
return obj->i.typeinfo->lpVtbl->Invoke(obj->i.typeinfo, obj->i.dispatch, dispIdMember,
wFlags, pDispParams, pVarResult, NULL, NULL);
}
}
PHPAPI HRESULT php_COM_get_ids_of_names(i_dispatch *obj, OLECHAR FAR* FAR* rgszNames, DISPID FAR* rgDispId)
{
if(obj->typelib) {
return obj->i.dispatch->lpVtbl->GetIDsOfNames(obj->i.dispatch, &IID_NULL, rgszNames, 1, LOCALE_SYSTEM_DEFAULT, rgDispId);
} else {
return obj->i.typeinfo->lpVtbl->GetIDsOfNames(obj->i.typeinfo, rgszNames, 1, rgDispId);
}
}
PHPAPI HRESULT php_COM_release(i_dispatch *obj)
{
HRESULT hr;
hr = obj->i.dispatch->lpVtbl->Release(obj->i.dispatch);
obj->i.dispatch = NULL;
obj->i.typeinfo = NULL;
obj->typelib = FALSE;
return hr;
}
PHPAPI HRESULT php_COM_set(i_dispatch *obj, IDispatch FAR* pDisp, int cleanup)
{
HRESULT hr;
obj->i.dispatch = pDisp;
obj->typelib = !FAILED(obj->i.dispatch->lpVtbl->GetTypeInfo(obj->i.dispatch, 0, LANG_NEUTRAL, &obj->i.typeinfo));
if(cleanup) {
pDisp = NULL;
} else {
hr = obj->i.dispatch->lpVtbl->AddRef(obj->i.dispatch);
}
return hr;
}
PHPAPI HRESULT php_COM_clone(i_dispatch *obj, i_dispatch *clone, int cleanup)
{
HRESULT hr;
obj->typelib = clone->typelib;
obj->i.dispatch = clone->i.dispatch;
obj->i.typeinfo = clone->i.typeinfo;
if(cleanup) {
obj->i.dispatch = NULL;
obj->i.typeinfo = NULL;
obj->typelib = FALSE;
} else {
hr = obj->i.dispatch->lpVtbl->AddRef(obj->i.dispatch);
}
return hr;
}
PHPAPI char *php_COM_error_message(HRESULT hr)
{
char *pMsgBuf;
void *pMsgBuf;
if (!FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, NULL,
hr, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPTSTR) &pMsgBuf, 0, NULL)) {
char error_string[] = "No description available";
pMsgBuf = (char *) LocalAlloc(LMEM_FIXED, sizeof(error_string));
pMsgBuf = LocalAlloc(LMEM_FIXED, sizeof(error_string));
memcpy(pMsgBuf, error_string, sizeof(error_string));
}
return pMsgBuf;
}
static char *php_string_from_clsid(const CLSID clsid)
static char *php_string_from_clsid(const CLSID *clsid)
{
LPOLESTR ole_clsid;
char *clsid_str;
StringFromCLSID(&clsid, &ole_clsid);
StringFromCLSID(clsid, &ole_clsid);
clsid_str = php_OLECHAR_to_char(ole_clsid, NULL, 0, codepage);
LocalFree(ole_clsid);
@@ -130,9 +187,9 @@ static char *php_string_from_clsid(const CLSID clsid)
static void php_idispatch_destructor(zend_rsrc_list_entry *rsrc)
{
IDispatch *i_dispatch = (IDispatch *)rsrc->ptr;
i_dispatch->lpVtbl->Release(i_dispatch);
i_dispatch *obj = (i_dispatch *)rsrc->ptr;
php_COM_release(obj);
efree(obj);
}
static PHP_INI_MH(OnTypelibFileChange)
@@ -199,12 +256,12 @@ static PHP_INI_MH(OnTypelibFileChange)
PHP_INI_BEGIN()
PHP_INI_ENTRY1_EX("allow_dcom", "0", PHP_INI_SYSTEM, NULL, NULL, php_ini_boolean_displayer_cb)
PHP_INI_ENTRY1("typelib_file", NULL, PHP_INI_SYSTEM, OnTypelibFileChange, NULL)
PHP_INI_ENTRY_EX("com.allow_dcom", "0", PHP_INI_SYSTEM, NULL, php_ini_boolean_displayer_cb)
PHP_INI_ENTRY("com.typelib_file", "", PHP_INI_SYSTEM, OnTypelibFileChange)
PHP_INI_END()
/* {{{ proto int com_load(string module_name)
/* {{{ proto int com_load(string module_name [, string remote_host [, int codepage]])
Loads a COM module */
PHP_FUNCTION(COM_load)
{
@@ -212,7 +269,7 @@ PHP_FUNCTION(COM_load)
CLSID clsid;
HRESULT hr;
OLECHAR *ProgID;
IDispatch *i_dispatch;
i_dispatch *obj;
char *error_message;
char *clsid_str;
@@ -222,7 +279,7 @@ PHP_FUNCTION(COM_load)
codepage = CP_ACP;
break;
case 2:
if (!INI_INT("allow_dcom")) {
if (!INI_INT("com.allow_dcom")) {
php_error(E_WARNING, "DCOM is disabled");
RETURN_FALSE;
}
@@ -237,7 +294,7 @@ PHP_FUNCTION(COM_load)
efree(server_name);
server_name = NULL;
} else {
if (!INI_INT("allow_dcom")) {
if (!INI_INT("com.allow_dcom")) {
php_error(E_WARNING, "DCOM is disabled");
RETURN_FALSE;
}
@@ -254,7 +311,7 @@ PHP_FUNCTION(COM_load)
convert_to_string(module_name);
ProgID = php_char_to_OLECHAR(module_name->value.str.val, module_name->value.str.len, codepage);
hr = CLSIDFromProgID(ProgID, &clsid);
hr=CLSIDFromProgID(ProgID, &clsid);
efree(ProgID);
/* obtain CLSID */
@@ -265,9 +322,12 @@ PHP_FUNCTION(COM_load)
RETURN_FALSE;
}
obj = (i_dispatch *) emalloc(sizeof(i_dispatch));
/* obtain IDispatch */
if (!server_name) {
hr = CoCreateInstance(&clsid, NULL, CLSCTX_SERVER, &IID_IDispatch, (LPVOID *) &i_dispatch);
hr = CoCreateInstance(&clsid, NULL, CLSCTX_SERVER, &IID_IDispatch, (LPVOID *) &(obj->i.dispatch));
php_COM_set(obj, obj->i.dispatch, TRUE);
} else {
COSERVERINFO server_info;
MULTI_QI pResults;
@@ -283,27 +343,28 @@ PHP_FUNCTION(COM_load)
hr=CoCreateInstanceEx(&clsid, NULL, CLSCTX_SERVER, &server_info, 1, &pResults);
if (SUCCEEDED(hr)) {
hr = pResults.hr;
i_dispatch = (IDispatch *) pResults.pItf;
obj->i.dispatch = (IDispatch *) pResults.pItf;
php_COM_set(obj, obj->i.dispatch, TRUE);
}
efree(server_info.pwszName);
}
if (FAILED(hr)) {
error_message = php_COM_error_message(hr);
clsid_str = php_string_from_clsid(clsid);
clsid_str = php_string_from_clsid(&clsid);
php_error(E_WARNING,"Unable to obtain IDispatch interface for CLSID %s: %s",clsid_str,error_message);
LocalFree(error_message);
efree(clsid_str);
efree(obj);
RETURN_FALSE;
}
RETURN_LONG(zend_list_insert(i_dispatch,le_idispatch));
RETURN_LONG(zend_list_insert(obj, le_idispatch));
}
/* }}} */
int do_COM_invoke(IDispatch *i_dispatch, pval *function_name, VARIANTARG *var_result, pval **arguments, int arg_count)
int do_COM_invoke(i_dispatch *obj, pval *function_name, VARIANTARG *var_result, pval **arguments, int arg_count)
{
DISPID dispid;
HRESULT hr;
@@ -315,7 +376,7 @@ int do_COM_invoke(IDispatch *i_dispatch, pval *function_name, VARIANTARG *var_re
funcname = php_char_to_OLECHAR(function_name->value.str.val, function_name->value.str.len, codepage);
hr = i_dispatch->lpVtbl->GetIDsOfNames(i_dispatch, &IID_NULL, &funcname, 1, LOCALE_SYSTEM_DEFAULT, &dispid);
hr = php_COM_get_ids_of_names(obj, &funcname, &dispid);
if (FAILED(hr)) {
error_message = php_COM_error_message(hr);
@@ -337,9 +398,7 @@ int do_COM_invoke(IDispatch *i_dispatch, pval *function_name, VARIANTARG *var_re
dispparams.cArgs = arg_count;
dispparams.cNamedArgs = 0;
hr = i_dispatch->lpVtbl->Invoke(i_dispatch, dispid, &IID_NULL,
LOCALE_SYSTEM_DEFAULT, DISPATCH_METHOD|DISPATCH_PROPERTYGET,
&dispparams, var_result, NULL, NULL);
hr = php_COM_invoke(obj, dispid, DISPATCH_METHOD|DISPATCH_PROPERTYGET, &dispparams, var_result);
if (FAILED(hr)) {
error_message = php_COM_error_message(hr);
@@ -362,7 +421,7 @@ PHP_FUNCTION(COM_invoke)
{
pval **arguments;
pval *object, *function_name;
IDispatch *i_dispatch;
i_dispatch *obj;
int type;
int arg_count = ZEND_NUM_ARGS();
VARIANTARG var_result;
@@ -378,10 +437,10 @@ PHP_FUNCTION(COM_invoke)
object = arguments[0];
function_name = arguments[1];
/* obtain i_dispatch interface */
/* obtain IDispatch interface */
convert_to_long(object);
i_dispatch = (IDispatch *)zend_list_find(object->value.lval, &type);
if (!i_dispatch || (type!=le_idispatch)) {
obj = (i_dispatch *)zend_list_find(object->value.lval, &type);
if (!obj || (type!=le_idispatch)) {
php_error(E_WARNING,"%d is not a COM object handler", function_name->value.str.val);
RETURN_FALSE;
}
@@ -389,7 +448,7 @@ PHP_FUNCTION(COM_invoke)
/* obtain property/method handler */
convert_to_string(function_name);
if (do_COM_invoke(i_dispatch, function_name, &var_result, arguments+2, arg_count-2)==FAILURE) {
if (do_COM_invoke(obj, function_name, &var_result, arguments+2, arg_count-2)==FAILURE) {
RETURN_FALSE;
}
efree(arguments);
@@ -403,16 +462,21 @@ static int do_COM_offget(VARIANTARG *var_result, VARIANTARG *array, pval *arg_pr
switch (array->vt) {
case VT_DISPATCH: { /* a Collection, possibly */
pval function_name;
IDispatch *i_dispatch = array->pdispVal;
i_dispatch *obj;
int retval;
obj = (i_dispatch *) emalloc(sizeof(i_dispatch));
php_COM_set(obj, array->pdispVal, TRUE);
function_name.value.str.val = "Item";
function_name.value.str.len = 4;
function_name.type = IS_STRING;
retval = do_COM_invoke(i_dispatch, &function_name, var_result, &arg_property, 1);
retval = do_COM_invoke(obj, &function_name, var_result, &arg_property, 1);
if (cleanup) {
i_dispatch->lpVtbl->Release(i_dispatch);
php_COM_release(obj);
}
efree(obj);
return retval;
}
}
@@ -420,7 +484,7 @@ static int do_COM_offget(VARIANTARG *var_result, VARIANTARG *array, pval *arg_pr
}
static int do_COM_propget(VARIANTARG *var_result, IDispatch *i_dispatch, pval *arg_property, int cleanup)
static int do_COM_propget(VARIANTARG *var_result, i_dispatch *obj, pval *arg_property, int cleanup)
{
DISPID dispid;
HRESULT hr;
@@ -432,7 +496,7 @@ static int do_COM_propget(VARIANTARG *var_result, IDispatch *i_dispatch, pval *a
/* obtain property handler */
propname = php_char_to_OLECHAR(arg_property->value.str.val, arg_property->value.str.len, codepage);
hr = i_dispatch->lpVtbl->GetIDsOfNames(i_dispatch, &IID_NULL, &propname, 1, LOCALE_SYSTEM_DEFAULT, &dispid);
hr = php_COM_get_ids_of_names(obj, &propname, &dispid);
if (FAILED(hr)) {
error_message = php_COM_error_message(hr);
@@ -440,7 +504,7 @@ static int do_COM_propget(VARIANTARG *var_result, IDispatch *i_dispatch, pval *a
LocalFree(error_message);
efree(propname);
if (cleanup) {
i_dispatch->lpVtbl->Release(i_dispatch);
php_COM_release(obj);
}
return FAILURE;
}
@@ -448,7 +512,7 @@ static int do_COM_propget(VARIANTARG *var_result, IDispatch *i_dispatch, pval *a
dispparams.cArgs = 0;
dispparams.cNamedArgs = 0;
hr = i_dispatch->lpVtbl->Invoke(i_dispatch, dispid, &IID_NULL, LOCALE_SYSTEM_DEFAULT, DISPATCH_PROPERTYGET, &dispparams, var_result, NULL, 0);
hr = php_COM_invoke(obj, dispid, DISPATCH_PROPERTYGET, &dispparams, var_result);
if (FAILED(hr)) {
error_message = php_COM_error_message(hr);
@@ -456,35 +520,37 @@ static int do_COM_propget(VARIANTARG *var_result, IDispatch *i_dispatch, pval *a
LocalFree(error_message);
efree(propname);
if (cleanup) {
i_dispatch->lpVtbl->Release(i_dispatch);
php_COM_release(obj);
}
return FAILURE;
}
efree(propname);
if (cleanup) {
i_dispatch->lpVtbl->Release(i_dispatch);
php_COM_release(obj);
}
return SUCCESS;
}
static void do_COM_propput(pval *return_value, IDispatch *i_dispatch, pval *arg_property, pval *value)
static void do_COM_propput(pval *return_value, i_dispatch *obj, pval *arg_property, pval *value)
{
DISPID dispid;
HRESULT hr;
OLECHAR *propname;
char *error_message;
VARIANTARG var_result;
VARIANT *var_result;
DISPPARAMS dispparams;
VARIANTARG new_value;
DISPID mydispid = DISPID_PROPERTYPUT;
var_result = emalloc(sizeof(VARIANT));
/* obtain property handler */
propname = php_char_to_OLECHAR(arg_property->value.str.val, arg_property->value.str.len, codepage);
hr = i_dispatch->lpVtbl->GetIDsOfNames(i_dispatch, &IID_NULL, &propname, 1, LOCALE_SYSTEM_DEFAULT, &dispid);
hr = php_COM_get_ids_of_names(obj, &propname, &dispid);
if (FAILED(hr)) {
error_message = php_COM_error_message(hr);
@@ -494,16 +560,14 @@ static void do_COM_propput(pval *return_value, IDispatch *i_dispatch, pval *arg_
RETURN_FALSE;
}
php_pval_to_variant(value, &new_value, codepage);
dispparams.rgvarg = &new_value;
dispparams.rgdispidNamedArgs = &mydispid;
dispparams.cArgs = 1;
dispparams.cNamedArgs = 1;
hr = i_dispatch->lpVtbl->Invoke(i_dispatch, dispid, &IID_NULL,
LOCALE_SYSTEM_DEFAULT, DISPATCH_PROPERTYPUT,
&dispparams, NULL, NULL, 0);
hr = php_COM_invoke(obj, dispid, DISPATCH_PROPERTYPUT, &dispparams, NULL);
if (FAILED(hr)) {
error_message = php_COM_error_message(hr);
php_error(E_WARNING,"PropPut() failed: %s\n", error_message);
@@ -515,18 +579,16 @@ static void do_COM_propput(pval *return_value, IDispatch *i_dispatch, pval *arg_
dispparams.cArgs = 0;
dispparams.cNamedArgs = 0;
hr = i_dispatch->lpVtbl->Invoke(i_dispatch, dispid, &IID_NULL,
LOCALE_SYSTEM_DEFAULT, DISPATCH_PROPERTYGET,
&dispparams, &var_result, NULL, 0);
hr = php_COM_invoke(obj, dispid, DISPATCH_PROPERTYGET, &dispparams, var_result);
if (SUCCEEDED(hr)) {
php_variant_to_pval(&var_result, return_value, 0, codepage);
php_variant_to_pval(var_result, return_value, 0, codepage);
} else {
*return_value = *value;
zval_copy_ctor(return_value);
}
efree(var_result);
efree(propname);
}
@@ -537,23 +599,22 @@ PHP_FUNCTION(com_propget)
{
pval *arg_idispatch, *arg_property;
int type;
IDispatch *i_dispatch;
i_dispatch *obj;
VARIANTARG var_result;
if (ZEND_NUM_ARGS()!=2 || getParameters(ht, 2, &arg_idispatch, &arg_property)==FAILURE) {
WRONG_PARAM_COUNT;
}
/* obtain i_dispatch interface */
/* obtain IDispatch interface */
convert_to_long(arg_idispatch);
/* obtain i_dispatch interface */
i_dispatch = (IDispatch *)zend_list_find(arg_idispatch->value.lval,&type);
if (!i_dispatch || (type!=le_idispatch)) {
obj = (i_dispatch *)zend_list_find(arg_idispatch->value.lval,&type);
if (!obj || (type!=le_idispatch)) {
php_error(E_WARNING,"%d is not a COM object handler", arg_idispatch->value.lval);
}
convert_to_string(arg_property);
if (do_COM_propget(&var_result, i_dispatch, arg_property, 0)==FAILURE) {
if (do_COM_propget(&var_result, obj, arg_property, 0)==FAILURE) {
RETURN_FALSE;
}
php_variant_to_pval(&var_result, return_value, 0, codepage);
@@ -567,7 +628,7 @@ PHP_FUNCTION(com_propput)
{
pval *arg_idispatch, *arg_property, *arg_value;
int type;
IDispatch *i_dispatch;
i_dispatch *obj;
if (ZEND_NUM_ARGS()!=3 || getParameters(ht, 3, &arg_idispatch, &arg_property, &arg_value)==FAILURE) {
WRONG_PARAM_COUNT;
@@ -576,62 +637,72 @@ PHP_FUNCTION(com_propput)
/* obtain i_dispatch interface */
convert_to_long(arg_idispatch);
/* obtain i_dispatch interface */
i_dispatch = (IDispatch *)zend_list_find(arg_idispatch->value.lval,&type);
if (!i_dispatch || (type!=le_idispatch)) {
obj = (i_dispatch *)zend_list_find(arg_idispatch->value.lval,&type);
if (!obj || (type!=le_idispatch)) {
php_error(E_WARNING,"%d is not a COM object handler", arg_idispatch->value.lval);
}
convert_to_string(arg_property);
do_COM_propput(return_value, i_dispatch, arg_property, arg_value);
do_COM_propput(return_value, obj, arg_property, arg_value);
}
/* }}} */
VARIANTARG _php_COM_get_property_handler(zend_property_reference *property_reference)
VARIANT *_php_COM_get_property_handler(zend_property_reference *property_reference)
{
zend_overloaded_element *overloaded_property;
zend_llist_element *element;
pval **idispatch_handle;
pval *object = property_reference->object;
IDispatch *i_dispatch;
int type;
VARIANTARG var_result;
VARIANT *var_result;
i_dispatch *obj, *obj_prop;
/* fetch the IDispatch interface */
zend_hash_index_find(object->value.obj.properties, 0, (void **) &idispatch_handle);
i_dispatch = (IDispatch *)zend_list_find((*idispatch_handle)->value.lval,&type);
if (!i_dispatch || (type!=le_idispatch)) {
var_result.vt = VT_EMPTY;
return var_result;
obj = (i_dispatch *) zend_list_find((*idispatch_handle)->value.lval, &type);
if (!obj || (type!=le_idispatch)) {
return NULL;
}
var_result.vt = VT_DISPATCH;
var_result.pdispVal = i_dispatch;
obj_prop = (i_dispatch *) emalloc(sizeof(i_dispatch));
php_COM_clone(obj_prop, obj, FALSE);
var_result = (VARIANT *) emalloc(sizeof(VARIANT));
var_result->vt = VT_DISPATCH;
var_result->pdispVal = obj_prop->i.dispatch;
for (element=property_reference->elements_list->head; element; element=element->next) {
overloaded_property = (zend_overloaded_element *) element->data;
switch (overloaded_property->type) {
case OE_IS_ARRAY:
if (do_COM_offget(&var_result, &var_result, &overloaded_property->element, element!=property_reference->elements_list->head)==FAILURE) {
var_result.vt = VT_EMPTY;
if (do_COM_offget(var_result, var_result, &overloaded_property->element, element!=property_reference->elements_list->head)==FAILURE) {
var_result->vt = VT_EMPTY;
efree(obj_prop);
return var_result;
}
/*printf("Array offset: ");*/
break;
case OE_IS_OBJECT:
if (var_result.vt != VT_DISPATCH) {
var_result.vt = VT_EMPTY;
if (var_result->vt != VT_DISPATCH) {
var_result->vt = VT_EMPTY;
efree(obj_prop);
return var_result;
} else {
if (do_COM_propget(&var_result, var_result.pdispVal, &overloaded_property->element, element!=property_reference->elements_list->head)==FAILURE) {
var_result.vt = VT_EMPTY;
php_COM_set(obj_prop, var_result->pdispVal, TRUE);
if (do_COM_propget(var_result, obj_prop, &overloaded_property->element, element!=property_reference->elements_list->head)==FAILURE) {
var_result->vt = VT_EMPTY;
efree(obj_prop);
return var_result;
}
/*printf("Object property: ");*/
}
break;
case OE_IS_METHOD:
var_result->pdispVal = obj_prop->i.dispatch;
efree(obj_prop);
return var_result;
break;
}
@@ -647,15 +718,17 @@ VARIANTARG _php_COM_get_property_handler(zend_property_reference *property_refer
*/
pval_destructor(&overloaded_property->element);
}
efree(obj_prop);
return var_result;
}
PHPAPI pval php_COM_get_property_handler(zend_property_reference *property_reference)
{
pval result;
VARIANTARG var_result = _php_COM_get_property_handler(property_reference);
VARIANT *var_result = _php_COM_get_property_handler(property_reference);
php_variant_to_pval(&var_result, &result, 0, codepage);
php_variant_to_pval(var_result, &result, 0, codepage);
efree(var_result);
return result;
}
@@ -667,19 +740,19 @@ PHPAPI int php_COM_set_property_handler(zend_property_reference *property_refere
zend_llist_element *element;
pval **idispatch_handle;
pval *object = property_reference->object;
IDispatch *i_dispatch;
i_dispatch *obj;
int type;
VARIANTARG var_result;
/* fetch the IDispatch interface */
zend_hash_index_find(object->value.obj.properties, 0, (void **) &idispatch_handle);
i_dispatch = (IDispatch *)zend_list_find((*idispatch_handle)->value.lval,&type);
if (!i_dispatch || (type!=le_idispatch)) {
obj = (i_dispatch *)zend_list_find((*idispatch_handle)->value.lval,&type);
if (!obj || (type!=le_idispatch)) {
return FAILURE;
}
var_result.vt = VT_DISPATCH;
var_result.pdispVal = i_dispatch;
var_result.pdispVal = obj->i.dispatch;
for (element=property_reference->elements_list->head; element && element!=property_reference->elements_list->tail; element=element->next) {
overloaded_property = (zend_overloaded_element *) element->data;
@@ -691,7 +764,8 @@ PHPAPI int php_COM_set_property_handler(zend_property_reference *property_refere
if (var_result.vt != VT_DISPATCH) {
return FAILURE;
} else {
do_COM_propget(&var_result, i_dispatch, &overloaded_property->element, element!=property_reference->elements_list->head);
// ??????
do_COM_propget(&var_result, obj, &overloaded_property->element, element!=property_reference->elements_list->head);
/*printf("Object property: ");*/
}
break;
@@ -715,9 +789,15 @@ PHPAPI int php_COM_set_property_handler(zend_property_reference *property_refere
if (var_result.vt != VT_DISPATCH) {
return FAILURE;
}
obj = (i_dispatch *) emalloc(sizeof(i_dispatch));
obj->typelib = FALSE;
obj->i.dispatch = var_result.pdispVal;
overloaded_property = (zend_overloaded_element *) element->data;
do_COM_propput(&result, var_result.pdispVal, &overloaded_property->element, value);
do_COM_propput(&result, obj, &overloaded_property->element, value);
pval_destructor(&overloaded_property->element);
efree(obj);
return SUCCESS;
}
@@ -745,24 +825,26 @@ PHPAPI void php_COM_call_function_handler(INTERNAL_FUNCTION_PARAMETERS, zend_pro
zend_hash_index_update(object->value.obj.properties, 0, &object_handle, sizeof(pval *), NULL);
pval_destructor(&function_name->element);
} else {
VARIANTARG object_handle = _php_COM_get_property_handler(property_reference);
i_dispatch *obj;
pval **arguments;
int arg_count = ZEND_NUM_ARGS();
VARIANTARG var_result;
var_result.vt = VT_EMPTY;
if (object_handle.vt != VT_DISPATCH) {
/* that shouldn't happen */
return;
}
obj = (i_dispatch *) emalloc(sizeof(i_dispatch));
php_COM_set(obj, _php_COM_get_property_handler(property_reference)->pdispVal, TRUE);
arguments = (pval **) emalloc(sizeof(pval *)*arg_count);
getParametersArray(ht, arg_count, arguments);
if (do_COM_invoke((IDispatch *) object_handle.pdispVal, &function_name->element, &var_result, arguments, arg_count)==FAILURE) {
if (do_COM_invoke(obj , &function_name->element, &var_result, arguments, arg_count)==FAILURE) {
RETVAL_FALSE;
}
pval_destructor(&function_name->element);
php_COM_release(obj);
efree(obj);
efree(arguments);
php_variant_to_pval(&var_result, return_value, 0, codepage);
}
@@ -788,18 +870,52 @@ static int php_COM_load_typelib(char *typelib_name, int mode)
ITypeLib *TypeLib;
ITypeComp *TypeComp;
OLECHAR *p;
CLSID clsid;
char *strtok_buf, *major, *minor;
int i;
int interfaces;
ELS_FETCH();
typelib_name = php_strtok_r(typelib_name, ",", &strtok_buf);
major = php_strtok_r(NULL, ",", &strtok_buf);
minor = php_strtok_r(NULL, ",", &strtok_buf);
p = php_char_to_OLECHAR(typelib_name, strlen(typelib_name), codepage);
if (FAILED(LoadTypeLib(p, &TypeLib))) {
efree(p);
return FAILURE;
if (!FAILED(CLSIDFromString(p, &clsid))) {
HRESULT hr;
if (major && minor) {
hr = LoadRegTypeLib((REFGUID) &clsid, 1, 0, LANG_NEUTRAL, &TypeLib);
}
if (!major || !minor || FAILED(hr)) {
IDispatch *i_dispatch;
ITypeInfo *TypeInfo;
int idx;
if (FAILED(CoCreateInstance(&clsid, NULL, CLSCTX_SERVER, &IID_IDispatch, (LPVOID *) &i_dispatch))) {
efree(p);
return FAILURE;
}
if (FAILED(i_dispatch->lpVtbl->GetTypeInfo(i_dispatch, 0, LANG_NEUTRAL, &TypeInfo))) {
efree(p);
return FAILURE;
}
if (FAILED(TypeInfo->lpVtbl->GetContainingTypeLib(TypeInfo, &TypeLib, &idx))) {
efree(p);
return FAILURE;
}
}
} else {
if (FAILED(LoadTypeLib(p, &TypeLib))) {
efree(p);
return FAILURE;
}
}
interfaces = TypeLib->lpVtbl->GetTypeInfoCount(TypeLib);
interfaces = TypeLib->lpVtbl->GetTypeInfoCount(TypeLib);
TypeLib->lpVtbl->GetTypeComp(TypeLib, &TypeComp);
for (i=0; i<interfaces; i++) {
@@ -865,7 +981,6 @@ void php_register_COM_class()
zend_register_internal_class(&com_class_entry);
}
PHP_MINIT_FUNCTION(COM)
{
CoInitialize(NULL);
@@ -883,7 +998,6 @@ PHP_MSHUTDOWN_FUNCTION(COM)
return SUCCESS;
}
BEGIN_EXTERN_C()
// exports for external object creation
zend_module_entry COM_module_entry = {
@@ -894,6 +1008,4 @@ PHPAPI int php_COM_get_le_idispatch() {
return le_idispatch;
}
END_EXTERN_C()
#endif
+24
View File
@@ -0,0 +1,24 @@
#ifndef COM_H
#define COM_H
#if PHP_WIN32
#include "unknwn.h"
typedef struct i_dispatch_ {
int typelib;
struct {
IDispatch *dispatch;
ITypeInfo *typeinfo;
} i;
} i_dispatch;
PHPAPI HRESULT php_COM_invoke(i_dispatch *obj, DISPID dispIdMember, WORD wFlags, DISPPARAMS FAR* pDispParams, VARIANT FAR* pVarResult);
PHPAPI HRESULT php_COM_get_ids_of_names(i_dispatch *obj, OLECHAR FAR* FAR* rgszNames, DISPID FAR* rgDispId);
PHPAPI HRESULT php_COM_release(i_dispatch *obj);
PHPAPI HRESULT php_COM_set(i_dispatch *obj, IDispatch FAR* pDisp, int cleanup);
PHPAPI HRESULT php_COM_clone(i_dispatch *obj, i_dispatch *clone, int cleanup);
#endif /* PHP_WIN32 */
#endif /* COM_H */
+1 -7
View File
@@ -3,7 +3,7 @@
#if PHP_WIN32
BEGIN_EXTERN_C()
#include "com.h"
extern PHP_MINIT_FUNCTION(COM);
extern PHP_MSHUTDOWN_FUNCTION(COM);
@@ -13,17 +13,11 @@ extern int php_COM_get_le_idispatch();
extern zend_module_entry COM_module_entry;
extern zend_class_entry com_class_entry;
END_EXTERN_C()
#ifdef __cplusplus
extern pval php_COM_get_property_handler(zend_property_reference *property_reference);
extern int php_COM_set_property_handler(zend_property_reference *property_reference, pval *value);
extern char *php_COM_error_message(HRESULT hr);
extern void php_COM_call_function_handler(INTERNAL_FUNCTION_PARAMETERS, zend_property_reference *property_reference);
#endif
#define COM_module_ptr &COM_module_entry
#else
+30 -30
View File
@@ -69,38 +69,38 @@ PHP_MINIT_FUNCTION(VARIANT)
le_variant = zend_register_list_destructors_ex(php_variant_destructor, NULL, "VARIANT", module_number);
/* variant datatypes */
REGISTER_LONG_CONSTANT("VT_NULL", VT_NULL, 0);
REGISTER_LONG_CONSTANT("VT_EMPTY", VT_EMPTY, 0);
REGISTER_LONG_CONSTANT("VT_UI1", VT_UI1, 0);
REGISTER_LONG_CONSTANT("VT_I2", VT_I2, 0);
REGISTER_LONG_CONSTANT("VT_I4", VT_I4, 0);
REGISTER_LONG_CONSTANT("VT_R4", VT_R4, 0);
REGISTER_LONG_CONSTANT("VT_R8", VT_R8, 0);
REGISTER_LONG_CONSTANT("VT_BOOL", VT_BOOL, 0);
REGISTER_LONG_CONSTANT("VT_ERROR", VT_ERROR, 0);
REGISTER_LONG_CONSTANT("VT_CY", VT_CY, 0);
REGISTER_LONG_CONSTANT("VT_DATE", VT_CY, 0);
REGISTER_LONG_CONSTANT("VT_BSTR", VT_BSTR, 0);
REGISTER_LONG_CONSTANT("VT_DECIMAL", VT_DECIMAL, 0);
REGISTER_LONG_CONSTANT("VT_UNKNOWN", VT_UNKNOWN, 0);
REGISTER_LONG_CONSTANT("VT_DISPATCH", VT_DISPATCH, 0);
REGISTER_LONG_CONSTANT("VT_VARIANT", VT_VARIANT, 0);
REGISTER_LONG_CONSTANT("VT_I1", VT_I1, 0);
REGISTER_LONG_CONSTANT("VT_UI2", VT_UI2, 0);
REGISTER_LONG_CONSTANT("VT_UI4", VT_UI4, 0);
REGISTER_LONG_CONSTANT("VT_INT", VT_INT, 0);
REGISTER_LONG_CONSTANT("VT_UINT", VT_UINT, 0);
REGISTER_LONG_CONSTANT("VT_ARRAY", VT_ARRAY, 0);
REGISTER_LONG_CONSTANT("VT_BYREF", VT_BYREF, 0);
REGISTER_LONG_CONSTANT("VT_NULL", VT_NULL, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("VT_EMPTY", VT_EMPTY, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("VT_UI1", VT_UI1, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("VT_I2", VT_I2, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("VT_I4", VT_I4, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("VT_R4", VT_R4, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("VT_R8", VT_R8, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("VT_BOOL", VT_BOOL, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("VT_ERROR", VT_ERROR, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("VT_CY", VT_CY, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("VT_DATE", VT_CY, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("VT_BSTR", VT_BSTR, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("VT_DECIMAL", VT_DECIMAL, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("VT_UNKNOWN", VT_UNKNOWN, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("VT_DISPATCH", VT_DISPATCH, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("VT_VARIANT", VT_VARIANT, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("VT_I1", VT_I1, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("VT_UI2", VT_UI2, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("VT_UI4", VT_UI4, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("VT_INT", VT_INT, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("VT_UINT", VT_UINT, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("VT_ARRAY", VT_ARRAY, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("VT_BYREF", VT_BYREF, CONST_CS | CONST_PERSISTENT);
/* codepages */
REGISTER_LONG_CONSTANT("CP_ACP", CP_ACP, 0);
REGISTER_LONG_CONSTANT("CP_MACCP", CP_MACCP, 0);
REGISTER_LONG_CONSTANT("CP_OEMCP", CP_OEMCP, 0);
REGISTER_LONG_CONSTANT("CP_SYMBOL", CP_SYMBOL, 0);
REGISTER_LONG_CONSTANT("CP_THREAD_ACP", CP_THREAD_ACP, 0);
REGISTER_LONG_CONSTANT("CP_UTF7", CP_UTF7, 0);
REGISTER_LONG_CONSTANT("CP_UTF8", CP_UTF8, 0);
REGISTER_LONG_CONSTANT("CP_ACP", CP_ACP, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("CP_MACCP", CP_MACCP, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("CP_OEMCP", CP_OEMCP, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("CP_SYMBOL", CP_SYMBOL, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("CP_THREAD_ACP", CP_THREAD_ACP, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("CP_UTF7", CP_UTF7, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("CP_UTF8", CP_UTF8, CONST_CS | CONST_PERSISTENT);
php_register_VARIANT_class();
return SUCCESS;
+5
View File
@@ -35,6 +35,10 @@
#define _XPG4_2
#define __EXTENSIONS__
#ifndef __PRAGMA_REDEFINE_EXTNAME
#define __PRAGMA_REDEFINE_EXTNAME
#endif
#include "ext/standard/info.h"
#include "php_sockets.h"
#include "php_ini.h"
@@ -1130,6 +1134,7 @@ PHP_FUNCTION(bind)
if (sock_type->sa_family == AF_UNIX) {
struct sockaddr_un *sa = (struct sockaddr_un *) sock_type;
memset(sa, 0, sizeof(sa_storage)); /* This is safe -> sock_type = &sa_storage -> sa = sock_type */
sa->sun_family = AF_UNIX;
snprintf(sa->sun_path, 108, "%s", Z_STRVAL_PP(arg1));
ret = bind(Z_LVAL_PP(arg0), (struct sockaddr *) sa, SUN_LEN(sa));
} else if (sock_type->sa_family == AF_INET) {
+1 -1
View File
@@ -2195,7 +2195,7 @@ PHP_FUNCTION(array_flip)
switch (zend_hash_get_current_key_ex(target_hash, &string_key, &str_key_len, &num_key, 1, &pos)) {
case HASH_KEY_IS_STRING:
Z_STRVAL_P(data) = string_key;
Z_STRLEN_P(data) = str_key_len;
Z_STRLEN_P(data) = str_key_len-1;
Z_TYPE_P(data) = IS_STRING;
break;
case HASH_KEY_IS_LONG:
+7 -2
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
@@ -2471,6 +2471,7 @@ PHP_FUNCTION(move_uploaded_file)
zval **path, **new_path;
zend_bool successful=0;
SLS_FETCH();
PLS_FETCH();
if (!SG(rfc1867_uploaded_files)) {
RETURN_FALSE;
@@ -2485,7 +2486,11 @@ PHP_FUNCTION(move_uploaded_file)
if (!zend_hash_exists(SG(rfc1867_uploaded_files), Z_STRVAL_PP(path), Z_STRLEN_PP(path)+1)) {
RETURN_FALSE;
}
if (PG(safe_mode) && (!php_checkuid(Z_STRVAL_PP(new_path), NULL, CHECKUID_CHECK_FILE_AND_DIR))) {
RETURN_FALSE;
}
V_UNLINK(Z_STRVAL_PP(new_path));
if (rename(Z_STRVAL_PP(path), Z_STRVAL_PP(new_path))==0) {
successful=1;
+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
+12 -4
View File
@@ -919,7 +919,7 @@ PHP_FUNCTION(fgets)
/* needed because recv doesnt put a null at the end*/
memset(buf,0,len+1);
#ifdef HAVE_FLUSHIO
if (!issock) {
if (type == le_fopen) {
fseek((FILE*)what, 0, SEEK_CUR);
}
#endif
@@ -967,7 +967,7 @@ PHP_FUNCTION(fgetc) {
}
#ifdef HAVE_FLUSHIO
if (!issock) {
if (type == le_fopen) {
fseek((FILE*)what, 0, SEEK_CUR);
}
#endif
@@ -1170,7 +1170,9 @@ PHP_FUNCTION(fwrite)
ret = SOCK_WRITEL((*arg2)->value.str.val,num_bytes,socketd);
} else {
#ifdef HAVE_FLUSHIO
fseek((FILE*)what, 0, SEEK_CUR);
if (type == le_fopen) {
fseek((FILE*)what, 0, SEEK_CUR);
}
#endif
ret = fwrite((*arg2)->value.str.val,1,num_bytes,(FILE*)what);
}
@@ -1703,6 +1705,10 @@ PHP_FUNCTION(copy)
RETURN_FALSE;
}
if (PG(safe_mode) &&(!php_checkuid((*target)->value.str.val, NULL, CHECKUID_CHECK_FILE_AND_DIR))) {
RETURN_FALSE;
}
if (php_copy_file(Z_STRVAL_PP(source), Z_STRVAL_PP(target))==SUCCESS) {
RETURN_TRUE;
} else {
@@ -1808,7 +1814,9 @@ PHP_FUNCTION(fread)
if (!issock) {
#ifdef HAVE_FLUSHIO
fseek((FILE*)what, 0, SEEK_CUR);
if (type == le_fopen) {
fseek((FILE*)what, 0, SEEK_CUR);
}
#endif
return_value->value.str.len = fread(return_value->value.str.val, 1, len, (FILE*)what);
return_value->value.str.val[return_value->value.str.len] = 0;
+1 -1
View File
@@ -92,7 +92,7 @@ static char *php_convert_to_decimal(double arg, int ndigits, int *decpt, int *si
while (p1 < &cvt_buf[NDIG])
*p++ = *p1++;
} else if (arg > 0) {
while ((fj = arg * 10) < 1) {
while ((fj = arg * 10.0) < 0.9999999) {
arg = fj;
r2--;
}
+2 -1
View File
@@ -13,7 +13,7 @@
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Authors: Paul Panotzki - Bunyip Information Systems |
| Jim Winstead (jimw@php.net) |
| Jim Winstead <jimw@php.net> |
| Sascha Schumann <sascha@schumann.cx> |
+----------------------------------------------------------------------+
*/
@@ -596,6 +596,7 @@ PHPAPI void php_sockset_timeout(int socket, struct timeval *timeout)
SOCK_FIND(sock, socket);
sock->timeout = *timeout;
sock->timeout_event = 0;
}
#define SOCK_FIND_AND_READ_MAX(max) \
+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"
+3 -2
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;
@@ -213,6 +214,7 @@ PHPAPI void php_end_ob_buffer(zend_bool send_buffer, zend_bool just_flush)
zend_stack_destroy(&OG(ob_buffers));
}
}
OG(nesting_level)--;
}
if (send_buffer) {
@@ -225,8 +227,6 @@ PHPAPI void php_end_ob_buffer(zend_bool send_buffer, zend_bool just_flush)
if (!just_flush) {
efree(to_be_destroyed_buffer);
OG(nesting_level)--;
} else {
OG(active_ob_buffer).text_length = 0;
OG(active_ob_buffer).status |= PHP_OUTPUT_HANDLER_START;
@@ -446,6 +446,7 @@ static int php_ub_body_write(const char *str, uint str_length)
OLS_FETCH();
if (SG(request_info).headers_only) {
php_header();
zend_bailout();
}
if (php_header()) {
+1 -1
View File
@@ -902,7 +902,7 @@ PHP_FUNCTION(pathinfo)
int idx;
p = strrchr(Z_STRVAL_PP(path), '.');
if (*p) {
if (p) {
idx = p - Z_STRVAL_PP(path);
add_assoc_stringl(tmp, "extension", Z_STRVAL_PP(path) + idx + 1, len - idx - 1, 1);
}
+3 -3
View File
@@ -67,12 +67,12 @@ static char *url_attr_addon(const char *tag,const char *attr,const char *val,con
if(flag) {
if(!strstr(val,buf)&&!strchr(val,':'))
{
char *result = (char *)emalloc(strlen(buf)+strlen(PG(arg_separator))+1);
char *result = (char *)emalloc(strlen(buf)+strlen(PG(arg_separator).output)+1);
int n;
if(strchr(val,'?')) {
strcpy(result,PG(arg_separator));
n=strlen(PG(arg_separator));
strcpy(result,PG(arg_separator).output);
n=strlen(PG(arg_separator).output);
} else {
*result='?';
n=1;
+4 -4
View File
@@ -1,5 +1,5 @@
/* Generated by re2c 0.5 on Tue Jan 9 17:13:20 2001 */
#line 1 "/home/sas/src/php4/ext/standard/url_scanner_ex.re"
/* Generated by re2c 0.5 on Wed Apr 4 19:29:46 2001 */
#line 1 "/usr/src/web/php/php4/ext/standard/url_scanner_ex.re"
/*
+----------------------------------------------------------------------+
| PHP version 4.0 |
@@ -140,7 +140,7 @@ static inline void tag_arg(url_adapt_state_ex_t *ctx, char quote PLS_DC)
smart_str_appendc(&ctx->result, quote);
if (f) {
append_modified_url(&ctx->val, &ctx->result, &ctx->q_name, &ctx->q_value, PG(arg_separator));
append_modified_url(&ctx->val, &ctx->result, &ctx->q_name, &ctx->q_value, PG(arg_separator).output);
} else {
smart_str_append(&ctx->result, &ctx->val);
}
@@ -670,7 +670,7 @@ char *url_adapt_single_url(const char *url, size_t urllen, const char *name, con
smart_str_sets(&sname, name);
smart_str_sets(&sval, value);
append_modified_url(&surl, &buf, &sname, &sval, PG(arg_separator));
append_modified_url(&surl, &buf, &sname, &sval, PG(arg_separator).output);
smart_str_0(&buf);
if (newlen) *newlen = buf.len;
+2 -2
View File
@@ -138,7 +138,7 @@ static inline void tag_arg(url_adapt_state_ex_t *ctx, char quote PLS_DC)
smart_str_appendc(&ctx->result, quote);
if (f) {
append_modified_url(&ctx->val, &ctx->result, &ctx->q_name, &ctx->q_value, PG(arg_separator));
append_modified_url(&ctx->val, &ctx->result, &ctx->q_name, &ctx->q_value, PG(arg_separator).output);
} else {
smart_str_append(&ctx->result, &ctx->val);
}
@@ -313,7 +313,7 @@ char *url_adapt_single_url(const char *url, size_t urllen, const char *name, con
smart_str_sets(&sname, name);
smart_str_sets(&sval, value);
append_modified_url(&surl, &buf, &sname, &sval, PG(arg_separator));
append_modified_url(&surl, &buf, &sname, &sval, PG(arg_separator).output);
smart_str_0(&buf);
if (newlen) *newlen = buf.len;
+6
View File
@@ -1156,11 +1156,17 @@ PHP_FUNCTION(ob_gzhandler)
if (sapi_add_header("Content-Encoding: gzip", sizeof("Content-Encoding: gzip") - 1, 1)==FAILURE) {
return_original = 1;
}
if (sapi_add_header("Vary: Accept-Encoding", sizeof("Vary: Accept-Encoding") - 1, 1)==FAILURE) {
return_original = 1;
}
break;
case CODING_DEFLATE:
if (sapi_add_header("Content-Encoding: deflate", sizeof("Content-Encoding: deflate") - 1, 1)==FAILURE) {
return_original = 1;
}
if (sapi_add_header("Vary: Accept-Encoding", sizeof("Vary: Accept-Encoding") - 1, 1)==FAILURE) {
return_original = 1;
}
break;
default:
return_original = 1;
+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));
+17 -5
View File
@@ -139,6 +139,18 @@ static void php_disable_functions()
}
static PHP_INI_MH(OnUpdateDeprecated)
{
PLS_FETCH();
PG(arg_separator.output) = new_value;
if (stage==PHP_INI_STAGE_RUNTIME) {
php_error(E_WARNING, "The arg_separator directive is deprecated. Use arg_separator.output instead");
}
return SUCCESS;
}
static PHP_INI_MH(OnUpdateTimeout)
{
ELS_FETCH();
@@ -209,7 +221,10 @@ PHP_INI_BEGIN()
STD_PHP_INI_BOOLEAN("track_errors", "0", PHP_INI_ALL, OnUpdateBool, track_errors, php_core_globals, core_globals)
STD_PHP_INI_BOOLEAN("y2k_compliance", "0", PHP_INI_ALL, OnUpdateBool, y2k_compliance, php_core_globals, core_globals)
STD_PHP_INI_ENTRY("arg_separator", "&", PHP_INI_ALL, OnUpdateStringUnempty, arg_separator, php_core_globals, core_globals)
STD_PHP_INI_ENTRY("arg_separator.output", "&", PHP_INI_ALL, OnUpdateStringUnempty, arg_separator.output, php_core_globals, core_globals)
STD_PHP_INI_ENTRY("arg_separator.input", "&", PHP_INI_SYSTEM|PHP_INI_PERDIR, OnUpdateStringUnempty, arg_separator.input, php_core_globals, core_globals)
PHP_INI_ENTRY("arg_separator", "&", PHP_INI_ALL, OnUpdateDeprecated)
STD_PHP_INI_ENTRY("auto_append_file", NULL, PHP_INI_ALL, OnUpdateString, auto_append_file, php_core_globals, core_globals)
STD_PHP_INI_ENTRY("auto_prepend_file", NULL, PHP_INI_ALL, OnUpdateString, auto_prepend_file, php_core_globals, core_globals)
STD_PHP_INI_ENTRY("doc_root", NULL, PHP_INI_SYSTEM, OnUpdateStringUnempty, doc_root, php_core_globals, core_globals)
@@ -870,10 +885,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();
+3 -2
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;
@@ -213,6 +214,7 @@ PHPAPI void php_end_ob_buffer(zend_bool send_buffer, zend_bool just_flush)
zend_stack_destroy(&OG(ob_buffers));
}
}
OG(nesting_level)--;
}
if (send_buffer) {
@@ -225,8 +227,6 @@ PHPAPI void php_end_ob_buffer(zend_bool send_buffer, zend_bool just_flush)
if (!just_flush) {
efree(to_be_destroyed_buffer);
OG(nesting_level)--;
} else {
OG(active_ob_buffer).text_length = 0;
OG(active_ob_buffer).status |= PHP_OUTPUT_HANDLER_START;
@@ -446,6 +446,7 @@ static int php_ub_body_write(const char *str, uint str_length)
OLS_FETCH();
if (SG(request_info).headers_only) {
php_header();
zend_bailout();
}
if (php_header()) {
+7 -1
View File
@@ -52,6 +52,11 @@ extern ZEND_API struct _php_core_globals core_globals;
struct _php_tick_function_entry;
typedef struct _arg_separators {
char *output;
char *input;
} arg_separators;
struct _php_core_globals {
zend_bool magic_quotes_gpc;
zend_bool magic_quotes_runtime;
@@ -93,7 +98,8 @@ struct _php_core_globals {
char *auto_prepend_file;
char *auto_append_file;
char *arg_separator;
arg_separators arg_separator;
char *gpc_order;
char *variables_order;
+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:
*/
+20 -16
View File
@@ -16,7 +16,7 @@
| Zeev Suraski <zeev@zend.com> |
+----------------------------------------------------------------------+
*/
/* $Id: */
/* $Id$ */
#include <stdio.h>
#include "php.h"
@@ -217,7 +217,7 @@ SAPI_POST_HANDLER_FUNC(php_std_post_handler)
void php_treat_data(int arg, char *str, zval* destArray ELS_DC PLS_DC SLS_DC)
{
char *res = NULL, *var, *val;
char *res = NULL, *var, *val, *separator=NULL;
const char *c_var;
pval *array_ptr;
int free_buffer=0;
@@ -252,7 +252,7 @@ void php_treat_data(int arg, char *str, zval* destArray ELS_DC PLS_DC SLS_DC)
return;
}
if (arg == PARSE_GET) { /* GET data */
if (arg == PARSE_GET) { /* GET data */
c_var = SG(request_info).query_string;
if (c_var && *c_var) {
res = (char *) estrdup(c_var);
@@ -277,14 +277,18 @@ void php_treat_data(int arg, char *str, zval* destArray ELS_DC PLS_DC SLS_DC)
return;
}
if (arg == PARSE_COOKIE) {
var = php_strtok_r(res, ";", &strtok_buf);
} else if (arg == PARSE_POST) {
var = php_strtok_r(res, "&", &strtok_buf);
} else {
var = php_strtok_r(res, PG(arg_separator), &strtok_buf);
switch (arg) {
case PARSE_GET:
case PARSE_STRING:
separator = (char *) estrdup(PG(arg_separator).input);
break;
case PARSE_COOKIE:
separator = ";\0";
break;
}
var = php_strtok_r(res, separator, &strtok_buf);
while (var) {
val = strchr(var, '=');
if (val) { /* have a value */
@@ -295,19 +299,19 @@ void php_treat_data(int arg, char *str, zval* destArray ELS_DC PLS_DC SLS_DC)
val_len = php_url_decode(val, strlen(val));
php_register_variable_safe(var, val, val_len, array_ptr ELS_CC PLS_CC);
}
if (arg == PARSE_COOKIE) {
var = php_strtok_r(NULL, ";", &strtok_buf);
} else {
var = php_strtok_r(NULL, PG(arg_separator), &strtok_buf);
}
var = php_strtok_r(NULL, separator, &strtok_buf);
}
if(arg != PARSE_COOKIE) {
efree(separator);
}
if (free_buffer) {
efree(res);
}
}
void php_import_environment_variables(zval *array_ptr ELS_DC PLS_DC)
{
char **env, *p, *t;
+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.5"
+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
?>
+13 -1
View File
@@ -243,7 +243,12 @@ warn_plus_overloading = Off
; The separator used in PHP generated URLs to separate arguments.
; Default is "&".
;arg_separator = "&amp;"
;arg_separator.output = "&amp;"
; List of separator(s) used by PHP to parse input URLs into variables.
; Default is "&".
; NOTE: Every character in this directive is considered as separator!
;arg_separator.input = ";&"
; This directive describes the order in which PHP registers GET, POST, Cookie,
; Environment and Built-in variables (G, P, C, E & S respectively, often
@@ -761,3 +766,10 @@ pfpro.defaulttimeout = 30
[Sockets]
; Use the system read() function instead of the php_read() wrapper.
sockets.use_system_read = On
[com]
; path to a file containing GUIDs, IIDs or filenames of files with TypeLibs
;com.typelib_file =
; allow Distributed-COM calls
;com.allow_dcom = true
+12 -2
View File
@@ -182,8 +182,14 @@ warn_plus_overloading = Off ; warn if the + operator is used with strings
;;;;;;;;;;;;;;;;;
; Data Handling ;
;;;;;;;;;;;;;;;;;
;arg_separator = "&amp;" ; The separator used in PHP generated URLs to separate arguments.
; Default is "&".
;arg_separator.output = "&amp;" ; The separator used in PHP generated URLs to separate arguments.
; Default is "&".
;arg_separator.input = ";&" ; List of separator(s) used by PHP to parse input URLs into variables.
; Default is "&".
; NOTE: Every character in this directive is considered as separator!
variables_order = "GPCS" ; This directive describes the order in which PHP registers
; GET, POST, Cookie, Environment and Built-in variables (G, P,
; C, E & S respectively, often referred to as EGPCS or GPC).
@@ -494,6 +500,10 @@ pfpro.defaulttimeout = 30 ; default timeout in seconds
[Sockets]
sockets.use_system_read = Off ; Use the system read() function instead of
; the php_read() wrapper.
[com]
;com.typelib_file = ; path to a file containing GUIDs, IIDs or filenames of files with TypeLibs
;com.allow_dcom = true ; allow Distributed-COM calls
; Local Variables:
; tab-width: 4
; End:
+12 -2
View File
@@ -182,8 +182,14 @@ warn_plus_overloading = Off ; warn if the + operator is used with strings
;;;;;;;;;;;;;;;;;
; Data Handling ;
;;;;;;;;;;;;;;;;;
;arg_separator = "&amp;" ; The separator used in PHP generated URLs to separate arguments.
; Default is "&".
;arg_separator.output = "&amp;" ; The separator used in PHP generated URLs to separate arguments.
; Default is "&".
;arg_separator.input = ";&" ; List of separator(s) used by PHP to parse input URLs into variables.
; Default is "&".
; NOTE: Every character in this directive is considered as separator!
variables_order = "GPCS" ; This directive describes the order in which PHP registers
; GET, POST, Cookie, Environment and Built-in variables (G, P,
; C, E & S respectively, often referred to as EGPCS or GPC).
@@ -494,6 +500,10 @@ pfpro.defaulttimeout = 30 ; default timeout in seconds
[Sockets]
sockets.use_system_read = Off ; Use the system read() function instead of
; the php_read() wrapper.
[com]
;com.typelib_file = ; path to a file containing GUIDs, IIDs or filenames of files with TypeLibs
;com.allow_dcom = true ; allow Distributed-COM calls
; Local Variables:
; tab-width: 4
; End:
+120 -42
View File
@@ -21,6 +21,8 @@
/*
* TODO:
* - look for test-specific php.ini files
* - implement module skipping for PEAR
* - do not test PEAR components if base class and/or component class cannot be instanciated
*/
ob_implicit_flush();
@@ -30,6 +32,9 @@ define('TEST_FAILED', -1);
define('TEST_SKIPPED', -2);
define('TEST_INTERNAL_ERROR', -3);
define('EXT_DIR_NAME','/php4/ext/');
define('EXT_DIR_NAME_LEN',strlen(EXT_DIR_NAME));
initialize();
/*
$opts = parse_options(&$argc, &$argv);
@@ -67,6 +72,43 @@ function dowriteln($str)
dowrite("$str\n");
}
function create_compiled_in_modules_list() {
global $php,$compiled_in_modules;
$ret=`$php -m`;
$compiled_in_modules=explode("\n",$ret);
foreach ($compiled_in_modules AS $key => $value) {
if (!$value
|| strchr($value,' ') ) unset($compiled_in_modules[$key]);
}
}
function extract_module_name_from_path($path) {
if ($pos1=strpos($path,EXT_DIR_NAME)) {
$pos3=strpos($path,'/',$pos1+EXT_DIR_NAME_LEN);
return substr($path,$pos2=$pos1+EXT_DIR_NAME_LEN,$pos3-$pos2);
}
}
function create_found_tests_4_modules_list() {
global $modules_2_test,$testdirs;
foreach ($testdirs AS $path) {
if ($mod_name=extract_module_name_from_path($path))
$modules_2_test[$mod_name]=TRUE;
}
}
function create_modules_2_test_list() {
global $compiled_in_modules,$modules_2_test,$modules_available;
foreach ($compiled_in_modules AS $value)
if ($modules_2_test[$value]) $modules_available[]=$value;
}
function initialize()
{
global $term, $windows_p, $php, $skip, $testdirs, $tmpfile,
@@ -87,19 +129,22 @@ function initialize()
$windows_p = (substr(php_uname(), 0, 7) == "Windows");
if ($windows_p) {
if (file_exists('Release_TS_inline/php.exe')) {
$php = 'Release_TS_inline\php.exe';
} elseif (file_exists('Release_TS/php.exe')) {
$php = 'Release_TS\php.exe';
if (file_exists('Release_TS_inline\\php.exe')) {
$php = 'Release_TS_inline\\php.exe';
} elseif (file_exists('Release_TS\\php.exe')) {
$php = 'Release_TS\\php.exe';
} else {
$php = "./php.exe";
$php=trim($windows_p ? `cd`:`pwd`).'\\php';
}
} else {
$php = $GLOBALS["TOP_BUILDDIR"]."/php";
// $php = $GLOBALS["TOP_BUILDDIR"]."/php"; // where should be the origin of this variable
$php=trim(`pwd`).'/php';
}
create_compiled_in_modules_list();
if (!is_executable($php)) {
dowriteln("PHP CGI binary ($php) not executable.");
dowriteln("PHP CGI binary ($php) is not executable.");
dowriteln("Please compile PHP as a CGI executable and try again.");
exit;
}
@@ -139,7 +184,7 @@ function &parse_options(&$argc, &$argv)
function do_testing($argc, &$argv)
{
global $term, $windows_p, $php, $skip, $testdirs, $tmpfile, $opts,
$skipped, $failed, $passed, $total, $term_bold, $term_norm;
$skipped, $failed, $passed, $total, $term_bold, $term_norm, $skipped_extensions;
if ($argc > 1) {
if (is_dir($argv[1])) {
@@ -162,11 +207,15 @@ function do_testing($argc, &$argv)
}
}
} else {
$dir = $GLOBALS["TOP_SRCDIR"];
// $dir = $GLOBALS["TOP_SRCDIR"]; // XXX ??? where should this variable be set?
$dir=str_replace('\\','/',trim(($windows_p ? `cd`:`pwd`)));
}
if (isset($dir) && $dir) {
find_testdirs($dir);
create_found_tests_4_modules_list();
create_modules_2_test_list();
for ($i = 0; $i < sizeof($testdirs); $i++) {
run_tests_in_dir($testdirs[$i]);
}
@@ -194,6 +243,9 @@ function do_testing($argc, &$argv)
dowriteln(sprintf("Tests skipped: %4d (%s%%)", $skipped, $skipped_pstr));
dowriteln(sprintf("Tests failed: %4d (%s%%)", $failed, $failed_pstr));
dowriteln(sprintf("Tests passed: %4d (%s%%)", $passed, $passed_pstr));
dowriteln("=============================");
dowriteln("Skipped ".sizeof($skipped_extensions)." extensions.");
}
function find_testdirs($dir = '.', $first_pass = true)
@@ -210,20 +262,27 @@ function find_testdirs($dir = '.', $first_pass = true)
}
while ($ent = readdir($dp)) {
$path = "$dir/$ent";
if ((isset($skip[$ent]) && $skip[$ent]) || substr($ent, 0, 1) == "." || !is_dir($path)) {
if ((isset($skip[$ent]) && $skip[$ent])
|| substr($ent, 0, 1) == "."
|| !is_dir($path)
) {
continue;
}
}
if (strstr("/$path/", "/tests/")) {
$testdirs[] = $path;
}
find_testdirs($path, false);
}
closedir($dp);
}
function run_tests_in_dir($dir = '.')
{
global $skip, $skipped, $failed, $passed, $total, $opts, $tests_in_dir;
global $skip, $skipped, $failed, $passed, $total, $opts, $tests_in_dir,$modules_available,$skipped_extensions;
$dp = opendir($dir);
if (!$dp) {
print "Warning: could not run tests in $dir\n";
@@ -245,29 +304,39 @@ function run_tests_in_dir($dir = '.')
if (sizeof($testfiles) == 0) {
return;
}
dowriteln("%bRunning tests in $dir%B");
dowriteln("=================".str_repeat("=", strlen($dir)));
sort($testfiles);
for ($i = 0; $i < sizeof($testfiles); $i++) {
switch (run_test($testfiles[$i])) {
case TEST_SKIPPED:
case TEST_INTERNAL_ERROR:
$skipped++;
break;
case TEST_FAILED:
$failed++;
break;
case TEST_PASSED:
$passed++;
break;
if ($mod_name=extract_module_name_from_path($dir)) {
if ($ext_found=in_array($mod_name,$modules_available))
dowriteln("Testing extension: $mod_name");
else $skipped_extensions[$mod_name]=TRUE;
}
if ($ext_found!==FALSE) {
dowriteln("%bRunning tests in $dir%B");
dowriteln("=================".str_repeat("=", strlen($dir)));
sort($testfiles);
for ($i = 0; $i < sizeof($testfiles); $i++) {
switch (run_test($testfiles[$i])) {
case TEST_SKIPPED:
case TEST_INTERNAL_ERROR:
$skipped++;
break;
case TEST_FAILED:
$failed++;
break;
case TEST_PASSED:
$passed++;
break;
}
$total++;
}
$total++;
if ($oskipped + (isset($tests_in_dir[$dir])?$tests_in_dir[$dir]:0) == $skipped) {
$skippednow = $skipped - $oskipped;
dowriteln("[all $skippednow test(s) skipped]");
}
dowriteln("");
}
if ($oskipped + (isset($tests_in_dir[$dir])?$tests_in_dir[$dir]:0) == $skipped) {
$skippednow = $skipped - $oskipped;
dowriteln("[all $skippednow test(s) skipped]");
}
dowriteln("");
return true;
}
@@ -286,7 +355,7 @@ function delete_tmpfiles()
reset($tmpfile);
while (list($k, $v) = each($tmpfile)) {
if (file_exists($v)) {
//print "unlink($v): "; var_dump(unlink($v));
//print "unlink($v): "; var_dump(unlink($v));
unlink($v);
}
}
@@ -301,26 +370,30 @@ function delete_tmpfiles()
* @return bool whether the files were "equal"
*/
function compare_results($file1, $file2)
{
{
$data1 = $data2 = "";
if (!($fp1 = @fopen($file1, "r")) || !($fp2 = @fopen($file2, "r"))) {
return false;
}
while (!(feof($fp1) || feof($fp2))) {
if (!feof($fp1) && trim($line1 = fgets($fp1, 10240)) != "") {
//print "adding line1 $line1\n";
$data1 .= $line1;
$data1 .= trim($line1);
}
if (!feof($fp2) && trim($line2 = fgets($fp2, 10240)) != "") {
//print "adding line2 $line2\n";
$data2 .= $line2;
$data2 .= trim($line2);
}
}
fclose($fp1);
fclose($fp2);
if (trim($data1) != trim($data2)) {
//print "data1=";var_dump($data1);
//print "data2=";var_dump($data2);
if ((trim($data1) != trim($data2))
|| ($data1=='' && $data2=='')) {
//print "data1=";var_dump($data1);
//print "data2=";var_dump($data2);
return false;
}
return true;
@@ -341,11 +414,13 @@ function run_test($file)
$tmpfile["FILE"] = tempnam($tmpdir, $tmpfix);
$tmpfile["SKIPIF"] = tempnam($tmpdir, $tmpfix);
$tmpfile["POST"] = tempnam($tmpdir, $tmpfix);
$tmpfile["EXPECT"] = tempnam($tmpdir, $tmpfix);
$tmpfile["OUTPUT"] = tempnam($tmpdir, $tmpfix);
while ($line = fgets($fp, 4096)) {
if (preg_match('/^--([A-Z]+)--$/', $line, $matches)) {
if (preg_match('/^--([A-Z]+)--/', $line, $matches)) {
$var = $matches[1];
if (isset($tmpfile[$var]) && $tmpfile[$var]) {
$fps[$var] = @fopen($tmpfile[$var], "w");
@@ -409,6 +484,8 @@ function run_test($file)
putenv("CONTENT_LENGTH=");
}
if (isset($fps["POST"])) {
// XXX Fix me, I do not work on win32 (?)
$cmd = "$php -q $tmpfile[FILE] < $tmpfile[POST]";
} else {
$cmd = "$php -q $tmpfile[FILE]";
@@ -419,6 +496,7 @@ function run_test($file)
delete_tmpfiles();
return TEST_INTERNAL_ERROR;
}
//echo $cmd;
$cp = popen($cmd, "r");
if (!$cp) {
dowriteln("Error: could not execute: $cmd");
+2 -2
View File
@@ -231,7 +231,7 @@ AP_MODULE_DECLARE_DATA module php4_module;
}
static int php_input_filter(ap_filter_t *f, apr_bucket_brigade *bb,
ap_input_mode_t mode)
ap_input_mode_t mode, apr_size_t *readbytes)
{
php_struct *ctx;
long old_index;
@@ -245,7 +245,7 @@ static int php_input_filter(ap_filter_t *f, apr_bucket_brigade *bb,
INIT_CTX;
if ((rv = ap_get_brigade(f->next, bb, mode)) != APR_SUCCESS) {
if ((rv = ap_get_brigade(f->next, bb, mode, readbytes)) != APR_SUCCESS) {
return rv;
}
+4
View File
@@ -0,0 +1,4 @@
fastcgi
Ben Mansell
Stephen Landamore
Daniel Silverstone
+5
View File
@@ -0,0 +1,5 @@
LTLIBRARY_NAME = libsapi.la
LTLIBRARY_SOURCES = fastcgi.c
include $(top_srcdir)/build/ltlib.mk
+17
View File
@@ -0,0 +1,17 @@
FastCGI module
--------------
This module requires the FastCGI development kit, available from
http://www.fastcgi.com/
Before building PHP, please enter the dev kit, and run:
./configure
make
make export
This will compile the library code required for the FastCGI module. All
that is then required is to configure PHP with the '--with-fastcgi' option.
After making the code, you will end up with a binary file called 'php'.
Installation of this file will depend on the web server being used, please
see their documentation for details.
+22
View File
@@ -0,0 +1,22 @@
AC_MSG_CHECKING(for FastCGI support)
AC_ARG_WITH(fastcgi,
[ --with-fastcgi=SRCDIR Build PHP as FastCGI application],[
if test "$withval" = "yes"; then
FASTCGIPATH=/usr/local
else
FASTCGIPATH=$withval
fi
test -f "$FASTCGIPATH/lib/libfcgi.a" || AC_MSG_ERROR(Unable to find libfcgi.a in $FASTCGIPATH/lib)
test -f "$FASTCGIPATH/include/fastcgi.h" || AC_MSG_ERROR(Unable to find fastcgi.h in $FASTCGIPATH/include)
PHP_SAPI=fastcgi
PHP_LIBS=$FASTCGIPATH/lib/libfcgi.a
AC_ADD_INCLUDE($FASTCGIPATH/include)
EXT_PROGRAM_LDADD="$EXT_PROGRAM_LDADD $FASTCGIPATH/lib/libfcgi.a"
INSTALL_IT="\$(INSTALL) -m 0755 $SAPI_PROGRAM \$(bindir)/$SAPI_FASTCGI"
RESULT="yes"
PHP_SUBST(FASTCGI_LIBADD)
PHP_SUBST(EXT_PROGRAM_LDADD)
],[
RESULT="no"
])
AC_MSG_RESULT($RESULT)
+432
View File
@@ -0,0 +1,432 @@
/*
+----------------------------------------------------------------------+
| PHP version 4.0 |
+----------------------------------------------------------------------+
| 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. |
| 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: Ben Mansell <php@slimyhorror.com> |
+----------------------------------------------------------------------+
*/
/* Debugging */
/* #define DEBUG_FASTCGI 1 */
/* Two configurables for the FastCGI runner.
*
* PHP_FCGI_CHILDREN - if set, the FastCGI will pre-fork this many processes
* which will accept requests.
*
* PHP_FCGI_MAX_REQUESTS - if set, the runner will kill itself after handling
* the given number of requests. This is to curb any
* memory leaks in PHP.
*/
/* The following code is based mainly on the thttpd sapi and the original
* CGI code, no doubt with many new and interesting bugs created... :)
*/
#include "php.h"
#include "SAPI.h"
#include "php_main.h"
#include "php_fastcgi.h"
#include "php_variables.h"
#include "fcgi_config.h"
#include "fcgiapp.h"
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/wait.h>
#include <sys/stat.h>
#define TLS_D
#define TLS_DC
#define TLS_C
#define TLS_CC
#define TLS_FETCH()
FCGX_Stream *in, *out, *err;
FCGX_ParamArray envp;
char *path_info = NULL;
/* Our original environment from when the FastCGI first started */
char **orig_env;
/* The environment given by the FastCGI */
char **cgi_env;
/* The manufactured environment, from merging the base environ with
* the parameters set by the per-connection environment
*/
char **merge_env;
static int sapi_fastcgi_ub_write(const char *str, uint str_length)
{
uint sent = FCGX_PutStr( str, str_length, out );
return sent;
}
static void sapi_fastcgi_flush( void *server_context )
{
if( FCGX_FFlush( out ) == -1 ) {
php_handle_aborted_connection();
}
}
static void sapi_fastcgi_send_header(sapi_header_struct *sapi_header, void *server_context)
{
if( sapi_header ) {
#ifdef DEBUG_FASTCGI
fprintf( stderr, "Header: %s\n", sapi_header->header );
#endif
FCGX_PutStr( sapi_header->header, sapi_header->header_len, out );
}
FCGX_PutStr( "\r\n", 2, out );
}
static int sapi_fastcgi_read_post(char *buffer, uint count_bytes SLS_DC)
{
size_t read_bytes = 0, tmp;
int c;
char *pos = buffer;
TLS_FETCH();
while( count_bytes ) {
c = FCGX_GetStr( pos, count_bytes, in );
read_bytes += c;
count_bytes -= c;
pos += c;
if( !c ) break;
}
return read_bytes;
}
static char *sapi_fastcgi_read_cookies(SLS_D)
{
return getenv( "HTTP_COOKIE" );
}
static void sapi_fastcgi_register_variables(zval *track_vars_array ELS_DC SLS_DC PLS_DC)
{
char *self = getenv("REQUEST_URI");
char *ptr = strchr( self, '?' );
/* In CGI mode, we consider the environment to be a part of the server
* variables
*/
php_import_environment_variables(track_vars_array ELS_CC PLS_CC);
/* strip query string off this */
if ( ptr ) *ptr = 0;
php_register_variable( "PHP_SELF", getenv("REQUEST_URI"), track_vars_array ELS_CC PLS_CC);
if ( ptr ) *ptr = '?';
}
static sapi_module_struct fastcgi_sapi_module = {
"fastcgi",
"FastCGI",
php_module_startup,
php_module_shutdown_wrapper,
NULL, /* activate */
NULL, /* deactivate */
sapi_fastcgi_ub_write,
sapi_fastcgi_flush,
NULL, /* get uid */
NULL, /* getenv */
php_error,
NULL,
NULL,
sapi_fastcgi_send_header,
sapi_fastcgi_read_post,
sapi_fastcgi_read_cookies,
sapi_fastcgi_register_variables,
NULL, /* Log message */
NULL, /* Block interruptions */
NULL, /* Unblock interruptions */
STANDARD_SAPI_MODULE_PROPERTIES
};
static void fastcgi_module_main(TLS_D SLS_DC)
{
zend_file_handle file_handle;
CLS_FETCH();
ELS_FETCH();
PLS_FETCH();
file_handle.type = ZEND_HANDLE_FILENAME;
file_handle.filename = SG(request_info).path_translated;
file_handle.free_filename = 0;
file_handle.opened_path = NULL;
if (php_request_startup(CLS_C ELS_CC PLS_CC SLS_CC) == SUCCESS) {
php_execute_script(&file_handle CLS_CC ELS_CC PLS_CC);
}
php_request_shutdown(NULL);
}
static void init_request_info( SLS_D )
{
char *content_length = getenv("CONTENT_LENGTH");
char *content_type = getenv( "CONTENT_TYPE" );
const char *auth;
struct stat st;
char *pi = getenv( "PATH_INFO" );
char *pt = getenv( "PATH_TRANSLATED" );
path_info = strdup( pi );
SG(request_info).request_method = getenv("REQUEST_METHOD");
SG(request_info).query_string = getenv("QUERY_STRING");
SG(request_info).request_uri = path_info;
SG(request_info).content_type = ( content_type ? content_type : "" );
SG(request_info).content_length = (content_length?atoi(content_length):0);
SG(sapi_headers).http_response_code = 200;
SG(request_info).path_translated = pt;
/*
* if the file doesn't exist, try to extract PATH_INFO out
* of it by stat'ing back through the '/'
*/
if ( stat( pt, &st ) == -1 ) {
int len = strlen(pt);
char *ptr;
while( ptr = strrchr(pt,'/') ) {
*ptr = 0;
if ( stat(pt,&st) == 0 && S_ISREG(st.st_mode) ) {
/*
* okay, we found the base script!
* work out how many chars we had to strip off;
* then we can modify PATH_INFO
* accordingly
*/
int slen = len - strlen(pt);
if ( pi ) {
int pilen = strlen( pi );
strcpy( pi, pi + pilen - slen );
}
break;
}
}
/*
* if we stripped out all the '/' and still didn't find
* a valid path... we will fail, badly. of course we would
* have failed anyway... is there a nice way to error?
*/
} else {
/* the first stat succeeded... */
if ( pi ) *pi = 0;
}
/* The CGI RFC allows servers to pass on unvalidated Authorization data */
auth = getenv("HTTP_AUTHORIZATION");
#ifdef DEBUG_FASTCGI
fprintf( stderr, "Authorization: %s\n", auth );
#endif
php_handle_auth_data(auth SLS_CC);
}
void fastcgi_php_init(void)
{
sapi_startup(&fastcgi_sapi_module);
fastcgi_sapi_module.startup(&fastcgi_sapi_module);
SG(server_context) = (void *) 1;
}
void fastcgi_php_shutdown(void)
{
if (SG(server_context) != NULL) {
fastcgi_sapi_module.shutdown(&fastcgi_sapi_module);
sapi_shutdown();
}
}
int main(int argc, char *argv[])
{
int exit_status = SUCCESS;
int c, i, len;
zend_file_handle file_handle;
char *s;
char *argv0=NULL;
char *script_file=NULL;
zend_llist global_vars;
int children = 8;
int max_requests = 500;
int requests = 0;
int status;
int env_size;
#ifdef FASTCGI_DEBUG
fprintf( stderr, "Initialising now!\n" );
#endif
/* Calculate environment size */
env_size = 0;
while( environ[ env_size ] ) { env_size++; }
/* Also include the final NULL pointer */
env_size++;
/* Allocate for our environment */
orig_env = malloc( env_size * sizeof( char *));
if( !orig_env ) {
perror( "Can't malloc environment" );
exit( 1 );
}
memcpy( orig_env, environ, env_size * sizeof( char *));
#ifdef HAVE_SIGNAL_H
#if defined(SIGPIPE) && defined(SIG_IGN)
signal(SIGPIPE,SIG_IGN); /* ignore SIGPIPE in standalone mode so
that sockets created via fsockopen()
don't kill PHP if the remote site
closes it. in apache|apxs mode apache
does that for us! thies@thieso.net
20000419 */
#endif
#endif
sapi_startup(&fastcgi_sapi_module);
if (php_module_startup(&fastcgi_sapi_module)==FAILURE) {
return FAILURE;
}
/* How many times to run PHP scripts before dying */
if( getenv( "PHP_FCGI_MAX_REQUESTS" )) {
max_requests = atoi( getenv( "PHP_FCGI_MAX_REQUESTS" ));
if( !max_requests ) {
fprintf( stderr,
"PHP_FCGI_MAX_REQUESTS is not valid\n" );
exit( 1 );
}
}
/* Pre-fork, if required */
if( getenv( "PHP_FCGI_CHILDREN" )) {
children = atoi( getenv( "PHP_FCGI_CHILDREN" ));
if( !children ) {
fprintf( stderr,
"PHP_FCGI_CHILDREN is not valid\n" );
exit( 1 );
}
}
if( children ) {
int parent = 1;
int running = 0;
while( parent ) {
do {
#ifdef FASTCGI_DEBUG
fprintf( stderr, "Forking, %d running\n",
running );
#endif
switch( fork() ) {
case 0:
/* One of the children.
* Make sure we don't go round the
* fork loop any more
*/
parent = 0;
break;
case -1:
perror( "php (pre-forking)" );
exit( 1 );
break;
default:
/* Fine */
running++;
break;
}
} while( parent && ( running < children ));
if( parent ) {
wait( &status );
running--;
}
}
}
/* Main FastCGI loop */
#ifdef FASTCGI_DEBUG
fprintf( stderr, "Going into accept loop\n" );
#endif
while( FCGX_Accept( &in, &out, &err, &cgi_env ) >= 0 ) {
#ifdef FASTCGI_DEBUG
fprintf( stderr, "Got accept\n" );
#endif
/* Allocate for our environment */
merge_env = malloc( env_size * sizeof( char *));
if( !merge_env ) {
perror( "Can't malloc environment" );
exit( 1 );
}
memcpy( merge_env, orig_env, env_size * sizeof( char *));
/* Use the new environment */
environ = merge_env;
/* Populate our environment with the CGI's */
for( i = 0; cgi_env[ i ]; i++ ) {
putenv( cgi_env[ i ] );
}
init_request_info( TLS_C SLS_CC );
SG(server_context) = (void *) 1; /* avoid server_context==NULL checks */
CG(extended_info) = 0;
SG(request_info).argv0 = argv0;
zend_llist_init(&global_vars, sizeof(char *), NULL, 0);
fastcgi_module_main( TLS_C SLS_CC );
if( path_info ) {
free( path_info );
path_info = NULL;
}
/* TODO: We should free our environment here, but
* some platforms are unhappy if they've altered our
* existing environment and we then free() the new
* environ pointer
*/
requests++;
if( max_requests && ( requests == max_requests )) {
FCGX_Finish();
break;
}
}
#ifdef FASTCGI_DEBUG
fprintf( stderr, "Exiting...\n" );
#endif
return 0;
}
View File
Whitespace-only changes.
+28
View File
@@ -0,0 +1,28 @@
/*
+----------------------------------------------------------------------+
| PHP version 4.0 |
+----------------------------------------------------------------------+
| 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. |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Author: Sascha Schumann <sascha@schumann.cx> |
+----------------------------------------------------------------------+
*/
#ifndef PHP_FASTCGI_H
#define PHP_FASTCGI_H
#include <sys/types.h>
#include <sys/stat.h>
void fastcgi_php_shutdown(void);
void fastcgi_php_init(void);
#endif
+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
+15 -19
View File
@@ -24,6 +24,8 @@
#include "php_variables.h"
#include "version.h"
#include "ext/standard/php_smart_str.h"
#include <sys/uio.h>
typedef struct {
@@ -57,7 +59,7 @@ static int sapi_thttpd_ub_write(const char *str, uint str_length)
if (n <= 0)
return n;
TG(hc)->bytes += n;
TG(hc)->bytes_sent += n;
str += n;
sent += n;
str_length -= n;
@@ -84,7 +86,7 @@ static int sapi_thttpd_send_headers(sapi_headers_struct *sapi_headers SLS_DC)
vec[n].iov_base = buf;
vec[n++].iov_len = len;
TG(hc)->status = SG(sapi_headers).http_response_code;
TG(hc)->bytes += len;
TG(hc)->bytes_sent += len;
}
h = zend_llist_get_first_ex(&sapi_headers->headers, &pos);
@@ -257,30 +259,24 @@ static void thttpd_module_main(TLS_D SLS_DC)
static void thttpd_request_ctor(TLS_D SLS_DC)
{
char *cp;
size_t cp_len;
char buf[1024];
int offset;
size_t filename_len;
size_t cwd_len;
smart_str s = {0};
SG(request_info).query_string = TG(hc)->query?strdup(TG(hc)->query):NULL;
filename_len = strlen(TG(hc)->expnfilename);
cwd_len = strlen(TG(hc)->hs->cwd);
cp_len = cwd_len + filename_len;
cp = (char *) malloc(cp_len + 1);
/* cwd always ends in "/", so this is safe */
memcpy(cp, TG(hc)->hs->cwd, cwd_len);
memcpy(cp + cwd_len, TG(hc)->expnfilename, filename_len);
cp[cp_len] = '\0';
smart_str_appends_ex(&s, TG(hc)->hs->cwd, 1);
smart_str_appends_ex(&s, TG(hc)->expnfilename, 1);
smart_str_0(&s);
SG(request_info).path_translated = s.c;
SG(request_info).path_translated = cp;
snprintf(buf, 1023, "/%s", TG(hc)->origfilename);
SG(request_info).request_uri = strdup(buf);
s.c = NULL;
smart_str_appendc_ex(&s, '/', 1);
smart_str_appends_ex(&s, TG(hc)->origfilename, 1);
smart_str_0(&s);
SG(request_info).request_uri = s.c;
SG(request_info).request_method = httpd_method_str(TG(hc)->method);
SG(sapi_headers).http_response_code = 200;
SG(request_info).content_type = TG(hc)->contenttype;
@@ -313,7 +309,7 @@ off_t thttpd_php_request(httpd_conn *hc)
TLS_FETCH();
TG(hc) = hc;
hc->bytes = 0;
hc->bytes_sent = 0;
thttpd_request_ctor(TLS_C SLS_CC);
+31 -30
View File
@@ -1,6 +1,6 @@
diff -Nur thttpd-2.20b/Makefile.in thttpd-2.20b-php/Makefile.in
--- thttpd-2.20b/Makefile.in Tue Jul 4 18:21:32 2000
+++ thttpd-2.20b-php/Makefile.in Mon Nov 13 14:25:48 2000
diff -ur thttpd-2.21/Makefile.in thttpd-2.21-p/Makefile.in
--- thttpd-2.21/Makefile.in Thu Mar 29 20:36:21 2001
+++ thttpd-2.21-p/Makefile.in Sun Apr 22 15:59:42 2001
@@ -46,13 +46,15 @@
# You shouldn't need to edit anything below here.
@@ -38,10 +38,10 @@ diff -Nur thttpd-2.20b/Makefile.in thttpd-2.20b-php/Makefile.in
tar:
@name=`sed -n -e '/SERVER_SOFTWARE/!d' -e 's,.*thttpd/,thttpd-,' -e 's, .*,,p' version.h` ; \
diff -Nur thttpd-2.20b/libhttpd.c thttpd-2.20b-php/libhttpd.c
--- thttpd-2.20b/libhttpd.c Wed Sep 27 20:13:24 2000
+++ thttpd-2.20b-php/libhttpd.c Mon Nov 13 14:25:57 2000
@@ -75,6 +75,8 @@
diff -ur thttpd-2.21/libhttpd.c thttpd-2.21-p/libhttpd.c
--- thttpd-2.21/libhttpd.c Sat Apr 21 02:11:32 2001
+++ thttpd-2.21-p/libhttpd.c Sun Apr 22 16:01:41 2001
@@ -85,6 +85,8 @@
#include "match.h"
#include "tdate_parse.h"
@@ -50,7 +50,7 @@ diff -Nur thttpd-2.20b/libhttpd.c thttpd-2.20b-php/libhttpd.c
#ifndef STDIN_FILENO
#define STDIN_FILENO 0
#endif
@@ -225,6 +227,8 @@
@@ -243,6 +245,8 @@
free( (void*) hs->cwd );
if ( hs->cgi_pattern != (char*) 0 )
free( (void*) hs->cgi_pattern );
@@ -59,7 +59,7 @@ diff -Nur thttpd-2.20b/libhttpd.c thttpd-2.20b-php/libhttpd.c
if ( hs->charset != (char*) 0 )
free( (void*) hs->charset );
if ( hs->url_pattern != (char*) 0 )
@@ -232,6 +236,7 @@
@@ -250,6 +254,7 @@
if ( hs->local_pattern != (char*) 0 )
free( (void*) hs->local_pattern );
free( (void*) hs );
@@ -67,7 +67,7 @@ diff -Nur thttpd-2.20b/libhttpd.c thttpd-2.20b-php/libhttpd.c
}
@@ -292,6 +297,7 @@
@@ -313,6 +318,7 @@
}
hs->port = port;
@@ -75,7 +75,7 @@ diff -Nur thttpd-2.20b/libhttpd.c thttpd-2.20b-php/libhttpd.c
if ( cgi_pattern == (char*) 0 )
hs->cgi_pattern = (char*) 0;
else
@@ -363,6 +369,8 @@
@@ -386,6 +392,8 @@
return (httpd_server*) 0;
}
@@ -83,19 +83,20 @@ diff -Nur thttpd-2.20b/libhttpd.c thttpd-2.20b-php/libhttpd.c
+
/* Done initializing. */
if ( hs->binding_hostname == (char*) 0 )
syslog( LOG_INFO, "%s starting on port %d", SERVER_SOFTWARE, hs->port );
@@ -2167,7 +2175,9 @@
void
httpd_close_conn( httpd_conn* hc, struct timeval* nowP )
syslog( LOG_INFO, "%.80s starting on port %d", SERVER_SOFTWARE, hs->port );
@@ -2336,7 +2344,10 @@
{
make_log_entry( hc, nowP );
- if ( hc->file_address != (char*) 0 )
+ if (hc->file_address == (char *) 1) {
+ thttpd_closed_conn(hc->conn_fd);
+ } else if ( hc->file_address != (char*) 0 )
+ if ( hc->file_address == (char*) 1 )
+ {
+ thttpd_closed_conn(hc->conn_fd);
+ } else if ( hc->file_address != (char*) 0 )
{
mmc_unmap( hc->file_address, nowP, &(hc->sb) );
mmc_unmap( hc->file_address, &(hc->sb), nowP );
hc->file_address = (char*) 0;
@@ -3336,6 +3346,11 @@
@@ -3543,6 +3554,11 @@
( hc->sb.st_mode & S_IXOTH ) &&
match( hc->hs->cgi_pattern, hc->expnfilename ) )
return cgi( hc );
@@ -107,9 +108,9 @@ diff -Nur thttpd-2.20b/libhttpd.c thttpd-2.20b-php/libhttpd.c
/* It's not CGI. If it's executable or there's pathinfo, someone's
** trying to either serve or run a non-CGI file as CGI. Either case
diff -Nur thttpd-2.20b/libhttpd.h thttpd-2.20b-php/libhttpd.h
--- thttpd-2.20b/libhttpd.h Tue Jun 13 20:48:56 2000
+++ thttpd-2.20b-php/libhttpd.h Mon Nov 13 14:25:48 2000
diff -ur thttpd-2.21/libhttpd.h thttpd-2.21-p/libhttpd.h
--- thttpd-2.21/libhttpd.h Fri Apr 13 07:37:17 2001
+++ thttpd-2.21-p/libhttpd.h Sun Apr 22 15:59:42 2001
@@ -69,6 +69,7 @@
char* server_hostname;
int port;
@@ -118,19 +119,19 @@ diff -Nur thttpd-2.20b/libhttpd.h thttpd-2.20b-php/libhttpd.h
char* charset;
char* cwd;
int listen4_fd, listen6_fd;
diff -Nur thttpd-2.20b/thttpd.c thttpd-2.20b-php/thttpd.c
--- thttpd-2.20b/thttpd.c Wed Sep 27 21:31:48 2000
+++ thttpd-2.20b-php/thttpd.c Mon Nov 13 14:25:57 2000
@@ -1332,6 +1333,12 @@
c->bytes_sent = hc->bytes;
diff -ur thttpd-2.21/thttpd.c thttpd-2.21-p/thttpd.c
--- thttpd-2.21/thttpd.c Sun Apr 15 18:09:20 2001
+++ thttpd-2.21-p/thttpd.c Sun Apr 22 15:59:42 2001
@@ -1392,6 +1392,12 @@
clear_connection( c, tvP );
return;
+ }
}
+ if (hc->file_address == (char *) 1) {
+ tmr_cancel( c->idle_read_timer );
+ c->idle_read_timer = (Timer*) 0;
+ c->wouldblock_delay = 0;
+ return;
}
+ }
if ( c->bytes_sent >= c->bytes_to_send )
{
/* There's nothing to send. */
-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
+4
View File
@@ -1899,6 +1899,10 @@ SOURCE=..\win32\wsyslog.c
# PROP Default_Filter ""
# Begin Source File
SOURCE=..\ext\com\com.h
# End Source File
# Begin Source File
SOURCE=..\ext\com\conversion.h
# End Source File
# Begin Source File