Compare commits

..
Author SHA1 Message Date
SVN Migration a5e8df44b1 This commit was manufactured by cvs2svn to create tag 'php_4_3_1'. 2003-02-16 14:48:28 +00:00
foobar 50febaf842 BFN 2003-02-16 14:48:27 +00:00
foobar 8c93651a60 revert this 2003-02-15 22:56:04 +00:00
foobar 9d6e343cc5 Revert this. 2003-02-15 22:51:43 +00:00
foobar 0f41757dfa - correct version plus the fix. 2003-02-15 21:41:38 +00:00
Edin Kadribasic cec89cfd76 New version number. 2003-02-15 21:37:42 +00:00
SVN Migration 652c5076f2 This commit was manufactured by cvs2svn to create branch 'PHP_4_3_1'. 2002-12-27 04:47:48 +00:00
786 changed files with 33682 additions and 23347 deletions

No files matched your search

-285
View File
@@ -1,285 +0,0 @@
define dump_bt
set $t = $arg0
while $t
printf "[0x%08x] ", $t
if $t->function_state.function->common.function_name
printf "%s() ", $t->function_state.function->common.function_name
else
printf "??? "
end
if $t->op_array != 0
printf "%s:%d ", $t->op_array->filename, $t->opline->lineno
end
set $t = $t->prev_execute_data
printf "\n"
end
end
document dump_bt
dumps the current execution stack. usage: dump_bt executor_globals.current_execute_data
end
define printzv
set $ind = 0
____printzv $arg0 0
end
document printzv
prints content of zval
end
define ____printzv
set $zvalue = $arg0
if $zvalue->type == 0
set $typename = "NULL"
end
if $zvalue->type == 1
set $typename = "long"
end
if $zvalue->type == 2
set $typename = "double"
end
if $zvalue->type == 3
set $typename = "string"
end
if $zvalue->type == 4
set $typename = "array"
end
if $zvalue->type == 5
set $typename = "object"
end
if $zvalue->type == 6
set $typename = "bool"
end
if $zvalue->type == 7
set $typename = "resource"
end
if $zvalue->type == 8
set $typename = "constant"
end
if $zvalue->type == 9
set $typename = "const_array"
end
printf "[0x%08x] ", $zvalue
if $zvalue == executor_globals.uninitialized_zval_ptr
printf "*uninitialized* "
end
printf "(refcount=%d) %s: ", $zvalue->refcount, $typename
if $zvalue->type == 1
printf "%ld", $zvalue->value.lval
end
if $zvalue->type == 2
printf "%lf", $zvalue->value.dval
end
if $zvalue->type == 3
printf "\"%s\"(%d)", $zvalue->value.str.val, $zvalue->value.str.len
end
if $zvalue->type == 4
if ! $arg1
printf "{\n"
set $ind = $ind + 1
____print_ht $zvalue->value.ht
set $ind = $ind - 1
set $i = $ind
while $i > 0
printf " "
set $i = $i - 1
end
printf "}"
end
end
if $zvalue->type == 5
if ! $arg1
printf "(prop examination disabled due to a gdb bug)"
# set $ht = $zvalue->value.obj.handlers->get_properties($zvalue)
# printf "{\n"
# set $ind = $ind + 1
# ____print_ht $ht
# set $ind = $ind - 1
# set $i = $ind
# while $i > 0
# printf " "
# set $i = $i - 1
# end
# printf "}"
end
end
if $zvalue->type == 6
if $zvalue->lval
printf "true"
else
printf "false"
end
end
if $zvalue->type == 7
printf "#%d", $zvalue->value.lval
end
printf "\n"
end
define ____print_ht
set $ht = $arg0
set $p = $ht->pListHead
while $p != 0
set $zval = *(struct _zval_struct **)$p->pData
set $i = $ind
while $i > 0
printf " "
set $i = $i - 1
end
if $p->nKeyLength > 0
printf "\"%s\" => ", $p->arKey
else
printf "%d => ", $p->h
end
____printzv $zval 1
set $p = $p->pListNext
end
end
define print_ht
set $ind = 1
printf "[0x%08x] {\n", $arg0
____print_ht $arg0
printf "}\n"
end
document print_ht
dumps elements of HashTable made of zval
end
define printzn
set $ind = 0
set $znode = $arg0
if $znode->op_type == 1
set $optype = "IS_CONST"
end
if $znode->op_type == 2
set $optype = "IS_TMP_VAR"
end
if $znode->op_type == 4
set $optype = "IS_VAR"
end
if $znode->op_type == 8
set $optype = "IS_UNUSED"
end
printf "[0x%08x] %s", $znode, $optype
if $znode->op_type == 1
printf ": "
____printzv &$znode->u.constant
end
if $znode->op_type == 2
printf ": "
set $tvar = (union _temp_variable *)((char *)executor_globals.current_execute_data->Ts + $znode->u.var)
____printzv ((union _temp_variable *)$tvar)->tmp_var
end
if $znode->op_type == 4
printf ": "
set $tvar = (union _temp_variable *)((char *)executor_globals.current_execute_data->Ts + $znode->u.var)
____printzv *$tvar->var.ptr_ptr
end
if $znode->op_type == 8
printf "\n"
end
end
document printzn
print type and content of znode.
usage: printzn &opline->op1
end
define printzops
printf "op1 => "
printzn &execute_data->opline.op1
printf "op2 => "
printzn &execute_data->opline.op2
printf "result => "
printzn &execute_data->opline.result
end
document printzops
dump operands of the current opline
end
define zmemcheck
set $p = alloc_globals.head
set $stat = "?"
set $total_size = 0
if $arg0 != 0
set $not_found = 1
else
set $not_found = 0
end
printf " block size status file:line\n"
printf "-------------------------------------------------------------------------------\n"
while $p
set $aptr = $p + sizeof(struct _zend_mem_header) + sizeof(align_test)
if $arg0 == 0 || (void *)$aptr == (void *)$arg0
if $p->magic == 0x7312f8dc
set $stat = "OK"
end
if $p->magic == 0x99954317
set $stat = "FREED"
end
if $p->magic == 0xfb8277dc
set $stat = "CACHED"
end
set $filename = strrchr($p->filename, '/')
if !$filename
set $filename = $p->filename
else
set $filename = $filename + 1
end
printf " 0x%08x ", $aptr
if $p->size == sizeof(struct _zval_struct) && ((struct _zval_struct *)$aptr)->type >= 0 && ((struct _zval_struct *)$aptr)->type < 10
printf "ZVAL?(%-2d) ", $p->size
else
printf "%-9d ", $p->size
end
set $total_size = $total_size + $p->size
printf "%-06s %s:%d", $stat, $filename, $p->lineno
if $p->orig_filename
set $orig_filename = strrchr($p->orig_filename, '/')
if !$orig_filename
set $orig_filename = $p->orig_filename
else
set $orig_filename = $orig_filename + 1
end
printf " <= %s:%d\n", $orig_filename, $p->orig_lineno
else
printf "\n"
end
if $arg0 != 0
set $p = 0
set $not_found = 0
else
set $p = $p->pNext
end
else
set $p = $p->pNext
end
end
if $not_found
printf "no such block that begins at 0x%08x.\n", $aptr
end
if $arg0 == 0
printf "-------------------------------------------------------------------------------\n"
printf " total: %d bytes\n", $total_size
end
end
document zmemcheck
show status of a memory block.
usage: zmemcheck [ptr].
if ptr is 0, all blocks will be listed.
end
+1 -1
View File
@@ -89,7 +89,7 @@ STATUS: Experimental
-------------------------------------------------------------------------------
EXTENSION: dba
PRIMARY MAINTAINER: Marcus Börger <helly@php.net>
PRIMARY MAINTAINER: Sascha Schumann <sascha@schumann.cx>
MAINTENANCE: Maintained
STATUS: Working
-------------------------------------------------------------------------------
-5
View File
@@ -8,11 +8,6 @@ up to date instructions in the online manual, located here:
http://www.php.net/manual/en/install.apache.php
For Apache 2, instructions and up-to-date information regarding it's
support status, is available here:
http://www.php.net/manual/en/install.apache2.php
It is strongly recommended that you read the manual page before going
further. However, for the impatient, here is a quick set of steps that
will build PHP as (first) a dynamic Apache module (DSO) for Apache 1.3.x
-5
View File
@@ -1,8 +1,3 @@
#
# Zend
#
$(builddir)/zend_language_scanner.lo: $(builddir)/zend_language_parser.h
$(builddir)/zend_ini_scanner.lo: $(builddir)/zend_ini_parser.h
+6 -12
View File
@@ -7,11 +7,7 @@ COMMON_FLAGS = $(DEFS) $(INCLUDES) $(EXTRA_INCLUDES) $(CPPFLAGS) $(PHP_FRAMEWORK
all: $(all_targets)
@echo
@echo "Build complete."
@echo "(It is safe to ignore warnings about tmpnam)."
@echo
build-modules: $(PHP_MODULES)
libphp4.la: $(PHP_GLOBAL_OBJS) $(PHP_SAPI_OBJS)
@@ -41,7 +37,7 @@ install-modules: build-modules
$(mkinstalldirs) $(INSTALL_ROOT)$(EXTENSION_DIR) && \
echo "Installing shared extensions: $(INSTALL_ROOT)$(EXTENSION_DIR)/" && \
rm -f modules/*.la && \
$(INSTALL) modules/* $(INSTALL_ROOT)$(EXTENSION_DIR) >/dev/null 2>&1 || true
cp modules/* $(INSTALL_ROOT)$(EXTENSION_DIR) >/dev/null 2>&1 || true
install-tester:
@echo "Installing regression tester: $(INSTALL_ROOT)$(PEAR_INSTALLDIR)/"
@@ -53,14 +49,12 @@ install-su: install-pear install-tester
test: $(SAPI_CLI_PATH)
@TEST_PHP_EXECUTABLE=$(top_builddir)/$(SAPI_CLI_PATH) \
TEST_PHP_SRCDIR=$(top_srcdir) \
CC="$(CC)" \
$(top_builddir)/$(SAPI_CLI_PATH) -d 'open_basedir=' -d 'safe_mode=0' -d 'output_buffering=0' $(top_srcdir)/run-tests.php $(TESTS)
CC=$(CC) \
$(top_builddir)/$(SAPI_CLI_PATH) -d 'open_basedir=' -d 'safe_mode=0' $(top_srcdir)/run-tests.php $(TESTS)
clean:
find . -name \*.lo | xargs rm -f
find . -name \*.o | xargs rm -f
find . -name \*.la | xargs rm -f
find . -name \*.a | xargs rm -f
find . -name \*.lo -o -name \*.o | xargs rm -f
find . -name \*.la -o -name \*.a | xargs rm -f
find . -name \*.so | xargs rm -f
find . -name .libs -a -type d|xargs rm -rf
rm -f libphp4.la $(SAPI_CLI_PATH) $(OVERALL_TARGET) modules/* libs/*
+9 -239
View File
@@ -1,237 +1,5 @@
PHP 4 NEWS
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
?? May 2003, Version 4.3.2
- Syncronized bundled GD library with GD 2.0.12. (Ilia)
- Removed support for GDLIB version 1.x.x (php_gd.dll) on Windows. (Edin)
- Enabled read-only GIF support in the bundled GDLIB (php_gd2.dll) on Windows.
(Sebastian, Edin)
- Improved dba extension (Marcus)
. Added support for internal error handling of Berkeley db libraries.
. Disallowed Berkeley db versions 4.1.0 to 4.1.24 due to locking problems.
. Disallowed linkage of Berkeley db submodules against libraries with
different major versions.
. Disallowed configuring of more than one Berkeley db handler.
. Reenabled dba_popen() with new persistent STDIO streams.
- Added a new Apache 2.0 SAPI module (sapi/apache2handler) based on the old
version (sapi/apache2filter). (Ian Holsman, Justin Erenkrantz)
- Added "disable_classes" php.ini option to allow administrators to disable
certain classes for security reasons. (Harald)
- Added man page for CLI version of PHP. (Marcus)
- Added --clean option into phpize. (Jani)
- Added --ldflags option into php-config. (Jani)
- Added imagesavealpha() and imageistruecolor() functions. (Pierre)
- Added XBM support for bundled GD library. (Marcus)
- Added session_regenerate_id() function. (Sascha)
- Added zlib_get_coding_type() function which returns the coding type used for
output compression. (Moriyoshi)
- Added OCIPasswordChange() which allows renewing expired Oracle users. (Maxim)
- Added memory_get_usage(). Only available when PHP is configured with
--enable-memory-limit. (Andrey)
- Added improved JPEG 2000 support for getimagesize(). (Marcus, Adam Wright)
- Added XBM and WBMP support for getimagesize(). (Marcus)
- Added KOI8-R, CP866, and CP1251 support for htmlentities().
(Antony Dovgal, Moriyoshi)
- Added domdocument->free() to free XML-documents from memory. (Rob Richards)
- Fixed spurious fsync calls during socket communication. (Sascha)
- Fixed a possible vhost issue in thttpd. (Sascha, dgl@dgl.cx)
- Fixed including from HTTP URLs. (Sascha)
- Fixed a lot of memory leaks in domxml. (Rob Richards, Chregu)
- Fixed a bug in GD's truecolor TTF handling. (Derick)
- Fixed several 64-bit problems. (Dave)
- Fixed several errors in hwapi extension. Objects weren't handled properly.
(Uwe)
- Fixed bug #23606 (Unable to build --with-db4 (db4.1.25)). (Marcus)
- Fixed bug #23567 (pfsockopen() returns dead connections). (Wez)
- Fixed bug #23527 (PostScript Type 1 fonts do not render properly).
(nid@home.se, Ilia)
- Fixed bug #23371 (configure falsely detects c-client using SSL). (Jani)
- Fixed bug #23340 (fopen on multiple URLs causes memory corruption). (Wez)
- Fixed bug #23298 (serialize cuts off floats & doubles). (Ilia)
- Fixed bug #23232 (safe_mode does not honor PHP_AUTH_* in apache2). (Ilia)
- Fixed bug #23225 (money_format() didn't handle erroneous return of strfmon).
(Ilia, marcot@tabini.ca)
- Fixed bug #23201 (set_file_buffer() crashes with stdio streams). (Ilia)
- Fixed Bug #23188 (CDB databases created with 'c' mode do not work). (Marcus)
- Fixed bug #23187 (memory leaks in sybase_connect/sybase_pconnect). (Ilia)
- Fixed bug #23162 (user_error() crashs if error message > 1024 bytes).
(Jay, Marcus, Moriyoshi)
- Fixed bug #23152 ($http_response_header empty on invalid URLs). (Ilia)
- Fixed bug #23102 (integer overflow in exif_iif_add_value()). (Ilia)
- Fixed bug #23099 (ext/interbase: libgds.so: undefined reference to 'crypt').
(Jani)
- Fixed bug #23093 (highlight_string() crashed with __FUNCTION__). (Jani)
- Fixed bug #23080 (socket_strerror() crashes on win32). (Moriyoshi)
- Fixed bug #23071 (when DST in effect, date("T") crashed PHP).
(Scott MacVicar, Jani)
- Fixed bug #23069 (tempnam creates readonly file [win32]). (Wez)
- Fixed bug #23009 (pg_select with timestamp). (Marcus, Jay)
- Fixed bug #23008 (ldap_start_tls() not available on Windows). (Edin)
- Fixed bug #23004 (When ftp_close() is called, send QUIT to the ftp server).
(Ilia)
- Fixed bug #22989 (sendmail not found by configure). (igyu@ionsphere.org)
- Fixed bug #22987 (missing perror() check in configure). (Jani)
- Fixed bug #22965 (Crash in gd lib's ImageFillToBorder()). (Ilia)
- Fixed bug #22939 (crash in imap_header_info()). (Ilia)
- Fixed bug #22844 (Changing bool value via -d or ini_set(), On would be Off).
(Ilia)
- Fixed bug #22786 (Crash when trying to call DomAttribute's
set_namespace method). (Chregu)
- Fixed bug #22775 (Fatal errors exit with status 0 with CGI/CLI). (Jani)
- Fixed bug #22774 (PHP crashes when exiting (long XML doc)). (Rob Richards)
- Fixed bug #22751 (Compile error in gdcache.c when external libgd is used).
(Jani)
- Fixed bug #22721 (Poor file() performance on systems without mmap). (Wez)
- Fixed bug #22709 (Crash in interbase when database unavailable).
(Vladimir Michl)
- Fixed bug #22681 (Crash when reading from invalid file pointer). (Ilia)
- Fixed bug #22672 (User not logged under Apache2). (Ian)
- Fixed bug #22616 (Wrong order of -lssl and -lcrypto with IMAP). (Jani)
- Fixed bug #22613 (imagettfbox() does not add the kerning distance to the
running position). (Ilia)
- Fixed bug #22585 (Do not terminate the script on minor errors). (Ilia)
- Fixed bug #22550 (overflow protection for upload_max_filesize ini option).
(Ilia)
- Fixed bug #22544 (writing transparency to truecolor png images). (Ilia)
- Fixed bug #22538 (failed stat on stdio/stdin/stderr streams). (Wez, Ilia)
- Fixed bug #22530 (append_child does not unlink node). (Chregu)
- Fixed bug #22520 (mcrypt_generic_deinit() was not available on Windows).
(Edin)
- Fixed bug #22508 (Added protection against circular HTML redirects). (Ilia)
- Fixed bug #22473 (ISAPI Secure Server variables not available).
(Christian Swoboda)
- Fixed bug #22402 (opening of ftp for read/write could fail due to invalid
return code handling). (Ilia)
- Fixed bug #22384 (FNM_CASEFOLD is not available). (Hartmut)
- Fixed bug #22382 (fgetcsv() did not handle \" correctly). (Ilia)
- Fixed bug #22376 (wrong httpd.conf modified when using INSTALL_ROOT). (Jani)
- Fixed bug #22363 (combinations of fwrite(), fread() and fseek() produce
unexpected results). (Wez)
- Fixed bug #22355 (PHP would remove folding from Subject & To fields). (Ilia)
- Fixed bug #22330 (overloaded strrpos() gives wrong results).
(david@santinoli.com, Moriyoshi)
- Fixed bug #22312 (crash on failed connection when curl_getinfo() was called).
(Phil Oleson <poleson@verio.net>)
- Fixed bug #22308 (optimized passthru, code is now ~40 times faster). (Ilia)
- Fixed bug #22306 (pg_lo_seek($h, 0, PGSQL_SEEK_SET) succeeds but
returns false). (Jani)
- Fixed bug #22301 (htmlspecialchars() crashes Apache on Tru64). (Ilia)
- Fixed bug #22299 (gethostbyname() with non-existing domain crashed on MacOSX).
(Jani)
- Fixed bug #22283 (possible crash when opening relative URLs). (Ilia)
- Fixed bug #22238 (stream_select() clobbers fifos under win9x). (Wez)
- Fixed bug #22234 (copy() fails if source file has 0 length). (Moriyoshi)
- Fixed bug #22227 (printf() field limiters broke between 4.2.3 and 4.3.0).
(Moriyoshi)
- Fixed bug #22224 (implode() changes object references in array). (Moriyoshi)
- Fixed bug #22221 (bad rows count in the result object for postgresql). (Marc)
- Fixed bug #22207 (e notation in *printf would be missing a 0 when there is
no exponent). (Ilia)
- Fixed bug #22220 ("php_admin_value open_basedir none" does not work). (Jani)
- Fixed bug #22191 (frontbase build broken with old version of frontbase).
(Ilia)
- Fixed bug #22187 (spprintf function did not handle floats correctly). (Ilia)
- Fixed bug #22149 (incorrect insertion of session id when tabs are used to
separate tag elements). (Ilia)
- Fixed bug #22141 (removed undocumented Boyer str_replace() method). (Sara)
- Fixed bug #22103 (Added gdImageEllipse and replaced old gdImageFilledEllipse
with a better implementation). (Pierre)
- Fixed bug #22088 (array_shift() left next index to be +1 too much). (Jani)
- Fixed bug #22083 (MySQL charset directory problem on Windows). (Edin)
- Fixed bug #22059 (ftp_chdir() causes segfault). (Sara)
- Fixed bug #22048 (crash in imap_header() when the e-mail contains an
abnormally large number of special characters). (Ilia)
- Fixed bug #22042 (pg_result_seek() would never seek to the 1st row in the
result due to always seeking to row next to the one requested). (Ilia)
- Fixed bug #22031 (Made curl_write() & curl_write_header() binary safe).
(Ilia)
- Fixed bug #22022 (Crash in imap_mail_compose() if the body is an empty array).
(Ilia)
- Fixed bug #22017 (date() does not support negative timestamps on win32).
(Ilia)
- Fixed bug #22008 (strip_tags() eliminates too much). (Moriyoshi)
- Fixed bug #22004 (Overload extension and _call() breaks classes). (Shane)
- Fixed bug #21998 (array_pop() did not reset the current array position).
(Jani)
- Fixed bug #21978, #21036 (win32 mail(), bcc: gets interpreted as cc:). (Sara)
- Fixed bug #21885 (move_uploaded_file() does not ignore open_basedir). (Wez)
- Fixed bug #21820 ("$arr['foo']" generates bogus E_NOTICE, should be E_PARSE).
(Jani)
- Fixed bug #21815 (fpassthru() ignored buffered data but complained anyway).
(Wez)
- Fixed bug #21809 (select would not always timeout during socket shutdown).
(Wez)
- Fixed bug #21751 (default output buffer could not be deleted). (Marcus)
- Fixed bug #21725 (return behaviour differs between include and require).
(Zeev)
- Fixed bug #21713 (include remote files leaks descriptors on Solaris). (Wez)
- Fixed bug #21708 (ucwords() trouble again). (Moriyoshi)
- Fixed bug #21689 (fgetcsv() suppresses some characters before a separator).
(Masahiro, Moriyoshi)
- Fixed bug #21912, #21676 (getimagesize() failed for remote files). (Wez)
- Fixed bug #21597 (made glob() understand Windows paths). (Edin)
- Fixed bug #21549 (problem with Ingres II persistent connections). (Jani)
- Fixed bug #21544 (Extended checks for where FreeTDS is installed). (Frank)
- Fixed bug #21534 (typo in gmp_gcdext() causes incorrect results). (Sara)
- Fixed bug #21531 (file_exists() and other filestat functions report errors
when the requested file/directory does not exists). (Sara)
- Fixed bug #21529 (memory corruption by fsockopen()). (Ilia)
- Fixed bug #21525 (bind_textdomain_codeset() now available on Windows). (Edin)
- Fixed bug #21523 (number_format() could cause a memory allocation for a
negative memory size in situations where the sprintf implementation of the
host system generated less decimal places than were requested). (Wez)
- Fixed bug #21518 (imagecreatefromstring() crashed with invalid image files).
(Ilia)
- Fixed bug #21511 (config.status warning). (Jani)
- Fixed bug #21498 (mysql_pconnect connection problems). (Georg)
- Fixed bug #21453 (improper handling of non-terminated < by strip_tags()).
(Ilia)
- Fixed bug #21445 (gd unable to open fonts). (Ilia)
- Fixed bug #21443 (improper handling of ? surrounded by spaces
in get_browser()). (Ilia)
- Fixed bug #21442 (crash in mail() on Windows when 1st parameter is empty).
(Edin)
- Fixed bug #21410 (fixed handling of NULL or "" files on Win32). (Ilia)
- Fixed bug #21378 (COM code crashes after update 4.2.1 to 4.3.0). (Harald)
- Fixed bug #21338 (html_entity_decode() crashed when "" is passed). (Ilia)
- Fixed bug #21310 (Solaris has issues with getcwd() needing read permissions
on directories instead of just execute). (Wez, jflemer)
- Fixed bug #21297 (in CLI/CGI on the #! it would leave a \n when the code
encounters \r\n). (Ilia)
- Fixed bug #21268 (session_decode() returned FALSE on success). (Ilia)
- Fixed bug #21267 (opening URLs that result in redirection to a relative
path was failing). (Ilia)
- Fixed bug #21229 (missing 3rd argument to php_module_startup). (Ilia)
- Fixed bug #21228 (broken check for ob_gzhandler and made ob_start() return
the correct value). (Ilia)
- Fixed bug #21226 (parse_url handling of urls without a path). (Ilia)
- Fixed bug #21224 (apache configure fails when using --enable-versioning).
(Jani)
- Fixed bug #21169 (Compile Failure and lots of warnings on UnixWare). (Derick)
- Fixed bug #21131 (fopen() with mode 'a+' and rewind() doesn't work). (Wez)
- Fixed bug #20857 (snmpset() failed always, patch by: rs@epost.de). (Jani)
- Fixed bug #20802 (PHP would die silently when memory limit reached). (Ilia)
- Fixed bug #20715 (odbc could not be compiled as shared extension). (Jani)
- Fixed bug #20641 (Numeric/decimal datatype overflow in ext/interbase
on Win32). (Daniela)
- Fixed bug #20503 (imagesetbrush() not available on Windows). (Edin)
- Fixed bug #20282 (COM memory leak). (Harald)
- Fixed bug #20256 (snprintf() not defined on some systems). (Jani)
- Fixed bug #19919 (crash in sapi_apache_header_handler under heavy load).
(George)
- Fixed bug #19795 (Problems with strnatcmp() / strnatcasecmp()). (Moriyoshi)
- Fixed bug #17868 (multiple <!--include--> used to include PHP files crashes).
(Ilia)
- Fixed bug #17448 (Print the message when OCI_SUCCESS_WITH_INFO is returned).
(Maxim)
- Fixed bug #17098 (make Apache2 aware that PHP scripts should not be cached).
(Ilia)
- Fixed bug #16798 (Compile failure with LOB support for Oracle version < 8.1).
(Maxim)
- Fixed bug #14532 (fixed connection_status() to return 2 for timeouts). (Jani)
- Fixed bug #14245 ('make install' fails on AIX when using --with-apxs). (Jani)
- Fixed bug #13561 (--without-pear disabled phpize/php-config install). (Jani)
- Fixed bug #13551 (bcmath functions applying scale incorrectly). (Sara)
17 Feb 2003, Version 4.3.1
- Fixed serious security vulnerability in CGI SAPI. (Shane)
@@ -244,23 +12,23 @@ PHP 4 NEWS
- Removed extensions: (Jan, Jani, Sebastian)
. ext/aspell
. ext/ccvs
. ext/cybercash
. ext/icap
. sapi/fastcgi
. sapi/fhttpd
- Moved extensions to PECL (http://pear.php.net/): (James, Derick, George)
- Moved extensions to PECL (http://pear.php.net/): (James, Derick)
. ext/vpopmail
. ext/cybermut
. ext/cybercash
- Make PHP_AUTH_* variables not available in safe mode under Apache when an
external basic auth mechanism is used. (Philip)
- Aliased dba_popen() to dba_open() until 4.3.2 when persistent STDIO streams
- Aliased dba_popen() to dba_open() until 4.3.1 when persistent STDIO streams
are introduced. (Andrei)
- Fixed a security bug in the bundled MySQL library. (Georg, Stefan)
- ZLIB extension is now built-in in the Windows distribution.
External extension (php_zlib.dll) has been removed. (Edin)
- Fixed a bug in ISO-8601 week calculation
- Fixed a crash when using invalid color index with imagecolortransparent().
(Pierre-Alain Joye)
- Fixed a crash when using invalid color index with imagecolortransparent()
(Pierre-Alain Joye).
- Fixed bug #20987 (no handling for client certificates). (Ilia)
- Fixed bug #21039 (crash when not supplying an IV to mcrypt_generic_init).
(Derick)
@@ -277,7 +45,7 @@ PHP 4 NEWS
true-color image). (Ilia)
- Fixed a crash when converting between true-color images (png/jpeg) and
gd1/gd2 image formats, png/jpeg -> gd1/gd2 -> png/jpeg conversion now
works correctly. (Ilia, Pierre-Alain Joye)
works correctly. (Ilia, (Pierre-Alain Joye).
- Fixed a memory leak in the bundled GD library inside
gdImageTrueColorToPalette(). (Ilia)
- Fixed bug #12776 (array_walk crash). (Moriyoshi)
@@ -336,7 +104,7 @@ PHP 4 NEWS
(Sterling)
- Remove $_FILES from $_REQUEST (import_request_variables is not modified),
this didn't work properly in the first place, and added confusion. (Sterling)
- Fixed the socket_read() function on win32 to work in normal mode (reading to
- Fix the socket_read() function on win32 to work in normal mode (reading to
the end of a line), as well as binary mode. (Sterling)
- Fixed bug #20110 (added sanity check to prevent include/require functions
from trying to include directories). (Ilia)
@@ -519,6 +287,8 @@ PHP 4 NEWS
- Made mime_magic and ZIP extensions available on Windows. (Edin)
- Added xslt_backend_version() and xslt_backend_name() for getting
information about the processor backend. (chregu)
- Added php.ini option "allow_webdav_methods" to allow handling of
WebDAV http requests within PHP scripts. (chregu)
- Added ImageColorMatch() and ImageLayerEffect() functions which are only
available when using the bundled GD library. (ttoohey)
- Made major improvents to the pcntl extension. (Jason)
+2 -1
View File
@@ -43,6 +43,7 @@ global
(DONE ?)
* Use arg_separator.input to implode args in the CGI sapi extension
and arg_separator.input to explode in php_build_argv(). (DONE?)
* Implement flush feature suitable for nested output buffers.
For PHP 5.0.0
* bundle and use curl lib for fopen wrapper.
@@ -66,7 +67,6 @@ global
* find a better way to implement script timeouts. SIGVTALRM is used
by some POSIX threads implementations (i.e. OpenBSD) and is not
available in ZTS mode.
* Implement flush feature suitable for nested output buffers.
documentation
@@ -158,6 +158,7 @@ ext/standard
basename()
dirname()
strrpos()
strip_tags()
ext/wddx
--------
-146
View File
@@ -1,146 +0,0 @@
This is an overview over existing segfaults in the current PHP source
tree.
Fixed:
mb_convert_encoding (Moriyoshi)
socket_iovec_alloc (Rasmus)
exif_imagetype,exif_thumbnail (Rasmus)
dbase_open (Rasmus)
array_pad (Rasmus)
setlocale (Rasmus)
unregister_tick_function (Rasmus)
bcsub (Rasmus)
str_repeat (Ilia)
imagecopyresized (Ilia)
mhash_keygen_s2k (Ilia)
mb_ereg, mb_ereg_match, mb_eregi, mb_split (Moriyoshi)
xml_parser_create (Moriyoshi)
ob_start (Sascha)
imagecreate/-truecolor (Sascha)
flock (Sascha)
register_shutdown_function (Sascha)
mb_strcut('', [number greater than the length of first arg]) (Moriyoshi)
ext/exif, ext/dba (7) (Marcus)
Open:
the dbase extension (1)
chunk_split (2)
socket_select (3)
php_imagepolygon (4)
imagesetstyle (5)
bundled gd (6)
php_base64_encode (8)
pack (9)
(1) heap corruption, mostly visible in malloc-related calls. Whether you see
this or not might depend on your libc/compiler. Hard to track down,
because the result of the corruption might be quite delayed.
Reproducable with glibc-2.3/gcc 3.2.2 by:
cat <<X | php do_crash
dbase_add_record
dbase_close
dbase_create
dbase_delete_record
dbase_get_record
dbase_get_record_with_names
dbase_numfields
dbase_numrecords
dbase_open
X
(2) integer overflow in php_chunk_split
(3) heap corruption, dies in efree()/execute()
Methodology
1. Use a plain PHP_4_3 tree
2. Use the config.nice from ammendment 1.
3. Download the test script from:
<URL:http://schumann.cx/do_crash.txt>
4a. Use the scripts funcparse.awk/genfunclist.sh from phpdoc/scripts
for creating a plain text function list. Feed that list to
the script. Avoid calls like pcntl_fork. Manually remove functions
which take too long to finish/eat up all memory.
4b. For testing a single function, echo the name of the function to
the script like this:
echo dbase_open | php do_crash.txt
(4) integer overflow inside php_imagepolygon and possible subsequent
integer overflows inside gdlib's gdImageFilledPolygon().
(5) integer overflow if the number of elements in the array passed as
second argument * sizeof(int) result in an overflow.
gdImageSetStyle function called by this php wrapper can die for the
same reason.
(6) multiple integer overflows that can occur when trying to allocate a buffer
for a new image. Affected functions:
gdImageCreateFromJpegCtx
readwbmp
gdImageCreateFromXpm
gdImageCreateFromPngCtx
gdImagePngCtx
gdImageCreateFromJpegCtx
gdImageJpegCtx
gdImageCreateFromGd2Ctx
gdImageCreateFromGd2PartCtx
_gdImageGd2
GetDataBlock (gd_gif_in.c)
(7) few possible integer overflows, once safe_emalloc() or something similar
is implemented they can all be addressed.
(8) integer overflow if the specified string is longer then ~1.1 billion bytes.
(9) multiple integer overflows, ex. pack("d4294967297", 2);
Ammendment 1.
CFLAGS='-O0 -g' \
'../src/php4/configure' \
'--enable-pcntl' \
'--enable-shmop' \
'--enable-sysvsem' \
'--enable-sysvshm' \
'--enable-wddx' \
'--enable-yp' \
'--enable-filepro' \
'--enable-ftp' \
'--enable-dba' \
'--enable-dbase' \
'--enable-dio' \
'--enable-exif' \
'--enable-mbstring' \
'--enable-mbregex' \
'--enable-sockets' \
'--enable-bcmath' \
'--enable-calendar' \
'--enable-pcntl' \
'--enable-shmop' \
'--enable-sysvsem' \
'--enable-sysvshm' \
'--enable-wddx' \
'--enable-yp' \
'--enable-filepro' \
'--enable-ftp' \
'--enable-dba' \
'--enable-dbase' \
'--enable-dio' \
'--enable-exif' \
'--enable-mbstring' \
'--enable-mbregex' \
'--enable-sockets' \
'--enable-bcmath' \
'--enable-calendar' \
"$@"
+1 -1
View File
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 4 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2003 The PHP Group |
| Copyright (c) 1997-2002 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 |
+1 -1
View File
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 4 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2003 The PHP Group |
| Copyright (c) 1997-2002 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 |
+46 -55
View File
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 4 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2003 The PHP Group |
| Copyright (c) 1997-2002 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 |
@@ -303,10 +303,7 @@ CWD_API int virtual_file_ex(cwd_state *state, const char *path, verify_path_func
return (0);
#if !defined(TSRM_WIN32) && !defined(NETWARE)
/* cwd_length can be 0 when getcwd() fails.
* This can happen under solaris when a dir does not have read permissions
* but *does* have execute permissions */
if (IS_ABSOLUTE_PATH(path, path_length) || (state->cwd_length < 1)) {
if (IS_ABSOLUTE_PATH(path, path_length)) {
if (use_realpath && realpath(path, resolved_path)) {
path = resolved_path;
path_length = strlen(path);
@@ -366,64 +363,58 @@ CWD_API int virtual_file_ex(cwd_state *state, const char *path, verify_path_func
}
if (state->cwd_length > 0 || IS_ABSOLUTE_PATH(path, path_length)) {
ptr = tsrm_strtok_r(path_copy, TOKENIZER_STRING, &tok);
while (ptr) {
ptr_length = strlen(ptr);
ptr = tsrm_strtok_r(path_copy, TOKENIZER_STRING, &tok);
while (ptr) {
ptr_length = strlen(ptr);
if (IS_DIRECTORY_UP(ptr, ptr_length)) {
char save;
if (IS_DIRECTORY_UP(ptr, ptr_length)) {
char save;
save = DEFAULT_SLASH;
save = DEFAULT_SLASH;
#define PREVIOUS state->cwd[state->cwd_length - 1]
while (IS_ABSOLUTE_PATH(state->cwd, state->cwd_length) &&
!IS_SLASH(PREVIOUS)) {
save = PREVIOUS;
PREVIOUS = '\0';
state->cwd_length--;
}
if (!IS_ABSOLUTE_PATH(state->cwd, state->cwd_length)) {
state->cwd[state->cwd_length++] = save;
state->cwd[state->cwd_length] = '\0';
} else {
PREVIOUS = '\0';
state->cwd_length--;
}
} else if (!IS_DIRECTORY_CURRENT(ptr, ptr_length)) {
state->cwd = (char *) realloc(state->cwd, state->cwd_length+ptr_length+1+1);
#ifdef TSRM_WIN32
/* Windows 9x will consider C:\\Foo as a network path. Avoid it. */
if ((state->cwd[state->cwd_length-1]!='\\' && state->cwd[state->cwd_length-1]!='/') ||
IsDBCSLeadByte(state->cwd[state->cwd_length-2])) {
state->cwd[state->cwd_length++] = DEFAULT_SLASH;
}
#elif defined(NETWARE)
/* If the token is a volume name, it will have colon at the end -- so, no slash before it */
if (ptr[ptr_length-1] != ':') {
state->cwd[state->cwd_length++] = DEFAULT_SLASH;
}
#else
state->cwd[state->cwd_length++] = DEFAULT_SLASH;
#endif
memcpy(&state->cwd[state->cwd_length], ptr, ptr_length+1);
state->cwd_length += ptr_length;
while (IS_ABSOLUTE_PATH(state->cwd, state->cwd_length) &&
!IS_SLASH(PREVIOUS)) {
save = PREVIOUS;
PREVIOUS = '\0';
state->cwd_length--;
}
ptr = tsrm_strtok_r(NULL, TOKENIZER_STRING, &tok);
}
if (state->cwd_length == COPY_WHEN_ABSOLUTE(state->cwd)) {
state->cwd = (char *) realloc(state->cwd, state->cwd_length+1+1);
state->cwd[state->cwd_length] = DEFAULT_SLASH;
state->cwd[state->cwd_length+1] = '\0';
state->cwd_length++;
if (!IS_ABSOLUTE_PATH(state->cwd, state->cwd_length)) {
state->cwd[state->cwd_length++] = save;
state->cwd[state->cwd_length] = '\0';
} else {
PREVIOUS = '\0';
state->cwd_length--;
}
} else if (!IS_DIRECTORY_CURRENT(ptr, ptr_length)) {
state->cwd = (char *) realloc(state->cwd, state->cwd_length+ptr_length+1+1);
#ifdef TSRM_WIN32
/* Windows 9x will consider C:\\Foo as a network path. Avoid it. */
if ((state->cwd[state->cwd_length-1]!='\\' && state->cwd[state->cwd_length-1]!='/') ||
IsDBCSLeadByte(state->cwd[state->cwd_length-2])) {
state->cwd[state->cwd_length++] = DEFAULT_SLASH;
}
#elif defined(NETWARE)
/* If the token is a volume name, it will have colon at the end -- so, no slash before it */
if (ptr[ptr_length-1] != ':') {
state->cwd[state->cwd_length++] = DEFAULT_SLASH;
}
#else
state->cwd[state->cwd_length++] = DEFAULT_SLASH;
#endif
memcpy(&state->cwd[state->cwd_length], ptr, ptr_length+1);
state->cwd_length += ptr_length;
}
} else {
state->cwd = (char *) realloc(state->cwd, path_length+1);
memcpy(state->cwd, path, path_length+1);
state->cwd_length = path_length;
ptr = tsrm_strtok_r(NULL, TOKENIZER_STRING, &tok);
}
if (state->cwd_length == COPY_WHEN_ABSOLUTE(state->cwd)) {
state->cwd = (char *) realloc(state->cwd, state->cwd_length+1+1);
state->cwd[state->cwd_length] = DEFAULT_SLASH;
state->cwd[state->cwd_length+1] = '\0';
state->cwd_length++;
}
if (verify_path && verify_path(state)) {
+3 -1
View File
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 4 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2003 The PHP Group |
| Copyright (c) 1997-2002 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 |
@@ -196,6 +196,8 @@ typedef struct _virtual_cwd_globals {
#define VCWD_STAT(path, buff) virtual_stat(path, buff TSRMLS_CC)
#if !defined(TSRM_WIN32) && !defined(NETWARE)
#define VCWD_LSTAT(path, buff) virtual_lstat(path, buff TSRMLS_CC)
#else
#define VCWD_LSTAT(path, buff) virtual_lstat(path, buff TSRMLS_CC)
#endif
#define VCWD_UNLINK(path) virtual_unlink(path TSRMLS_CC)
#define VCWD_MKDIR(pathname, mode) virtual_mkdir(pathname, mode TSRMLS_CC)
+1 -1
View File
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 4 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2003 The PHP Group |
| Copyright (c) 1997-2002 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 |
+1 -1
View File
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 4 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2003 The PHP Group |
| Copyright (c) 1997-2002 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 |
+99 -80
View File
@@ -28,7 +28,7 @@ AC_DEFUN([PHP_DEFINE],[
dnl PHP_INIT_BUILD_SYSTEM
dnl
AC_DEFUN([PHP_INIT_BUILD_SYSTEM],[
test -d include || mkdir include
mkdir include >/dev/null 2>&1
> Makefile.objects
> Makefile.fragments
dnl We need to play tricks here to avoid matching the egrep line itself
@@ -211,13 +211,13 @@ AC_DEFUN([PHP_SETUP_OPENSSL],[
AC_MSG_CHECKING([for OpenSSL version])
AC_EGREP_CPP(yes,[
#include <openssl/opensslv.h>
#if OPENSSL_VERSION_NUMBER >= 0x0090600fL
#if OPENSSL_VERSION_NUMBER >= 0x0090500fL
yes
#endif
],[
AC_MSG_RESULT([>= 0.9.6])
AC_MSG_RESULT([>= 0.9.5])
],[
AC_MSG_ERROR([OpenSSL version 0.9.6 or greater required.])
AC_MSG_ERROR([OpenSSL version 0.9.5 or greater required.])
])
CPPFLAGS=$old_CPPFLAGS
@@ -531,7 +531,7 @@ PHP_ALWAYS_SHARED([$1])
])
AC_DEFUN([PHP_ARG_ANALYZE],[
ifelse([$3],yes,[PHP_ARG_ANALYZE_EX([$1])],[ext_output=ifelse([$]$1,,no,[$]$1)])
ifelse([$3],yes,[PHP_ARG_ANALYZE_EX([$1])])
ifelse([$2],,,[AC_MSG_RESULT([$ext_output])])
])
@@ -590,8 +590,7 @@ AC_DEFUN([PHP_MODULE_PTR],[
])
AC_DEFUN([PHP_CONFIG_NICE],[
test -f $1 && mv $1 $1.old
rm -f $1.old
rm -f $1
cat >$1<<EOF
#! /bin/sh
#
@@ -668,6 +667,21 @@ AC_DEFUN([PHP_SUBST_OLD],[
AC_SUBST($1)
])
AC_DEFUN([PHP_MKDIR_P_CHECK],[
AC_CACHE_CHECK(for working mkdir -p, ac_cv_mkdir_p,[
test -d conftestdir && rm -rf conftestdir
mkdir -p conftestdir/somedir >/dev/null 2>&1
dnl `mkdir -p' must be quiet about creating existing directories
mkdir -p conftestdir/somedir >/dev/null 2>&1
if test "$?" = "0" && test -d conftestdir/somedir; then
ac_cv_mkdir_p=yes
else
ac_cv_mkdir_p=no
fi
rm -rf conftestdir
])
])
AC_DEFUN([PHP_TM_GMTOFF],[
AC_CACHE_CHECK([for tm_gmtoff in struct tm], ac_cv_struct_tm_gmtoff,
[AC_TRY_COMPILE([#include <sys/types.h>
@@ -687,8 +701,7 @@ AC_DEFUN([PHP_CONFIGURE_PART],[
])
AC_DEFUN([PHP_PROG_SENDMAIL],[
PHP_ALT_PATH=/usr/bin:/usr/sbin:/usr/etc:/etc:/usr/ucblib:/usr/lib
AC_PATH_PROG(PROG_SENDMAIL, sendmail,[], $PATH:$PHP_ALT_PATH)
AC_PATH_PROG(PROG_SENDMAIL, sendmail,[], $PATH:/usr/bin:/usr/sbin:/usr/etc:/etc:/usr/ucblib:/usr/lib)
if test -n "$PROG_SENDMAIL"; then
AC_DEFINE(HAVE_SENDMAIL,1,[whether you have sendmail])
fi
@@ -1094,11 +1107,7 @@ dnl
dnl Set libtool variable
dnl
AC_DEFUN([PHP_SET_LIBTOOL_VARIABLE],[
if test -z "$LIBTOOL"; then
LIBTOOL='$(SHELL) $(top_builddir)/libtool $1'
else
LIBTOOL="$LIBTOOL $1"
fi
LIBTOOL='$(SHELL) libtool $1'
])
dnl
@@ -1261,7 +1270,10 @@ AC_DEFUN([PHP_ADD_BUILD_DIR],[
])
AC_DEFUN([PHP_GEN_BUILD_DIRS],[
$php_shtool mkdir -p $BUILD_DIR
PHP_MKDIR_P_CHECK
if test "$ac_cv_mkdir_p" = "yes"; then
mkdir -p $BUILD_DIR
fi
])
dnl
@@ -1450,70 +1462,6 @@ int main(void) {
fi
])
dnl Some systems, notably Solaris, cause getcwd() or realpath to fail if a
dnl component of the path has execute but not read permissions
AC_DEFUN([PHP_BROKEN_GETCWD],[
AC_MSG_CHECKING([for broken getcwd])
os=`uname -sr 2>/dev/null`
case $os in
SunOS*)
AC_DEFINE(HAVE_BROKEN_GETCWD,1, [Define if system has broken getcwd])
AC_MSG_RESULT([yes]);;
*)
AC_MSG_RESULT([no]);;
esac
])
AC_DEFUN([PHP_BROKEN_GLIBC_FOPEN_APPEND],[
AC_MSG_CHECKING([for broken libc stdio])
AC_CACHE_VAL(have_broken_glibc_fopen_append,[
AC_TRY_RUN([
#include <stdio.h>
int main(int argc, char *argv[])
{
FILE *fp;
long position;
char *filename = "/tmp/phpglibccheck";
fp = fopen(filename, "w");
if (fp == NULL) {
perror("fopen");
exit(2);
}
fputs("foobar", fp);
fclose(fp);
fp = fopen(filename, "a+");
position = ftell(fp);
fclose(fp);
unlink(filename);
if (position == 0)
return 1;
return 0;
}
],
[have_broken_glibc_fopen_append=no],
[have_broken_glibc_fopen_append=yes ],
AC_TRY_COMPILE([
#include <features.h>
],[
#if !__GLIBC_PREREQ(2,2)
choke me
#endif
],
[have_broken_glibc_fopen_append=yes],
[have_broken_glibc_fopen_append=no ])
)])
if test "$have_broken_glibc_fopen_append" = "yes"; then
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_BROKEN_GLIBC_FOPEN_APPEND,1, [Define if your glibc borks on fopen with mode a+])
else
AC_MSG_RESULT(no)
fi
])
AC_DEFUN([PHP_FOPENCOOKIE],[
AC_CHECK_FUNC(fopencookie, [ have_glibc_fopencookie=yes ])
@@ -1606,7 +1554,6 @@ AC_DEFUN([PHP_CHECK_LIBRARY], [
$3
],[
LDFLAGS=$save_old_LDFLAGS
unset ac_cv_func_$1
$4
])dnl
])
@@ -1791,3 +1738,75 @@ IFS="- /.
APACHE_VERSION=`expr [$]4 \* 1000000 + [$]5 \* 1000 + [$]6`
])
dnl PHP_PROG_SED
dnl ------------
dnl Check for a fully-functional sed program, that truncates
dnl as few characters as possible. Prefer GNU sed if found.
dnl
dnl Based on LT_AC_PROG_SED (libtool CVS)
dnl
AC_DEFUN([PHP_PROG_SED],
[AC_MSG_CHECKING([for working sed])
AC_CACHE_VAL(ac_cv_path_sed,
[
# Create a temporary directory, and hook for its removal unless debugging.
$debug ||
{
trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0
trap '{ (exit 1); exit 1; }' 1 2 13 15
}
# Create a (secure) tmp directory for tmp files.
: ${TMPDIR=/tmp}
{
tmp=`(umask 077 && mktemp -d -q "$TMPDIR/sedXXXXXX") 2>/dev/null` &&
test -n "$tmp" && test -d "$tmp"
} ||
{
tmp=$TMPDIR/sed$$-$RANDOM
(umask 077 && mkdir $tmp)
} ||
{
echo "$me: cannot create a temporary directory in $TMPDIR" >&2
{ (exit 1); exit 1; }
}
_max=0
_count=0
# Use the sed found in PATH, skip the rest
_sed=sed
# Check for GNU sed and select it if it is found.
if "${_sed}" --version 2>&1 < /dev/null | egrep '(GNU)' > /dev/null; then
ac_cv_path_sed=${_sed}
else
cat /dev/null > "$tmp/sed.in"
_count=0
echo -n "0123456789" >"$tmp/sed.in"
while true; do
cat "$tmp/sed.in" "$tmp/sed.in" >"$tmp/sed.tmp"
mv "$tmp/sed.tmp" "$tmp/sed.in"
cp "$tmp/sed.in" "$tmp/sed.nl"
echo >>"$tmp/sed.nl"
${_sed} -e 's/a$//' < "$tmp/sed.nl" >"$tmp/sed.out" || break
cmp -s "$tmp/sed.out" "$tmp/sed.nl" || break
# 10000 chars as input seems more than enough
test $_count -gt 10 && break
_count=`expr $_count + 1`
if test $_count -gt $_max; then
_max=$_count
ac_cv_path_sed=${_sed}
fi
done
fi
rm -rf "$tmp"
])
if test -z "$ac_cv_path_sed"; then
AC_MSG_ERROR([Could not find working sed on this system. Please install GNU sed.])
else
SED=$ac_cv_path_sed
PHP_SUBST(SED)
AC_MSG_RESULT([$SED])
fi
])
+5 -11
View File
@@ -16,7 +16,7 @@
# | Sascha Schumann <sascha@schumann.cx> |
# +----------------------------------------------------------------------+
#
# $Id: buildcheck.sh,v 1.21.2.2 2003-04-16 12:05:43 jan Exp $
# $Id: buildcheck.sh,v 1.21 2002-10-30 11:42:22 sas Exp $
#
echo "buildconf: checking installation..."
@@ -73,29 +73,23 @@ fi
# libtool 1.4 or newer
# Prefer glibtool over libtool for Mac OS X compatibility
libtool=`which glibtool 2> /dev/null`
if test ! -r "$libtool"; then libtool=`which libtool`; fi
if test ! -f "$libtool"; then libtool=`which libtool`; fi
lt_pversion=`$libtool --version 2>/dev/null|sed -n -e 's/^[^0-9]*//' -e 1's/[- ].*//p'`
if test "$lt_pversion" = ""; then
echo "buildconf: libtool not found."
echo " You need libtool version 1.4.3 or newer installed"
echo " You need libtool version 1.4 or newer installed"
echo " to build PHP from CVS."
exit 1
fi
lt_version=`echo $lt_pversion|sed -e 's/\([a-z]*\)$/.\1/'`
IFS=.; set $lt_version; IFS=' '
if test "$3" = ""; then
third=0
else
third=$3
fi
if test "$1" -gt "1" || test "$2" -ge "5" || (test "$2" -ge "4" && test "$third" -ge "3")
if test "$1" -gt "1" || test "$2" -ge "4";
then
echo "buildconf: libtool version $lt_pversion (ok)"
else
echo "buildconf: libtool version $lt_pversion found."
echo " You need libtool version 1.4.3 or newer installed"
echo " You need libtool version 1.4 or newer installed"
echo " to build PHP from CVS."
exit 1
fi
+31 -69
View File
@@ -3,7 +3,7 @@
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
# 2000, 2001, 2002 Free Software Foundation, Inc.
timestamp='2002-10-21'
timestamp='2002-05-29'
# This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
@@ -88,40 +88,30 @@ if test $# != 0; then
exit 1
fi
trap 'exit 1' 1 2 15
# CC_FOR_BUILD -- compiler used by this script. Note that the use of a
# compiler to aid in system detection is discouraged as it requires
# temporary files to be created and, as you can see below, it is a
# headache to deal with in a portable fashion.
dummy=dummy-$$
trap 'rm -f $dummy.c $dummy.o $dummy.rel $dummy; exit 1' 1 2 15
# CC_FOR_BUILD -- compiler used by this script.
# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
# use `HOST_CC' if defined, but it is deprecated.
# This shell variable is my proudest work .. or something. --bje
set_cc_for_build='tmpdir=${TMPDIR-/tmp}/config-guess-$$ ;
(old=`umask` && umask 077 && mkdir $tmpdir && umask $old && unset old)
|| (echo "$me: cannot create $tmpdir" >&2 && exit 1) ;
dummy=$tmpdir/dummy ;
files="$dummy.c $dummy.o $dummy.rel $dummy" ;
trap '"'"'rm -f $files; rmdir $tmpdir; exit 1'"'"' 1 2 15 ;
case $CC_FOR_BUILD,$HOST_CC,$CC in
,,) echo "int x;" > $dummy.c ;
set_cc_for_build='case $CC_FOR_BUILD,$HOST_CC,$CC in
,,) echo "int dummy(){}" > $dummy.c ;
for c in cc gcc c89 c99 ; do
if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then
($c $dummy.c -c -o $dummy.o) >/dev/null 2>&1 ;
if test $? = 0 ; then
CC_FOR_BUILD="$c"; break ;
fi ;
done ;
rm -f $files ;
rm -f $dummy.c $dummy.o $dummy.rel ;
if test x"$CC_FOR_BUILD" = x ; then
CC_FOR_BUILD=no_compiler_found ;
fi
;;
,,*) CC_FOR_BUILD=$CC ;;
,*,*) CC_FOR_BUILD=$HOST_CC ;;
esac ;
unset files'
esac'
# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
# (ghazi@noc.rutgers.edu 1994-08-24)
@@ -231,7 +221,6 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
# A Tn.n version is a released field test version.
# A Xn.n version is an unreleased experimental baselevel.
# 1.2 uses "1.2" for uname -r.
eval $set_cc_for_build
cat <<EOF >$dummy.s
.data
\$Lformat:
@@ -257,9 +246,10 @@ main:
jsr \$26,exit
.end main
EOF
$CC_FOR_BUILD -o $dummy $dummy.s 2>/dev/null
eval $set_cc_for_build
$CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null
if test "$?" = 0 ; then
case `$dummy` in
case `./$dummy` in
0-0)
UNAME_MACHINE="alpha"
;;
@@ -281,12 +271,9 @@ EOF
2-1307)
UNAME_MACHINE="alphaev68"
;;
3-1307)
UNAME_MACHINE="alphaev7"
;;
esac
fi
rm -f $dummy.s $dummy && rmdir $tmpdir
rm -f $dummy.s $dummy
echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
exit 0 ;;
Alpha\ *:Windows_NT*:*)
@@ -327,10 +314,6 @@ EOF
NILE*:*:*:dcosx)
echo pyramid-pyramid-svr4
exit 0 ;;
DRS?6000:UNIX_SV:4.2*:7*)
case `/usr/bin/uname -p` in
sparc) echo sparc-icl-nx7 && exit 0 ;;
esac ;;
sun4H:SunOS:5.*:*)
echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
exit 0 ;;
@@ -437,18 +420,15 @@ EOF
exit (-1);
}
EOF
$CC_FOR_BUILD -o $dummy $dummy.c \
&& $dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \
&& rm -f $dummy.c $dummy && rmdir $tmpdir && exit 0
rm -f $dummy.c $dummy && rmdir $tmpdir
$CC_FOR_BUILD $dummy.c -o $dummy \
&& ./$dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \
&& rm -f $dummy.c $dummy && exit 0
rm -f $dummy.c $dummy
echo mips-mips-riscos${UNAME_RELEASE}
exit 0 ;;
Motorola:PowerMAX_OS:*:*)
echo powerpc-motorola-powermax
exit 0 ;;
Motorola:*:4.3:PL8-*)
echo powerpc-harris-powermax
exit 0 ;;
Night_Hawk:*:*:PowerMAX_OS)
echo powerpc-harris-powermax
exit 0 ;;
@@ -524,8 +504,8 @@ EOF
exit(0);
}
EOF
$CC_FOR_BUILD -o $dummy $dummy.c && $dummy && rm -f $dummy.c $dummy && rmdir $tmpdir && exit 0
rm -f $dummy.c $dummy && rmdir $tmpdir
$CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm -f $dummy.c $dummy && exit 0
rm -f $dummy.c $dummy
echo rs6000-ibm-aix3.2.5
elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
echo rs6000-ibm-aix3.2.4
@@ -623,9 +603,9 @@ EOF
exit (0);
}
EOF
(CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
(CCOPTS= $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null) && HP_ARCH=`./$dummy`
if test -z "$HP_ARCH"; then HP_ARCH=hppa; fi
rm -f $dummy.c $dummy && rmdir $tmpdir
rm -f $dummy.c $dummy
fi ;;
esac
echo ${HP_ARCH}-hp-hpux${HPUX_REV}
@@ -661,8 +641,8 @@ EOF
exit (0);
}
EOF
$CC_FOR_BUILD -o $dummy $dummy.c && $dummy && rm -f $dummy.c $dummy && rmdir $tmpdir && exit 0
rm -f $dummy.c $dummy && rmdir $tmpdir
$CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm -f $dummy.c $dummy && exit 0
rm -f $dummy.c $dummy
echo unknown-hitachi-hiuxwe2
exit 0 ;;
9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
@@ -745,19 +725,7 @@ EOF
echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
exit 0 ;;
*:FreeBSD:*:*)
# Determine whether the default compiler uses glibc.
eval $set_cc_for_build
sed 's/^ //' << EOF >$dummy.c
#include <features.h>
#if __GLIBC__ >= 2
LIBC=gnu
#else
LIBC=
#endif
EOF
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=`
rm -f $dummy.c && rmdir $tmpdir
echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`${LIBC:+-$LIBC}
echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
exit 0 ;;
i*:CYGWIN*:*)
echo ${UNAME_MACHINE}-pc-cygwin
@@ -818,7 +786,7 @@ EOF
#endif
EOF
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=`
rm -f $dummy.c && rmdir $tmpdir
rm -f $dummy.c
test x"${CPU}" != x && echo "${CPU}-pc-linux-gnu" && exit 0
;;
ppc:Linux:*:*)
@@ -881,7 +849,7 @@ EOF
;;
a.out-i386-linux)
echo "${UNAME_MACHINE}-pc-linux-gnuaout"
exit 0 ;;
exit 0 ;;
coff-i386)
echo "${UNAME_MACHINE}-pc-linux-gnucoff"
exit 0 ;;
@@ -914,7 +882,7 @@ EOF
#endif
EOF
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=`
rm -f $dummy.c && rmdir $tmpdir
rm -f $dummy.c
test x"${LIBC}" != x && echo "${UNAME_MACHINE}-pc-linux-${LIBC}" && exit 0
test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0
;;
@@ -992,9 +960,6 @@ EOF
# "miniframe"
echo m68010-convergent-sysv
exit 0 ;;
mc68k:UNIX:SYSTEM5:3.51m)
echo m68k-convergent-sysv
exit 0 ;;
M68*:*:R3V[567]*:*)
test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;;
3[34]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0)
@@ -1088,9 +1053,6 @@ EOF
SX-5:SUPER-UX:*:*)
echo sx5-nec-superux${UNAME_RELEASE}
exit 0 ;;
SX-6:SUPER-UX:*:*)
echo sx6-nec-superux${UNAME_RELEASE}
exit 0 ;;
Power*:Rhapsody:*:*)
echo powerpc-apple-rhapsody${UNAME_RELEASE}
exit 0 ;;
@@ -1111,7 +1073,7 @@ EOF
*:QNX:*:4*)
echo i386-pc-qnx
exit 0 ;;
NSR-[DGKLNPTVW]:NONSTOP_KERNEL:*:*)
NSR-[GKLNPTVW]:NONSTOP_KERNEL:*:*)
echo nsr-tandem-nsk${UNAME_RELEASE}
exit 0 ;;
*:NonStop-UX:*:*)
@@ -1283,8 +1245,8 @@ main ()
}
EOF
$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && $dummy && rm -f $dummy.c $dummy && rmdir $tmpdir && exit 0
rm -f $dummy.c $dummy && rmdir $tmpdir
$CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy && rm -f $dummy.c $dummy && exit 0
rm -f $dummy.c $dummy
# Apollos put the system type in the environment.
Vendored
+42 -69
View File
@@ -3,7 +3,7 @@
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
# 2000, 2001, 2002 Free Software Foundation, Inc.
timestamp='2002-09-05'
timestamp='2002-05-28'
# This file is (in principle) common to ALL GNU software.
# The presence of a machine in this file suggests that SOME GNU software
@@ -118,7 +118,7 @@ esac
# Here we must recognize all the valid KERNEL-OS combinations.
maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
case $maybe_os in
nto-qnx* | linux-gnu* | freebsd*-gnu* | storm-chaos* | os2-emx* | windows32-* | rtmk-nova*)
nto-qnx* | linux-gnu* | storm-chaos* | os2-emx* | windows32-* | rtmk-nova*)
os=-$maybe_os
basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
;;
@@ -229,34 +229,24 @@ case $basic_machine in
| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
| arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \
| clipper \
| c4x | clipper \
| d10v | d30v | dlx | dsp16xx \
| fr30 | frv \
| fr30 \
| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
| i370 | i860 | i960 | ia64 \
| ip2k \
| m32r | m68000 | m68k | m88k | mcore \
| mips | mipsbe | mipseb | mipsel | mipsle \
| mips16 \
| mips64 | mips64el \
| mips64vr | mips64vrel \
| mips64orion | mips64orionel \
| mips64vr4100 | mips64vr4100el \
| mips64vr4300 | mips64vr4300el \
| mips64vr5000 | mips64vr5000el \
| mipsisa32 | mipsisa32el \
| mipsisa64 | mipsisa64el \
| mipsisa64sb1 | mipsisa64sb1el \
| mipsisa64sr71k | mipsisa64sr71kel \
| mipstx39 | mipstx39el \
| mips | mips16 | mips64 | mips64el | mips64orion | mips64orionel \
| mips64vr4100 | mips64vr4100el | mips64vr4300 \
| mips64vr4300el | mips64vr5000 | mips64vr5000el \
| mipsbe | mipseb | mipsel | mipsle | mipstx39 | mipstx39el \
| mipsisa32 | mipsisa64 \
| mn10200 | mn10300 \
| ns16k | ns32k \
| openrisc | or32 \
| pdp10 | pdp11 | pj | pjl \
| powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
| pyramid \
| sh | sh[1234] | sh3e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \
| sh64 | sh64le \
| sh | sh[34] | sh[34]eb | shbe | shle | sh64 \
| sparc | sparc64 | sparc86x | sparclet | sparclite | sparcv9 | sparcv9b \
| strongarm \
| tahoe | thumb | tic80 | tron \
@@ -294,42 +284,31 @@ case $basic_machine in
| arm-* | armbe-* | armle-* | armeb-* | armv*-* \
| avr-* \
| bs2000-* \
| c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* \
| c[123]* | c30-* | [cjt]90-* | c54x-* \
| clipper-* | cydra-* \
| d10v-* | d30v-* | dlx-* \
| elxsi-* \
| f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \
| f30[01]-* | f700-* | fr30-* | fx80-* \
| h8300-* | h8500-* \
| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
| i*86-* | i860-* | i960-* | ia64-* \
| ip2k-* \
| m32r-* \
| m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
| m88110-* | m88k-* | mcore-* \
| mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
| mips16-* \
| mips64-* | mips64el-* \
| mips64vr-* | mips64vrel-* \
| mips64orion-* | mips64orionel-* \
| mips64vr4100-* | mips64vr4100el-* \
| mips64vr4300-* | mips64vr4300el-* \
| mips64vr5000-* | mips64vr5000el-* \
| mipsisa32-* | mipsisa32el-* \
| mipsisa64-* | mipsisa64el-* \
| mipsisa64sb1-* | mipsisa64sb1el-* \
| mipsisa64sr71k-* | mipsisa64sr71kel-* \
| mipstx39 | mipstx39el \
| mips-* | mips16-* | mips64-* | mips64el-* | mips64orion-* \
| mips64orionel-* | mips64vr4100-* | mips64vr4100el-* \
| mips64vr4300-* | mips64vr4300el-* | mipsbe-* | mipseb-* \
| mipsle-* | mipsel-* | mipstx39-* | mipstx39el-* \
| none-* | np1-* | ns16k-* | ns32k-* \
| orion-* \
| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
| pyramid-* \
| romp-* | rs6000-* \
| sh-* | sh[1234]-* | sh3e-* | sh[34]eb-* | shbe-* \
| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
| sh-* | sh[34]-* | sh[34]eb-* | shbe-* | shle-* | sh64-* \
| sparc-* | sparc64-* | sparc86x-* | sparclet-* | sparclite-* \
| sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \
| tahoe-* | thumb-* | tic30-* | tic4x-* | tic54x-* | tic80-* | tron-* \
| tahoe-* | thumb-* | tic30-* | tic54x-* | tic80-* | tron-* \
| v850-* | v850e-* | vax-* \
| we32k-* \
| x86-* | x86_64-* | xps100-* | xscale-* | xstormy16-* \
@@ -749,13 +728,13 @@ case $basic_machine in
pbb)
basic_machine=m68k-tti
;;
pc532 | pc532-*)
pc532 | pc532-*)
basic_machine=ns32k-pc532
;;
pentium | p5 | k5 | k6 | nexgen | viac3)
basic_machine=i586-pc
;;
pentiumpro | p6 | 6x86 | athlon | athlon_*)
pentiumpro | p6 | 6x86 | athlon)
basic_machine=i686-pc
;;
pentiumii | pentium2)
@@ -776,22 +755,22 @@ case $basic_machine in
power) basic_machine=power-ibm
;;
ppc) basic_machine=powerpc-unknown
;;
;;
ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
ppcle | powerpclittle | ppc-le | powerpc-little)
basic_machine=powerpcle-unknown
;;
;;
ppcle-* | powerpclittle-*)
basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
ppc64) basic_machine=powerpc64-unknown
;;
;;
ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
ppc64le | powerpc64little | ppc64-le | powerpc64-little)
basic_machine=powerpc64le-unknown
;;
;;
ppc64le-* | powerpc64little-*)
basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
@@ -822,12 +801,6 @@ case $basic_machine in
basic_machine=a29k-amd
os=-udi
;;
sb1)
basic_machine=mipsisa64sb1-unknown
;;
sb1el)
basic_machine=mipsisa64sb1el-unknown
;;
sequent)
basic_machine=i386-sequent
;;
@@ -893,7 +866,7 @@ case $basic_machine in
sun386 | sun386i | roadrunner)
basic_machine=i386-sun
;;
sv1)
sv1)
basic_machine=sv1-cray
os=-unicos
;;
@@ -913,10 +886,6 @@ case $basic_machine in
basic_machine=t90-cray
os=-unicos
;;
tic4x | c4x*)
basic_machine=tic4x-unknown
os=-coff
;;
tic54x | c54x*)
basic_machine=tic54x-unknown
os=-coff
@@ -955,8 +924,8 @@ case $basic_machine in
os=-vms
;;
vpp*|vx|vx-*)
basic_machine=f301-fujitsu
;;
basic_machine=f301-fujitsu
;;
vxworks960)
basic_machine=i960-wrs
os=-vxworks
@@ -981,7 +950,7 @@ case $basic_machine in
basic_machine=i386-pc
os=-windows32-msvcrt
;;
xps | xps100)
xps | xps100)
basic_machine=xps100-honeywell
;;
ymp)
@@ -1027,7 +996,7 @@ case $basic_machine in
we32k)
basic_machine=we32k-att
;;
sh3 | sh4 | sh3eb | sh4eb | sh[1234]le | sh3ele)
sh3 | sh4 | sh3eb | sh4eb)
basic_machine=sh-unknown
;;
sh64)
@@ -1036,7 +1005,7 @@ case $basic_machine in
sparc | sparcv9 | sparcv9b)
basic_machine=sparc-sun
;;
cydra)
cydra)
basic_machine=cydra-cydrome
;;
orion)
@@ -1051,6 +1020,10 @@ case $basic_machine in
pmac | pmac-mpw)
basic_machine=powerpc-apple
;;
c4x*)
basic_machine=c4x-none
os=-coff
;;
*-unknown)
# Make sure to match an already-canonicalized machine name.
;;
@@ -1182,7 +1155,7 @@ case $os in
os=-rtmk-nova
;;
-ns2 )
os=-nextstep2
os=-nextstep2
;;
-nsk*)
os=-nsk
@@ -1221,8 +1194,8 @@ case $os in
-xenix)
os=-xenix
;;
-*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
os=-mint
-*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
os=-mint
;;
-none)
;;
@@ -1259,7 +1232,7 @@ case $basic_machine in
pdp10-*)
os=-tops20
;;
pdp11-*)
pdp11-*)
os=-none
;;
*-dec | vax-*)
@@ -1352,19 +1325,19 @@ case $basic_machine in
*-next)
os=-nextstep3
;;
*-gould)
*-gould)
os=-sysv
;;
*-highlevel)
*-highlevel)
os=-bsd
;;
*-encore)
os=-bsd
;;
*-sgi)
*-sgi)
os=-irix
;;
*-siemens)
*-siemens)
os=-sysv4
;;
*-masscomp)
+47 -68
View File
@@ -30,6 +30,9 @@ dnl -------------------------------------------------------------------------
AC_PREREQ(2.13)
AC_INIT(README.CVS-RULES)
dnl check for working sed
PHP_PROG_SED
PHP_CONFIG_NICE(config.nice)
for arg in $0 "$@"; do
CONFIGURE_COMMAND="$CONFIGURE_COMMAND '$arg'"
@@ -40,8 +43,8 @@ AC_CONFIG_HEADER(main/php_config.h)
MAJOR_VERSION=4
MINOR_VERSION=3
RELEASE_VERSION=2
EXTRA_VERSION="RC3"
RELEASE_VERSION=1
EXTRA_VERSION=""
VERSION="$MAJOR_VERSION.$MINOR_VERSION.$RELEASE_VERSION$EXTRA_VERSION"
dnl Define where extension directories are located in the configure context
@@ -61,15 +64,16 @@ echo "#define PHP_MINOR_VERSION $MINOR_VERSION" >> php_version.h.new
echo "#define PHP_RELEASE_VERSION $RELEASE_VERSION" >> php_version.h.new
echo "#define PHP_EXTRA_VERSION \"$EXTRA_VERSION\"" >> php_version.h.new
echo "#define PHP_VERSION \"$PHP_VERSION\"" >> php_version.h.new
cmp php_version.h.new $srcdir/main/php_version.h >/dev/null 2>&1
cmp php_version.h.new php_version.h >/dev/null 2>&1
if test $? -ne 0 ; then
rm -f $srcdir/main/php_version.h && mv php_version.h.new $srcdir/main/php_version.h && \
echo 'Updated main/php_version.h'
rm -f php_version.h && mv php_version.h.new php_version.h && \
echo 'Updated php_version.h'
else
rm -f php_version.h.new
fi
dnl Catch common errors here to save a few seconds of our users' time
dnl -------------------------------------------------------------------------
@@ -87,12 +91,12 @@ dnl -------------------------------------------------------------------------
cwd=`pwd`
PHP_INIT_BUILD_SYSTEM
php_shtool=$srcdir/build/shtool
T_MD=`$php_shtool echo -n -e %B`
T_ME=`$php_shtool echo -n -e %b`
PHP_INIT_BUILD_SYSTEM
dnl We want this one before the checks, so the checks can modify CFLAGS.
test -z "$CFLAGS" && auto_cflags=1
@@ -135,9 +139,9 @@ if test "$YACC" != "bison -y"; then
AC_MSG_WARN([You will need bison if you want to regenerate the PHP parsers.])
else
AC_MSG_CHECKING([bison version])
set `bison --version| grep 'GNU Bison' | cut -d ' ' -f 4 | sed -e 's/\./ /'|tr -d a-z`
if test "${1}" = "1" -a "(" "${2}" -lt "75" -a "${2}" -ne "28" -a "${2}" -ne "35" -o "${2}" -ge "875" ")"; then
AC_MSG_WARN(You will need bison 1.28, 1.35 or 1.75 if you want to regenerate the Zend parser (found ${1}.${2}).)
set `bison --version| grep 'GNU Bison' | cut -d ' ' -f 4 | sed -e 's/\./ /'`
if test "${1}" = "1" -a "${2}" -lt "28"; then
AC_MSG_WARN(You will need bison 1.28 if you want to regenerate the Zend parser (found ${1}.${2}).)
fi
AC_MSG_RESULT(${1}.${2} (ok))
fi
@@ -155,19 +159,11 @@ if test "$ac_cv_c_const" = "yes" ; then
fi
AC_MSG_CHECKING([flex version])
if test "$LEX" ;then
flexvers=`echo "" | $LEX -V -v --version 2>/dev/null |
sed -e 's/^.* //' -e 's/\./ /g'`
if test ! -z "$flexvers"; then
set $flexvers
if test "${1}" != "2" -o "${2}" != "5" -o "${3}" -lt "4"; then
AC_MSG_WARN(You will need flex 2.5.4 or later if you want to regenerate Zend/PHP lexical parsers.)
fi
fi
AC_MSG_RESULT(${1}.${2}.${3} (ok))
else
AC_MSG_WARN(You will need flex 2.5.4 or later if you want to regenerate Zend/PHP lexical parsers.)
set `echo "" | $LEX -V -v --version 2>/dev/null | grep 'version' | cut -d ' ' -f 3 | sed -e 's/\./ /g' | sed -e 's/[^0-9 ]//g'`
if test "${1}" != "2" -o "${2}" != "5" -o "${3}" -lt "4"; then
AC_MSG_WARN(You will need flex 2.5.4 or later if you want to regenerate Zend/PHP lexical parsers.)
fi
AC_MSG_RESULT(${1}.${2}.${3} (ok))
dnl Platform-specific compile settings.
dnl -------------------------------------------------------------------------
@@ -235,7 +231,7 @@ SAPI_LIBTOOL=libphp4.la
PHP_CONFIGURE_PART(Configuring SAPI modules)
esyscmd(./build/config-stubs sapi)
esyscmd(./scripts/config-stubs sapi)
dnl Show which main SAPI was selected
AC_MSG_CHECKING([for chosen SAPI module])
@@ -386,8 +382,6 @@ sys/ipc.h \
])
PHP_FOPENCOOKIE
PHP_BROKEN_GETCWD
PHP_BROKEN_GLIBC_FOPEN_APPEND
dnl Checks for typedefs, structures, and compiler characteristics.
dnl -------------------------------------------------------------------------
@@ -450,7 +444,6 @@ dnl -------------------------------------------------------------------------
AC_FUNC_VPRINTF
AC_CHECK_FUNCS(
alphasort \
asctime_r \
chroot \
ctime_r \
@@ -479,7 +472,6 @@ memmove \
mkstemp \
mmap \
nl_langinfo \
perror \
poll \
putenv \
realpath \
@@ -487,7 +479,6 @@ random \
rand_r \
regcomp \
res_search \
scandir \
setitimer \
setlocale \
localeconv \
@@ -563,7 +554,7 @@ dnl ## In diversion 4 we check user-configurable general settings.
dnl General settings.
dnl -------------------------------------------------------------------------
PHP_CONFIGURE_PART(General settings)
PHP_HELP_SEPARATOR([General settings:])
@@ -620,10 +611,10 @@ fi
PHP_ARG_WITH(pear, [whether to install PEAR, and where],
[ --with-pear=DIR Install PEAR in DIR (default PREFIX/lib/php)
--without-pear Do not install PEAR], DEFAULT, yes)
--without-pear Do not install PEAR], DEFAULT, no)
if test "$PHP_PEAR" != "no" && test "$disable_cli" != "1"; then
install_pear="install-pear"
install_pear="install-pear install-build install-headers install-programs"
PEAR_INSTALLDIR=$PHP_PEAR
fi
@@ -736,13 +727,20 @@ dnl
dnl OpenSSL configure
dnl
PHP_ARG_WITH(openssl,for OpenSSL support,
[ --with-openssl[=DIR] Include OpenSSL support (requires OpenSSL >= 0.9.6) ])
[ --with-openssl[=DIR] Include OpenSSL support (requires OpenSSL >= 0.9.5) ])
if test "$PHP_OPENSSL" != "no"; then
ext_openssl_shared=$ext_shared
PHP_SETUP_OPENSSL
fi
AC_CHECK_LIB(crypt, crypt, [
PHP_ADD_LIBRARY(crypt)
PHP_ADD_LIBRARY(crypt, 1)
AC_DEFINE(HAVE_CRYPT,1,[ ])
])
divert(5)
dnl ## In diversion 5 we check which extensions should be compiled.
@@ -771,12 +769,13 @@ dnl
AC_ARG_ENABLE(all,
[ --disable-all Disable all extensions enabled by default.
--enable-all Enable all extensions.
], [
PHP_ENABLE_ALL=$enableval
])
# reading config stubs
esyscmd(./build/config-stubs ext)
esyscmd(./scripts/config-stubs ext)
dnl Other settings.
@@ -787,12 +786,8 @@ PHP_HELP_SEPARATOR([Other settings:])
AC_MSG_CHECKING([whether to enable versioning])
AC_ARG_ENABLE(versioning,
[ --enable-versioning Export only required symbols.
See INSTALL for more information], [
if test "x$APXS" != "x"; then
PHP_VERSIONING=$enableval
else
PHP_VERSIONING=no
fi
See INSTALL for more information],[
PHP_VERSIONING=$enableval
],[
PHP_VERSIONING=no
])
@@ -801,7 +796,7 @@ AC_MSG_RESULT([$PHP_VERSIONING])
if test "$PHP_VERSIONING" = "yes"; then
test -z "$PHP_SYM_FILE" && PHP_SYM_FILE="$abs_srcdir/sapi/$PHP_SAPI/php.sym"
if test -f "$PHP_SYM_FILE"; then
EXTRA_LDFLAGS="-export-symbols $PHP_SYM_FILE $EXTRA_LDFLAGS"
EXTRA_LDFLAGS="-export-symbols $PHP_SYM_FILE"
fi
fi
@@ -826,13 +821,6 @@ esac
PHP_REGEX
EXTRA_LIBS="$EXTRA_LIBS $DLIBS $LIBS"
dnl this has to be here to prevent the openssl crypt() from
dnl overriding the system provided crypt().
if test "$ac_cv_lib_crypt_crypt" = "yes"; then
EXTRA_LIBS="-lcrypt $EXTRA_LIBS -lcrypt"
fi
unset LIBS LDFLAGS
dnl Configuring Zend and TSRM.
@@ -999,7 +987,6 @@ PHP_SUBST(bindir)
PHP_SUBST(exec_prefix)
PHP_SUBST(includedir)
PHP_SUBST(libdir)
PHP_SUBST(mandir)
PHP_SUBST(phplibdir)
PHP_SUBST(phptempdir)
PHP_SUBST(prefix)
@@ -1073,20 +1060,11 @@ if test "$PHP_THREAD_SAFETY" = "yes" && test "$PHP_MYSQL" = "yes"; then
CPPFLAGS="$CPPFLAGS -DTHREAD=1"
fi
dnl
dnl Libtool creation
dnl
PHP_CONFIGURE_PART(Configuring libtool)
LDFLAGS="$LDFLAGS $PHP_AIX_LDFLAGS"
AC_PROG_LIBTOOL
if test "$enable_debug" != "yes"; then
PHP_SET_LIBTOOL_VARIABLE([--silent])
fi
dnl libtool 1.4.3 needs this.
PHP_SET_LIBTOOL_VARIABLE([--preserve-dup-deps])
test -z "$PHP_COMPILE" && PHP_COMPILE='$(LIBTOOL) --mode=compile $(COMPILE) -c $<'
test -z "$CXX_PHP_COMPILE" && CXX_PHP_COMPILE='$(LIBTOOL) --mode=compile $(CXX_COMPILE) -c $<'
@@ -1103,7 +1081,7 @@ INLINE_CFLAGS="$INLINE_CFLAGS $standard_libtool_flag"
CXXFLAGS="$CXXFLAGS $standard_libtool_flag"
all_targets='$(OVERALL_TARGET) $(PHP_MODULES) $(PHP_CLI_TARGET)'
install_targets="install-sapi install-modules $install_pear install-build install-headers install-programs"
install_targets="install-sapi install-modules $install_pear"
if test "$PHP_SAPI" != "cgi"; then
install_targets="$PHP_INSTALL_CLI_TARGET $install_targets"
fi
@@ -1114,7 +1092,7 @@ PHP_SUBST(install_targets)
PHP_ADD_SOURCES(TSRM, TSRM.c tsrm_strtok_r.c tsrm_virtual_cwd.c)
PHP_ADD_SOURCES(main, main.c snprintf.c spprintf.c php_sprintf.c \
safe_mode.c fopen_wrappers.c alloca.c php_scandir.c \
safe_mode.c fopen_wrappers.c alloca.c \
php_ini.c SAPI.c rfc1867.c php_content_types.c strlcpy.c \
strlcat.c mergesort.c reentrancy.c php_variables.c php_ticks.c \
streams.c network.c php_open_temporary_file.c php_logos.c \
@@ -1122,7 +1100,7 @@ PHP_ADD_SOURCES(main, main.c snprintf.c spprintf.c php_sprintf.c \
PHP_ADD_SOURCES(/main, internal_functions.c,, sapi)
PHP_ADD_SOURCES(/main, internal_functions_cli.c,, cli)
PHP_ADD_SOURCES(/Zend, zend_language_parser.c zend_language_scanner.c \
PHP_ADD_SOURCES(/Zend, zend_language_parser.c zend_language_scanner.c \
zend_ini_parser.c zend_ini_scanner.c)
PHP_ADD_SOURCES(Zend, \
@@ -1153,7 +1131,7 @@ PHP_ADD_BUILD_DIR(sapi/$PHP_SAPI sapi/cli)
PHP_ADD_BUILD_DIR(TSRM)
PHP_ADD_BUILD_DIR(Zend)
PHP_ADD_MAKEFILE_FRAGMENT($abs_srcdir/scripts/Makefile.frag,$abs_srcdir/scripts,scripts)
PHP_ADD_MAKEFILE_FRAGMENT($abs_srcdir/pear/Makefile.frag,$abs_srcdir/pear,pear)
PHP_ADD_MAKEFILE_FRAGMENT($abs_srcdir/Makefile.frag,$abs_srcdir/Zend,Zend)
@@ -1163,10 +1141,8 @@ PHP_GEN_GLOBAL_MAKEFILE
AC_DEFINE([HAVE_BUILD_DEFS_H], 1, [ ])
$php_shtool mkdir -p pear/scripts
$php_shtool mkdir -p scripts
ALL_OUTPUT_FILES="php4.spec main/build-defs.h \
scripts/phpize scripts/php-config \
pear/scripts/phpize pear/scripts/php-config \
$PHP_OUTPUT_FILES"
AC_OUTPUT($ALL_OUTPUT_FILES, [], [
@@ -1186,10 +1162,10 @@ fi
# Create configuration headers
#
test -d TSRM || $php_shtool mkdir TSRM
test -d TSRM || mkdir TSRM
echo '#include "../main/php_config.h"' > TSRM/tsrm_config.h
test -d Zend || $php_shtool mkdir Zend
test -d Zend || mkdir Zend
cat >Zend/zend_config.h <<FEO
#include "../main/php_config.h"
@@ -1320,7 +1296,7 @@ X
fi
fi
cat <<X
cat<<X
+--------------------------------------------------------------------+
| License: |
| This software is subject to the PHP License, available in this |
@@ -1340,7 +1316,10 @@ cat <<X
| avoid using it if possible. |
+--------------------------------------------------------------------+
Thank you for using PHP.
X
PHP_CONFIGURE_PART(Thank you for using PHP.)
cat<<X
X
+21 -49
View File
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 4 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2003 The PHP Group |
| Copyright (c) 1997-2002 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 |
@@ -96,7 +96,7 @@ PHP_RINIT_FUNCTION(bcmath)
if (cfg_get_long("bcmath.scale", &bc_precision)==FAILURE) {
bc_precision=0;
}
if(bc_precision<0) bc_precision=0;
bc_init_numbers(TSRMLS_C);
return SUCCESS;
@@ -110,21 +110,6 @@ PHP_MINFO_FUNCTION(bcmath)
php_info_print_table_end();
}
/* {{{ php_str2num
Convert to bc_num detecting scale */
static void php_str2num(bc_num *num, char *str TSRMLS_DC)
{
char *p;
if (!(p = strchr(str, '.'))) {
bc_str2num(num, str, 0 TSRMLS_CC);
return;
}
bc_str2num(num, str, strlen(p+1) TSRMLS_CC);
}
/* }}} */
/* {{{ proto string bcadd(string left_operand, string right_operand [, int scale])
Returns the sum of two arbitrary precision numbers */
PHP_FUNCTION(bcadd)
@@ -144,7 +129,7 @@ PHP_FUNCTION(bcadd)
WRONG_PARAM_COUNT;
}
convert_to_long_ex(scale_param);
scale = (int) (Z_LVAL_PP(scale_param)<0) ? 0:Z_LVAL_PP(scale_param);
scale = (int) Z_LVAL_PP(scale_param);
break;
default:
WRONG_PARAM_COUNT;
@@ -155,11 +140,9 @@ PHP_FUNCTION(bcadd)
bc_init_num(&first TSRMLS_CC);
bc_init_num(&second TSRMLS_CC);
bc_init_num(&result TSRMLS_CC);
php_str2num(&first, Z_STRVAL_PP(left) TSRMLS_CC);
php_str2num(&second, Z_STRVAL_PP(right) TSRMLS_CC);
bc_str2num(&first, Z_STRVAL_PP(left), scale TSRMLS_CC);
bc_str2num(&second, Z_STRVAL_PP(right), scale TSRMLS_CC);
bc_add (first, second, &result, scale);
if (result->n_scale > scale)
result->n_scale = scale;
Z_STRVAL_P(return_value) = bc_num2str(result);
Z_STRLEN_P(return_value) = strlen(Z_STRVAL_P(return_value));
Z_TYPE_P(return_value) = IS_STRING;
@@ -189,7 +172,7 @@ PHP_FUNCTION(bcsub)
WRONG_PARAM_COUNT;
}
convert_to_long_ex(scale_param);
scale = (int) (Z_LVAL_PP(scale_param)<0) ? 0:Z_LVAL_PP(scale_param);
scale = (int) Z_LVAL_PP(scale_param);
break;
default:
WRONG_PARAM_COUNT;
@@ -200,11 +183,9 @@ PHP_FUNCTION(bcsub)
bc_init_num(&first TSRMLS_CC);
bc_init_num(&second TSRMLS_CC);
bc_init_num(&result TSRMLS_CC);
php_str2num(&first, Z_STRVAL_PP(left) TSRMLS_CC);
php_str2num(&second, Z_STRVAL_PP(right) TSRMLS_CC);
bc_str2num(&first, Z_STRVAL_PP(left), scale TSRMLS_CC);
bc_str2num(&second, Z_STRVAL_PP(right), scale TSRMLS_CC);
bc_sub (first, second, &result, scale);
if (result->n_scale > scale)
result->n_scale = scale;
Z_STRVAL_P(return_value) = bc_num2str(result);
Z_STRLEN_P(return_value) = strlen(Z_STRVAL_P(return_value));
Z_TYPE_P(return_value) = IS_STRING;
@@ -234,7 +215,7 @@ PHP_FUNCTION(bcmul)
WRONG_PARAM_COUNT;
}
convert_to_long_ex(scale_param);
scale = (int) (Z_LVAL_PP(scale_param)<0) ? 0:Z_LVAL_PP(scale_param);
scale = (int) Z_LVAL_PP(scale_param);
break;
default:
WRONG_PARAM_COUNT;
@@ -245,11 +226,9 @@ PHP_FUNCTION(bcmul)
bc_init_num(&first TSRMLS_CC);
bc_init_num(&second TSRMLS_CC);
bc_init_num(&result TSRMLS_CC);
php_str2num(&first, Z_STRVAL_PP(left) TSRMLS_CC);
php_str2num(&second, Z_STRVAL_PP(right) TSRMLS_CC);
bc_str2num(&first, Z_STRVAL_PP(left), scale TSRMLS_CC);
bc_str2num(&second, Z_STRVAL_PP(right), scale TSRMLS_CC);
bc_multiply (first, second, &result, scale TSRMLS_CC);
if (result->n_scale > scale)
result->n_scale = scale;
Z_STRVAL_P(return_value) = bc_num2str(result);
Z_STRLEN_P(return_value) = strlen(Z_STRVAL_P(return_value));
Z_TYPE_P(return_value) = IS_STRING;
@@ -279,7 +258,7 @@ PHP_FUNCTION(bcdiv)
WRONG_PARAM_COUNT;
}
convert_to_long_ex(scale_param);
scale = (int) (Z_LVAL_PP(scale_param)<0) ? 0:Z_LVAL_PP(scale_param);
scale = (int) Z_LVAL_PP(scale_param);
break;
default:
WRONG_PARAM_COUNT;
@@ -290,12 +269,10 @@ PHP_FUNCTION(bcdiv)
bc_init_num(&first TSRMLS_CC);
bc_init_num(&second TSRMLS_CC);
bc_init_num(&result TSRMLS_CC);
php_str2num(&first, Z_STRVAL_PP(left) TSRMLS_CC);
php_str2num(&second, Z_STRVAL_PP(right) TSRMLS_CC);
bc_str2num(&first, Z_STRVAL_PP(left), scale TSRMLS_CC);
bc_str2num(&second, Z_STRVAL_PP(right), scale TSRMLS_CC);
switch (bc_divide (first, second, &result, scale TSRMLS_CC)) {
case 0: /* OK */
if (result->n_scale > scale)
result->n_scale = scale;
Z_STRVAL_P(return_value) = bc_num2str(result);
Z_STRLEN_P(return_value) = strlen(Z_STRVAL_P(return_value));
Z_TYPE_P(return_value) = IS_STRING;
@@ -371,7 +348,7 @@ PHP_FUNCTION(bcpow)
WRONG_PARAM_COUNT;
}
convert_to_long_ex(scale_param);
scale = (int) (Z_LVAL_PP(scale_param)<0) ? 0:Z_LVAL_PP(scale_param);
scale = (int) Z_LVAL_PP(scale_param);
break;
default:
WRONG_PARAM_COUNT;
@@ -382,11 +359,9 @@ PHP_FUNCTION(bcpow)
bc_init_num(&first TSRMLS_CC);
bc_init_num(&second TSRMLS_CC);
bc_init_num(&result TSRMLS_CC);
php_str2num(&first, Z_STRVAL_PP(left) TSRMLS_CC);
php_str2num(&second, Z_STRVAL_PP(right) TSRMLS_CC);
bc_str2num(&first, Z_STRVAL_PP(left), scale TSRMLS_CC);
bc_str2num(&second, Z_STRVAL_PP(right), scale TSRMLS_CC);
bc_raise (first, second, &result, scale TSRMLS_CC);
if (result->n_scale > scale)
result->n_scale = scale;
Z_STRVAL_P(return_value) = bc_num2str(result);
Z_STRLEN_P(return_value) = strlen(Z_STRVAL_P(return_value));
Z_TYPE_P(return_value) = IS_STRING;
@@ -416,7 +391,7 @@ PHP_FUNCTION(bcsqrt)
WRONG_PARAM_COUNT;
}
convert_to_long_ex(scale_param);
scale = (int) (Z_LVAL_PP(scale_param)<0) ? 0:Z_LVAL_PP(scale_param);
scale = (int) Z_LVAL_PP(scale_param);
break;
default:
WRONG_PARAM_COUNT;
@@ -424,10 +399,8 @@ PHP_FUNCTION(bcsqrt)
}
convert_to_string_ex(left);
bc_init_num(&result TSRMLS_CC);
php_str2num(&result, Z_STRVAL_PP(left) TSRMLS_CC);
bc_str2num(&result, Z_STRVAL_PP(left), scale TSRMLS_CC);
if (bc_sqrt (&result, scale TSRMLS_CC) != 0) {
if (result->n_scale > scale)
result->n_scale = scale;
Z_STRVAL_P(return_value) = bc_num2str(result);
Z_STRLEN_P(return_value) = strlen(Z_STRVAL_P(return_value));
Z_TYPE_P(return_value) = IS_STRING;
@@ -458,7 +431,7 @@ PHP_FUNCTION(bccomp)
WRONG_PARAM_COUNT;
}
convert_to_long_ex(scale_param);
scale = (int) (Z_LVAL_PP(scale_param)<0) ? 0:Z_LVAL_PP(scale_param);
scale = (int) Z_LVAL_PP(scale_param);
break;
default:
WRONG_PARAM_COUNT;
@@ -492,8 +465,7 @@ PHP_FUNCTION(bcscale)
}
convert_to_long_ex(new_scale);
bc_precision = (Z_LVAL_PP(new_scale)<0) ? 0 : Z_LVAL_PP(new_scale);
bc_precision = Z_LVAL_PP(new_scale);
RETURN_TRUE;
}
/* }}} */
+1 -1
View File
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 4 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2003 The PHP Group |
| Copyright (c) 1997-2002 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 |
+1 -1
View File
@@ -1,6 +1,6 @@
--TEST--
bcadd() function
--SKIPIF--
--SKIP--
<?php if(!extension_loaded("bcmath")) print "skip"; ?>
--INI--
bcmath.scale=0
+1 -1
View File
@@ -1,6 +1,6 @@
--TEST--
bccomp() function
--SKIPIF--
--SKIP--
<?php if(!extension_loaded("bcmath")) print "skip"; ?>
--INI--
bcmath.scale=0
+1 -1
View File
@@ -1,6 +1,6 @@
--TEST--
bcdiv() function
--SKIPIF--
--SKIP--
<?php if(!extension_loaded("bcmath")) print "skip"; ?>
--INI--
bcmath.scale=0
+1 -1
View File
@@ -1,6 +1,6 @@
--TEST--
bcmod() function
--SKIPIF--
--SKIP--
<?php if(!extension_loaded("bcmath")) print "skip"; ?>
--INI--
bcmath.scale=0
+1 -1
View File
@@ -1,6 +1,6 @@
--TEST--
bcmul() function
--SKIPIF--
--SKIP--
<?php if(!extension_loaded("bcmath")) print "skip"; ?>
--INI--
bcmath.scale=0
+1 -1
View File
@@ -1,6 +1,6 @@
--TEST--
bcpow() function
--SKIPIF--
--SKIP--
<?php if(!extension_loaded("bcmath")) print "skip"; ?>
--INI--
bcmath.scale=0
+1 -1
View File
@@ -1,6 +1,6 @@
--TEST--
bcscale() function
--SKIPIF--
--SKIP--
<?php if(!extension_loaded("bcmath")) print "skip"; ?>
--INI--
bcmath.scale=0
+1 -1
View File
@@ -1,6 +1,6 @@
--TEST--
bcsqrt() function
--SKIPIF--
--SKIP--
<?php if(!extension_loaded("bcmath")) print "skip"; ?>
--INI--
bcmath.scale=0
+1 -1
View File
@@ -1,6 +1,6 @@
--TEST--
bcsub() function
--SKIPIF--
--SKIP--
<?php if(!extension_loaded("bcmath")) print "skip"; ?>
--INI--
bcmath.scale=0
+1 -1
View File
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 4 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2003 The PHP Group |
| Copyright (c) 1997-2002 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 |
+1 -1
View File
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 4 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2003 The PHP Group |
| Copyright (c) 1997-2002 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 |
+1 -1
View File
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 4 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2003 The PHP Group |
| Copyright (c) 1997-2002 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 |
-4
View File
@@ -260,10 +260,6 @@
*
**************************************************************************/
#if defined(PHP_WIN32) && _MSC_VER >= 1200
#pragma setlocale("english")
#endif
#include "sdncal.h"
#define HALAKIM_PER_HOUR 1080
+136 -61
View File
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 4 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2003 The PHP Group |
| Copyright (c) 1997-2002 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 |
@@ -15,7 +15,7 @@
| Author: Zeev Suraski <zeev@zend.com> |
| Harald Radi <h.radi@nme.at> |
| Alan Brown <abrown@pobox.com> |
| Wez Furlong <wez@thebrainroom.com> |
| Wez Furlong <wez@thebrainroom.com> |
+----------------------------------------------------------------------+
*/
/* $Id$ */
@@ -124,7 +124,7 @@ PHPAPI HRESULT php_COM_invoke(comval *obj, DISPID dispIdMember, WORD wFlags, DIS
if (C_ISREFD(obj)) {
if (C_HASTLIB(obj)) {
hr = C_TYPEINFO_VT(obj)->Invoke(C_TYPEINFO(obj), C_DISPATCH(obj), dispIdMember, wFlags, pDispParams, pVarResult, &ExceptInfo, &ArgErr);
if (FAILED(hr) && (hr != DISP_E_EXCEPTION)) {
if (FAILED(hr)) {
hr = C_DISPATCH_VT(obj)->Invoke(C_DISPATCH(obj), dispIdMember, &IID_NULL, LOCALE_SYSTEM_DEFAULT, wFlags, pDispParams, pVarResult, &ExceptInfo, &ArgErr);
if (SUCCEEDED(hr)) {
/*
@@ -726,7 +726,7 @@ PHP_FUNCTION(com_load)
}
}
RETVAL_COM(obj);
RETURN_RESOURCE(zend_list_insert(obj, IS_COM));
}
/* }}} */
@@ -744,7 +744,7 @@ static int do_COM_invoke(comval *obj, WORD dispflags, pval *function_name, VARIA
int current_arg, current_variant;
unsigned long count;
if (C_HASENUM(obj) && strstr(Z_STRVAL_P(function_name), "next")) {
if (C_HASENUM(obj) && strstr(Z_STRVAL_P(function_name), "next")) {
/* Grab one argument off the stack, allocate enough
* VARIANTs
* Get the IEnumVariant interface and call ->Next();
@@ -896,7 +896,7 @@ static int do_COM_invoke(comval *obj, WORD dispflags, pval *function_name, VARIA
efree(funcname);
for (current_arg=0;current_arg<arg_count;current_arg++) {
/* don't release IDispatch pointers as they are used afterwards */
if (V_VT(&(variant_args[current_arg])) != VT_DISPATCH) {
if (V_VT(&variant_args[current_arg]) != VT_DISPATCH) {
/* @todo review this: what happens to an array of IDispatchs or a VARIANT->IDispatch */
VariantClear(&variant_args[current_arg]);
}
@@ -918,7 +918,6 @@ static int do_COM_invoke(comval *obj, WORD dispflags, pval *function_name, VARIA
return SUCCESS;
}
/* {{{ proto mixed com_invoke_ex(int module, int invokeflags, string handler_name [, mixed arg [, mixed ...]])
Invokes a COM module */
PHP_FUNCTION(com_invoke_ex)
@@ -948,7 +947,17 @@ PHP_FUNCTION(com_invoke_ex)
dispflags = (WORD)Z_LVAL_P(invokeflags);
/* obtain IDispatch interface */
FETCH_COM_SAFE(object, obj);
if (Z_TYPE_P(object) == IS_OBJECT && (Z_OBJCE_P(object) == &COM_class_entry || !strcmp(Z_OBJCE_P(object)->name, "COM"))) {
zval **tmp;
zend_hash_index_find(Z_OBJPROP_P(object), 0, (void**)&tmp);
ZEND_FETCH_RESOURCE(obj, comval*, tmp, -1, "comval", IS_COM);
} else if (Z_TYPE_P(object) == IS_RESOURCE) {
ZEND_FETCH_RESOURCE(obj, comval*, &object, -1, "comval", IS_COM);
}
if (obj == NULL) {
php_error(E_WARNING, "%d is not a COM object handler", Z_LVAL_P(object));
RETURN_NULL();
}
ALLOC_VARIANT(var_result);
@@ -973,6 +982,7 @@ PHP_FUNCTION(com_invoke)
pval **arguments;
pval *object, *function_name;
comval *obj;
int type;
int arg_count = ZEND_NUM_ARGS();
VARIANT *var_result;
@@ -988,7 +998,12 @@ PHP_FUNCTION(com_invoke)
function_name = arguments[1];
/* obtain IDispatch interface */
FETCH_COM_SAFE(object, obj);
convert_to_long(object);
obj = (comval *)zend_list_find(Z_LVAL_P(object), &type);
if (!obj || (type != IS_COM)) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s is not a COM object handler", Z_STRVAL_P(function_name));
RETURN_NULL();
}
/* obtain property/method handler */
convert_to_string_ex(&function_name);
@@ -1015,6 +1030,7 @@ PHP_FUNCTION(com_release)
{
pval *object;
comval *obj;
int type;
int arg_count = ZEND_NUM_ARGS();
if (arg_count != 1) {
@@ -1026,7 +1042,12 @@ PHP_FUNCTION(com_release)
}
/* obtain IDispatch interface */
FETCH_COM_SAFE(object, obj);
convert_to_long_ex(&object);
obj = (comval *)zend_list_find(Z_LVAL_P(object), &type);
if (!obj || (type != IS_COM)) {
php_error(E_WARNING, "%s(): %d is not a COM object handler", get_active_function_name(TSRMLS_C));
RETURN_FALSE;
}
RETURN_LONG(php_COM_release(obj TSRMLS_CC))
}
@@ -1039,6 +1060,7 @@ PHP_FUNCTION(com_addref)
{
pval *object;
comval *obj;
int type;
int arg_count = ZEND_NUM_ARGS();
if (arg_count != 1) {
@@ -1050,7 +1072,13 @@ PHP_FUNCTION(com_addref)
}
/* obtain IDispatch interface */
FETCH_COM_SAFE(object, obj);
convert_to_long_ex(&object);
obj = (comval *)zend_list_find(Z_LVAL_P(object), &type);
if (!obj || (type != IS_COM))
{
php_error(E_WARNING, "%s(): %d is not a COM object handler", get_active_function_name(TSRMLS_C));
RETURN_FALSE;
}
RETURN_LONG(php_COM_addref(obj TSRMLS_CC));
}
@@ -1425,8 +1453,12 @@ PHP_FUNCTION(com_print_typeinfo)
RETURN_FALSE;
}
if (Z_TYPE_P(arg1) == IS_OBJECT) {
FETCH_COM_SAFE(arg1, obj);
if (Z_TYPE_P(arg1) == IS_OBJECT && (Z_OBJCE_P(arg1) == &COM_class_entry || !strcmp(Z_OBJCE_P(arg1)->name, "COM"))) {
zval **tmp;
zend_hash_index_find(Z_OBJPROP_P(arg1), 0, (void**)&tmp);
ZEND_FETCH_RESOURCE(obj, comval*, tmp, -1, "comval", IS_COM);
} else if (Z_TYPE_P(arg1) == IS_RESOURCE) {
ZEND_FETCH_RESOURCE(obj, comval*, &arg1, -1, "comval", IS_COM);
} else {
convert_to_string(arg1);
typelibname = Z_STRVAL_P(arg1);
@@ -1460,8 +1492,14 @@ PHP_FUNCTION(com_event_sink)
RETURN_FALSE;
}
FETCH_COM_SAFE(object, obj);
if (Z_TYPE_P(object) == IS_OBJECT && (Z_OBJCE_P(object) == &COM_class_entry || !strcmp(Z_OBJCE_P(object)->name, "COM"))) {
zval **tmp;
zend_hash_index_find(Z_OBJPROP_P(object), 0, (void**)&tmp);
ZEND_FETCH_RESOURCE(obj, comval*, tmp, -1, "comval", IS_COM);
} else {
ZEND_FETCH_RESOURCE(obj, comval*, &object, -1, "comval", IS_COM);
}
if (sink && Z_TYPE_P(sink) == IS_ARRAY) {
/* 0 => typelibname, 1 => dispname */
zval **tmp;
@@ -1644,10 +1682,8 @@ static void do_COM_propput(pval *return_value, comval *obj, pval *arg_property,
hr = php_COM_invoke(obj, dispid, DISPATCH_PROPERTYGET, &dispparams, var_result, &ErrString TSRMLS_CC);
if (SUCCEEDED(hr)) {
RETVAL_VARIANT(var_result);
php_variant_to_pval(var_result, return_value, codepage TSRMLS_CC);
} else {
FREE_VARIANT(var_result);
*return_value = *value;
zval_copy_ctor(return_value);
}
@@ -1655,10 +1691,10 @@ static void do_COM_propput(pval *return_value, comval *obj, pval *arg_property,
if (ErrString) {
pefree(ErrString, 1);
}
} else {
FREE_VARIANT(var_result);
}
FREE_VARIANT(var_result);
efree(new_value); // FREE_VARIANT does a VariantClear() which is not desired here !
efree(propname);
}
@@ -1685,8 +1721,18 @@ PHP_FUNCTION(com_propget)
object = arguments[0];
function_name = arguments[1];
FETCH_COM_SAFE(object, obj);
if (Z_TYPE_P(object) == IS_OBJECT && (Z_OBJCE_P(object) == &COM_class_entry || !strcmp(Z_OBJCE_P(object)->name, "COM"))) {
zval **tmp;
zend_hash_index_find(Z_OBJPROP_P(object), 0, (void**)&tmp);
ZEND_FETCH_RESOURCE(obj, comval*, tmp, -1, "comval", IS_COM);
} else if (Z_TYPE_P(object) == IS_RESOURCE) {
ZEND_FETCH_RESOURCE(obj, comval*, &object, -1, "comval", IS_COM);
}
if (obj == NULL) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "parameter 1 is not a COM object handler");
RETURN_NULL();
}
/* obtain property/method handler */
convert_to_string_ex(&function_name);
@@ -1727,8 +1773,18 @@ PHP_FUNCTION(com_propput)
object = arguments[0];
function_name = arguments[1];
FETCH_COM_SAFE(object, obj);
if (Z_TYPE_P(object) == IS_OBJECT && (Z_OBJCE_P(object) == &COM_class_entry || !strcmp(Z_OBJCE_P(object)->name, "COM"))) {
zval **tmp;
zend_hash_index_find(Z_OBJPROP_P(object), 0, (void**)&tmp);
ZEND_FETCH_RESOURCE(obj, comval*, tmp, -1, "comval", IS_COM);
} else if (Z_TYPE_P(object) == IS_RESOURCE) {
ZEND_FETCH_RESOURCE(obj, comval*, &object, -1, "comval", IS_COM);
}
if (obj == NULL) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "parameter 1 is not a COM object handler");
RETURN_NULL();
}
/* obtain property/method handler */
convert_to_string_ex(&function_name);
@@ -1788,7 +1844,7 @@ PHPAPI pval php_COM_get_property_handler(zend_property_reference *property_refer
{
zend_overloaded_element *overloaded_property;
zend_llist_element *element;
pval retval;
pval return_value;
pval **comval_handle;
pval *object = property_reference->object;
int type;
@@ -1796,14 +1852,14 @@ PHPAPI pval php_COM_get_property_handler(zend_property_reference *property_refer
VARIANT *var_result;
TSRMLS_FETCH();
INIT_ZVAL(retval);
ZVAL_NULL(&retval);
INIT_ZVAL(return_value);
ZVAL_NULL(&return_value);
/* fetch the IDispatch interface */
zend_hash_index_find(Z_OBJPROP_P(object), 0, (void **) &comval_handle);
obj = (comval *) zend_list_find(Z_LVAL_P(*comval_handle), &type);
if (!obj || (type != IS_COM)) {
return retval;
return return_value;
}
ALLOC_COM(obj_prop);
@@ -1817,7 +1873,7 @@ PHPAPI pval php_COM_get_property_handler(zend_property_reference *property_refer
FREE_VARIANT(var_result);
FREE_COM(obj_prop);
return retval;
return return_value;
}
break;
@@ -1826,7 +1882,7 @@ PHPAPI pval php_COM_get_property_handler(zend_property_reference *property_refer
FREE_VARIANT(var_result);
FREE_COM(obj_prop);
return retval;
return return_value;
}
break;
@@ -1834,32 +1890,35 @@ PHPAPI pval php_COM_get_property_handler(zend_property_reference *property_refer
FREE_VARIANT(var_result);
if (obj != obj_prop) {
efree(obj_prop);
FREE_COM(obj_prop);
retval = *object;
zval_copy_ctor(&retval);
return_value = *object;
ZVAL_ADDREF(&return_value);
} else {
ZVAL_COM(&retval, obj);
RETVAL_COM(obj);
}
return retval;
return return_value;
}
zval_dtor(&overloaded_property->element);
if (obj == obj_prop) {
// not head
pval_destructor(&overloaded_property->element);
}
if (V_VT(var_result) == VT_DISPATCH) {
if (V_DISPATCH(var_result) == NULL) {
FREE_VARIANT(var_result);
FREE_COM(obj_prop);
return retval;
return return_value;
}
obj = obj_prop;
php_COM_set(obj, &V_DISPATCH(var_result), TRUE TSRMLS_CC);
VariantInit(var_result); // to protect C_DISPATCH(obj) from being freed when var_result is destructed
} else {
php_variant_to_pval(var_result, &retval, codepage TSRMLS_CC);
php_variant_to_pval(var_result, &return_value, codepage TSRMLS_CC);
FREE_COM(obj_prop);
obj_prop = NULL;
@@ -1867,13 +1926,13 @@ PHPAPI pval php_COM_get_property_handler(zend_property_reference *property_refer
}
if (obj_prop != NULL) {
ZVAL_COM(&retval, obj);
RETVAL_COM(obj);
}
FREE_VARIANT(var_result);
return retval;
return return_value;
}
@@ -1943,7 +2002,7 @@ PHPAPI int php_COM_set_property_handler(zend_property_reference *property_refere
}
VariantInit(var_result); // to protect C_DISPATCH(obj) from being freed when var_result is destructed
zval_dtor(&overloaded_property->element);
pval_destructor(&overloaded_property->element);
}
FREE_VARIANT(var_result);
@@ -1951,7 +2010,7 @@ PHPAPI int php_COM_set_property_handler(zend_property_reference *property_refere
do_COM_propput(NULL, obj, &overloaded_property->element, value TSRMLS_CC);
FREE_COM(obj_prop);
zval_dtor(&overloaded_property->element);
pval_destructor(&overloaded_property->element);
return SUCCESS;
}
@@ -1982,15 +2041,20 @@ PHPAPI void php_COM_call_function_handler(INTERNAL_FUNCTION_PARAMETERS, zend_pro
if (zend_llist_count(property_reference->elements_list)==1
&& !strcmp(Z_STRVAL(function_name->element), "com")) {
/* constructor */
pval *object_handle;
PHP_FN(com_load)(INTERNAL_FUNCTION_PARAM_PASSTHRU);
/* free instance created by 'new' */
zval_dtor(object);
if (zend_is_true(return_value)) {
ALLOC_ZVAL(object_handle);
*object_handle = *return_value;
pval_copy_constructor(object_handle);
INIT_PZVAL(object_handle);
zend_hash_index_update(Z_OBJPROP_P(object), 0, &object_handle, sizeof(pval *), NULL);
pval_destructor(&function_name->element);
} else {
ZVAL_NULL(object);
}
/* and override it with the instance created by 'com_load()' */
*object = *return_value;
INIT_ZVAL(*return_value);
zval_dtor(&function_name->element);
return;
}
@@ -1998,8 +2062,8 @@ PHPAPI void php_COM_call_function_handler(INTERNAL_FUNCTION_PARAMETERS, zend_pro
property = php_COM_get_property_handler(property_reference);
if (Z_TYPE(property) != IS_OBJECT) {
zval_dtor(&property);
zval_dtor(&function_name->element);
pval_destructor(&property);
pval_destructor(&function_name->element);
/* error message - function call on a non-object */
return;
@@ -2009,8 +2073,8 @@ PHPAPI void php_COM_call_function_handler(INTERNAL_FUNCTION_PARAMETERS, zend_pro
obj = (comval *)zend_list_find(Z_LVAL_PP(handle), &type);
if (!obj || (type != IS_COM)) {
zval_dtor(&property);
zval_dtor(&function_name->element);
pval_destructor(&property);
pval_destructor(&function_name->element);
return;
}
@@ -2028,20 +2092,24 @@ PHPAPI void php_COM_call_function_handler(INTERNAL_FUNCTION_PARAMETERS, zend_pro
ALLOC_VARIANT(var_result);
arguments = (zval **) emalloc(sizeof(zval *)*arg_count);
arguments = (pval **) emalloc(sizeof(pval *)*arg_count);
zend_get_parameters_array(ht, arg_count, arguments);
if (do_COM_invoke(obj , DISPATCH_METHOD|DISPATCH_PROPERTYGET, &function_name->element, var_result, arguments, arg_count TSRMLS_CC) == SUCCESS) {
RETVAL_VARIANT(var_result);
} else {
FREE_VARIANT(var_result);
php_variant_to_pval(var_result, return_value, codepage TSRMLS_CC);
}
FREE_VARIANT(var_result);
efree(arguments);
}
zval_dtor(&property);
zval_dtor(&function_name->element);
if (zend_llist_count(property_reference->elements_list) > 1) {
/* destruct temporary object */
zend_list_delete(Z_LVAL_PP(handle));
pval_destructor(&property);
}
pval_destructor(&function_name->element);
}
@@ -2302,7 +2370,9 @@ PHPAPI int php_COM_load_typelib(ITypeLib *TypeLib, int mode TSRMLS_DC)
PHP_FUNCTION(com_isenum)
{
pval *object;
pval **comval_handle;
comval *obj;
int type;
if (ZEND_NUM_ARGS() != 1) {
ZEND_WRONG_PARAM_COUNT();
@@ -2311,7 +2381,12 @@ PHP_FUNCTION(com_isenum)
zend_get_parameters(ht, 1, &object);
/* obtain IDispatch interface */
FETCH_COM_SAFE(object, obj);
zend_hash_index_find(Z_OBJPROP_P(object), 0, (void **) &comval_handle);
obj = (comval *) zend_list_find(Z_LVAL_PP(comval_handle), &type);
if (!obj || (type != IS_COM)) {
php_error(E_WARNING,"%s(): %s is not a COM object handler", get_active_function_name(TSRMLS_C), "");
RETURN_FALSE;
}
RETURN_BOOL(C_HASENUM(obj));
}
+1 -1
View File
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 4 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2003 The PHP Group |
| Copyright (c) 1997-2002 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 |
+4 -17
View File
@@ -42,33 +42,20 @@ END_EXTERN_C()
} \
ZVAL_RESOURCE(handle, zend_list_insert((o), IS_COM)); \
\
zval_copy_ctor(handle); \
zend_hash_index_update(properties, 0, &handle, sizeof(zval *), NULL); \
object_and_properties_init(z, &COM_class_entry, properties); \
(z)->is_ref=1; \
}
#define RETVAL_COM(o) ZVAL_COM(return_value, o);
#define RETVAL_COM(o) ZVAL_COM(&return_value, o);
#define RETURN_COM(o) RETVAL_COM(o) \
return;
#define ALLOC_COM(z) (z) = (comval *) ecalloc(1, sizeof(comval));
#define ALLOC_COM(z) (z) = (comval *) ecalloc(1, sizeof(comval)); \
C_REFCOUNT(z) = 0;
#define FREE_COM(z) php_COM_destruct(z TSRMLS_CC);
#define FETCH_COM(z, obj) { \
zval **tmp; \
zend_hash_index_find(Z_OBJPROP_P(z), 0, (void**)&tmp); \
ZEND_FETCH_RESOURCE(obj, comval*, tmp, -1, "comval", IS_COM); \
} \
if (obj == NULL) { \
php_error(E_WARNING, "%d is not a COM object handler", Z_LVAL_P(z)); \
RETURN_NULL(); \
}
#define FETCH_COM_SAFE(z, obj) \
if ((Z_TYPE_P(z) == IS_OBJECT) && (Z_OBJCE_P(z) == &COM_class_entry)) \
FETCH_COM(z, obj)
#define IS_COM php_COM_get_le_comval()
#define C_HASTLIB(x) ((x)->typelib)
+2 -1
View File
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 4 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2003 The PHP Group |
| Copyright (c) 1997-2002 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 |
@@ -729,6 +729,7 @@ PHPAPI int php_variant_to_pval(VARIANT *var_arg, pval *pval_arg, int codepage TS
php_COM_set(obj, &V_DISPATCH(var_arg), FALSE TSRMLS_CC);
ZVAL_COM(pval_arg, obj);
VariantInit(var_arg); // to protect C_DISPATCH(obj) from being freed when var_result is destructed
}
}
break;
+1 -1
View File
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 4 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2003 The PHP Group |
| Copyright (c) 1997-2002 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 |
+8 -13
View File
@@ -12,19 +12,14 @@
#define IS_VARIANT php_VARIANT_get_le_variant()
#define ZVAL_VARIANT(z, v) if (V_VT(v) == VT_DISPATCH) { \
if (V_DISPATCH(v)) { \
comval *obj; \
ALLOC_COM(obj); \
php_COM_set(obj, &V_DISPATCH(v), TRUE TSRMLS_CC); \
ZVAL_COM((z), obj); \
efree(v); \
} else { \
ZVAL_NULL(z); \
} \
} else { \
php_variant_to_pval((v), (z), codepage TSRMLS_CC); \
FREE_VARIANT(v); \
#define ZVAL_VARIANT(z, v) if (V_VT(v) == VT_DISPATCH) { \
comval *obj; \
ALLOC_COM(obj); \
php_COM_set(obj, &V_DISPATCH(v), TRUE TSRMLS_CC); \
ZVAL_RESOURCE((z), zend_list_insert(obj, IS_COM)); \
} else { \
php_variant_to_pval((v), (z), codepage TSRMLS_CC); \
FREE_VARIANT(v); \
}
#define RETVAL_VARIANT(v) ZVAL_VARIANT(return_value, (v));
+61 -87
View File
@@ -1,96 +1,70 @@
dnl $Id$
AC_DEFUN(CPDF_TEMP_SUBST,[
old_LIBS=$LIBS
$1
LIBS=$old_LIBS
])
AC_DEFUN(CPDF_JPEG_TEST,[
CPDF_TEMP_SUBST([
AC_ARG_WITH(jpeg-dir,
[ --with-jpeg-dir[=DIR] CPDF: Set the path to libjpeg install prefix.],[
for i in $withval /usr/local /usr; do
if test -f "$i/lib/libjpeg.$SHLIB_SUFFIX_NAME" -o -f "$i/lib/libjpeg.a"; then
CPDF_JPEG_DIR=$i
break;
fi
done
if test -z "$CPDF_JPEG_DIR"; then
AC_MSG_CHECKING([for libjpeg (needed by cpdflib 2.x)])
AC_MSG_ERROR([libjpeg.(a|so) not found.])
fi
LIBS="$LIBS -L$CPDF_JPEG_DIR/lib"
],)
AC_CHECK_LIB(jpeg,jpeg_read_header, ,[AC_MSG_ERROR(Problem with libjpeg.(a|so). Please check config.log for more information.)],)
if test -z "$CPDF_JPEG_DIR"; then
PHP_ADD_LIBRARY(jpeg)
else
PHP_ADD_LIBRARY_WITH_PATH(jpeg, $CPDF_JPEG_DIR/lib)
fi
])
])
AC_DEFUN(CPDF_TIFF_TEST,[
CPDF_TEMP_SUBST([
AC_ARG_WITH(tiff-dir,
[ --with-tiff-dir[=DIR] CPDF: Set the path to libtiff install prefix.],[
for i in $withval /usr/local /usr; do
if test -f "$i/lib/libtiff.$SHLIB_SUFFIX_NAME" -o -f "$i/lib/libtiff.a"; then
CPDF_TIFF_DIR=$i
break;
fi
done
if test -z "$CPDF_TIFF_DIR"; then
AC_MSG_CHECKING([for libtiff (needed by cpdflib 2.x)])
AC_MSG_ERROR([libtiff.(a|so) not found.])
fi
LIBS="$LIBS -L$CPDF_TIFF_DIR/lib"
],)
AC_CHECK_LIB(tiff,TIFFOpen, ,[AC_MSG_ERROR(Problem with libtiff.(a|so). Please check config.log for more information.)],)
if test -z "$CPDF_TIFF_DIR"; then
PHP_ADD_LIBRARY(tiff)
else
PHP_ADD_LIBRARY_WITH_PATH(tiff, $CPDF_TIFF_DIR/lib)
fi
])
])
AC_MSG_CHECKING(for cpdflib support)
AC_ARG_WITH(cpdflib,
[ --with-cpdflib[=DIR] Include cpdflib support (requires cpdflib >= 2).],
[
if test "$withval" = "no"; then
AC_MSG_RESULT(no)
else
AC_MSG_RESULT(yes)
PHP_NEW_EXTENSION(cpdf, cpdf.c)
CPDF_JPEG_TEST
CPDF_TIFF_TEST
for i in $withval /usr /usr/local; do
if test -f "$i/include/cpdflib.h"; then
CPDFLIB_INCLUDE=$i/include
AC_MSG_CHECKING(for cpdflib.h)
AC_MSG_RESULT([in $i/include])
CPDF_TEMP_SUBST([
LIBS="$LIBS -L$i/lib"
AC_CHECK_LIB(cpdf, cpdf_open, [AC_DEFINE(HAVE_CPDFLIB,1,[Whether you have cpdflib])],
[AC_MSG_ERROR([Cpdflib module requires cpdflib >= 2.])])
])
if test "$i" != "/usr" -a "$i" != "/usr/local"; then
PHP_ADD_LIBRARY_WITH_PATH(cpdf, $i/lib)
PHP_ADD_INCLUDE($CPDFLIB_INCLUDE)
else
PHP_ADD_LIBRARY(cpdf)
fi
break
fi
done
if test -z "$CPDFLIB_INCLUDE"; then
AC_MSG_CHECKING(for cpdflib.h)
AC_MSG_ERROR([not found])
fi
fi
case $withval in
no)
AC_MSG_RESULT(no) ;;
yes)
AC_MSG_RESULT(yes)
PHP_NEW_EXTENSION(cpdf, cpdf.c)
AC_CHECK_LIB(cpdf, cpdf_open, [AC_DEFINE(HAVE_CPDFLIB,1,[Whether you have cpdflib])],
[AC_MSG_ERROR([Cpdf module requires cpdflib >= 2.])])
PHP_ADD_LIBRARY(cpdf)
PHP_ADD_LIBRARY(tiff)
PHP_ADD_LIBRARY(jpeg)
;;
*)
test -f $withval/include/cpdflib.h && CPDFLIB_INCLUDE=$withval/include
if test -n "$CPDFLIB_INCLUDE" ; then
AC_MSG_RESULT(yes)
PHP_NEW_EXTENSION(cpdf, cpdf.c)
old_LIBS=$LIBS
old_withval=$withval
AC_MSG_CHECKING([for libjpeg (needed by cpdflib 2.x)])
AC_ARG_WITH(jpeg-dir,
[ --with-jpeg-dir[=DIR] jpeg dir for cpdflib 2.x],[
AC_MSG_RESULT(yes)
if test -z $withval; then
withval=/usr/local
fi
LIBS="$LIBS -L$withval/lib"
AC_CHECK_LIB(jpeg,jpeg_read_header, ,[AC_MSG_RESULT(no)],)
PHP_ADD_LIBRARY_WITH_PATH(jpeg, $withval/lib)
],[
AC_MSG_RESULT(no)
AC_MSG_WARN(If configure fails try --with-jpeg-dir=<DIR>)
])
AC_MSG_CHECKING([for libtiff (needed by cpdflib 2.x)])
AC_ARG_WITH(tiff-dir,
[ --with-tiff-dir[=DIR] tiff dir for cpdflib 2.x],[
AC_MSG_RESULT(yes)
if test -z $withval; then
withval=/usr/local
fi
LIBS="$LIBS -L$withval/lib"
AC_CHECK_LIB(tiff,TIFFOpen, ,[AC_MSG_RESULT(no)],)
PHP_ADD_LIBRARY_WITH_PATH(tiff, $withval/lib)
],[
AC_MSG_RESULT(no)
AC_MSG_WARN(If configure fails try --with-tiff-dir=<DIR>)
])
withval=$old_withval
LIBS="$LIBS -L$withval/lib"
AC_CHECK_LIB(cpdf, cpdf_open, [AC_DEFINE(HAVE_CPDFLIB,1,[Whether you have cpdflib])],
[AC_MSG_ERROR([Cpdflib module requires cpdflib >= 2.])])
LIBS=$old_LIBS
PHP_ADD_LIBRARY_WITH_PATH(cpdf, $withval/lib)
PHP_ADD_INCLUDE($CPDFLIB_INCLUDE)
else
AC_MSG_RESULT(no)
fi ;;
esac
],[
AC_MSG_RESULT(no)
])
+1 -3
View File
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 4 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2003 The PHP Group |
| Copyright (c) 1997-2002 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 |
@@ -41,8 +41,6 @@
#include <gd.h>
#endif
#include <cpdflib.h>
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
+3 -1
View File
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 4 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2003 The PHP Group |
| Copyright (c) 1997-2002 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 |
@@ -29,6 +29,8 @@
#undef T
#endif
#include <cpdflib.h>
extern zend_module_entry cpdf_module_entry;
#define cpdf_module_ptr &cpdf_module_entry
+1 -1
View File
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 4 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2003 The PHP Group |
| Copyright (c) 1997-2002 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 |
+1 -1
View File
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 4 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2003 The PHP Group |
| Copyright (c) 1997-2002 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 |
+1 -1
View File
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 4 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2003 The PHP Group |
| Copyright (c) 1997-2002 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 |
-1
View File
@@ -18,7 +18,6 @@ if test "$PHP_CURL" != "no"; then
if test -r $i/include/curl/easy.h; then
CURL_DIR=$i
AC_MSG_RESULT(found in $i)
break
fi
done
fi
+45 -77
View File
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 4 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2003 The PHP Group |
| Copyright (c) 1997-2002 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 |
@@ -191,10 +191,7 @@ PHP_MINIT_FUNCTION(curl)
REGISTER_CURL_CONSTANT(CURLOPT_SSLENGINE);
REGISTER_CURL_CONSTANT(CURLOPT_SSLENGINE_DEFAULT);
REGISTER_CURL_CONSTANT(CURLOPT_CRLF);
#ifdef CURLOPT_ENCODING
REGISTER_CURL_CONSTANT(CURLOPT_ENCODING);
#endif
/* Constants effecting the way CURLOPT_CLOSEPOLICY works */
REGISTER_CURL_CONSTANT(CURLCLOSEPOLICY_LEAST_RECENTLY_USED);
REGISTER_CURL_CONSTANT(CURLCLOSEPOLICY_LEAST_TRAFFIC);
@@ -338,7 +335,7 @@ static size_t curl_write(char *data, size_t size, size_t nmemb, void *ctx)
switch (t->method) {
case PHP_CURL_STDOUT:
PHPWRITE(data, size);
PUTS(data);
break;
case PHP_CURL_FILE:
return fwrite(data, size, nmemb, t->fp);
@@ -394,9 +391,7 @@ static size_t curl_read(char *data, size_t size, size_t nmemb, void *ctx)
switch (t->method) {
case PHP_CURL_DIRECT:
if (t->fp) {
length = fread(data, size, nmemb, t->fp);
}
length = fread(data, size, nmemb, t->fp);
break;
case PHP_CURL_USER: {
zval *argv[3];
@@ -458,7 +453,7 @@ static size_t curl_write_header(char *data, size_t size, size_t nmemb, void *ctx
if (ch->handlers->write->method == PHP_CURL_RETURN)
smart_str_appendl(&ch->handlers->write->buf, data, (int) length);
else
PHPWRITE(data, size);
PUTS(data);
break;
case PHP_CURL_FILE:
return fwrite(data, size, nmemb, t->fp);
@@ -632,8 +627,6 @@ PHP_FUNCTION(curl_init)
ch->handlers->read->method = PHP_CURL_DIRECT;
ch->handlers->write_header->method = PHP_CURL_IGNORE;
ch->uses = 0;
curl_easy_setopt(ch->cp, CURLOPT_NOPROGRESS, 1);
curl_easy_setopt(ch->cp, CURLOPT_VERBOSE, 0);
curl_easy_setopt(ch->cp, CURLOPT_ERRORBUFFER, ch->err.str);
@@ -744,9 +737,6 @@ PHP_FUNCTION(curl_setopt)
case CURLOPT_SSLKEYTYPE:
case CURLOPT_SSLKEYPASSWD:
case CURLOPT_SSLENGINE:
#ifdef CURLOPT_ENCODING
case CURLOPT_ENCODING:
#endif
case CURLOPT_SSLENGINE_DEFAULT: {
char *copystr = NULL;
@@ -1046,68 +1036,46 @@ PHP_FUNCTION(curl_getinfo)
array_init(return_value);
if (curl_easy_getinfo(ch->cp, CURLINFO_EFFECTIVE_URL, &s_code) == CURLE_OK) {
CAAS("url", s_code);
}
if (curl_easy_getinfo(ch->cp, CURLINFO_CONTENT_TYPE, &s_code) == CURLE_OK) {
if (s_code != NULL) {
CAAS("content_type", s_code);
}
}
if (curl_easy_getinfo(ch->cp, CURLINFO_HTTP_CODE, &l_code) == CURLE_OK) {
CAAL("http_code", l_code);
}
if (curl_easy_getinfo(ch->cp, CURLINFO_HEADER_SIZE, &l_code) == CURLE_OK) {
CAAL("header_size", l_code);
}
if (curl_easy_getinfo(ch->cp, CURLINFO_REQUEST_SIZE, &l_code) == CURLE_OK) {
CAAL("request_size", l_code);
}
if (curl_easy_getinfo(ch->cp, CURLINFO_FILETIME, &l_code) == CURLE_OK) {
CAAL("filetime", l_code);
}
if (curl_easy_getinfo(ch->cp, CURLINFO_SSL_VERIFYRESULT, &l_code) == CURLE_OK) {
CAAL("ssl_verify_result", l_code);
}
if (curl_easy_getinfo(ch->cp, CURLINFO_REDIRECT_COUNT, &l_code) == CURLE_OK) {
CAAL("redirect_count", l_code);
}
if (curl_easy_getinfo(ch->cp, CURLINFO_TOTAL_TIME, &d_code) == CURLE_OK) {
CAAD("total_time", d_code);
}
if (curl_easy_getinfo(ch->cp, CURLINFO_NAMELOOKUP_TIME, &d_code) == CURLE_OK) {
CAAD("namelookup_time", d_code);
}
if (curl_easy_getinfo(ch->cp, CURLINFO_CONNECT_TIME, &d_code) == CURLE_OK) {
CAAD("connect_time", d_code);
}
if (curl_easy_getinfo(ch->cp, CURLINFO_PRETRANSFER_TIME, &d_code) == CURLE_OK) {
CAAD("pretransfer_time", d_code);
}
if (curl_easy_getinfo(ch->cp, CURLINFO_SIZE_UPLOAD, &d_code) == CURLE_OK) {
CAAD("size_upload", d_code);
}
if (curl_easy_getinfo(ch->cp, CURLINFO_SIZE_DOWNLOAD, &d_code) == CURLE_OK) {
CAAD("size_download", d_code);
}
if (curl_easy_getinfo(ch->cp, CURLINFO_SPEED_DOWNLOAD, &d_code) == CURLE_OK) {
CAAD("speed_download", d_code);
}
if (curl_easy_getinfo(ch->cp, CURLINFO_SPEED_UPLOAD, &d_code) == CURLE_OK) {
CAAD("speed_upload", d_code);
}
if (curl_easy_getinfo(ch->cp, CURLINFO_CONTENT_LENGTH_DOWNLOAD, &d_code) == CURLE_OK) {
CAAD("download_content_length", d_code);
}
if (curl_easy_getinfo(ch->cp, CURLINFO_CONTENT_LENGTH_UPLOAD, &d_code) == CURLE_OK) {
CAAD("upload_content_length", d_code);
}
if (curl_easy_getinfo(ch->cp, CURLINFO_STARTTRANSFER_TIME, &d_code) == CURLE_OK) {
CAAD("starttransfer_time", d_code);
}
if (curl_easy_getinfo(ch->cp, CURLINFO_REDIRECT_TIME, &d_code) == CURLE_OK) {
CAAD("redirect_time", d_code);
}
curl_easy_getinfo(ch->cp, CURLINFO_EFFECTIVE_URL, &s_code);
CAAS("url", s_code);
curl_easy_getinfo(ch->cp, CURLINFO_CONTENT_TYPE, &s_code);
CAAS("content_type", s_code);
curl_easy_getinfo(ch->cp, CURLINFO_HTTP_CODE, &l_code);
CAAL("http_code", l_code);
curl_easy_getinfo(ch->cp, CURLINFO_HEADER_SIZE, &l_code);
CAAL("header_size", l_code);
curl_easy_getinfo(ch->cp, CURLINFO_REQUEST_SIZE, &l_code);
CAAL("request_size", l_code);
curl_easy_getinfo(ch->cp, CURLINFO_FILETIME, &l_code);
CAAL("filetime", l_code);
curl_easy_getinfo(ch->cp, CURLINFO_SSL_VERIFYRESULT, &l_code);
CAAL("ssl_verify_result", l_code);
curl_easy_getinfo(ch->cp, CURLINFO_REDIRECT_COUNT, &l_code);
CAAL("redirect_count", l_code);
curl_easy_getinfo(ch->cp, CURLINFO_TOTAL_TIME, &d_code);
CAAD("total_time", d_code);
curl_easy_getinfo(ch->cp, CURLINFO_NAMELOOKUP_TIME, &d_code);
CAAD("namelookup_time", d_code);
curl_easy_getinfo(ch->cp, CURLINFO_CONNECT_TIME, &d_code);
CAAD("connect_time", d_code);
curl_easy_getinfo(ch->cp, CURLINFO_PRETRANSFER_TIME, &d_code);
CAAD("pretransfer_time", d_code);
curl_easy_getinfo(ch->cp, CURLINFO_SIZE_UPLOAD, &d_code);
CAAD("size_upload", d_code);
curl_easy_getinfo(ch->cp, CURLINFO_SIZE_DOWNLOAD, &d_code);
CAAD("size_download", d_code);
curl_easy_getinfo(ch->cp, CURLINFO_SPEED_DOWNLOAD, &d_code);
CAAD("speed_download", d_code);
curl_easy_getinfo(ch->cp, CURLINFO_SPEED_UPLOAD, &d_code);
CAAD("speed_upload", d_code);
curl_easy_getinfo(ch->cp, CURLINFO_CONTENT_LENGTH_DOWNLOAD, &d_code);
CAAD("download_content_length", d_code);
curl_easy_getinfo(ch->cp, CURLINFO_CONTENT_LENGTH_UPLOAD, &d_code);
CAAD("upload_content_length", d_code);
curl_easy_getinfo(ch->cp, CURLINFO_STARTTRANSFER_TIME, &d_code);
CAAD("starttransfer_time", d_code);
curl_easy_getinfo(ch->cp, CURLINFO_REDIRECT_TIME, &d_code);
CAAD("redirect_time", d_code);
} else {
option = Z_LVAL_PP(zoption);
switch (option) {
+1 -1
View File
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 4 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2003 The PHP Group |
| Copyright (c) 1997-2002 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 |
+1 -1
View File
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 4 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2003 The PHP Group |
| Copyright (c) 1997-2002 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 |
+2 -2
View File
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 4 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2003 The PHP Group |
| Copyright (c) 1997-2002 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 |
@@ -108,7 +108,7 @@ PHP_MINFO_FUNCTION(cyrus)
extern void fatal(char *s, int exit)
{
php_error(E_ERROR, "%s", s);
php_error(E_ERROR, s);
}
/* {{{ proto resource cyrus_connect([ string host [, string port [, int flags]]])
+1 -1
View File
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 4 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2003 The PHP Group |
| Copyright (c) 1997-2002 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 |
+2 -2
View File
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 4 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2003 The PHP Group |
| Copyright (c) 1997-2002 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 |
@@ -260,7 +260,7 @@ PHP_MINFO_FUNCTION(db)
{
/* this isn't pretty ... should break out the info a bit more (cmv) */
php_info_print_box_start(0);
php_printf("%s", php_get_info_db());
php_printf(php_get_info_db());
php_info_print_box_end();
}
/* }}} */
+1 -1
View File
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 4 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2003 The PHP Group |
| Copyright (c) 1997-2002 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 |
+135 -277
View File
@@ -2,11 +2,7 @@ dnl
dnl $Id$
dnl
dnl Suppose we need FlatFile if no support or only CDB is used.
AC_DEFUN(PHP_DBA_STD_BEGIN,[
unset THIS_INCLUDE THIS_LIBS THIS_LFLAGS THIS_PREFIX THIS_RESULT
])
dnl Suppose we need FlatFile if no or only CDB is used.
AC_DEFUN(PHP_TEMP_LDFLAGS,[
old_LDFLAGS=$LDFLAGS
@@ -18,6 +14,7 @@ AC_DEFUN(PHP_TEMP_LDFLAGS,[
dnl Assign INCLUDE/LFLAGS from PREFIX
AC_DEFUN(PHP_DBA_STD_ASSIGN,[
if test -n "$THIS_PREFIX" && test "$THIS_PREFIX" != "/usr"; then
THIS_INCLUDE=$THIS_PREFIX/include
THIS_LFLAGS=$THIS_PREFIX/lib
fi
])
@@ -25,324 +22,195 @@ AC_DEFUN(PHP_DBA_STD_ASSIGN,[
dnl Standard check
AC_DEFUN(PHP_DBA_STD_CHECK,[
THIS_RESULT="yes"
if test -z "$THIS_INCLUDE"; then
if test "$THIS_PREFIX" != "/usr" -a "$THIS_INCLUDE" = ""; then
AC_MSG_ERROR(cannot find necessary header file(s))
fi
if test -z "$THIS_LIBS"; then
if test "$THIS_LIBS" = "" ; then
AC_MSG_ERROR(cannot find necessary library)
fi
])
dnl Attach THIS_x to DBA_x
AC_DEFUN(PHP_DBA_STD_ATTACH,[
PHP_ADD_INCLUDE($THIS_INCLUDE)
PHP_ADD_LIBRARY_WITH_PATH($THIS_LIBS, $THIS_LFLAGS, DBA_SHARED_LIBADD)
unset THIS_INCLUDE THIS_LIBS THIS_LFLAGS THIS_PREFIX
])
dnl Print the result message
dnl parameters(name [, full name [, empty or error message]])
AC_DEFUN(AC_DBA_STD_RESULT,[
THIS_NAME=[]translit($1,a-z0-9-,A-Z0-9_)
if test -n "$2"; then
THIS_FULL_NAME="$2"
else
THIS_FULL_NAME="$THIS_NAME"
fi
AC_MSG_CHECKING(for $THIS_FULL_NAME support)
if test -n "$3"; then
AC_MSG_ERROR($3)
fi
if test "$THIS_RESULT" = "yes" -o "$THIS_RESULT" = "builtin"; then
HAVE_DBA=1
eval HAVE_$THIS_NAME=1
AC_MSG_RESULT($THIS_RESULT)
else
AC_MSG_RESULT(no)
fi
unset THIS_RESULT THIS_NAME THIS_FULL_NAME
unset THIS_RESULT
])
PHP_ARG_ENABLE(dba,whether to enable DBA,
[ --enable-dba Build DBA with builtin modules])
AC_ARG_WITH(gdbm,
[ --with-gdbm[=DIR] DBA: Include GDBM support],[
[ --with-gdbm[=DIR] Include GDBM support],[
if test "$withval" != "no"; then
PHP_DBA_STD_BEGIN
for i in $withval /usr/local /usr; do
for i in /usr/local /usr $withval; do
if test -f "$i/include/gdbm.h"; then
THIS_PREFIX=$i
THIS_INCLUDE=$i/include/gdbm.h
break
THIS_PREFIX="$i"
fi
done
if test -n "$THIS_INCLUDE"; then
unset ac_cv_lib_gdbm_gdbm_open
PHP_TEMP_LDFLAGS(-L$THIS_PREFIX/lib,[
AC_CHECK_LIB(gdbm, gdbm_open, [
AC_DEFINE_UNQUOTED(GDBM_INCLUDE_FILE, "$THIS_INCLUDE", [ ])
AC_DEFINE(DBA_GDBM, 1, [ ])
THIS_LIBS=gdbm
])
])
fi
unset ac_cv_lib_gdbm_gdbm_open
PHP_TEMP_LDFLAGS(-L$THIS_PREFIX/lib,[
AC_CHECK_LIB(gdbm, gdbm_open, [AC_DEFINE(DBA_GDBM, 1, [ ]) THIS_LIBS=gdbm])
])
PHP_DBA_STD_ASSIGN
PHP_DBA_STD_CHECK
PHP_DBA_STD_ATTACH
fi
])
AC_DBA_STD_RESULT(gdbm)
AC_MSG_CHECKING(for GDBM support)
AC_DBA_STD_RESULT
AC_ARG_WITH(ndbm,
[ --with-ndbm[=DIR] DBA: Include NDBM support],[
[ --with-ndbm[=DIR] Include NDBM support],[
if test "$withval" != "no"; then
PHP_DBA_STD_BEGIN
for i in $withval /usr/local /usr; do
if test -f "$i/include/ndbm.h"; then
for i in /usr/local /usr $withval; do
if test -f "$i/include/db1/ndbm.h" ; then
THIS_PREFIX=$i
THIS_INCLUDE=$i/include/ndbm.h
break
elif test -f "$i/include/db1/ndbm.h"; then
NDBM_EXTRA=db1/ndbm.h
elif test -f "$i/include/ndbm.h" ; then
THIS_PREFIX=$i
THIS_INCLUDE=$i/include/db1/ndbm.h
break
NDBM_EXTRA=ndbm.h
fi
done
done
if test -n "$THIS_INCLUDE"; then
for LIB in ndbm db1 c; do
PHP_TEMP_LDFLAGS(-L$THIS_PREFIX/lib,[
AC_CHECK_LIB($LIB, dbm_open, [
AC_DEFINE_UNQUOTED(NDBM_INCLUDE_FILE, "$THIS_INCLUDE", [ ])
AC_DEFINE(DBA_NDBM,1, [ ])
THIS_LIBS=$LIB
break
])
])
done
if test "$NDBM_EXTRA" != ""; then
AC_DEFINE_UNQUOTED(NDBM_INCLUDE_FILE, "$NDBM_EXTRA", [ ])
fi
for LIB in db1 ndbm c; do
PHP_TEMP_LDFLAGS(-L$THIS_PREFIX/lib,[
AC_CHECK_LIB($LIB, dbm_open, [AC_DEFINE(DBA_NDBM,1, [ ]) THIS_LIBS=$LIB])
])
done
PHP_DBA_STD_ASSIGN
PHP_DBA_STD_CHECK
PHP_DBA_STD_ATTACH
fi
])
AC_DBA_STD_RESULT(ndbm)
dnl Berkeley specific (library and version test)
dnl parameters(version, library list, function)
AC_DEFUN(PHP_DBA_DB_CHECK,[
for LIB in $2; do
if test -f $THIS_PREFIX/lib/lib$LIB.a -o -f $THIS_PREFIX/lib/lib$LIB.$SHLIB_SUFFIX_NAME; then
PHP_TEMP_LDFLAGS(-L$THIS_PREFIX/lib -l$LIB,[
AC_TRY_LINK([
#include "$THIS_INCLUDE"
],[
$3;
],[
AC_EGREP_CPP(yes,[
#include "$THIS_INCLUDE"
#if DB_VERSION_MAJOR == $1
yes
#endif
],[
THIS_LIBS=$LIB
break
])
])
])
fi
done
if test -z "$THIS_LIBS"; then
AC_MSG_CHECKING(for db$1 major version)
AC_MSG_ERROR(Header contains different version)
fi
if test "$1" = "4"; then
AC_MSG_CHECKING(for db4 minor version and patch level)
AC_EGREP_CPP(yes,[
#include "$THIS_INCLUDE"
#if DB_VERSION_MINOR != 1 || DB_VERSION_PATCH >= 25
yes
#endif
],[
AC_MSG_RESULT(ok)
],[
AC_MSG_ERROR(Version 4.1 requires patch level 25)
])
fi
if test "$ext_shared" = "yes"; then
AC_MSG_CHECKING(if db can be used as shared extension)
AC_EGREP_CPP(yes,[
#include "$THIS_INCLUDE"
#if DB_VERSION_MAJOR > 3 || (DB_VERSION_MAJOR == 3 && DB_VERSION_MINOR > 2)
yes
#endif
],[
AC_MSG_RESULT(yes)
],[
AC_MSG_ERROR(At least version 3.3 is required)
])
fi
if test -n "$THIS_LIBS"; then
AC_DEFINE(DBA_DB$1, 1, [ ])
if test -n "$THIS_INCLUDE"; then
AC_DEFINE_UNQUOTED(DB$1_INCLUDE_FILE, "$THIS_INCLUDE", [ ])
fi
fi
PHP_DBA_STD_ASSIGN
PHP_DBA_STD_CHECK
PHP_DBA_STD_ATTACH
])
AC_ARG_WITH(db4,
[ --with-db4[=DIR] DBA: Include Berkeley DB4 support],[
if test "$withval" != "no"; then
PHP_DBA_STD_BEGIN
for i in $withval /usr/local/BerkeleyDB.4.1 /usr/local/BerkeleyDB.4.0 /usr/local /usr; do
if test -f "$i/db4/db.h"; then
THIS_PREFIX=$i
THIS_INCLUDE=$i/db4/db.h
break
elif test -f "$i/include/db4/db.h"; then
THIS_PREFIX=$i
THIS_INCLUDE=$i/include/db4/db.h
break
elif test -f "$i/include/db/db4.h"; then
THIS_PREFIX=$i
THIS_INCLUDE=$i/include/db/db4.h
break
elif test -f "$i/include/db4.h"; then
THIS_PREFIX=$i
THIS_INCLUDE=$i/include/db4.h
break
elif test -f "$i/include/db.h"; then
THIS_PREFIX=$i
THIS_INCLUDE=$i/include/db.h
break
fi
done
PHP_DBA_DB_CHECK(4, db-4.1 db-4.0 db-4 db4 db, [(void)db_create((DB**)0, (DB_ENV*)0, 0)])
fi
])
AC_DBA_STD_RESULT(db4,Berkeley DB4)
AC_ARG_WITH(db3,
[ --with-db3[=DIR] DBA: Include Berkeley DB3 support],[
if test "$withval" != "no"; then
PHP_DBA_STD_BEGIN
if test "$HAVE_DB4" = "1"; then
AC_DBA_STD_RESULT(db3,Berkeley DB3,You cannot combine --with-db3 with --with-db4)
fi
for i in $withval /usr/local/BerkeleyDB.3.3 /usr/local/BerkeleyDB.3.2 /usr/local/BerkeleyDB.3.1 /usr/local/BerkeleyDB.3.0 /usr/local /usr; do
if test -f "$i/db3/db.h"; then
THIS_PREFIX=$i
THIS_INCLUDE=$i/include/db3/db.h
break
elif test -f "$i/include/db3/db.h"; then
THIS_PREFIX=$i
THIS_INCLUDE=$i/include/db3/db.h
break
elif test -f "$i/include/db/db3.h"; then
THIS_PREFIX=$i
THIS_INCLUDE=$i/include/db/db3.h
break
elif test -f "$i/include/db3.h"; then
THIS_PREFIX=$i
THIS_INCLUDE=$i/include/db3.h
break
elif test -f "$i/include/db.h"; then
THIS_PREFIX=$i
THIS_INCLUDE=$i/include/db.h
break
fi
done
PHP_DBA_DB_CHECK(3, db-3.3 db-3.2 db-3.1 db-3.0 db-3 db3 db, [(void)db_create((DB**)0, (DB_ENV*)0, 0)])
fi
])
AC_DBA_STD_RESULT(db3,Berkeley DB3)
AC_MSG_CHECKING(for NDBM support)
AC_DBA_STD_RESULT
AC_ARG_WITH(db2,
[ --with-db2[=DIR] DBA: Include Berkeley DB2 support],[
[ --with-db2[=DIR] Include Berkeley DB2 support],[
if test "$withval" != "no"; then
PHP_DBA_STD_BEGIN
if test "$HAVE_DB3" = "1" -o "$HAVE_DB4" = "1"; then
AC_DBA_STD_RESULT(db2,Berkeley DB2,You cannot combine --with-db2 with --with-db3 or --with-db4)
fi
for i in $withval $withval/BerkeleyDB /usr/BerkeleyDB /usr/local /usr; do
for i in /usr/local /usr /usr/BerkeleyDB $withval/BerkeleyDB $withval; do
if test -f "$i/db2/db.h"; then
THIS_PREFIX=$i
THIS_INCLUDE=$i/db2/db.h
break
DB2_EXTRA=db2
elif test -f "$i/include/db2/db.h"; then
THIS_PREFIX=$i
THIS_INCLUDE=$i/include/db2/db.h
break
DB2_EXTRA=db2/db.h
elif test -f "$i/include/db/db2.h"; then
THIS_PREFIX=$i
THIS_INCLUDE=$i/include/db/db2.h
break
DB2_EXTRA=db/db2.h
elif test -f "$i/include/db2.h"; then
THIS_PREFIX=$i
THIS_INCLUDE=$i/include/db2.h
break
elif test -f "$i/include/db.h"; then
DB2_EXTRA=db2.h
elif test -f "$i/include/db.h" ; then
THIS_PREFIX=$i
THIS_INCLUDE=$i/include/db.h
break
DB2_EXTRA=db.h
fi
done
PHP_DBA_DB_CHECK(2, db-2 db2 db, [(void)db_appinit("", NULL, (DB_ENV*)0, 0)])
fi
])
AC_DBA_STD_RESULT(db2,Berkeley DB2)
done
AC_ARG_WITH(dbm,
[ --with-dbm[=DIR] DBA: Include DBM support],[
if test "$withval" != "no"; then
PHP_DBA_STD_BEGIN
for i in $withval /usr/local /usr; do
if test -f "$i/include/dbm.h"; then
THIS_PREFIX=$i
THIS_INCLUDE=$i/include/dbm.h
break
elif test -f "$i/include/gdbm/dbm.h"; then
THIS_PREFIX=$i
THIS_INCLUDE=$i/include/gdbm/dbm.h
break
fi
done
if test -n "$THIS_INCLUDE"; then
for LIB in dbm c gdbm; do
PHP_TEMP_LDFLAGS(-L$THIS_PREFIX/lib,[
AC_CHECK_LIB($LIB, dbminit, [
AC_MSG_CHECKING(for DBM using GDBM)
AC_DEFINE_UNQUOTED(DBM_INCLUDE_FILE, "$THIS_INCLUDE", [ ])
if test "$LIB" = "gdbm"; then
AC_DEFINE_UNQUOTED(DBM_VERSION, "GDBM", [ ])
AC_MSG_RESULT(yes)
else
AC_DEFINE_UNQUOTED(DBM_VERSION, "DBM", [ ])
AC_MSG_RESULT(no)
fi
AC_DEFINE(DBA_DBM,1,[ ])
THIS_LIBS=$LIB
])
if test -n "$THIS_LIBS"; then
break
fi
])
done
if test "$DB2_EXTRA" = "db2" ; then
DBA_INCLUDE="$DBA_INCLUDE -I$THIS_PREFIX/db2"
DB2_EXTRA=db.h
fi
if test -n "$DB2_EXTRA"; then
AC_DEFINE_UNQUOTED(DB2_INCLUDE_FILE, "$DB2_EXTRA", [ ])
fi
for LIB in db db2 c; do
PHP_TEMP_LDFLAGS(-L$THIS_PREFIX/lib,[
AC_CHECK_LIB($LIB, db_appinit, [AC_DEFINE(DBA_DB2,1,[ ]) THIS_LIBS=$LIB])
])
done
PHP_DBA_STD_ASSIGN
PHP_DBA_STD_CHECK
PHP_DBA_STD_ATTACH
fi
])
AC_DBA_STD_RESULT(dbm)
AC_MSG_CHECKING(for Berkeley DB2 support)
AC_DBA_STD_RESULT
AC_ARG_WITH(db3,
[ --with-db3[=DIR] Include Berkeley DB3 support],[
if test "$withval" != "no"; then
for i in /usr/local /usr /usr/local/BerkeleyDB.3.0 $withval; do
if test -f "$i/db3/db.h"; then
THIS_PREFIX=$i
DB3_EXTRA=db3
elif test -f "$i/include/db3/db.h"; then
THIS_PREFIX=$i
DB3_EXTRA=db3/db.h
elif test -f "$i/include/db/db3.h"; then
THIS_PREFIX=$i
DB3_EXTRA=db/db3.h
elif test -f "$i/include/db3.h"; then
THIS_PREFIX=$i
DB3_EXTRA=db3.h
elif test -f "$i/include/db.h"; then
THIS_PREFIX=$i
DB3_EXTRA=db.h
fi
done
if test -n "$DB3_EXTRA"; then
AC_DEFINE_UNQUOTED(DB3_INCLUDE_FILE, "$DB3_EXTRA", [ ])
fi
for LIB in db-3.1 db-3 db3 db; do
PHP_TEMP_LDFLAGS(-L$THIS_PREFIX/lib,[
AC_CHECK_LIB($LIB, db_create, [AC_DEFINE(DBA_DB3,1,[ ]) THIS_LIBS=$LIB])
])
done
PHP_DBA_STD_ASSIGN
PHP_DBA_STD_CHECK
PHP_DBA_STD_ATTACH
fi
])
AC_MSG_CHECKING(for Berkeley DB3 support)
AC_DBA_STD_RESULT
AC_ARG_WITH(dbm,
[ --with-dbm[=DIR] Include DBM support],[
if test "$withval" != "no"; then
for i in /usr/local /usr $withval; do
if test -f "$i/include/dbm.h" ; then
THIS_PREFIX=$i
fi
done
for LIB in db1 dbm c; do
PHP_TEMP_LDFLAGS(-L$THIS_PREFIX/lib,[
AC_CHECK_LIB($LIB, dbminit, [AC_DEFINE(DBA_DBM,1,[ ]) THIS_LIBS=$LIB])
])
done
PHP_DBA_STD_ASSIGN
PHP_DBA_STD_CHECK
PHP_DBA_STD_ATTACH
fi
])
AC_MSG_CHECKING(for DBM support)
AC_DBA_STD_RESULT
AC_DEFUN(PHP_DBA_BUILTIN_CDB,[
PHP_ADD_BUILD_DIR($ext_builddir/libcdb)
@@ -354,31 +222,21 @@ AC_DEFUN(PHP_DBA_BUILTIN_CDB,[
])
AC_ARG_WITH(cdb,
[ --with-cdb[=DIR] DBA: Include CDB support],[
if test "$withval" = "yes"; then
[ --with-cdb[=DIR] Include CDB support],[
if test "$withval" != "no"; then
PHP_DBA_BUILTIN_CDB
elif test "$withval" != "no"; then
PHP_DBA_STD_BEGIN
for i in $withval /usr/local /usr; do
if test -f "$i/include/cdb.h"; then
for i in /usr/local /usr $withval; do
if test -f "$i/include/cdb.h" ; then
THIS_PREFIX=$i
THIS_INCLUDE=$i/include/cdb.h
break
fi
done
if test -n "$THIS_INCLUDE"; then
for LIB in cdb c; do
PHP_TEMP_LDFLAGS(-L$THIS_PREFIX/lib,[
AC_CHECK_LIB($LIB, cdb_read, [
AC_DEFINE_UNQUOTED(CDB_INCLUDE_FILE, "$THIS_INCLUDE", [ ])
AC_DEFINE(DBA_CDB,1,[ ])
THIS_LIBS=$LIB
break
])
])
done
fi
for LIB in cdb c; do
PHP_TEMP_LDFLAGS(-L$THIS_PREFIX/lib,[
AC_CHECK_LIB($LIB, cdb_read, [AC_DEFINE(DBA_CDB,1,[ ]) THIS_LIBS=$LIB])
])
done
PHP_DBA_STD_ASSIGN
PHP_DBA_STD_CHECK
@@ -389,12 +247,13 @@ AC_ARG_WITH(cdb,
PHP_DBA_BUILTIN_CDB
fi
])
AC_DBA_STD_RESULT(cdb)
AC_MSG_CHECKING(for CDB support)
AC_DBA_STD_RESULT
AC_DEFUN(PHP_DBA_BUILTIN_FLATFILE,[
PHP_ADD_BUILD_DIR($ext_builddir/libflatfile)
AC_DEFINE(DBA_FLATFILE, 1, [ ])
flat_sources="libflatfile/flatfile.c"
flat_sources="dba_flatfile.c libflatfile/flatfile.c"
THIS_RESULT="builtin"
])
@@ -402,7 +261,7 @@ dnl
dnl FlatFile check must be the last one.
dnl
AC_ARG_WITH(flatfile,
[ --with-flatfile DBA: Include FlatFile support],[
[ --with-flatfile Include FlatFile support],[
if test "$withval" != "no"; then
PHP_DBA_BUILTIN_FLATFILE
fi
@@ -411,15 +270,14 @@ AC_ARG_WITH(flatfile,
PHP_DBA_BUILTIN_FLATFILE
fi
])
AC_DBA_STD_RESULT(FlatFile,FlatFile)
AC_MSG_CHECKING(for FlatFile support)
AC_DBA_STD_RESULT
AC_MSG_CHECKING(whether to enable DBA interface)
if test "$HAVE_DBA" = "1"; then
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_DBA, 1, [ ])
PHP_NEW_EXTENSION(dba, dba.c dba_cdb.c dba_db2.c dba_dbm.c dba_gdbm.c dba_ndbm.c dba_db3.c dba_db4.c dba_flatfile.c $cdb_sources $flat_sources, $ext_shared)
PHP_ADD_BUILD_DIR($ext_builddir/libcdb)
PHP_ADD_BUILD_DIR($ext_builddir/libflatfile)
PHP_NEW_EXTENSION(dba, dba.c dba_cdb.c dba_db2.c dba_dbm.c dba_gdbm.c dba_ndbm.c dba_db3.c $cdb_sources $flat_sources, $ext_shared)
PHP_SUBST(DBA_SHARED_LIBADD)
else
AC_MSG_RESULT(no)
+48 -73
View File
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 4 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2003 The PHP Group |
| Copyright (c) 1997-2002 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 |
@@ -44,14 +44,13 @@
#include "php_cdb.h"
#include "php_db2.h"
#include "php_db3.h"
#include "php_db4.h"
#include "php_flatfile.h"
/* {{{ dba_functions[]
*/
function_entry dba_functions[] = {
PHP_FE(dba_open, NULL)
PHP_FE(dba_popen, NULL)
PHP_FALIAS(dba_popen, dba_open, NULL)
/* Disabled until 4.3.1, when persistent STDIO streams are implemented. */
/* PHP_FE(dba_popen, NULL) */
PHP_FE(dba_close, NULL)
@@ -71,7 +70,6 @@ function_entry dba_functions[] = {
/* }}} */
PHP_MINIT_FUNCTION(dba);
PHP_MSHUTDOWN_FUNCTION(dba);
PHP_MINFO_FUNCTION(dba);
zend_module_entry dba_module_entry = {
@@ -79,7 +77,7 @@ zend_module_entry dba_module_entry = {
"dba",
dba_functions,
PHP_MINIT(dba),
PHP_MSHUTDOWN(dba),
NULL,
NULL,
NULL,
PHP_MINFO(dba),
@@ -91,6 +89,21 @@ zend_module_entry dba_module_entry = {
ZEND_GET_MODULE(dba)
#endif
typedef struct dba_handler {
char *name; /* handler name */
int flags; /* whether and how dba does locking and other flags*/
int (*open)(dba_info *, char **error TSRMLS_DC);
void (*close)(dba_info * TSRMLS_DC);
char* (*fetch)(dba_info *, char *, int, int, int * TSRMLS_DC);
int (*update)(dba_info *, char *, int, char *, int, int TSRMLS_DC);
int (*exists)(dba_info *, char *, int TSRMLS_DC);
int (*delete)(dba_info *, char *, int TSRMLS_DC);
char* (*firstkey)(dba_info *, int * TSRMLS_DC);
char* (*nextkey)(dba_info *, int * TSRMLS_DC);
int (*optimize)(dba_info * TSRMLS_DC);
int (*sync)(dba_info * TSRMLS_DC);
} dba_handler;
/* {{{ macromania */
#define DBA_ID_PARS \
@@ -143,14 +156,14 @@ ZEND_GET_MODULE(dba)
/* a DBA handler must have specific routines */
#define DBA_NAMED_HND(alias, name, flags) \
#define DBA_NAMED_HND(name, x, flags) \
{\
#alias, flags, dba_open_##name, dba_close_##name, dba_fetch_##name, dba_update_##name, \
dba_exists_##name, dba_delete_##name, dba_firstkey_##name, dba_nextkey_##name, \
dba_optimize_##name, dba_sync_##name, dba_info_##name \
#name, flags, dba_open_##x, dba_close_##x, dba_fetch_##x, dba_update_##x, \
dba_exists_##x, dba_delete_##x, dba_firstkey_##x, dba_nextkey_##x, \
dba_optimize_##x, dba_sync_##x \
},
#define DBA_HND(name, flags) DBA_NAMED_HND(name, name, flags)
#define DBA_HND(x, flags) DBA_NAMED_HND(x, x, flags)
/* check whether the user has write access */
#define DBA_WRITE_CHECK \
@@ -185,13 +198,10 @@ static dba_handler handler[] = {
#if DBA_DB3
DBA_HND(db3, DBA_LOCK_ALL) /* No lock in lib */
#endif
#if DBA_DB4
DBA_HND(db4, DBA_LOCK_ALL) /* No lock in lib */
#endif
#if DBA_FLATFILE
DBA_HND(flatfile, DBA_STREAM_OPEN|DBA_LOCK_ALL) /* No lock in lib */
#endif
{ NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL }
{ NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL }
};
static int le_db;
@@ -202,26 +212,16 @@ static int le_pdb;
*/
static void dba_close(dba_info *info TSRMLS_DC)
{
if (info->hnd) {
info->hnd->close(info TSRMLS_CC);
}
if (info->path) {
pefree(info->path, info->flags&DBA_PERSISTENT);
}
if (info->fp && info->fp!=info->lock.fp) {
php_stream_close(info->fp);
}
if (info->hnd) info->hnd->close(info TSRMLS_CC);
if (info->path) pefree(info->path, info->flags&DBA_PERSISTENT);
if (info->fp && info->fp!=info->lock.fp) php_stream_close(info->fp);
if (info->lock.fd) {
php_flock(info->lock.fd, LOCK_UN);
/*close(info->lock.fd);*/
info->lock.fd = 0;
}
if (info->lock.fp) {
php_stream_close(info->lock.fp);
}
if (info->lock.name) {
pefree(info->lock.name, info->flags&DBA_PERSISTENT);
}
if (info->lock.fp) php_stream_close(info->lock.fp);
if (info->lock.name) pefree(info->lock.name, info->flags&DBA_PERSISTENT);
pefree(info, info->flags&DBA_PERSISTENT);
}
/* }}} */
@@ -236,29 +236,12 @@ static void dba_close_rsrc(zend_rsrc_list_entry *rsrc TSRMLS_DC)
}
/* }}} */
/* {{{ dba_close_pe_rsrc_deleter */
int dba_close_pe_rsrc_deleter(list_entry *le, void *pDba TSRMLS_DC)
{
return le->ptr == pDba;
}
/* }}} */
/* {{{ dba_close_pe_rsrc */
static void dba_close_pe_rsrc(zend_rsrc_list_entry *rsrc TSRMLS_DC)
{
dba_info *info = (dba_info *)rsrc->ptr;
/* closes the resource by calling dba_close_rsrc() */
zend_hash_apply_with_argument(&EG(persistent_list), (apply_func_arg_t) dba_close_pe_rsrc_deleter, info TSRMLS_CC);
}
/* }}} */
/* {{{ PHP_MINIT_FUNCTION
*/
PHP_MINIT_FUNCTION(dba)
{
le_db = zend_register_list_destructors_ex(dba_close_rsrc, NULL, "dba", module_number);
le_pdb = zend_register_list_destructors_ex(dba_close_pe_rsrc, dba_close_rsrc, "dba persistent", module_number);
le_pdb = zend_register_list_destructors_ex(NULL, dba_close_rsrc, "dba persistent", module_number);
return SUCCESS;
}
/* }}} */
@@ -374,15 +357,14 @@ static void php_dba_open(INTERNAL_FUNCTION_PARAMETERS, int persistent)
int i;
int lock_mode, lock_flag, lock_dbf = 0;
char *file_mode;
char mode[4], *pmode, *lock_file_mode = NULL;
int persistent_flag = persistent ? STREAM_OPEN_PERSISTENT : 0;
char mode[4], *pmode, *lock_file_mode;
if(ac < 3) {
WRONG_PARAM_COUNT;
}
/* we pass additional args to the respective handler */
args = safe_emalloc(ac, sizeof(zval *), 0);
args = emalloc(ac * sizeof(zval *));
if (zend_get_parameters_array_ex(ac, args) != SUCCESS) {
FREENOW;
WRONG_PARAM_COUNT;
@@ -447,10 +429,6 @@ static void php_dba_open(INTERNAL_FUNCTION_PARAMETERS, int persistent)
switch (pmode[1]) {
case 'd':
lock_dbf = 1;
if ((hptr->flags & DBA_LOCK_ALL) == 0) {
lock_flag = (hptr->flags & DBA_LOCK_ALL);
break;
}
/* no break */
case 'l':
lock_flag = DBA_LOCK_ALL;
@@ -561,7 +539,7 @@ static void php_dba_open(INTERNAL_FUNCTION_PARAMETERS, int persistent)
/* when in read only mode try to use existing .lck file first */
/* do not log errors for .lck file while in read ony mode on .lck file */
lock_file_mode = "rb";
info->lock.fp = php_stream_open_wrapper(info->lock.name, lock_file_mode, STREAM_MUST_SEEK|IGNORE_PATH|ENFORCE_SAFE_MODE|persistent_flag, NULL);
info->lock.fp = php_stream_open_wrapper(info->lock.name, lock_file_mode, STREAM_MUST_SEEK|IGNORE_PATH|ENFORCE_SAFE_MODE, NULL);
}
if (!info->lock.fp) {
/* when not in read mode or failed to open .lck file read only. now try again in create(write) mode and log errors */
@@ -569,7 +547,7 @@ static void php_dba_open(INTERNAL_FUNCTION_PARAMETERS, int persistent)
}
}
if (!info->lock.fp) {
info->lock.fp = php_stream_open_wrapper(info->lock.name, lock_file_mode, STREAM_MUST_SEEK|REPORT_ERRORS|IGNORE_PATH|ENFORCE_SAFE_MODE|persistent_flag, NULL);
info->lock.fp = php_stream_open_wrapper(info->lock.name, lock_file_mode, STREAM_MUST_SEEK|REPORT_ERRORS|IGNORE_PATH|ENFORCE_SAFE_MODE, NULL);
}
if (!info->lock.fp) {
dba_close(info TSRMLS_CC);
@@ -593,7 +571,7 @@ static void php_dba_open(INTERNAL_FUNCTION_PARAMETERS, int persistent)
if (info->lock.fp && lock_dbf) {
info->fp = info->lock.fp; /* use the same stream for locking and database access */
} else {
info->fp = php_stream_open_wrapper(info->path, file_mode, STREAM_MUST_SEEK|REPORT_ERRORS|IGNORE_PATH|ENFORCE_SAFE_MODE|persistent_flag, NULL);
info->fp = php_stream_open_wrapper(info->path, file_mode, STREAM_MUST_SEEK|REPORT_ERRORS|IGNORE_PATH|ENFORCE_SAFE_MODE, NULL);
}
if (!info->fp) {
dba_close(info TSRMLS_CC);
@@ -605,7 +583,7 @@ static void php_dba_open(INTERNAL_FUNCTION_PARAMETERS, int persistent)
if (error || hptr->open(info, &error TSRMLS_CC) != SUCCESS) {
dba_close(info TSRMLS_CC);
php_error_docref2(NULL TSRMLS_CC, Z_STRVAL_PP(args[0]), Z_STRVAL_PP(args[1]), E_WARNING, "Driver initialization failed for handler: %s%s%s", hptr->name, error?": ":"", error?error:"");
php_error_docref2(NULL TSRMLS_CC, Z_STRVAL_PP(args[0]), Z_STRVAL_PP(args[1]), E_WARNING, "Driver initialization failed for handler: %s%s%s", Z_STRVAL_PP(args[2]), error?": ":"", error?error:"");
FREENOW;
RETURN_FALSE;
}
@@ -620,8 +598,6 @@ static void php_dba_open(INTERNAL_FUNCTION_PARAMETERS, int persistent)
Z_TYPE(new_le) = le_pdb;
new_le.ptr = info;
if (zend_hash_update(&EG(persistent_list), key, keylen+1, &new_le, sizeof(list_entry), NULL) == FAILURE) {
dba_close(info TSRMLS_CC);
php_error_docref2(NULL TSRMLS_CC, Z_STRVAL_PP(args[0]), Z_STRVAL_PP(args[1]), E_WARNING, "Could not register persistent resource");
FREENOW;
RETURN_FALSE;
}
@@ -780,26 +756,23 @@ PHP_FUNCTION(dba_sync)
}
/* }}} */
/* {{{ proto array dba_handlers([bool full_info])
/* {{{ proto array dba_handlers()
List configured databases */
PHP_FUNCTION(dba_handlers)
{
dba_handler *hptr;
zend_bool full_info = 0;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|b", &full_info) == FAILURE) {
if (ZEND_NUM_ARGS()!=0) {
ZEND_WRONG_PARAM_COUNT();
RETURN_FALSE;
}
array_init(return_value);
if (array_init(return_value) == FAILURE) {
php_error_docref(NULL TSRMLS_CC, E_ERROR, "Unable to initialize array");
RETURN_FALSE;
}
for(hptr = handler; hptr->name; hptr++) {
if (full_info) {
add_assoc_string(return_value, hptr->name, hptr->info(hptr, NULL TSRMLS_CC), 0);
} else {
add_next_index_string(return_value, hptr->name, 1);
}
add_next_index_string(return_value, hptr->name, 1);
}
}
/* }}} */
@@ -817,8 +790,10 @@ PHP_FUNCTION(dba_list)
RETURN_FALSE;
}
array_init(return_value);
if (array_init(return_value) == FAILURE) {
php_error_docref(NULL TSRMLS_CC, E_ERROR, "Unable to initialize array");
RETURN_FALSE;
}
numitems = zend_hash_next_free_element(&EG(regular_list));
for (i=1; i<numitems; i++) {
if (zend_hash_index_find(&EG(regular_list), i, (void **) &le)==FAILURE) {
@@ -832,7 +807,7 @@ PHP_FUNCTION(dba_list)
}
/* }}} */
#endif /* HAVE_DBA */
#endif
/*
* Local variables:
+10 -24
View File
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 4 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2003 The PHP Group |
| Copyright (c) 1997-2002 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 |
@@ -35,13 +35,12 @@
#include <fcntl.h>
#if DBA_CDB_BUILTIN
# include "libcdb/cdb.h"
# include "libcdb/cdb_make.h"
# include "libcdb/uint32.h"
#include "libcdb/cdb.h"
#include "libcdb/cdb_make.h"
#include "libcdb/uint32.h"
#else
# ifdef CDB_INCLUDE_FILE
# include CDB_INCLUDE_FILE
# endif
#include <cdb.h>
#include <uint32.h>
#endif
#define CDB_INFO \
@@ -86,10 +85,10 @@ DBA_OPEN_FUNC(cdb)
break;
#if DBA_CDB_BUILTIN
case DBA_TRUNC:
case DBA_CREAT:
make = 1;
file = info->fp;
break;
case DBA_CREAT:
case DBA_WRITER:
*error = "Update operations are not supported";
return FAILURE; /* not supported */
@@ -163,7 +162,7 @@ DBA_FETCH_FUNC(cdb)
}
}
len = cdb_datalen(&cdb->c);
new_entry = safe_emalloc(len, 1, 1);
new_entry = emalloc(len+1);
if (php_cdb_read(&cdb->c, new_entry, len, cdb_datapos(&cdb->c)) == -1) {
efree(new_entry);
@@ -268,7 +267,7 @@ DBA_FIRSTKEY_FUNC(cdb)
uint32_unpack(buf, &klen);
uint32_unpack(buf + 4, &dlen);
key = safe_emalloc(klen, 1, 1);
key = emalloc(klen + 1);
if (cdb_file_read(cdb->file, key, klen) < klen) {
efree(key);
key = NULL;
@@ -300,7 +299,7 @@ DBA_NEXTKEY_FUNC(cdb)
uint32_unpack(buf, &klen);
uint32_unpack(buf + 4, &dlen);
key = safe_emalloc(klen, 1, 1);
key = emalloc(klen + 1);
if (cdb_file_read(cdb->file, key, klen) < klen) {
efree(key);
key = NULL;
@@ -325,19 +324,6 @@ DBA_SYNC_FUNC(cdb)
return SUCCESS;
}
DBA_INFO_FUNC(cdb)
{
#if DBA_CDB_BUILTIN
if (!strcmp(hnd->name, "cdb")) {
return estrdup(cdb_version());
} else {
return estrdup(cdb_make_version());
}
#else
return estrdup("External");
#endif
}
#endif
/*
+1 -6
View File
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 4 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2003 The PHP Group |
| Copyright (c) 1997-2002 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 |
@@ -188,11 +188,6 @@ DBA_SYNC_FUNC(db2)
return dba->dbp->sync(dba->dbp, 0) ? FAILURE : SUCCESS;
}
DBA_INFO_FUNC(db2)
{
return estrdup(DB_VERSION_STRING);
}
#endif
/*
+16 -34
View File
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 4 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2003 The PHP Group |
| Copyright (c) 1997-2002 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 |
@@ -35,13 +35,6 @@
#include <db.h>
#endif
static void php_dba_db3_errcall_fcn(const char *errpfx, char *msg)
{
TSRMLS_FETCH();
php_error_docref(NULL TSRMLS_CC, E_NOTICE, "%s%s", errpfx?errpfx:"", msg);
}
#define DB3_DATA dba_db3_data *dba = info->dbf
#define DB3_GKEY \
DBT gkey; \
@@ -57,7 +50,7 @@ DBA_OPEN_FUNC(db3)
{
DB *dbp = NULL;
DBTYPE type;
int gmode = 0, err;
int gmode = 0;
int filemode = 0644;
struct stat check_stat;
int s = VCWD_STAT(info->path, &check_stat);
@@ -72,36 +65,30 @@ DBA_OPEN_FUNC(db3)
info->mode == DBA_WRITER ? 0 :
info->mode == DBA_TRUNC ? DB_CREATE | DB_TRUNCATE : -1;
if (gmode == -1) {
if (gmode == -1)
return FAILURE; /* not possible */
}
if (info->argc > 0) {
convert_to_long_ex(info->argv[0]);
filemode = Z_LVAL_PP(info->argv[0]);
}
#ifdef DB_FCNTL_LOCKING
gmode |= DB_FCNTL_LOCKING;
if (db_create(&dbp, NULL, 0) == 0 &&
#if (DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR >= 1)
dbp->open(dbp, 0, info->path, NULL, type, gmode, filemode) == 0) {
#else
dbp->open(dbp, info->path, NULL, type, gmode, filemode) == 0) {
#endif
dba_db3_data *data;
if ((err=db_create(&dbp, NULL, 0)) == 0) {
dbp->set_errcall(dbp, php_dba_db3_errcall_fcn);
if ((err=dbp->open(dbp, info->path, NULL, type, gmode, filemode)) == 0) {
dba_db3_data *data;
data = pemalloc(sizeof(*data), info->flags&DBA_PERSISTENT);
data->dbp = dbp;
data->cursor = NULL;
info->dbf = data;
data = pemalloc(sizeof(*data), info->flags&DBA_PERSISTENT);
data->dbp = dbp;
data->cursor = NULL;
info->dbf = data;
return SUCCESS;
} else {
dbp->close(dbp, 0);
*error = db_strerror(err);
}
} else {
*error = db_strerror(err);
return SUCCESS;
} else if (dbp != NULL) {
dbp->close(dbp, 0);
}
return FAILURE;
@@ -217,11 +204,6 @@ DBA_SYNC_FUNC(db3)
return dba->dbp->sync(dba->dbp, 0) ? FAILURE : SUCCESS;
}
DBA_INFO_FUNC(db3)
{
return estrdup(DB_VERSION_STRING);
}
#endif
/*
-239
View File
@@ -1,239 +0,0 @@
/*
+----------------------------------------------------------------------+
| PHP Version 4 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2003 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> |
+----------------------------------------------------------------------+
*/
/* $Id$ */
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "php.h"
#if DBA_DB4
#include "php_db4.h"
#include <sys/stat.h>
#include <string.h>
#ifdef DB4_INCLUDE_FILE
#include DB4_INCLUDE_FILE
#else
#include <db.h>
#endif
static void php_dba_db4_errcall_fcn(const char *errpfx, char *msg)
{
TSRMLS_FETCH();
php_error_docref(NULL TSRMLS_CC, E_NOTICE, "%s%s", errpfx?errpfx:"", msg);
}
#define DB4_DATA dba_db4_data *dba = info->dbf
#define DB4_GKEY \
DBT gkey; \
memset(&gkey, 0, sizeof(gkey)); \
gkey.data = (char *) key; gkey.size = keylen
typedef struct {
DB *dbp;
DBC *cursor;
} dba_db4_data;
DBA_OPEN_FUNC(db4)
{
DB *dbp = NULL;
DBTYPE type;
int gmode = 0, err;
int filemode = 0644;
struct stat check_stat;
int s = VCWD_STAT(info->path, &check_stat);
type = info->mode == DBA_READER ? DB_UNKNOWN :
info->mode == DBA_TRUNC ? DB_BTREE :
s? DB_BTREE : DB_UNKNOWN;
gmode = info->mode == DBA_READER ? DB_RDONLY :
(info->mode == DBA_CREAT && s) ? DB_CREATE :
(info->mode == DBA_CREAT && !s) ? 0 :
info->mode == DBA_WRITER ? 0 :
info->mode == DBA_TRUNC ? DB_CREATE | DB_TRUNCATE : -1;
if (gmode == -1) {
return FAILURE; /* not possible */
}
if (info->argc > 0) {
convert_to_long_ex(info->argv[0]);
filemode = Z_LVAL_PP(info->argv[0]);
}
#ifdef DB_FCNTL_LOCKING
gmode |= DB_FCNTL_LOCKING;
#endif
if ((err=db_create(&dbp, NULL, 0)) == 0) {
dbp->set_errcall(dbp, php_dba_db4_errcall_fcn);
if (
#if (DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR >= 1)
(err=dbp->open(dbp, 0, info->path, NULL, type, gmode, filemode)) == 0) {
#else
(err=dbp->open(dbp, info->path, NULL, type, gmode, filemode)) == 0) {
#endif
dba_db4_data *data;
data = pemalloc(sizeof(*data), info->flags&DBA_PERSISTENT);
data->dbp = dbp;
data->cursor = NULL;
info->dbf = data;
return SUCCESS;
} else {
dbp->close(dbp, 0);
*error = db_strerror(err);
}
} else {
*error = db_strerror(err);
}
return FAILURE;
}
DBA_CLOSE_FUNC(db4)
{
DB4_DATA;
if (dba->cursor) dba->cursor->c_close(dba->cursor);
dba->dbp->close(dba->dbp, 0);
pefree(dba, info->flags&DBA_PERSISTENT);
}
DBA_FETCH_FUNC(db4)
{
DBT gval;
char *new = NULL;
DB4_DATA;
DB4_GKEY;
memset(&gval, 0, sizeof(gval));
if (!dba->dbp->get(dba->dbp, NULL, &gkey, &gval, 0)) {
if (newlen) *newlen = gval.size;
new = estrndup(gval.data, gval.size);
}
return new;
}
DBA_UPDATE_FUNC(db4)
{
DBT gval;
DB4_DATA;
DB4_GKEY;
memset(&gval, 0, sizeof(gval));
gval.data = (char *) val;
gval.size = vallen;
if (!dba->dbp->put(dba->dbp, NULL, &gkey, &gval,
mode == 1 ? DB_NOOVERWRITE : 0)) {
return SUCCESS;
}
return FAILURE;
}
DBA_EXISTS_FUNC(db4)
{
DBT gval;
DB4_DATA;
DB4_GKEY;
memset(&gval, 0, sizeof(gval));
if (!dba->dbp->get(dba->dbp, NULL, &gkey, &gval, 0)) {
return SUCCESS;
}
return FAILURE;
}
DBA_DELETE_FUNC(db4)
{
DB4_DATA;
DB4_GKEY;
return dba->dbp->del(dba->dbp, NULL, &gkey, 0) ? FAILURE : SUCCESS;
}
DBA_FIRSTKEY_FUNC(db4)
{
DB4_DATA;
if (dba->cursor) {
dba->cursor->c_close(dba->cursor);
}
dba->cursor = NULL;
if (dba->dbp->cursor(dba->dbp, NULL, &dba->cursor, 0) != 0) {
return NULL;
}
/* we should introduce something like PARAM_PASSTHRU... */
return dba_nextkey_db4(info, newlen TSRMLS_CC);
}
DBA_NEXTKEY_FUNC(db4)
{
DB4_DATA;
DBT gkey, gval;
char *nkey = NULL;
memset(&gkey, 0, sizeof(gkey));
memset(&gval, 0, sizeof(gval));
if (dba->cursor->c_get(dba->cursor, &gkey, &gval, DB_NEXT) == 0) {
if (gkey.data) {
nkey = estrndup(gkey.data, gkey.size);
if (newlen) *newlen = gkey.size;
}
}
return nkey;
}
DBA_OPTIMIZE_FUNC(db4)
{
return SUCCESS;
}
DBA_SYNC_FUNC(db4)
{
DB4_DATA;
return dba->dbp->sync(dba->dbp, 0) ? FAILURE : SUCCESS;
}
DBA_INFO_FUNC(db4)
{
return estrdup(DB_VERSION_STRING);
}
#endif
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* End:
* vim600: sw=4 ts=4 fdm=marker
* vim<600: sw=4 ts=4
*/
+2 -26
View File
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 4 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2003 The PHP Group |
| Copyright (c) 1997-2002 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 |
@@ -27,12 +27,7 @@
#if DBA_DBM
#include "php_dbm.h"
#ifdef DBM_INCLUDE_FILE
#include DBM_INCLUDE_FILE
#endif
#if DBA_GDBM
#include "php_gdbm.h"
#endif
#include <dbm.h>
#include <unistd.h>
#include <sys/types.h>
@@ -113,14 +108,6 @@ DBA_UPDATE_FUNC(dbm)
datum gval;
DBM_GKEY;
if (mode == 1) { /* insert */
gval = fetch(gkey);
if(gval.dptr) {
return FAILURE;
}
}
gval.dptr = (char *) val;
gval.dsize = vallen;
@@ -190,17 +177,6 @@ DBA_SYNC_FUNC(dbm)
return SUCCESS;
}
DBA_INFO_FUNC(dbm)
{
#if DBA_GDBM
if (!strcmp(DBM_VERSION, "GDBM"))
{
return dba_info_gdbm(hnd, info TSRMLS_CC);
}
#endif
return estrdup(DBM_VERSION);
}
#endif
/*
+1 -6
View File
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 4 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2003 The PHP Group |
| Copyright (c) 1997-2002 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 |
@@ -163,11 +163,6 @@ DBA_SYNC_FUNC(flatfile)
return SUCCESS;
}
DBA_INFO_FUNC(flatfile)
{
return estrdup(flatfile_version());
}
#endif
/*
+2 -10
View File
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 4 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2003 The PHP Group |
| Copyright (c) 1997-2002 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 |
@@ -27,9 +27,7 @@
#if DBA_GDBM
#include "php_gdbm.h"
#ifdef GDBM_INCLUDE_FILE
#include GDBM_INCLUDE_FILE
#endif
#include <gdbm.h>
#define GDBM_DATA dba_gdbm_data *dba = info->dbf
#define GDBM_GKEY datum gkey; gkey.dptr = (char *) key; gkey.dsize = keylen
@@ -182,12 +180,6 @@ DBA_SYNC_FUNC(gdbm)
gdbm_sync(dba->dbf);
return SUCCESS;
}
DBA_INFO_FUNC(gdbm)
{
return estrdup(gdbm_version);
}
#endif
/*
+1 -7
View File
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 4 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2003 The PHP Group |
| Copyright (c) 1997-2002 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 |
@@ -153,12 +153,6 @@ DBA_SYNC_FUNC(ndbm)
{
return SUCCESS;
}
DBA_INFO_FUNC(ndbm)
{
return estrdup("NDBM");
}
#endif
/*
+1 -8
View File
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 4 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2003 The PHP Group |
| Copyright (c) 1997-2002 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 |
@@ -193,10 +193,3 @@ int cdb_find(struct cdb *c, char *key, unsigned int len TSRMLS_DC)
return cdb_findnext(c, key, len TSRMLS_CC);
}
/* }}} */
/* {{{ cdb_version */
char *cdb_version()
{
return "0.75, $Revision$";
}
/* }}} */
+1 -3
View File
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 4 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2003 The PHP Group |
| Copyright (c) 1997-2002 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 |
@@ -52,6 +52,4 @@ int cdb_find(struct cdb *, char *, unsigned int TSRMLS_DC);
#define cdb_datapos(c) ((c)->dpos)
#define cdb_datalen(c) ((c)->dlen)
char *cdb_version();
#endif
+5 -9
View File
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 4 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2003 The PHP Group |
| Copyright (c) 1997-2002 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 |
@@ -79,7 +79,8 @@ int cdb_make_addend(struct cdb_make *c, unsigned int keylen, unsigned int datale
head = c->head;
if (!head || (head->num >= CDB_HPLIST)) {
head = (struct cdb_hplist *) emalloc(sizeof(struct cdb_hplist));
head = (struct cdb_hplist *)
emalloc(sizeof(struct cdb_hplist));
if (!head)
return -1;
head->num = 0;
@@ -171,7 +172,8 @@ int cdb_make_finish(struct cdb_make *c TSRMLS_DC)
return -1;
}
c->split = (struct cdb_hp *) safe_emalloc(memsize, sizeof(struct cdb_hp), 0);
c->split = (struct cdb_hp *)
emalloc(memsize * sizeof(struct cdb_hp));
if (!c->split)
return -1;
@@ -236,9 +238,3 @@ int cdb_make_finish(struct cdb_make *c TSRMLS_DC)
return php_stream_flush(c->fp);
}
/* }}} */
/* {{{ cdb_make_version */
char *cdb_make_version()
{
return "0.75, $Revision$";
}
+1 -2
View File
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 4 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2003 The PHP Group |
| Copyright (c) 1997-2002 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 |
@@ -59,6 +59,5 @@ int cdb_make_addbegin(struct cdb_make *, unsigned int, unsigned int TSRMLS_DC);
int cdb_make_addend(struct cdb_make *, unsigned int, unsigned int, uint32 TSRMLS_DC);
int cdb_make_add(struct cdb_make *, char *, unsigned int, char *, unsigned int TSRMLS_DC);
int cdb_make_finish(struct cdb_make * TSRMLS_DC);
char *cdb_make_version();
#endif
+1 -1
View File
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 4 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2003 The PHP Group |
| Copyright (c) 1997-2002 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 |
+1 -1
View File
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 4 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2003 The PHP Group |
| Copyright (c) 1997-2002 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 |
+113 -129
View File
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 4 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2003 The PHP Group |
| Copyright (c) 1997-2002 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 |
@@ -38,8 +38,6 @@
#include "flatfile.h"
#define FLATFILE_BLOCK_SIZE 1024
/*
* ret = -1 means that database was opened for read-only
* ret = 0 success
@@ -56,25 +54,21 @@ int flatfile_store(flatfile *dba, datum key_datum, datum value_datum, int mode T
php_stream_seek(dba->fp, 0L, SEEK_END);
php_stream_printf(dba->fp TSRMLS_CC, "%d\n", key_datum.dsize);
php_stream_flush(dba->fp);
if (php_stream_write(dba->fp, key_datum.dptr, key_datum.dsize) < key_datum.dsize) {
if (php_stream_write(dba->fp, key_datum.dptr, key_datum.dsize) < key_datum.dsize)
return -1;
}
php_stream_printf(dba->fp TSRMLS_CC, "%d\n", value_datum.dsize);
php_stream_flush(dba->fp);
if (php_stream_write(dba->fp, value_datum.dptr, value_datum.dsize) < value_datum.dsize) {
if (php_stream_write(dba->fp, value_datum.dptr, value_datum.dsize) < value_datum.dsize)
return -1;
}
} else { /* FLATFILE_REPLACE */
} else { /* DBM_REPLACE */
flatfile_delete(dba, key_datum TSRMLS_CC);
php_stream_printf(dba->fp TSRMLS_CC, "%d\n", key_datum.dsize);
php_stream_flush(dba->fp);
if (php_stream_write(dba->fp, key_datum.dptr, key_datum.dsize) < key_datum.dsize) {
if (php_stream_write(dba->fp, key_datum.dptr, key_datum.dsize) < key_datum.dsize)
return -1;
}
php_stream_printf(dba->fp TSRMLS_CC, "%d\n", value_datum.dsize);
if (php_stream_write(dba->fp, value_datum.dptr, value_datum.dsize) < value_datum.dsize) {
if (php_stream_write(dba->fp, value_datum.dptr, value_datum.dsize) < value_datum.dsize)
return -1;
}
}
php_stream_flush(dba->fp);
@@ -86,16 +80,25 @@ int flatfile_store(flatfile *dba, datum key_datum, datum value_datum, int mode T
*/
datum flatfile_fetch(flatfile *dba, datum key_datum TSRMLS_DC) {
datum value_datum = {NULL, 0};
char buf[16];
size_t num=0;
size_t buf_size = 1024;
char *buf;
if (flatfile_findkey(dba, key_datum TSRMLS_CC)) {
if (php_stream_gets(dba->fp, buf, sizeof(buf))) {
value_datum.dsize = atoi(buf);
value_datum.dptr = safe_emalloc(value_datum.dsize, 1, 1);
value_datum.dsize = php_stream_read(dba->fp, value_datum.dptr, value_datum.dsize);
buf = emalloc((buf_size+1) * sizeof(char));
if (php_stream_gets(dba->fp, buf, 15)) {
num = atoi(buf);
if (num > buf_size) {
buf_size+=num;
buf = erealloc(buf, (buf_size+1)*sizeof(char));
}
php_stream_read(dba->fp, buf, num);
value_datum.dptr = buf;
value_datum.dsize = num;
} else {
value_datum.dptr = NULL;
value_datum.dsize = 0;
efree(buf);
}
}
return value_datum;
@@ -107,55 +110,57 @@ datum flatfile_fetch(flatfile *dba, datum key_datum TSRMLS_DC) {
int flatfile_delete(flatfile *dba, datum key_datum TSRMLS_DC) {
char *key = key_datum.dptr;
size_t size = key_datum.dsize;
size_t buf_size = FLATFILE_BLOCK_SIZE;
char *buf = emalloc(buf_size);
char *buf;
size_t num;
size_t buf_size = 1024;
size_t pos;
php_stream_rewind(dba->fp);
buf = emalloc((buf_size + 1)*sizeof(char));
while(!php_stream_eof(dba->fp)) {
/* read in the length of the key name */
if (!php_stream_gets(dba->fp, buf, 15)) {
if (!php_stream_gets(dba->fp, buf, 15))
break;
}
num = atoi(buf);
if (num >= buf_size) {
buf_size = num + FLATFILE_BLOCK_SIZE;
buf = erealloc(buf, buf_size);
if (num > buf_size) {
buf_size += num;
buf = erealloc(buf, (buf_size+1)*sizeof(char));
}
pos = php_stream_tell(dba->fp);
/* read in the key name */
num = php_stream_read(dba->fp, buf, num);
if (num < 0) {
num = php_stream_read(dba->fp, buf, sizeof(char)*num);
if (num<0)
break;
}
*(buf+num) = '\0';
if (size == num && !memcmp(buf, key, size)) {
php_stream_seek(dba->fp, pos, SEEK_SET);
php_stream_putc(dba->fp, 0);
php_stream_flush(dba->fp);
php_stream_seek(dba->fp, 0L, SEEK_END);
efree(buf);
if (buf)
efree(buf);
return SUCCESS;
}
/* read in the length of the value */
if (!php_stream_gets(dba->fp, buf, 15)) {
if (!php_stream_gets(dba->fp, buf, 15))
break;
}
num = atoi(buf);
if (num >= buf_size) {
buf_size = num + FLATFILE_BLOCK_SIZE;
buf = erealloc(buf, buf_size);
if (num > buf_size) {
buf_size+=num;
buf = erealloc(buf, (buf_size+1)*sizeof(char));
}
/* read in the value */
num = php_stream_read(dba->fp, buf, num);
if (num < 0) {
num = php_stream_read(dba->fp, buf, sizeof(char)*num);
if (num<0)
break;
}
}
efree(buf);
if (buf)
efree(buf);
return FAILURE;
}
/* }}} */
@@ -163,154 +168,133 @@ int flatfile_delete(flatfile *dba, datum key_datum TSRMLS_DC) {
/* {{{ flatfile_findkey
*/
int flatfile_findkey(flatfile *dba, datum key_datum TSRMLS_DC) {
size_t buf_size = FLATFILE_BLOCK_SIZE;
char *buf = emalloc(buf_size);
char *buf = NULL;
size_t num;
size_t buf_size = 1024;
int ret=0;
void *key = key_datum.dptr;
size_t size = key_datum.dsize;
php_stream_rewind(dba->fp);
buf = emalloc((buf_size+1)*sizeof(char));
while (!php_stream_eof(dba->fp)) {
if (!php_stream_gets(dba->fp, buf, 15)) {
if (!php_stream_gets(dba->fp, buf, 15))
break;
}
num = atoi(buf);
if (num >= buf_size) {
buf_size = num + FLATFILE_BLOCK_SIZE;
buf = erealloc(buf, buf_size);
}
num = php_stream_read(dba->fp, buf, num);
if (num < 0) {
break;
if (num > buf_size) {
buf_size+=num;
buf = erealloc(buf, (buf_size+1)*sizeof(char));
}
num = php_stream_read(dba->fp, buf, sizeof(char)*num);
if (num<0) break;
*(buf+num) = '\0';
if (size == num) {
if (!memcmp(buf, key, size)) {
ret = 1;
break;
}
}
if (!php_stream_gets(dba->fp, buf, 15)) {
if (!php_stream_gets(dba->fp, buf, 15))
break;
}
num = atoi(buf);
if (num >= buf_size) {
buf_size = num + FLATFILE_BLOCK_SIZE;
buf = erealloc(buf, buf_size);
if (num > buf_size) {
buf_size+=num;
buf = erealloc(buf, (buf_size+1)*sizeof(char));
}
num = php_stream_read(dba->fp, buf, num);
if (num < 0) {
num = php_stream_read(dba->fp, buf, sizeof(char)*num);
if (num<0)
break;
}
*(buf+num) = '\0';
}
efree(buf);
return ret;
if (buf)
efree(buf);
return(ret);
}
/* }}} */
/* {{{ flatfile_firstkey
*/
datum flatfile_firstkey(flatfile *dba TSRMLS_DC) {
datum res;
datum buf;
size_t num;
size_t buf_size = FLATFILE_BLOCK_SIZE;
char *buf = emalloc(buf_size);
size_t buf_size = 1024;
php_stream_rewind(dba->fp);
buf.dptr = emalloc((buf_size+1)*sizeof(char));
while(!php_stream_eof(dba->fp)) {
if (!php_stream_gets(dba->fp, buf, 15)) {
if (!php_stream_gets(dba->fp, buf.dptr, 15)) break;
num = atoi(buf.dptr);
if (num > buf_size) {
buf_size+=num;
buf.dptr = erealloc(buf.dptr, (buf_size+1)*sizeof(char));
}
num = php_stream_read(dba->fp, buf.dptr, num);
if (num<0)
break;
}
num = atoi(buf);
if (num >= buf_size) {
buf_size = num + FLATFILE_BLOCK_SIZE;
buf = erealloc(buf, buf_size);
}
num = php_stream_read(dba->fp, buf, num);
if (num < 0) {
break;
}
if (*(buf) != 0) {
buf.dsize = num;
if (*(buf.dptr)!=0) {
dba->CurrentFlatFilePos = php_stream_tell(dba->fp);
res.dptr = buf;
res.dsize = num;
return res;
return(buf);
}
if (!php_stream_gets(dba->fp, buf, 15)) {
if (!php_stream_gets(dba->fp, buf.dptr, 15)) break;
num = atoi(buf.dptr);
if (num > buf_size) {
buf_size+=num;
buf.dptr = erealloc(buf.dptr, (buf_size+1)*sizeof(char));
}
num = php_stream_read(dba->fp, buf.dptr, num);
if (num<0)
break;
}
num = atoi(buf);
if (num >= buf_size) {
buf_size = num + FLATFILE_BLOCK_SIZE;
buf = erealloc(buf, buf_size);
}
num = php_stream_read(dba->fp, buf, num);
if (num < 0) {
break;
}
}
efree(buf);
res.dptr = NULL;
res.dsize = 0;
return res;
if (buf.dptr)
efree(buf.dptr);
buf.dptr = NULL;
return(buf);
}
/* }}} */
/* {{{ flatfile_nextkey
*/
datum flatfile_nextkey(flatfile *dba TSRMLS_DC) {
datum res;
datum buf;
size_t num;
size_t buf_size = FLATFILE_BLOCK_SIZE;
char *buf = emalloc(buf_size);
size_t buf_size = 1024;
php_stream_seek(dba->fp, dba->CurrentFlatFilePos, SEEK_SET);
buf.dptr = emalloc((buf_size+1)*sizeof(char));
while(!php_stream_eof(dba->fp)) {
if (!php_stream_gets(dba->fp, buf, 15)) {
if (!php_stream_gets(dba->fp, buf.dptr, 15)) break;
num = atoi(buf.dptr);
if (num > buf_size) {
buf_size+=num;
buf.dptr = erealloc(buf.dptr, (buf_size+1)*sizeof(char));
}
num = php_stream_read(dba->fp, buf.dptr, num);
if (num<0)
break;
}
num = atoi(buf);
if (num >= buf_size) {
buf_size = num + FLATFILE_BLOCK_SIZE;
buf = erealloc(buf, buf_size);
}
num = php_stream_read(dba->fp, buf, num);
if (num < 0) {
if (!php_stream_gets(dba->fp, buf.dptr, 15))
break;
num = atoi(buf.dptr);
if (num > buf_size) {
buf_size+=num;
buf.dptr = erealloc(buf.dptr, (buf_size+1)*sizeof(char));
}
if (!php_stream_gets(dba->fp, buf, 15)) {
num = php_stream_read(dba->fp, buf.dptr, num);
if (num<0)
break;
}
num = atoi(buf);
if (num >= buf_size) {
buf_size = num + FLATFILE_BLOCK_SIZE;
buf = erealloc(buf, buf_size);
}
num = php_stream_read(dba->fp, buf, num);
if (num < 0) {
break;
}
if (*(buf)!=0) {
buf.dsize = num;
if (*(buf.dptr)!=0) {
dba->CurrentFlatFilePos = php_stream_tell(dba->fp);
res.dptr = buf;
res.dsize = num;
return res;
return(buf);
}
}
efree(buf);
res.dptr = NULL;
res.dsize = 0;
return res;
if (buf.dptr)
efree(buf.dptr);
buf.dptr = NULL;
return(buf);
}
/* }}} */
/* {{{ flatfile_version */
char *flatfile_version()
{
return "1.0, $Revision$";
}
/* }}} */
/*
* Local variables:
* tab-width: 4
+3 -4
View File
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 4 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2003 The PHP Group |
| Copyright (c) 1997-2002 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 |
@@ -18,8 +18,8 @@
/* $Id$ */
#ifndef PHP_LIB_FLATFILE_H
#define PHP_LIB_FLATFILE_H
#ifndef PHP_LIBDBM_H
#define PHP_LIBDBM_H
typedef struct {
char *dptr;
@@ -43,6 +43,5 @@ int flatfile_delete(flatfile *dba, datum key_datum TSRMLS_DC);
int flatfile_findkey(flatfile *dba, datum key_datum TSRMLS_DC);
datum flatfile_firstkey(flatfile *dba TSRMLS_DC);
datum flatfile_nextkey(flatfile *dba TSRMLS_DC);
char *flatfile_version();
#endif
-12
View File
@@ -1,12 +0,0 @@
#ifndef PHP_DB4_H
#define PHP_DB4_H
#if DBA_DB4
#include "php_dba.h"
DBA_FUNCS(db4);
#endif
#endif
+2 -22
View File
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 4 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2003 The PHP Group |
| Copyright (c) 1997-2002 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 |
@@ -68,23 +68,6 @@ typedef struct dba_info {
extern zend_module_entry dba_module_entry;
#define dba_module_ptr &dba_module_entry
typedef struct dba_handler {
char *name; /* handler name */
int flags; /* whether and how dba does locking and other flags*/
int (*open)(dba_info *, char **error TSRMLS_DC);
void (*close)(dba_info * TSRMLS_DC);
char* (*fetch)(dba_info *, char *, int, int, int * TSRMLS_DC);
int (*update)(dba_info *, char *, int, char *, int, int TSRMLS_DC);
int (*exists)(dba_info *, char *, int TSRMLS_DC);
int (*delete)(dba_info *, char *, int TSRMLS_DC);
char* (*firstkey)(dba_info *, int * TSRMLS_DC);
char* (*nextkey)(dba_info *, int * TSRMLS_DC);
int (*optimize)(dba_info * TSRMLS_DC);
int (*sync)(dba_info * TSRMLS_DC);
char* (*info)(struct dba_handler *hnd, dba_info * TSRMLS_DC);
/* dba_info==NULL: Handler info, dba_info!=NULL: Database info */
} dba_handler;
/* common prototypes which must be supplied by modules */
#define DBA_OPEN_FUNC(x) \
@@ -107,8 +90,6 @@ typedef struct dba_handler {
int dba_optimize_##x(dba_info *info TSRMLS_DC)
#define DBA_SYNC_FUNC(x) \
int dba_sync_##x(dba_info *info TSRMLS_DC)
#define DBA_INFO_FUNC(x) \
char *dba_info_##x(dba_handler *hnd, dba_info *info TSRMLS_DC)
#define DBA_FUNCS(x) \
DBA_OPEN_FUNC(x); \
@@ -120,8 +101,7 @@ typedef struct dba_handler {
DBA_FIRSTKEY_FUNC(x); \
DBA_NEXTKEY_FUNC(x); \
DBA_OPTIMIZE_FUNC(x); \
DBA_SYNC_FUNC(x); \
DBA_INFO_FUNC(x)
DBA_SYNC_FUNC(x)
#define VALLEN(p) Z_STRVAL_PP(p), Z_STRLEN_PP(p)
-33
View File
@@ -1,33 +0,0 @@
--TEST--
DBA dba_popen Test
--SKIPIF--
<?php
require_once('skipif.inc');
print("info $HND handler used");
?>
--FILE--
<?php
require_once('test.inc');
echo "database handler: $handler\n";
if (($db=dba_popen($db_file, "n", $handler))!==FALSE) {
echo "Opened\n";
dba_insert("a", "Inserted", $db);
echo dba_fetch("a", $db)."\n";
dba_close($db);
echo "Closed\n";
} else {
echo "Error creating database\n";
}
if (($db=dba_popen($db_file, "n", $handler))!==FALSE) {
echo "Opened\n";
dba_insert("a", "Inserted", $db);
echo dba_fetch("a", $db)."\n";
}
?>
--EXPECTF--
database handler: %s
Opened
Inserted
Closed
Opened
Inserted
+2 -2
View File
@@ -2,14 +2,14 @@
DBA CDB handler test
--SKIPIF--
<?php
$handler = 'cdb';
require_once('skipif.inc');
if (!in_array('cdb', dba_handlers())) die('skip CDB handler not available');
die('info CDB does not support replace or delete');
?>
--FILE--
<?php
$handler = 'cdb';
require_once('test.inc');
$handler = 'cdb';
require_once('dba_handler.inc');
?>
--EXPECT--
+2 -3
View File
@@ -4,14 +4,13 @@ DBA CDB_MAKE handler test
magic_quotes_runtime=1
--SKIPIF--
<?php
$handler = 'cdb_make';
require_once('skipif.inc');
die('info CDB_MAKE does not support reading');
if (!in_array('cdb_make', dba_handlers())) die('skip CDB_MAKE handler not available');
?>
--FILE--
<?php
$handler = 'cdb_make';
require_once('test.inc');
$handler = 'cdb_make';
echo "database handler: $handler\n";
// print md5 checksum of test.cdb which is generated by cdb_make program
var_dump(md5(implode('',file(dirname(__FILE__).'/test.cdb'))));
+2 -2
View File
@@ -2,8 +2,8 @@
DBA CDB handler test (read only)
--SKIPIF--
<?php
$handler = 'cdb_make';
require_once('skipif.inc');
if (!extension_loaded('dba')) die('skip dba extension not available');
if (!in_array('cdb', dba_handlers())) die('skip CDB handler not available');
?>
--FILE--
<?php
+2 -2
View File
@@ -2,13 +2,13 @@
DBA DB2 handler test
--SKIPIF--
<?php
$handler = 'db2';
require_once('skipif.inc');
if (!in_array('db2', dba_handlers())) die('skip DB2 handler not available');
?>
--FILE--
<?php
$handler = 'db2';
require_once('test.inc');
$handler = 'db2';
require_once('dba_handler.inc');
?>
--EXPECT--
+2 -2
View File
@@ -2,13 +2,13 @@
DBA DB3 handler test
--SKIPIF--
<?php
$handler = 'db3';
require_once('skipif.inc');
if (!in_array('db3', dba_handlers())) die('skip DB3 handler not available');
?>
--FILE--
<?php
$handler = 'db3';
require_once('test.inc');
$handler = 'db3';
require_once('dba_handler.inc');
?>
--EXPECT--
-29
View File
@@ -1,29 +0,0 @@
--TEST--
DBA DB4 handler test
--SKIPIF--
<?php
$handler = 'db4';
require_once('skipif.inc');
?>
--FILE--
<?php
$handler = 'db4';
require_once('test.inc');
require_once('dba_handler.inc');
?>
--EXPECT--
database handler: db4
3NYNYY
Content String 2
Content 2 replaced
Read during write: not allowed
Content 2 replaced 2nd time
The 6th value
array(3) {
["key number 6"]=>
string(13) "The 6th value"
["key2"]=>
string(27) "Content 2 replaced 2nd time"
["key5"]=>
string(23) "The last content string"
}
+2 -2
View File
@@ -2,13 +2,13 @@
DBA DBM handler test
--SKIPIF--
<?php
$handler = 'dbm';
require_once('skipif.inc');
if (!in_array('dbm', dba_handlers())) die('skip DBM handler not available');
?>
--FILE--
<?php
$handler = 'dbm';
require_once('test.inc');
$handler = 'dbm';
require_once('dba_handler.inc');
?>
--EXPECT--
+2 -2
View File
@@ -2,13 +2,13 @@
DBA FlatFile handler test
--SKIPIF--
<?php
$handler = 'flatfile';
require_once('skipif.inc');
if (!in_array('flatfile', dba_handlers())) die('skip FlatFile handler not available');
?>
--FILE--
<?php
$handler = 'flatfile';
require_once('test.inc');
$handler = 'flatfile';
require_once('dba_handler.inc');
?>
--EXPECT--
+2 -2
View File
@@ -2,13 +2,13 @@
DBA GDBM handler test
--SKIPIF--
<?php
$handler = 'gdbm';
require_once('skipif.inc');
if (!in_array('gdbm', dba_handlers())) die('skip GDBM handler not available');
?>
--FILE--
<?php
$handler = 'gdbm';
require_once('test.inc');
$handler = 'gdbm';
$lock_flag = ''; // lock in library
require_once('dba_handler.inc');
+2 -2
View File
@@ -2,13 +2,13 @@
DBA NDBM handler test
--SKIPIF--
<?php
$handler = 'ndbm';
require_once('skipif.inc');
if (!in_array('ndbm', dba_handlers())) die('skip NDBM handler not available');
?>
--FILE--
<?php
$handler = 'ndbm';
require_once('test.inc');
$handler = 'ndbm';
require_once('dba_handler.inc');
?>
--EXPECT--
+11 -14
View File
@@ -2,22 +2,19 @@
if (!extension_loaded('dba')) die('skip dba extension not available');
if (!function_exists('dba_handlers')) die ('skip dba_handlers() not available');
if (!sizeof(dba_handlers())) die('skip no handlers installed');
if (!isset($handler)) {
$handlers = dba_handlers();
if (in_array('flatfile', $handlers)) {
$handler = 'flatfile';
} else {
$handler = array_diff($handlers, array('cdb', 'cdb_make')); /* these can only read OR write */
if (count($handler)==0) {
die('skip no handler available that can be used for the test');
}
$handler = array_shift($handlers);
$handler = dba_handlers();
if (in_array('flatfile', $handler)) {
$handler = 'flatfile';
} elseif ($handler[0]=='cdb') { // CDB currently supports only reading
if (count($handler)==1) {
die('skip CDB currently supports only reading');
}
if ($handler[1]=='cdb_make' && count($handler)==2) {
die('skip CDB currently supports only reading and creating');
}
$handler = $handler[1];
} else {
if (!in_array($handler, dba_handlers())) {
$HND = strtoupper($handler);
die("skip $HND handler not available");
}
$handler = $handler[0];
}
$HND = strtoupper($handler);
?>
+12 -2
View File
@@ -1,7 +1,17 @@
<?php
require_once('skipif.inc');
$lock_flag = 'l';
$db_filename = $db_file = dirname(__FILE__).'/test0.dbm';
$handler = dba_handlers();
if (in_array('flatfile', $handler)) {
$handler = 'flatfile';
} elseif ($handler[0]=='cdb') { // CDB currently supports only reading
if (count($handler)==1) {
die('CDB currently supports only reading ');
}
$handler = $handler[1];
} else {
$handler = $handler[0];
}
$lock_flag = 'l';
@unlink($db_filename);
@unlink($db_filename.'.lck');
?>
+1 -1
View File
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 4 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2003 The PHP Group |
| Copyright (c) 1997-2002 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 |
+2 -3
View File
@@ -247,10 +247,9 @@ dbhead_t *dbf_open(char *dp, int o_flags TSRMLS_DC)
cp = dp;
if ((fd = VCWD_OPEN(cp, o_flags|O_BINARY)) < 0) {
cp = (char *)malloc(MAXPATHLEN); /* So where does this get free()'d? -RL */
strncpy(cp, dp, MAXPATHLEN-5); strcat(cp, ".dbf");
cp = (char *)malloc(256);
strcpy(cp, dp); strcat(cp, ".dbf");
if ((fd = VCWD_OPEN(cp, o_flags)) < 0) {
free(cp);
perror("open");
return NULL;
}
+1 -1
View File
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 4 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2003 The PHP Group |
| Copyright (c) 1997-2002 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 |
+6 -6
View File
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 4 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2003 The PHP Group |
| Copyright (c) 1997-2002 The PHP Group |
+----------------------------------------------------------------------+
| dbx module version 1.0 |
+----------------------------------------------------------------------+
@@ -85,7 +85,7 @@ int get_module_identifier(char *module_name)
return DBX_UNKNOWN;
}
int split_dbx_handle_object(zval **dbx_object, zval ***pdbx_handle, zval ***pdbx_module, zval ***pdbx_database TSRMLS_DC)
int split_dbx_handle_object(zval **dbx_object, zval ***pdbx_handle, zval ***pdbx_module, zval ***pdbx_database)
{
convert_to_object_ex(dbx_object);
if (zend_hash_find(Z_OBJPROP_PP(dbx_object), "handle", 7, (void **) pdbx_handle)==FAILURE
@@ -334,7 +334,7 @@ ZEND_FUNCTION(dbx_close)
if (ZEND_NUM_ARGS() !=number_of_arguments || zend_get_parameters_array_ex(number_of_arguments, arguments) == FAILURE) {
WRONG_PARAM_COUNT;
}
if (!split_dbx_handle_object(arguments[0], &dbx_handle, &dbx_module, &dbx_database TSRMLS_CC)) {
if (!split_dbx_handle_object(arguments[0], &dbx_handle, &dbx_module, &dbx_database)) {
zend_error(E_WARNING, "dbx_close: not a valid dbx_handle-object...");
RETURN_LONG(0);
}
@@ -386,7 +386,7 @@ ZEND_FUNCTION(dbx_query)
if (ZEND_NUM_ARGS()<min_number_of_arguments || ZEND_NUM_ARGS()>number_of_arguments || zend_get_parameters_array_ex(ZEND_NUM_ARGS(), arguments) == FAILURE) {
WRONG_PARAM_COUNT;
}
if (!split_dbx_handle_object(arguments[0], &dbx_handle, &dbx_module, &dbx_database TSRMLS_CC)) {
if (!split_dbx_handle_object(arguments[0], &dbx_handle, &dbx_module, &dbx_database)) {
zend_error(E_WARNING, "dbx_query: not a valid dbx_handle-object...");
RETURN_LONG(0);
}
@@ -560,7 +560,7 @@ ZEND_FUNCTION(dbx_error)
if (ZEND_NUM_ARGS() !=number_of_arguments || zend_get_parameters_array_ex(number_of_arguments, arguments) == FAILURE) {
WRONG_PARAM_COUNT;
}
if (!split_dbx_handle_object(arguments[0], &dbx_handle, &dbx_module, &dbx_database TSRMLS_CC)) {
if (!split_dbx_handle_object(arguments[0], &dbx_handle, &dbx_module, &dbx_database)) {
zend_error(E_WARNING, "dbx_error: not a valid dbx_handle-object...");
RETURN_LONG(0);
}
@@ -593,7 +593,7 @@ ZEND_FUNCTION(dbx_escape_string)
if (ZEND_NUM_ARGS() !=number_of_arguments || zend_get_parameters_array_ex(number_of_arguments, arguments) == FAILURE) {
WRONG_PARAM_COUNT;
}
if (!split_dbx_handle_object(arguments[0], &dbx_handle, &dbx_module, &dbx_database TSRMLS_CC)) {
if (!split_dbx_handle_object(arguments[0], &dbx_handle, &dbx_module, &dbx_database)) {
zend_error(E_WARNING, "dbx_esc: not a valid dbx_handle-object...");
RETURN_NULL();
}
+1 -1
View File
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 4 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2003 The PHP Group |
| Copyright (c) 1997-2002 The PHP Group |
+----------------------------------------------------------------------+
| dbx module version 1.0 |
+----------------------------------------------------------------------+
+1 -1
View File
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 4 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2003 The PHP Group |
| Copyright (c) 1997-2002 The PHP Group |
+----------------------------------------------------------------------+
| dbx module version 1.0 |
+----------------------------------------------------------------------+
+1 -1
View File
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 4 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2003 The PHP Group |
| Copyright (c) 1997-2002 The PHP Group |
+----------------------------------------------------------------------+
| dbx module version 1.0 |
+----------------------------------------------------------------------+
+1 -1
View File
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 4 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2003 The PHP Group |
| Copyright (c) 1997-2002 The PHP Group |
+----------------------------------------------------------------------+
| dbx module version 1.0 |
+----------------------------------------------------------------------+
+1 -1
View File
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 4 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2003 The PHP Group |
| Copyright (c) 1997-2002 The PHP Group |
+----------------------------------------------------------------------+
| dbx module version 1.0 |
+----------------------------------------------------------------------+
+1 -1
View File
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 4 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2003 The PHP Group |
| Copyright (c) 1997-2002 The PHP Group |
+----------------------------------------------------------------------+
| dbx module version 1.0 |
+----------------------------------------------------------------------+
+1 -1
View File
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 4 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2003 The PHP Group |
| Copyright (c) 1997-2002 The PHP Group |
+----------------------------------------------------------------------+
| dbx module version 1.0 |
+----------------------------------------------------------------------+
+1 -1
View File
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 4 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2003 The PHP Group |
| Copyright (c) 1997-2002 The PHP Group |
+----------------------------------------------------------------------+
| dbx module version 1.0 |
+----------------------------------------------------------------------+
+1 -1
View File
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 4 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2003 The PHP Group |
| Copyright (c) 1997-2002 The PHP Group |
+----------------------------------------------------------------------+
| dbx module version 1.0 |
+----------------------------------------------------------------------+
Loaded 100 of 786 files, more files were not shown because too many files have changed in this diff. Show more