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
1725 changed files with 98892 additions and 189215 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
+10 -10
View File
@@ -148,9 +148,9 @@
* Changed all argument parsing to use the new zend_parse_parameters()
* If a function is unavailable due to lack of support for a certain
feature,
do not make the function available, rather then making it print an
do not make the function avaliable, rather then making it print an
error
saying that the functionality offered by the function is not available.
saying that the functionality offered by the function is not avaliable.
* Lots of WS fixes all over the file.
* Change strcpy() to strncpy() to prevent possible buffer overflows.
Fixed a bug in ncurses_pair_content(), 1st parameter was wrong.
@@ -1384,7 +1384,7 @@
2002-12-11 Ilia Alshanetsky <ilia@prohost.org>
* ext/exif/exif.c:
decode variable is only used when mbstring is available.
decode variable is only used when mbstring is avaliable.
* ext/openssl/openssl.c:
ZTS fix.
@@ -2193,7 +2193,7 @@
2002-12-04 Ilia Alshanetsky <ilia@prohost.org>
* ext/gd/gd.c:
MFH (build fix, when xpm support is not available).
MFH (build fix, when xpm support is not avaliable).
2002-12-04 Rasmus Lerdorf <rasmus@lerdorf.on.ca>
@@ -5864,7 +5864,7 @@
Compile warning fix.
* ext/mbstring/tests/overload.phpt:
Added a skip condition for when mail() function is not available.
Added a skip condition for when mail() function is not avaliable.
* ext/mbstring/tests/mb_send_mail05.phpt
ext/mbstring/tests/mb_send_mail06.phpt:
@@ -6758,7 +6758,7 @@
ext/standard/tests/strings/htmlentities07.phpt
ext/standard/tests/strings/htmlentities08.phpt
ext/standard/tests/strings/htmlentities09.phpt:
Added skip conditions in the event the required charset is not availabled.
Added skip conditions in the event the required charset is not avaliabled.
Removed old (commented out) module loading code.
* run-tests.php:
@@ -6766,11 +6766,11 @@
* ext/pspell/tests/01pspell_basic.phpt:
Added a skip condition if the English dictionary needed for the test is not
available.
avaliable.
* ext/pcntl/tests/001.phpt:
Added a skip condition in the event posix_kill(), which is used by the test
is not available.
is not avaliable.
* ext/exif/exif.c:
@@ -6903,7 +6903,7 @@
main/safe_mode.c:
Instead of checking whether realpath exists based on OS. Use the
HAVE_REALPATH define, which is set if realpath() is available. This patch
HAVE_REALPATH define, which is set if realpath() is avaliable. This patch
also resolves bug #18868.
2002-11-06 Sascha Schumann <sascha@schumann.cx>
@@ -9030,7 +9030,7 @@
* ext/standard/tests/strings/strtoupper.phpt:
Added 'skip logic' to the test on platforms where the locale required by
this test is not available.
this test is not avaliable.
2002-10-23 Melvyn Sopacua <msopacua@idg.nl>
+135 -165
View File
@@ -26,9 +26,6 @@ Status legend
== Server APIs ==
-------------------------------------------------------------------------------
EXTENSION: activescript
COMMENT: See http://pecl.php.net/package/PHPScript
-------------------------------------------------------------------------------
EXTENSION: aolserver
MAINTENANCE: Unknown
@@ -39,41 +36,26 @@ PRIMARY MAINTAINER: Rasmus Lerdorf <rasmus@php.net>
MAINTENANCE: Maintained
STATUS: Working
-------------------------------------------------------------------------------
EXTENSION: apache2filter
EXTENSION: apache2
PRIMARY MAINTAINER: Aaron Bannert <aaron@php.net>
MAINTENANCE: Maintained
STATUS: Experimental
-------------------------------------------------------------------------------
EXTENSION: apache2handler
PRIMARY MAINTAINER: Aaron Bannert <aaron@php.net>, Ilia Alshanetsky <iliaa@php.net>
MAINTENANCE: Maintained
STATUS: Working
-------------------------------------------------------------------------------
EXTENSION: caudium
MAINTENANCE: Unknown
STATUS: Unknown
-------------------------------------------------------------------------------
EXTENSION: cgi
MAINTENANCE: Unknown
STATUS: Working
-------------------------------------------------------------------------------
EXTENSION: cli
EXTENSION: fhttpd
MAINTENANCE: Unknown
STATUS: Working
-------------------------------------------------------------------------------
EXTENSION: embed
PRIMARY MAINTAINER: Edin Kadribasic <edink@php.net>
MAINTENANCE: Maintained
STATUS: Working
STATUS: Unknown
-------------------------------------------------------------------------------
EXTENSION: isapi
MAINTENANCE: Unknown
STATUS: Working
-------------------------------------------------------------------------------
EXTENSION: nsapi
PRIMARY MAINTAINER: Uwe Schindler <thetaphi@php.net>
MAINTENANCE: Maintained
STATUS: Working
MAINTENANCE: Unknown
STATUS: Unknown
-------------------------------------------------------------------------------
EXTENSION: phttpd
MAINTENANCE: Unknown
@@ -88,7 +70,7 @@ MAINTENANCE: Unknown
STATUS: Unknown
-------------------------------------------------------------------------------
EXTENSION: servlet
PRIMARY MAINTAINER: Sam Ruby <rubys@php.net>
PRIMARY MAINTAINER: Sam Ruby <rubys@us.ibm.com>
MAINTENANCE: Maintained
STATUS: Working
-------------------------------------------------------------------------------
@@ -96,12 +78,8 @@ EXTENSION: thttpd
MAINTENANCE: Unknown
STATUS: Unknown
-------------------------------------------------------------------------------
EXTENSION: tux
MAINTENANCE: Unknown
STATUS: Unknown
-------------------------------------------------------------------------------
EXTENSION: webjames
PRIMARY MAINTAINER: Alex Waugh <alexwaugh@php.net>
PRIMARY MAINTAINER: Alex Waugh <alex@alexwaugh.com>
MAINTENANCE: Maintained
STATUS: Experimental
-------------------------------------------------------------------------------
@@ -109,14 +87,9 @@ STATUS: Experimental
== Database extensions ==
-------------------------------------------------------------------------------
EXTENSION: db
PRIMARY MAINTAINER: Unknown
MAINTENANCE: Unknown
STATUS: Unknown
-------------------------------------------------------------------------------
EXTENSION: dba
PRIMARY MAINTAINER: Marcus Börger <helly@php.net>
PRIMARY MAINTAINER: Sascha Schumann <sascha@schumann.cx>
MAINTENANCE: Maintained
STATUS: Working
-------------------------------------------------------------------------------
@@ -126,19 +99,23 @@ MAINTENANCE: Odd Fixes
STATUS: Working
-------------------------------------------------------------------------------
EXTENSION: dbx
PRIMARY MAINTAINER: Marc Boeren <mboeren@php.net>
PRIMARY MAINTAINER: Marc Boeren <M.Boeren@guidance.nl>
MAINTENANCE: Maintained
STATUS: Working
SINCE: 4.0.6
COMMENT: DB abstraction for odbc, mysql, pgsql, mssql, fbsql and more, see documentation
-------------------------------------------------------------------------------
EXTENSION: fbsql
PRIMARY MAINTAINER: Frank M. Kromann <fmk@php.net>
EXTENSION: filepro
MAINTENANCE: Unknown
STATUS: Unknown
-------------------------------------------------------------------------------
EXTENSION: hyperwave
PRIMARY MAINTAINER: Uwe Steinmann <steinm@php.net>
MAINTENANCE: Maintained
STATUS: Working
-------------------------------------------------------------------------------
EXTENSION: informix
PRIMARY MAINTAINER: Danny Heijl <danny@php.net>
PRIMARY MAINTAINER: Danny Heijl <Danny.Heijl@cevi.be>
MAINTENANCE: Maintained
STATUS: Working
-------------------------------------------------------------------------------
@@ -149,7 +126,7 @@ STATUS: Experimental
SINCE: 4.0.2
-------------------------------------------------------------------------------
EXTENSION: interbase
PRIMARY MAINTAINER: Jouni Ahto <jah@php.net>, Ard Biesheuvel <abies@php.net>
PRIMARY MAINTAINER: Jouni Ahto <jouni.ahto@exdec.fi>
MAINTENANCE: Odd Fixes
STATUS: Working
-------------------------------------------------------------------------------
@@ -157,37 +134,23 @@ EXTENSION: msql
MAINTENANCE: Unknown
STATUS: Working
-------------------------------------------------------------------------------
EXTENSION: msession
PRIMARY MAINTAINER Mark L. Woodward mlwmohawk@mohawksoft.com
MAINTENANCE: Maintained
STATUS: Working/Experimental
COMMENT: Tested on Linux, should work on other UNIX platforms. Backend server code can compile under Windows.
-------------------------------------------------------------------------------
EXTENSION: mssql
PRIMARY MAINTAINER: Frank M. Kromann <fmk@php.net>
PRIMARY MAINTAINER: Frank M. Kromann <fmk@swwwing.com>
MAINTENANCE: Maintained
STATUS: Working
COMMENT: Tested on phpts and isapi versions
-------------------------------------------------------------------------------
EXTENSION: mysql
PRIMARY MAINTAINER: Zak Greant <zak@php.net>, Georg Richter <georg@php.net>
PRIMARY MAINTAINER: Zak Greant <zak@mysql.com>, Georg Richter <georg@php.net>
MAINTENANCE: Maintained
STATUS: Working
-------------------------------------------------------------------------------
EXTENSION: oci8
PRIMARY MAINTAINER: Antony Dovgal <tony2001@php.net>
MAINTENANCE: Maintained
STATUS: Working
-------------------------------------------------------------------------------
EXTENSION: odbc
PRIMARY MAINTAINER: Dan Kalowsky <kalowsky@php.net>
MAINTENANCE: Maintained
STATUS: Working
COMMENT: Working
-------------------------------------------------------------------------------
EXTENSION: oracle
MAINTENANCE: Orphaned
STATUS: Working
COMMENT: Using the new OCI8 driver is encouraged where possible.
-------------------------------------------------------------------------------
EXTENSION: ovrimos
MAINTENANCE: Unknown
STATUS: Unknown
-------------------------------------------------------------------------------
EXTENSION: pgsql
PRIMARY MAINTAINER: Yasuo Ohgaki <yohgaki@php.net>
MAINTENANCE: Maintained
@@ -202,25 +165,62 @@ EXTENSION: sybase_ct
MAINTENANCE: Unknown
STATUS: Working
-------------------------------------------------------------------------------
EXTENSION: oci8
PRIMARY MAINTAINER: Thies C. Arntzen <thies@thieso.net>
MAINTENANCE: Maintained
STATUS: Working
-------------------------------------------------------------------------------
EXTENSION: odbc
PRIMARY MAINTAINER: Daniel R. Kalowsky <kalowsky@php.net>
MAINTENANCE: Maintained
STATUS: Working
COMMENT: Working
-------------------------------------------------------------------------------
EXTENSION: oracle
PRIMARY MAINTAINER: Thies C. Arntzen <thies@thieso.net>
MAINTENANCE: Maintained
STATUS: Working
COMMENT: Using the new OCI8 driver is encouraged where possible.
-------------------------------------------------------------------------------
== Other extensions ==
-------------------------------------------------------------------------------
EXTENSION: aspell
MAINTENANCE: Unknown
STATUS: Working
COMMENT: For aspell .27 and greater, check out the pspell extension
-------------------------------------------------------------------------------
EXTENSION: bcmath
MAINTENANCE: Unknown
STATUS: Unknown
-------------------------------------------------------------------------------
EXTENSION: bz2
COMMENT: See http://pecl.php.net/package/bz2
PRIMARY MAINTAINER: Hartmut Holzgraefe <hartmut@six.de>
MAINTENANCE: Odd Fixes
STATUS: Working
SINCE: 4.0.3
-------------------------------------------------------------------------------
EXTENSION: dio
PRIMARY MAINTAINER: Sterling Hughes <sterling@php.net>
MAINTENANCE: Orphaned
STATUS: Working
SINCE: 4.0.6
-------------------------------------------------------------------------------
EXTENSION: cyrus
PRIMARY MAINTAINER: Sterling Hughes <sterling@php.net>
MAINTENANCE: Orphaned
STATUS: Working
SINCE: 4.0.6
-------------------------------------------------------------------------------
EXTENSION: calendar
PRIMARY MAINTAINER: Hartmut Holzgraefe <hholzgra@php.net>
PRIMARY MAINTAINER: Hartmut Holzgraefe <hartmut@six.de>
MAINTENANCE: Odd Fixes
STATUS: Working
-------------------------------------------------------------------------------
EXTENSION: com
PRIMARY MAINTAINER: Harald Radi <phanto@php.net>
PRIMARY MAINTAINER: Harald Radi <h.radi@nme.at>
MAINTENANCE: Maintained
STATUS: Working
-------------------------------------------------------------------------------
@@ -230,40 +230,38 @@ MAINTENANCE: Maintained
STATUS: Working
-------------------------------------------------------------------------------
EXTENSION: crack
COMMENT: See http://pecl.php.net/package/crack
MAINTENANCE: Unknown
STATUS: Experimental
SINCE: 4.0.5
-------------------------------------------------------------------------------
EXTENSION: ctype
PRIMARY MAINTAINER: Hartmut Holzgraefe <hholzgra@php.net>
PRIMARY MAINTAINER: Hartmut Holzgraefe <hartmut@six.de>
MAINTENANCE: Maintained
STATUS: Working
-------------------------------------------------------------------------------
EXTENSION: curl
PRIMARY MAINTAINER: Sterling Hughes <sterling@php.net>,Ilia Alshanetsky <iliaa@php.net>
PRIMARY MAINTAINER: Sterling Hughes <sterling@php.net>
MAINTENANCE: Maintained
STATUS: Working
SINCE: 4.0.2
-------------------------------------------------------------------------------
EXTENSION: cyrus
COMMENT: See http://pecl.php.net/package/cyrus
-------------------------------------------------------------------------------
EXTENSION: dio
PRIMARY MAINTAINER: Sterling Hughes <sterling@php.net>
MAINTENANCE: Orphaned
STATUS: Working
SINCE: 4.0.6
EXTENSION: cybercash
PRIMARY MAINTAINER: Evan Klinger <evan715@sirius.com>
MAINTENANCE: Maintained
STATUS: Unknown
-------------------------------------------------------------------------------
EXTENSION: domxml
PRIMARY MAINTAINER: Uwe Steinmann <steinm@php.net>
MAINTENANCE: Maintained
STATUS: Working
STATUS: Experimental
-------------------------------------------------------------------------------
EXTENSION: dotnet
PRIMARY MAINTAINER: Sam Ruby <rubys@php.net>
PRIMARY MAINTAINER: Sam Ruby <rubys@us.ibm.com>
MAINTENANCE: Maintained
STATUS: Experimental
-------------------------------------------------------------------------------
EXTENSION: exif
PRIMARY MAINTAINER: Marcus Börger <helly@php.net>
PRIMARY MAINTAINER: Marcus Boerger <helly@php.net>
MAINTENANCE: Maintained
STATUS: Working
SINCE: 4.2
@@ -273,15 +271,13 @@ PRIMARY MAINTAINER: Uwe Steinmann <steinm@php.net>
MAINTENANCE: Maintained
STATUS: Unknown
-------------------------------------------------------------------------------
EXTENSION: filepro
MAINTENANCE: Unknown
STATUS: Unknown
-------------------------------------------------------------------------------
EXTENSION: fribidi
COMMENT: See http://pecl.php.net/package/fribidi
PRIMARY MAINTAINER: Tal Peer <tal@php.net>
MAINTENANCE: Maintained
STATUS: Working
-------------------------------------------------------------------------------
EXTENSION: ftp
PRIMARY MAINTAINER: Stefan Esser <sesser@php.net>
PRIMARY MAINTAINER: Stefan Esser (sesser@php.net)
MAINTENANCE: Maintained
STATUS: Working
-------------------------------------------------------------------------------
@@ -299,15 +295,9 @@ MAINTENANCE: Unknown
STATUS: Unknown
SINCE: 4.0.4
-------------------------------------------------------------------------------
EXTENSION: hwapi
PRIMARY MAINTAINER: Uwe Steinmann <steinm@php.net>
EXTENSION: icap
MAINTENANCE: Unknown
STATUS: Unknown
-------------------------------------------------------------------------------
EXTENSION: hyperwave
PRIMARY MAINTAINER: Uwe Steinmann <steinm@php.net>
MAINTENANCE: Maintained
STATUS: Working
STATUS: Obsolete
-------------------------------------------------------------------------------
EXTENSION: iconv
PRIMARY MAINTAINER: Moriyoshi Koizumi <moriyoshi@php.net>
@@ -315,17 +305,12 @@ MAINTENANCE: Maintained
STATUS: Working
-------------------------------------------------------------------------------
EXTENSION: imap
PRIMARY MAINTAINER: Chuck Hagenbuch <chagenbu@php.net>, Ilia Alshanetsky <iliaa@php.net>
MAINTENANCE: Maintained
PRIMARY MAINTAINER: Chuck Hagenbuch <chuck@horde.org>
MAINTENANCE: Odd Fixes
STATUS: Working
-------------------------------------------------------------------------------
EXTENSION: ircg
PRIMARY MAINTAINER: Sascha Schumann <sas@php.net>
MAINTENANCE: Unknown
STATUS: Unknown
-------------------------------------------------------------------------------
EXTENSION: java
PRIMARY MAINTAINER: Sam Ruby <rubys@php.net>
PRIMARY MAINTAINER: Sam Ruby <rubys@us.ibm.com>
MAINTENANCE: Maintained
STATUS: Working
-------------------------------------------------------------------------------
@@ -340,50 +325,26 @@ MAINTENANCE: Maintained
STATUS: Working
-------------------------------------------------------------------------------
EXTENSION: mcal
PRIMARY MAINTAINER: Chuck Hagenbuch <chagenbu@php.net>
PRIMARY MAINTAINER: Chuck Hagenbuch <chuck@horde.org>
MAINTENANCE: Odd Fixes
STATUS: Working
-------------------------------------------------------------------------------
EXTENSION: mcrypt
PRIMARY MAINTAINER: Derick Rethans <derick@php.net>
PRIMARY MAINTAINER: Derick Rethans <d.rethans@jdimedia.nl>
MAINTENANCE: Maintained
STATUS: Working
-------------------------------------------------------------------------------
EXTENSION: mhash
PRIMARY MAINTAINER: Sascha Schumann <sas@php.net>
PRIMARY MAINTAINER: Sascha Schumann <sascha@schumann.cx>
MAINTENANCE: Maintained
STATUS: Working
-------------------------------------------------------------------------------
EXTENSION: mime_magic
PRIMARY MAINTAINER: Unknown
MAINTENANCE: Unknown
STATUS: Experimental
-------------------------------------------------------------------------------
EXTENSION: ming
PRIMARY MAINTAINER: Frank M. Kromann <fmk@php.net>
MAINTENANCE: Unknown
STATUS: Experimental
-------------------------------------------------------------------------------
EXTENSION: mnogosearch
PRIMARY MAINTAINER: Sergey Kartashoff <gluke@php.net>
MAINTENANCE: Unknown
STATUS: Unknown
-------------------------------------------------------------------------------
EXTENSION: msession
PRIMARY MAINTAINER Mark L. Woodward <mlwmohawk@php.net>
EXTENSION: muscat
PRIMARY MAINTAINER: Sam Liddicott <sam@ananova.com>
MAINTENANCE: Maintained
STATUS: Working/Experimental
COMMENT: Tested on Linux, should work on other UNIX platforms. Backend server code can compile under Windows.
-------------------------------------------------------------------------------
EXTENSION: notes
PRIMARY MAINTAINER: Unknown
MAINTENANCE: Unknown
STATUS: Unknown
-------------------------------------------------------------------------------
EXTENSION: ncurses
PRIMARY MAINTAINER Ilia Alshanetsky <iliaa@php.net>, Wez Furlong <wez@php.net>, Hartmut Holzgraefe <hholzgra@php.net>, Georg Richter <georg@php.net>
MAINTENANCE: Unknown
STATUS: Experimental
STATUS: Working
SINCE: 4.0.5
COMMENT: Not tested against windows, only core API completed, rest under development
-------------------------------------------------------------------------------
EXTENSION: openssl
PRIMARY MAINTAINER: Wez Furlong <wez@php.net>
@@ -396,10 +357,6 @@ PRIMARY MAINTAINER: Andrei Zmievski <andrei@php.net>
MAINTENANCE: Maintained
STATUS: Experimental
-------------------------------------------------------------------------------
EXTENSION: pcntl
MAINTENANCE: Unknown
STATUS: Experimental
-------------------------------------------------------------------------------
EXTENSION: pcre
PRIMARY MAINTAINER: Andrei Zmievski <andrei@php.net>
MAINTENANCE: Maintained
@@ -411,18 +368,25 @@ MAINTENANCE: Maintained
STATUS: Working
-------------------------------------------------------------------------------
EXTENSION: pfpro
PRIMARY MAINTAINER: David Croft <david@php.net>
PRIMARY MAINTAINER: David Croft <david@infotrek.co.uk>
MAINTENANCE: Maintained
STATUS: Working
SINCE: 4.0.2
-------------------------------------------------------------------------------
EXTENSION: posix
PRIMARY MAINTAINER: Kristian Köhntopp <kk@php.net>
PRIMARY MAINTAINER: Kristian Köhntopp <kris@koehntopp.de>
MAINTENANCE: Maintained
STATUS: Working
-------------------------------------------------------------------------------
EXTENSION: printer
PRIMARY MAINTAINER: Daniel Beulshausen <daniel@php4win.de>
MAINTENANCE: Maintained
STATUS: Working
SINCE: 4.0.4
COMMENT: Only for Win32
-------------------------------------------------------------------------------
EXTENSION: pspell
PRIMARY MAINTAINER: Vlad Krupin <vlad@php.net>
PRIMARY MAINTAINER: Vlad Krupin <phpdevel@echospace.com>
MAINTENANCE: Unknown
STATUS: Unknown
SINCE: 4.0.2
@@ -437,12 +401,24 @@ MAINTENANCE: Unknown
STATUS: Unknown
-------------------------------------------------------------------------------
EXTENSION: recode
PRIMARY MAINTAINER: Kristian Köhntopp <kk@php.net>
PRIMARY MAINTAINER: Kristian Köhntopp <kris@koehntopp.de>
MAINTENANCE: Maintained
STATUS: Working
-------------------------------------------------------------------------------
EXTENSION: sablot
PRIMARY MAINTAINER: Sterling Hughes <sterling@php.net>
MAINTENANCE: Obsolete
STATUS: Experimental
SINCE: 4.0.3
-------------------------------------------------------------------------------
EXTENSION: satellite
PRIMARY MAINTAINER: David Eriksson <eriksson@php.net>
MAINTENANCE: Odd Fixes
STATUS: Experimental
SINCE: 4.0.3
-------------------------------------------------------------------------------
EXTENSION: session
PRIMARY MAINTAINER: Sascha Schumann <sas@php.net>, Ilia Alshanetsky <iliaa@php.net>
PRIMARY MAINTAINER: Sascha Schumann <sascha@schumann.cx>
MAINTENANCE: Maintained
STATUS: Working
-------------------------------------------------------------------------------
@@ -458,7 +434,7 @@ MAINTENANCE: Odd Fixes
STATUS: Working
-------------------------------------------------------------------------------
EXTENSION: sockets
PRIMARY MAINTAINER: Chris Vandomelen <chrisv@php.net>
PRIMARY MAINTAINER: Chris Vandomelen <chrisv@b0rked.dhs.org>
MAINTENANCE: Maintained
STATUS: Experimental
SINCE: 4.0.2
@@ -469,10 +445,6 @@ MAINTENANCE: Orphaned
STATUS: Deprecated (Use the ming swf extension instead)
COMMENT: Only for Unix (won't change)
-------------------------------------------------------------------------------
EXTENSION: sysvmsg
MAINTENANCE: Unknown
STATUS: Experimental
-------------------------------------------------------------------------------
EXTENSION: sysvsem
MAINTENANCE: Unknown
STATUS: Unknown
@@ -481,14 +453,10 @@ EXTENSION: sysvshm
MAINTENANCE: Unknown
STATUS: Working
-------------------------------------------------------------------------------
EXTENSION: tokenizer
PRIMARY MAINTAINER: Andrei Zmievski <andrei@php.net>
MAINTENANCE: Unknown
STATUS: Unknown
-------------------------------------------------------------------------------
EXTENSION: w32api
EXTENSION: vpopmail
MAINTENANCE: Unknown
STATUS: Experimental
SINCE: 4.0.5
-------------------------------------------------------------------------------
EXTENSION: wddx
PRIMARY MAINTAINER: Andrei Zmievski <andrei@php.net>
@@ -496,32 +464,34 @@ MAINTENANCE: Maintained
STATUS: Working
-------------------------------------------------------------------------------
EXTENSION: xml
PRIMARY MAINTAINER: Thies C. Arntzen <thies@php.net>
PRIMARY MAINTAINER: Thies C. Arntzen <thies@thieso.net>
MAINTENANCE: Maintained
STATUS: Working
-------------------------------------------------------------------------------
EXTENSION: xmlrpc
MAINTENANCE: Unknown
STATUS: Experimental
-------------------------------------------------------------------------------
EXTENSION: xslt
PRIMARY MAINTAINER: Hartmut Holzgraefe <hholzgra@php.net>
PRIMARY MAINTAINER: Hartmut Holzgraefe <hartmut@six.de>
MAINTENANCE: Odd Fixes
STATUS: Working (mostly)
-------------------------------------------------------------------------------
EXTENSION: yaz
COMMENT: See http://pecl.php.net/package/yaz
PRIMARY MAINTAINER: Adam Dickmeiss <adam@indexdata.dk>
MAINTENANCE: Maintained
STATUS: Unknown
SINCE: 4.0.1
-------------------------------------------------------------------------------
EXTENSION: yp
MAINTENANCE: Unknown
STATUS: Unknown
-------------------------------------------------------------------------------
EXTENSION: zip
COMMENT: See http://pecl.php.net/package/zip
-------------------------------------------------------------------------------
EXTENSION: zlib
PRIMARY MAINTAINER: Stefan Roehrich <sr@php.net>
PRIMARY MAINTAINER: Stefan Roehrich <sr@linux.de>
MAINTENANCE: Maintained
STATUS: Working
-------------------------------------------------------------------------------
EXTENSION: zziplib
PRIMARY MAINTAINER: Hartmut Holzgraefe <hartmut@six.de>
MAINTENANCE: Odd Fixes
STATUS: Working
SINCE: 4.0.5
-------------------------------------------------------------------------------
# iptc?
+354 -1472
View File
File diff suppressed because it is too large. Load diff
+5 -5
View File
@@ -1,6 +1,6 @@
--------------------------------------------------------------------
The PHP License, version 3.01
Copyright (c) 1999 - 2006 The PHP Group. All rights reserved.
The PHP License, version 3.0
Copyright (c) 1999 - 2002 The PHP Group. All rights reserved.
--------------------------------------------------------------------
Redistribution and use in source and binary forms, with or without
@@ -38,8 +38,8 @@ are met:
6. Redistributions of any form whatsoever must retain the following
acknowledgment:
"This product includes PHP software, freely available from
<http://www.php.net/software/>".
"This product includes PHP, freely available from
<http://www.php.net/>".
THIS SOFTWARE IS PROVIDED BY THE PHP DEVELOPMENT TEAM ``AS IS'' AND
ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
@@ -64,5 +64,5 @@ The PHP Group can be contacted via Email at group@php.net.
For more information on the PHP Group and the PHP project,
please see <http://www.php.net>.
PHP includes the Zend Engine, freely available at
This product includes the Zend Engine, freely available at
<http://www.zend.com>.
-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
+17 -27
View File
@@ -7,24 +7,20 @@ COMMON_FLAGS = $(DEFS) $(INCLUDES) $(EXTRA_INCLUDES) $(CPPFLAGS) $(PHP_FRAMEWORK
all: $(all_targets)
@echo
@echo "Build complete."
@echo "(It is safe to ignore warnings about tempnam and tmpnam)."
@echo
build-modules: $(PHP_MODULES)
libphp4.la: $(PHP_GLOBAL_OBJS) $(PHP_SAPI_OBJS)
$(LIBTOOL) --mode=link $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -rpath $(phptempdir) $(EXTRA_LDFLAGS) $(LDFLAGS) $(PHP_RPATHS) $(PHP_GLOBAL_OBJS) $(PHP_SAPI_OBJS) $(EXTRA_LIBS) $(ZEND_EXTRA_LIBS) -o $@
-@$(LIBTOOL) --silent --mode=install cp libphp4.la $(phptempdir)/libphp4.la >/dev/null 2>&1
libs/libphp4.bundle: $(PHP_GLOBAL_OBJS) $(PHP_SAPI_OBJS)
$(CC) $(MH_BUNDLE_FLAGS) $(CFLAGS_CLEAN) $(EXTRA_CFLAGS) $(LDFLAGS) $(EXTRA_LDFLAGS) $(PHP_GLOBAL_OBJS:.lo=.o) $(PHP_SAPI_OBJS:.lo=.o) $(PHP_FRAMEWORKS) $(EXTRA_LIBS) $(ZEND_EXTRA_LIBS) -o $@ && cp $@ libs/libphp4.so
install: $(all_targets) $(install_targets)
install: $(install_targets)
install-sapi: $(OVERALL_TARGET)
@echo "Installing PHP SAPI module: $(PHP_SAPI)"
install-sapi: libphp4.la
@echo "Installing PHP SAPI module"
-@$(LIBTOOL) --silent --mode=install cp libphp4.la $(phptempdir)/libphp4.la >/dev/null 2>&1
-@$(mkinstalldirs) $(INSTALL_ROOT)$(bindir)
-@if test ! -r $(phptempdir)/libphp4.$(SHLIB_SUFFIX_NAME); then \
for i in 0.0.0 0.0 0; do \
@@ -38,10 +34,10 @@ install-sapi: $(OVERALL_TARGET)
install-modules: build-modules
@test -d modules && \
$(mkinstalldirs) $(INSTALL_ROOT)$(EXTENSION_DIR)
@echo "Installing shared extensions: $(INSTALL_ROOT)$(EXTENSION_DIR)/"
@rm -f modules/*.la >/dev/null 2>&1
@$(INSTALL) modules/* $(INSTALL_ROOT)$(EXTENSION_DIR)
$(mkinstalldirs) $(INSTALL_ROOT)$(EXTENSION_DIR) && \
echo "Installing shared extensions: $(INSTALL_ROOT)$(EXTENSION_DIR)/" && \
rm -f modules/*.la && \
cp modules/* $(INSTALL_ROOT)$(EXTENSION_DIR) >/dev/null 2>&1 || true
install-tester:
@echo "Installing regression tester: $(INSTALL_ROOT)$(PEAR_INSTALLDIR)/"
@@ -50,28 +46,22 @@ install-tester:
install-su: install-pear install-tester
test:
-@if test -x $(SAPI_CLI_PATH) && test ! -z $(SAPI_CLI_PATH); then \
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); \
else \
echo "ERROR: Cannot run tests without CLI sapi."; \
fi
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' $(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/*
distclean: clean
rm -f config.cache config.log config.status Makefile.objects Makefile.fragments libtool main/php_config.h stamp-h php4.spec sapi/apache/libphp4.module buildmk.stamp
egrep define'.*include/php' $(top_srcdir)/configure|sed 's/.*>//'|xargs rm -f
egrep define'.*include/php' configure|sed 's/.*>//'|xargs rm -f
find . -name Makefile | xargs rm -f
.PHONY: all clean install distclean test
+9 -1366
View File
File diff suppressed because it is too large. Load diff
+28 -35
View File
@@ -29,21 +29,7 @@ Having said that, here are the organizational rules:
5. If you don't know how to do something, ask first!
6. Test your changes before committing them. We mean it. Really.
To do so use "make test".
7. For development use the --enable-maintainer-zts switch to ensure your
code handles TSRM correctly and doesn't break for thos who need that.
Currently we have the following branches in use:
HEAD Will become PHP 6.0. This CVS branch is for active development.
PHP_5_2 Is used to release the PHP 5.2.x series. Only minor feature
enhancements may go in here, but please keep that as infrequent as
possible.
PHP_5_1 Is used to release the PHP 5.1.x series. Only bugfixes are permitted
on this branch (Consult the releasemaster prior to commit).
PHP_4_4 Is used to release the PHP 4.4.x series. Only bugfixes are permitted
on this branch (Consult the releasemaster prior to commit).
PHP_4_3 This branch is closed.
The next few rules are more of a technical nature.
@@ -51,11 +37,8 @@ The next few rules are more of a technical nature.
messages every day. Woe be to those who attempt to mess with it.
2. All news updates intended for public viewing, such as new features,
bug fixes, improvements, etc., should go into the NEWS file.
NB! Lines, starting with @ will go automagically into NEWS file, but
this is NOT recommended, though. Please, add news entries directly to
NEWS file and don't forget to keep them adjusted and sorted.
bug fixes, improvements, etc., should go into the NEWS file. Also see
the note below about automatically updating NEWS in your commit message.
3. Do not commit multiple file and dump all messages in one commit. If you
modified several unrelated files, commit each group separately and
@@ -75,29 +58,37 @@ The next few rules are more of a technical nature.
The format of the commit messages is pretty simple.
Use a - to start a new item in your commit message.
If a line begins with #, it is taken to be a comment and will not appear
in the ChangeLog. Everything else goes into the ChangeLog.
in the ChangeLog. If the line begins with @, it will be redirected to the
NEWS file. Everything else goes into the ChangeLog.
It is important to note that if your comment or news logline spans multiple
lines, you have to put # at the beginning of _every_ such line.
lines, you have to put # or @ at the beginning of _every_ such line. Every
entry in NEWS has to have a name after it, so if you did it with someone's
help, put both your names there. Your name WILL NOT be automatically put
at the end of the NEWS entry - so, please provide it yourself.
Example. Say you modified two files, datetime.c and string.c. In datetime.c you
added a new format option for the date() function, and in string.c you fixed a
memory leak in php_trim(). Don't commit both of these at once. Commit them
Example. Say you modified two files, datetime.c and string.c. In datetime.c
you added a new format option for date() function, and in string.c you fixed
a memory leak in php_trim(). Don't commit both of these at once. Commit them
separately and try to make sure your commit messages look something like the
following.
For datetime.c:
- Added new 'K' format modifier to date() for printing out number of days until
New Year's Eve.
(PHP date) Added new 'K' format modifier for printing out number of
days until New Year's Eve.
@- Added new 'K' format modifier that will output the number of days
@ until New Year's Eve. (Bob)
For string.c:
- Fixed a memory leak in php_trim() resulting from improper use of zval_dtor().
#- Man, that thing was leaking all over the place!
(php_trim) Fixed a memory leak resulting from improper use of zval_dtor().
# Man, that thing was leaking all over the place!
@- Fixed memory leak in trim(). (Bob)
The # lines will be omitted from the ChangeLog automagically.
The lines above marked with @ will go into NEWS file automagically, and the
# lines will be omitted from the ChangeLog. Alternatively, you might want
to modify NEWS file directly and not use the @ lines.
If you fix some bugs, you should note the bug ID numbers in your
commit message. Bug ID should be prefixed by "#" for easier access to
@@ -105,11 +96,13 @@ bug report when developers are browsing CVS via. LXR or Bonsai.
Example:
Fixed bug #14016 (pgsql notice handler double free crash bug.)
Fixed pgsql notice handler double free crash bug. Bug #14016
@ Fixed pgsql notice handler double free crash bug. Bug #14016
If you don't see your messages in ChangeLog right away, don't worry!
If you don't see your messages in ChangeLog and NEWS right away, don't worry!
These files are updated once a day, so your stuff will not show up until
somewhat later.
somewhat later. Don't go adding stuff to NEWS by hand if you already put @
lines in the commit message.
You can use LXR (http://lxr.php.net/) and Bonsai (http://bonsai.php.net/)
to look at PHP CVS repository in various ways.
+2 -3
View File
@@ -37,7 +37,7 @@ Note though that you might get little response, if your patch is
too hard to review.
If you would like change/add many lines, it is better to ask module
maintainer and/or internals@lists.php.net, or pear-dev@lists.php.net if
maintainer and/or php-dev@lists.php.net, or pear-dev@lists.php.net if
you are patching PEAR. Official module maintainers can be found in
EXTENSIONS file in PHP source.
@@ -79,7 +79,7 @@ Check list for submitting patch
Where to send your patch?
-------------------------
If you are patching C source, send the patch to internals@lists.php.net.
If you are patching C source, send the patch to php-dev@lists.php.net.
If you are patching a module, you should also send the patch to the
maintainer. Official module maintainers are listed in EXTENSION file
in source.
@@ -123,5 +123,4 @@ commit log. If your patch affects end-users, a brief description
and your name might be added to the NEWS file.
Thank you for submitting patch for PHP!
+10 -6
View File
@@ -13,6 +13,9 @@ Zend
* Allow to set a default value for call-by-reference-parameters.
eg: function hello (&$pallo = NULL) {}
* Disallow function(method) redefinition in class.
* Add configure test to determine if dlsym() requires underscore and set
DLSYM_NEEDS_UNDERSCORE accordingly. Perl and zsh have it in configure,
for example. (DONE?)
For PHP 5.0.0:
* Native large number support (probably with GNU GMP)
@@ -40,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.
@@ -63,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
@@ -77,11 +80,11 @@ documentation
ext/bz2
-------
* Add an ini directive to specify the size of decompression buffer.
The default 4k is too small for large files and also requires much time
for decompression. 40k is suitable for such files, however it may be too
much under certain environments. There should be appropriate default
settings for the various SAPI modules (e.g. apache and cli).
* Add ini setting for decompression buffer size. The default 4k is to small
for big files and takes ages to decompress. However, 40k which perform
quite good with big files may be to much under certain environments as
default setting. There should be consideren different default sizes for
different SAPIS (e.g. apache and cli).
ext/curl
--------
@@ -155,6 +158,7 @@ ext/standard
basename()
dirname()
strrpos()
strip_tags()
ext/wddx
--------
+3
View File
@@ -0,0 +1,3 @@
- clean up .cvsignores
- purge Makefile.ins and replace PHP_EXTENSION in config.m4s
with appropiate calls to PHP_NEW_EXTENSION
-112
View File
@@ -1,112 +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)
bundled gd (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 (Marcus)
php_base64_encode (Moriyoshi)
pack (Ilia)
Open:
the dbase extension (1)
socket_select (2)
(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) 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
Amendment 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' \
"$@"
+19 -14
View File
@@ -157,16 +157,7 @@ TSRM_API void tsrm_shutdown(void)
int j;
next_p = p->next;
for (j=0; j<p->count; j++) {
/* Disabled - calling dtors in tsrm_shutdown makes
modules registering TSRM ids to crash, if they have
dtors, since the module is unloaded before tsrm_shutdown
is called. Can be re-enabled after tsrm_free_id is
implemented.
if (resource_types_table && resource_types_table[j].dtor) {
resource_types_table[j].dtor(p->storage[j], &p->storage);
}
*/
for (j=0; j<id_count; j++) {
free(p->storage[j]);
}
free(p->storage);
@@ -190,7 +181,6 @@ TSRM_API void tsrm_shutdown(void)
#if defined(GNUPTH)
pth_kill();
#elif defined(PTHREADS)
pthread_setspecific(tls_key, 0);
pthread_key_delete(tls_key);
#elif defined(TSRM_WIN32)
TlsFree(tls_key);
@@ -285,11 +275,11 @@ static void allocate_new_resource(tsrm_tls_entry **thread_resources_ptr, THREAD_
}
}
tsrm_mutex_unlock(tsmm_mutex);
if (tsrm_new_thread_end_handler) {
tsrm_new_thread_end_handler(thread_id, &((*thread_resources_ptr)->storage));
}
tsrm_mutex_unlock(tsmm_mutex);
}
@@ -428,6 +418,8 @@ TSRM_API THREAD_T tsrm_thread_id(void)
{
#ifdef TSRM_WIN32
return GetCurrentThreadId();
#elif defined(NETWARE)
return NXThreadGetId();
#elif defined(GNUPTH)
return pth_self();
#elif defined(PTHREADS)
@@ -448,9 +440,17 @@ TSRM_API THREAD_T tsrm_thread_id(void)
TSRM_API MUTEX_T tsrm_mutex_alloc(void)
{
MUTEX_T mutexp;
#ifdef NETWARE
long flags = 0; /* Don't require NX_MUTEX_RECURSIVE, I guess */
NXHierarchy_t order = 0;
NX_LOCK_INFO_ALLOC (lockInfo, "PHP-TSRM", 0);
#endif
#ifdef TSRM_WIN32
mutexp = malloc(sizeof(CRITICAL_SECTION));
InitializeCriticalSection(mutexp);
#elif defined(NETWARE)
mutexp = NXMutexAlloc(flags, order, &lockInfo); /* return value ignored for now */
#elif defined(GNUPTH)
mutexp = (MUTEX_T) malloc(sizeof(*mutexp));
pth_mutex_init(mutexp);
@@ -481,7 +481,8 @@ TSRM_API void tsrm_mutex_free(MUTEX_T mutexp)
if (mutexp) {
#ifdef TSRM_WIN32
DeleteCriticalSection(mutexp);
free(mutexp);
#elif defined(NETWARE)
NXMutexFree(mutexp);
#elif defined(GNUPTH)
free(mutexp);
#elif defined(PTHREADS)
@@ -511,6 +512,8 @@ TSRM_API int tsrm_mutex_lock(MUTEX_T mutexp)
#ifdef TSRM_WIN32
EnterCriticalSection(mutexp);
return 1;
#elif defined(NETWARE)
return NXLock(mutexp);
#elif defined(GNUPTH)
return pth_mutex_acquire(mutexp, 0, NULL);
#elif defined(PTHREADS)
@@ -536,6 +539,8 @@ TSRM_API int tsrm_mutex_unlock(MUTEX_T mutexp)
#ifdef TSRM_WIN32
LeaveCriticalSection(mutexp);
return 1;
#elif defined(NETWARE)
return NXUnlock(mutexp);
#elif defined(GNUPTH)
return pth_mutex_release(mutexp);
#elif defined(PTHREADS)
+8 -2
View File
@@ -14,8 +14,8 @@
#define TSRM_H
/* #ifndef WIN32 */
#if !defined(WIN32)
# include <tsrm_config.h>
#if !defined(WIN32) && !defined(NETWARE)
# include "tsrm_config.h"
#endif
#ifdef WIN32
@@ -38,6 +38,9 @@
#ifdef TSRM_WIN32
# include <windows.h>
#elif defined(NETWARE)
# include <nks/thread.h>
# include <nks/synch.h>
#elif defined(GNUPTH)
# include <pth.h>
#elif defined(PTHREADS)
@@ -55,6 +58,9 @@ typedef int ts_rsrc_id;
#ifdef TSRM_WIN32
# define THREAD_T DWORD
# define MUTEX_T CRITICAL_SECTION *
#elif defined(NETWARE)
# define THREAD_T NXThreadId_t
# define MUTEX_T NXMutex_t *
#elif defined(GNUPTH)
# define THREAD_T pth_t
# define MUTEX_T pth_mutex_t *
+1 -1
View File
@@ -1,5 +1,5 @@
AC_DEFUN([AM_SET_LIBTOOL_VARIABLE],[
AC_DEFUN(AM_SET_LIBTOOL_VARIABLE,[
LIBTOOL='$(SHELL) $(top_builddir)/libtool $1'
])
+5 -13
View File
@@ -30,7 +30,7 @@ dnl PTHREADS_FLAGS
dnl
dnl Set some magic defines to achieve POSIX threads conformance
dnl
AC_DEFUN([PTHREADS_FLAGS],[
AC_DEFUN(PTHREADS_FLAGS,[
if test -z "$host_alias" && test -n "$host"; then
host_alias=$host
fi
@@ -65,7 +65,7 @@ dnl PTHREADS_CHECK_COMPILE
dnl
dnl Check whether the current setup can use POSIX threads calls
dnl
AC_DEFUN([PTHREADS_CHECK_COMPILE], [
AC_DEFUN(PTHREADS_CHECK_COMPILE, [
AC_TRY_RUN( [
#include <pthread.h>
#include <stddef.h>
@@ -84,15 +84,7 @@ int main() {
pthreads_working=yes
], [
pthreads_working=no
], [
dnl For cross compiling running this test is of no use. NetWare supports pthreads
pthreads_working=no
case $host_alias in
*netware*)
pthreads_working=yes
esac
]
) ] )dnl
], pthreads_working=no ) ] )dnl
dnl
dnl PTHREADS_CHECK()
dnl
@@ -108,7 +100,7 @@ dnl -pthreads gcc (Solaris)
dnl -qthreaded AIX cc V5
dnl -threads gcc (HP-UX)
dnl
AC_DEFUN([PTHREADS_CHECK],[
AC_DEFUN(PTHREADS_CHECK,[
if test "$beos_threads" = "1"; then
pthreads_working="yes"
@@ -162,7 +154,7 @@ fi
])dnl
dnl
dnl
AC_DEFUN([PTHREADS_ASSIGN_VARS],[
AC_DEFUN(PTHREADS_ASSIGN_VARS,[
if test -n "$ac_cv_pthreads_lib"; then
LIBS="$LIBS -l$ac_cv_pthreads_lib"
fi
+8 -9
View File
@@ -1,6 +1,6 @@
dnl TSRM_CHECK_GCC_ARG(ARG, ACTION-IF-FOUND, ACTION-IF-NOT_FOUND)
AC_DEFUN([TSRM_CHECK_GCC_ARG],[
AC_DEFUN(TSRM_CHECK_GCC_ARG,[
gcc_arg_name=[ac_cv_gcc_arg]translit($1,A-Z-,a-z_)
AC_CACHE_CHECK([whether $CC supports $1], [ac_cv_gcc_arg]translit($1,A-Z-,a-z_), [
echo 'void somefunc() { };' > conftest.c
@@ -21,7 +21,7 @@ AC_DEFUN([TSRM_CHECK_GCC_ARG],[
fi
])
AC_DEFUN([TSRM_BASIC_CHECKS],[
AC_DEFUN(TSRM_BASIC_CHECKS,[
AC_REQUIRE([AC_PROG_CC])dnl
dnl AC_REQUIRE([AM_PROG_CC_STDC])dnl
@@ -33,7 +33,7 @@ AC_CHECK_HEADERS(stdarg.h)
])
AC_DEFUN([TSRM_CHECK_PTH],[
AC_DEFUN(TSRM_CHECK_PTH,[
AC_MSG_CHECKING(for GNU Pth)
PTH_PREFIX="`$1 --prefix`"
@@ -50,7 +50,7 @@ AC_MSG_RESULT(yes - installed in $PTH_PREFIX)
])
AC_DEFUN([TSRM_CHECK_ST],[
AC_DEFUN(TSRM_CHECK_ST,[
if test -r "$1/include/st.h"; then
CPPFLAGS="$CPPFLAGS -I$1/include"
LDFLAGS="$LDFLAGS -L$1/lib"
@@ -70,7 +70,7 @@ AC_DEFUN([TSRM_CHECK_ST],[
sinclude(threads.m4)
sinclude(TSRM/threads.m4)
AC_DEFUN([TSRM_CHECK_PTHREADS],[
AC_DEFUN(TSRM_CHECK_PTHREADS,[
PTHREADS_CHECK
@@ -89,21 +89,20 @@ fi
])
AC_DEFUN([TSRM_THREADS_CHECKS],[
AC_DEFUN(TSRM_THREADS_CHECKS,[
dnl For the thread implementations, we always use --with-*
dnl to maintain consistency
AC_ARG_WITH(tsrm-pth,
[ --with-tsrm-pth[=pth-config]
Use GNU Pth.],[
[ --with-tsrm-pth[=pth-config] Use GNU Pth.],[
TSRM_PTH=$withval
],[
TSRM_PTH=no
])
AC_ARG_WITH(tsrm-st,
[ --with-tsrm-st Use SGI's State Threads],[
[ --with-tsrm-st],[
TSRM_ST=$withval
],[
TSRM_ST=no
-1
View File
@@ -3,7 +3,6 @@
#define HAVE_UTIME 1
#define HAVE_ALLOCA 1
#define HAVE_REALPATH 1
#include <malloc.h>
#include <stdlib.h>
+2 -4
View File
@@ -10,7 +10,7 @@
#elif defined(NETWARE)
# include "tsrm_config.nw.h"
#else
# include <tsrm_config.h>
# include "tsrm_config.h"
# include <sys/param.h>
#endif
@@ -22,7 +22,7 @@
#ifndef __GNUC__
# ifndef HAVE_ALLOCA_H
# ifdef _AIX
#pragma alloca
#pragma alloca
# else
# ifndef alloca /* predefined by HP cc +Olibcalls */
char *alloca ();
@@ -42,8 +42,6 @@ char *alloca ();
#ifndef MAXPATHLEN
# ifdef PATH_MAX
# define MAXPATHLEN PATH_MAX
# elif defined(MAX_PATH)
# define MAXPATHLEN MAX_PATH
# else
# define MAXPATHLEN 256
# endif
+4 -4
View File
@@ -2,12 +2,12 @@
+----------------------------------------------------------------------+
| PHP Version 4 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2006 The PHP Group |
| Copyright (c) 1997-2002 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| 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 through the world-wide-web at the following url: |
| http://www.php.net/license/3_01.txt |
| 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. |
+4 -4
View File
@@ -2,12 +2,12 @@
+----------------------------------------------------------------------+
| PHP Version 4 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2006 The PHP Group |
| Copyright (c) 1997-2002 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| 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 through the world-wide-web at the following url: |
| http://www.php.net/license/3_01.txt |
| 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. |
+103 -154
View File
@@ -2,12 +2,12 @@
+----------------------------------------------------------------------+
| PHP Version 4 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2006 The PHP Group |
| Copyright (c) 1997-2002 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| 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 through the world-wide-web at the following url: |
| http://www.php.net/license/3_01.txt |
| 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. |
@@ -37,7 +37,8 @@
#endif
#ifdef NETWARE
#include <fsio.h>
/*#include "pipe.h"*/
#include "tsrm_nw.h"
#endif
#ifndef HAVE_REALPATH
@@ -91,7 +92,7 @@ static int php_check_dots(const char *element, int n)
(len >= 2 && !php_check_dots(element, len))
#define IS_DIRECTORY_CURRENT(element, len) \
(len == 1 && element[0] == '.')
(len == 1 && ptr[0] == '.')
#elif defined(NETWARE)
/* NetWare has strtok() (in LibC) and allows both slashes in paths, like Windows --
@@ -110,12 +111,12 @@ static int php_check_dots(const char *element, int n)
#ifndef IS_DIRECTORY_UP
#define IS_DIRECTORY_UP(element, len) \
(len == 2 && element[0] == '.' && element[1] == '.')
(len == 2 && memcmp(element, "..", 2) == 0)
#endif
#ifndef IS_DIRECTORY_CURRENT
#define IS_DIRECTORY_CURRENT(element, len) \
(len == 1 && element[0] == '.')
(len == 1 && ptr[0] == '.')
#endif
/* define this to check semantics */
@@ -136,9 +137,15 @@ static int php_check_dots(const char *element, int n)
static int php_is_dir_ok(const cwd_state *state)
{
#if !(defined(NETWARE) && defined(CLIB_STAT_PATCH))
struct stat buf;
if (stat(state->cwd, &buf) == 0 && S_ISDIR(buf.st_mode))
#else
struct stat_libc buf;
if (stat(state->cwd, (struct stat*)(&buf)) == 0 && S_ISDIR(buf.st_mode))
#endif
return (0);
return (1);
@@ -146,9 +153,15 @@ static int php_is_dir_ok(const cwd_state *state)
static int php_is_file_ok(const cwd_state *state)
{
#if !(defined(NETWARE) && defined(CLIB_STAT_PATCH))
struct stat buf;
if (stat(state->cwd, &buf) == 0 && S_ISREG(buf.st_mode))
#else
struct stat_libc buf;
if (stat(state->cwd, (struct stat*)(&buf)) == 0 && S_ISREG(buf.st_mode))
#endif
return (0);
return (1);
@@ -183,20 +196,8 @@ CWD_API void virtual_cwd_startup(void)
{
char cwd[MAXPATHLEN];
char *result;
#ifdef NETWARE
result = getcwdpath(cwd, NULL, 1);
if(result)
{
char *c=cwd;
while(c = strchr(c, '\\'))
{
*c='/';
++c;
}
}
#else
result = getcwd(cwd, sizeof(cwd));
#endif
result = getcwd(cwd, sizeof(cwd));
if (!result) {
cwd[0] = '\0';
}
@@ -209,7 +210,7 @@ CWD_API void virtual_cwd_startup(void)
cwd_globals_ctor(&cwd_globals TSRMLS_CC);
#endif
#if (defined(TSRM_WIN32) || defined(NETWARE)) && defined(ZTS)
#if defined(TSRM_WIN32) && defined(ZTS)
cwd_mutex = tsrm_mutex_alloc();
#endif
}
@@ -219,7 +220,7 @@ CWD_API void virtual_cwd_shutdown(void)
#ifndef ZTS
cwd_globals_dtor(&cwd_globals TSRMLS_CC);
#endif
#if (defined(TSRM_WIN32) || defined(NETWARE)) && defined(ZTS)
#if defined(TSRM_WIN32) && defined(ZTS)
tsrm_mutex_free(cwd_mutex);
#endif
@@ -300,22 +301,12 @@ CWD_API int virtual_file_ex(cwd_state *state, const char *path, verify_path_func
if (path_length == 0)
return (0);
if (path_length >= MAXPATHLEN)
return (1);
#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 (use_realpath) {
if (realpath(path, resolved_path)) {
path = resolved_path;
path_length = strlen(path);
} else {
/* disable for now
return 1; */
}
if (IS_ABSOLUTE_PATH(path, path_length)) {
if (use_realpath && realpath(path, resolved_path)) {
path = resolved_path;
path_length = strlen(path);
}
} else { /* Concat current directory with relative path and then run realpath() on it */
char *tmp;
@@ -331,19 +322,9 @@ CWD_API int virtual_file_ex(cwd_state *state, const char *path, verify_path_func
memcpy(ptr, path, path_length);
ptr += path_length;
*ptr = '\0';
if (strlen(tmp) >= MAXPATHLEN) {
free(tmp);
return 1;
}
if (use_realpath) {
if (realpath(tmp, resolved_path)) {
path = resolved_path;
path_length = strlen(path);
} else {
/* disable for now
free(tmp);
return 1; */
}
if (use_realpath && realpath(tmp, resolved_path)) {
path = resolved_path;
path_length = strlen(path);
}
free(tmp);
}
@@ -382,76 +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)
/*
Below code keeps appending to state->cwd a File system seperator
cases where this appending should not happen is given below,
a) sys: should just be left as it is
b) sys:system should just be left as it is,
Colon is allowed only in the first token as volume names alone can have the : in their names.
Files and Directories cannot have : in their names
So the check goes like this,
For second token and above simply append the DEFAULT_SLASH to the state->cwd.
For first token check for the existence of :
if it exists don't append the DEFAULT_SLASH to the state->cwd.
*/
if(((state->cwd_length == 0) && (strchr(ptr, ':') == NULL)) || (state->cwd_length > 0))
{
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)) {
@@ -514,23 +477,19 @@ CWD_API int virtual_chdir_file(const char *path, int (*p_chdir)(const char *path
CWD_API char *virtual_realpath(const char *path, char *real_path TSRMLS_DC)
{
cwd_state new_state;
char *retval;
int retval;
CWD_STATE_COPY(&new_state, &CWDG(cwd));
retval = virtual_file_ex(&new_state, path, NULL, 1);
if (virtual_file_ex(&new_state, path, NULL, 1)==0) {
if (!retval) {
int len = new_state.cwd_length>MAXPATHLEN-1?MAXPATHLEN-1:new_state.cwd_length;
memcpy(real_path, new_state.cwd, len);
real_path[len] = '\0';
retval = real_path;
} else {
retval = NULL;
return real_path;
}
CWD_STATE_FREE(&new_state);
return retval;
return NULL;
}
CWD_API int virtual_filepath_ex(const char *path, char **filepath, verify_path_func verify_path TSRMLS_DC)
@@ -694,23 +653,37 @@ CWD_API int virtual_rename(char *oldname, char *newname TSRMLS_DC)
return retval;
}
#if !(defined(NETWARE) && defined(CLIB_STAT_PATCH))
CWD_API int virtual_stat(const char *path, struct stat *buf TSRMLS_DC)
{
cwd_state new_state;
int retval;
CWD_STATE_COPY(&new_state, &CWDG(cwd));
if (virtual_file_ex(&new_state, path, NULL, 1)) {
return -1;
}
virtual_file_ex(&new_state, path, NULL, 1);
retval = stat(new_state.cwd, buf);
CWD_STATE_FREE(&new_state);
return retval;
}
#else
CWD_API int virtual_stat(const char *path, struct stat_libc *buf TSRMLS_DC)
{
cwd_state new_state;
int retval;
#ifndef TSRM_WIN32
CWD_STATE_COPY(&new_state, &CWDG(cwd));
virtual_file_ex(&new_state, path, NULL, 1);
retval = stat(new_state.cwd, (struct stat*)buf);
CWD_STATE_FREE(&new_state);
return retval;
}
#endif
#if !defined(TSRM_WIN32) && !defined(NETWARE)
CWD_API int virtual_lstat(const char *path, struct stat *buf TSRMLS_DC)
{
cwd_state new_state;
@@ -832,24 +805,13 @@ CWD_API FILE *virtual_popen(const char *command, const char *type TSRMLS_DC)
CWD_API FILE *virtual_popen(const char *command, const char *type TSRMLS_DC)
{
int command_length;
int dir_length, extra = 0;
char *command_line;
char *ptr, *dir;
char *ptr;
FILE *retval;
command_length = strlen(command);
dir_length = CWDG(cwd).cwd_length;
dir = CWDG(cwd).cwd;
while (dir_length > 0) {
if (*dir == '\'') extra+=3;
dir++;
dir_length--;
}
dir_length = CWDG(cwd).cwd_length;
dir = CWDG(cwd).cwd;
ptr = command_line = (char *) malloc(command_length + sizeof("cd '' ; ") + dir_length +extra+1+1);
ptr = command_line = (char *) malloc(command_length + sizeof("cd ; ") + CWDG(cwd).cwd_length+1);
if (!command_line) {
return NULL;
}
@@ -859,21 +821,8 @@ CWD_API FILE *virtual_popen(const char *command, const char *type TSRMLS_DC)
if (CWDG(cwd).cwd_length == 0) {
*ptr++ = DEFAULT_SLASH;
} else {
*ptr++ = '\'';
while (dir_length > 0) {
switch (*dir) {
case '\'':
*ptr++ = '\'';
*ptr++ = '\\';
*ptr++ = '\'';
/* fall-through */
default:
*ptr++ = *dir;
}
dir++;
dir_length--;
}
*ptr++ = '\'';
memcpy(ptr, CWDG(cwd).cwd, CWDG(cwd).cwd_length);
ptr += CWDG(cwd).cwd_length;
}
*ptr++ = ' ';
+16 -37
View File
@@ -2,12 +2,12 @@
+----------------------------------------------------------------------+
| PHP Version 4 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2006 The PHP Group |
| Copyright (c) 1997-2002 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| 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 through the world-wide-web at the following url: |
| http://www.php.net/license/3_01.txt |
| 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. |
@@ -41,10 +41,6 @@
#include <unistd.h>
#endif
#if defined(__osf__) || defined(_AIX)
#include <errno.h>
#endif
#ifdef TSRM_WIN32
#include "readdir.h"
#include <sys/utime.h>
@@ -61,10 +57,10 @@ typedef unsigned short mode_t;
* to account for volume name that is unique to NetWare absolute paths
*/
#define COPY_WHEN_ABSOLUTE(path) 2
#define IS_ABSOLUTE_PATH(path, len) \
(len >= 2 && ((isalpha(path[0]) && path[1] == ':') || (IS_SLASH(path[0]) && IS_SLASH(path[1]))))
#define IS_UNC_PATH(path, len) \
(len >= 2 && IS_SLASH(path[0]) && IS_SLASH(path[1]))
#define IS_ABSOLUTE_PATH(path, len) \
(len >= 2 && ((isalpha(path[0]) && path[1] == ':') || IS_UNC_PATH(path, len)))
#elif defined(NETWARE)
#ifdef HAVE_DIRENT_H
@@ -74,10 +70,10 @@ typedef unsigned short mode_t;
#define DEFAULT_SLASH '/'
#define DEFAULT_DIR_SEPARATOR ';'
#define IS_SLASH(c) ((c) == '/' || (c) == '\\')
#define IS_SLASH_P(c) IS_SLASH(*(c))
/* Colon indicates volume name, either first character should be forward slash or backward slash */
#define COPY_WHEN_ABSOLUTE(path) \
(strchr(path, ':') - path + 1) /* Take the volume name which ends with a colon */
#define IS_ABSOLUTE_PATH(path, len) \
((strchr(path, ':') != NULL) || ((len >= 1) && ((path[0] == '/') || (path[0] == '\\'))))
(strchr(path, ':') != NULL) /* Colon indicates volume name */
#else
#ifdef HAVE_DIRENT_H
@@ -141,7 +137,11 @@ CWD_API FILE *virtual_fopen(const char *path, const char *mode TSRMLS_DC);
CWD_API int virtual_open(const char *path TSRMLS_DC, int flags, ...);
CWD_API int virtual_creat(const char *path, mode_t mode TSRMLS_DC);
CWD_API int virtual_rename(char *oldname, char *newname TSRMLS_DC);
#if !(defined(NETWARE) && defined(CLIB_STAT_PATCH))
CWD_API int virtual_stat(const char *path, struct stat *buf TSRMLS_DC);
#else
CWD_API int virtual_stat(const char *path, struct stat_libc *buf TSRMLS_DC);
#endif
#if !defined(TSRM_WIN32) && !defined(NETWARE)
CWD_API int virtual_lstat(const char *path, struct stat *buf TSRMLS_DC);
#endif
@@ -155,25 +155,6 @@ CWD_API FILE *virtual_popen(const char *command, const char *type TSRMLS_DC);
CWD_API int virtual_access(const char *pathname, int mode TSRMLS_DC);
#endif
/* On AIX & Tru64 when a file does not exist realpath() returns
* NULL, and sets errno to ENOENT. Unlike in other libc implementations
* the destination is not filled and remains undefined. Therefor, we
* must populate it manually using strcpy as done on systems with no
* realpath() function.
*/
#if defined(__osf__) || defined(_AIX)
static char *php_realpath_hack(char *src, char *dest)
{
char *ret;
if ((ret = realpath(src, dest)) == NULL && errno == ENOENT) {
return strcpy(dest, src);
} else {
return ret;
}
}
#endif
#if HAVE_UTIME
CWD_API int virtual_utime(const char *filename, struct utimbuf *buf TSRMLS_DC);
#endif
@@ -213,7 +194,9 @@ typedef struct _virtual_cwd_globals {
#define VCWD_REALPATH(path, real_path) virtual_realpath(path, real_path TSRMLS_CC)
#define VCWD_RENAME(oldname, newname) virtual_rename(oldname, newname TSRMLS_CC)
#define VCWD_STAT(path, buff) virtual_stat(path, buff TSRMLS_CC)
#ifndef TSRM_WIN32
#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)
@@ -251,11 +234,7 @@ typedef struct _virtual_cwd_globals {
#define VCWD_ACCESS(pathname, mode) access(pathname, mode)
#ifdef HAVE_REALPATH
#if defined(__osf__) || defined(_AIX)
#define VCWD_REALPATH(path, real_path) php_realpath_hack(path, real_path)
#else
#define VCWD_REALPATH(path, real_path) realpath(path, real_path)
#endif
#else
#define VCWD_REALPATH(path, real_path) strcpy(real_path, path)
#endif
+4 -13
View File
@@ -2,12 +2,12 @@
+----------------------------------------------------------------------+
| PHP Version 4 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2006 The PHP Group |
| Copyright (c) 1997-2002 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| 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 through the world-wide-web at the following url: |
| http://www.php.net/license/3_01.txt |
| 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. |
@@ -359,13 +359,4 @@ TSRM_API int shmctl(int key, int cmd, struct shmid_ds *buf) {
return -1;
}
}
TSRM_API char *realpath(char *orig_path, char *buffer)
{
int ret = GetFullPathName(orig_path, _MAX_PATH, buffer, NULL);
if(!ret || ret > _MAX_PATH) {
return NULL;
}
return buffer;
}
#endif
+4 -5
View File
@@ -2,12 +2,12 @@
+----------------------------------------------------------------------+
| PHP Version 4 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2006 The PHP Group |
| Copyright (c) 1997-2002 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| 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 through the world-wide-web at the following url: |
| http://www.php.net/license/3_01.txt |
| 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. |
@@ -101,5 +101,4 @@ TSRM_API void *shmat(int key, const void *shmaddr, int flags);
TSRM_API int shmdt(const void *shmaddr);
TSRM_API int shmctl(int key, int cmd, struct shmid_ds *buf);
TSRM_API char *realpath(char *orig_path, char *buffer);
#endif
+212 -417
View File
@@ -1,4 +1,4 @@
dnl $Id$ -*- autoconf -*-
dnl $Id$
dnl
dnl This file contains local autoconf functions.
@@ -16,36 +16,19 @@ AC_DEFUN([PHP_ADD_MAKEFILE_FRAGMENT],[
sed -e "s#\$(srcdir)#$ac_srcdir#g" -e "s#\$(builddir)#$ac_builddir#g" $src >> Makefile.fragments
])
AC_DEFUN([PHP_PROG_RE2C],[
AC_CHECK_PROG(RE2C, re2c, re2c, [exit 0;])
])
dnl PHP_DEFINE(WHAT[, value[, directory]])
dnl PHP_DEFINE(WHAT[, value])
dnl
dnl Creates builddir/include/what.h and in there #define WHAT value
dnl
AC_DEFUN([PHP_DEFINE],[
[echo "#define ]$1[]ifelse([$2],,[ 1],[ $2])[" > ]ifelse([$3],,[include],[$3])[/php_]translit($1,A-Z,a-z)[.h]
])
dnl PHP_CANONICAL_HOST
dnl
AC_DEFUN([PHP_CANONICAL_HOST],[
AC_REQUIRE([AC_CANONICAL_HOST])dnl
dnl Make sure we do not continue if host_alias is empty.
if test -z "$host_alias" && test -n "$host"; then
host_alias=$host
fi
if test -z "$host_alias"; then
AC_MSG_ERROR([host_alias is not set!])
fi
[echo "#define ]$1[]ifelse([$2],,[ 1],[ $2])[" > include/php_]translit($1,A-Z,a-z)[.h]
])
dnl PHP_INIT_BUILD_SYSTEM
dnl
AC_DEFUN([PHP_INIT_BUILD_SYSTEM],[
AC_REQUIRE([PHP_CANONICAL_HOST])dnl
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
@@ -143,7 +126,7 @@ dnl append to the array which has been dynamically chosen at m4 time
dnl choose the right compiler/flags/etc. for the source-file
case $ac_src in
*.c[)] ac_comp="$b_c_pre $3 $ac_inc $b_c_meta -c $ac_srcdir$ac_src -o $ac_bdir$ac_obj.$b_lo $6$b_c_post" ;;
*.cpp|*.cc[)] ac_comp="$b_cxx_pre $3 $ac_inc $b_cxx_meta -c $ac_srcdir$ac_src -o $ac_bdir$ac_obj.$b_lo $6$b_cxx_post" ;;
*.cpp[)] ac_comp="$b_cxx_pre $3 $ac_inc $b_cxx_meta -c $ac_srcdir$ac_src -o $ac_bdir$ac_obj.$b_lo $6$b_cxx_post" ;;
esac
dnl create a rule for the object/source combo
@@ -194,13 +177,73 @@ AC_DEFUN([PHP_REMOVE_USR_LIB],[
unset ac_new_flags
for i in [$]$1; do
case [$]i in
-L/usr/lib|-L/usr/lib/[)] ;;
*[)] ac_new_flags="[$]ac_new_flags [$]i" ;;
-L/usr/lib|-L/usr/lib/) ;;
*) ac_new_flags="[$]ac_new_flags [$]i" ;;
esac
done
$1=[$]ac_new_flags
])
AC_DEFUN([PHP_SETUP_OPENSSL],[
if test "$PHP_OPENSSL" = "yes"; then
PHP_OPENSSL="/usr/local/ssl /usr/local /usr /usr/local/openssl"
fi
for i in $PHP_OPENSSL; do
if test -r $i/include/openssl/evp.h; then
OPENSSL_INCDIR=$i/include
fi
if test -r $i/lib/libssl.a -o -r $i/lib/libssl.$SHLIB_SUFFIX_NAME; then
OPENSSL_LIBDIR=$i/lib
fi
done
if test -z "$OPENSSL_INCDIR"; then
AC_MSG_ERROR([Cannot find OpenSSL's <evp.h>])
fi
if test -z "$OPENSSL_LIBDIR"; then
AC_MSG_ERROR([Cannot find OpenSSL's libraries])
fi
old_CPPFLAGS=$CPPFLAGS
CPPFLAGS=-I$OPENSSL_INCDIR
AC_MSG_CHECKING([for OpenSSL version])
AC_EGREP_CPP(yes,[
#include <openssl/opensslv.h>
#if OPENSSL_VERSION_NUMBER >= 0x0090500fL
yes
#endif
],[
AC_MSG_RESULT([>= 0.9.5])
],[
AC_MSG_ERROR([OpenSSL version 0.9.5 or greater required.])
])
CPPFLAGS=$old_CPPFLAGS
PHP_ADD_INCLUDE($OPENSSL_INCDIR)
PHP_ADD_LIBPATH($OPENSSL_LIBDIR)
PHP_CHECK_LIBRARY(crypto, CRYPTO_free, [
PHP_ADD_LIBRARY(crypto)
],[
AC_MSG_ERROR([libcrypto not found!])
],[
-L$OPENSSL_LIBDIR
])
PHP_CHECK_LIBRARY(ssl, SSL_CTX_set_ssl_version, [
PHP_ADD_LIBRARY(ssl)
],[
AC_MSG_ERROR([libssl not found!])
],[
-L$OPENSSL_LIBDIR
])
OPENSSL_INCDIR_OPT=-I$OPENSSL_INCDIR
AC_SUBST(OPENSSL_INCDIR_OPT)
])
dnl PHP_EVAL_LIBLINE(LINE, SHARED-LIBADD)
dnl
dnl Use this macro, if you need to add libraries and or library search
@@ -210,11 +253,11 @@ dnl
AC_DEFUN([PHP_EVAL_LIBLINE],[
for ac_i in $1; do
case $ac_i in
-l*[)]
-l*)
ac_ii=`echo $ac_i|cut -c 3-`
PHP_ADD_LIBRARY($ac_ii,1,$2)
;;
-L*[)]
-L*)
ac_ii=`echo $ac_i|cut -c 3-`
PHP_ADD_LIBPATH($ac_ii,$2)
;;
@@ -230,7 +273,7 @@ dnl
AC_DEFUN([PHP_EVAL_INCLINE],[
for ac_i in $1; do
case $ac_i in
-I*[)]
-I*)
ac_ii=`echo $ac_i|cut -c 3-`
PHP_ADD_INCLUDE($ac_ii)
;;
@@ -291,14 +334,13 @@ int readdir_r(DIR *, struct dirent *);
])
AC_DEFUN([PHP_SHLIB_SUFFIX_NAME],[
AC_REQUIRE([PHP_CANONICAL_HOST])dnl
PHP_SUBST(SHLIB_SUFFIX_NAME)
SHLIB_SUFFIX_NAME=so
case $host_alias in
*hpux*[)]
*hpux*)
SHLIB_SUFFIX_NAME=sl
;;
*darwin*[)]
*darwin*)
SHLIB_SUFFIX_NAME=dylib
;;
esac
@@ -469,17 +511,17 @@ AC_DEFUN([PHP_ARG_ANALYZE_EX],[
ext_output="yes, shared"
ext_shared=yes
case [$]$1 in
shared,*[)]
shared,*)
$1=`echo "[$]$1"|sed 's/^shared,//'`
;;
shared[)]
shared)
$1=yes
;;
no[)]
no)
ext_output=no
ext_shared=no
;;
*[)]
*)
ext_output=yes
ext_shared=no
;;
@@ -489,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])])
])
@@ -548,12 +590,7 @@ AC_DEFUN([PHP_MODULE_PTR],[
])
AC_DEFUN([PHP_CONFIG_NICE],[
AC_REQUIRE([AC_PROG_EGREP])
AC_REQUIRE([LT_AC_PROG_SED])
PHP_SUBST(EGREP)
PHP_SUBST(SED)
test -f $1 && mv $1 $1.old
rm -f $1.old
rm -f $1
cat >$1<<EOF
#! /bin/sh
#
@@ -616,8 +653,8 @@ main() {
])
])
case $ac_cv_time_r_type in
hpux[)] AC_DEFINE(PHP_HPUX_TIME_R,1,[Whether you have HP-UX 10.x]) ;;
irix[)] AC_DEFINE(PHP_IRIX_TIME_R,1,[Whether you have IRIX-style functions]) ;;
hpux) AC_DEFINE(PHP_HPUX_TIME_R,1,[Whether you have HP-UX 10.x]) ;;
irix) AC_DEFINE(PHP_IRIX_TIME_R,1,[Whether you have IRIX-style functions]) ;;
esac
])
@@ -630,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>
@@ -649,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
@@ -794,17 +845,12 @@ AC_DEFUN([PHP_BUILD_PROGRAM],[
php_cxx_meta='$(COMMON_FLAGS) $(CXXFLAGS_CLEAN) $(EXTRA_CXXFLAGS)'
php_cxx_post=' && echo > $[@]'
php_lo=o
case $with_pic in
yes) pic_setting='-prefer-pic';;
no) pic_setting='-prefer-non-pic';;
esac
shared_c_pre='$(LIBTOOL) --mode=compile $(CC)'
shared_c_meta='$(COMMON_FLAGS) $(CFLAGS_CLEAN) $(EXTRA_CFLAGS) '$pic_setting
shared_c_meta='$(COMMON_FLAGS) $(CFLAGS_CLEAN) $(EXTRA_CFLAGS) -prefer-pic'
shared_c_post=
shared_cxx_pre='$(LIBTOOL) --mode=compile $(CXX)'
shared_cxx_meta='$(COMMON_FLAGS) $(CXXFLAGS_CLEAN) $(EXTRA_CXXFLAGS) '$pic_setting
shared_cxx_meta='$(COMMON_FLAGS) $(CXXFLAGS_CLEAN) $(EXTRA_CXXFLAGS) -prefer-pic'
shared_cxx_post=
shared_lo=lo
@@ -1061,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
@@ -1091,30 +1133,20 @@ AC_DEFUN([PHP_CHECK_CC_OPTION],[
AC_MSG_RESULT([no])
fi
fi
rm -rf conftest*
])
AC_DEFUN([PHP_REGEX],[
if test "$REGEX_TYPE" = "php"; then
AC_DEFINE(HAVE_REGEX_T_RE_MAGIC, 1, [ ])
AC_DEFINE(HSREGEX,1,[ ])
AC_DEFINE(REGEX,1,[ ])
PHP_ADD_SOURCES(regex, regcomp.c regexec.c regerror.c regfree.c)
elif test "$REGEX_TYPE" = "system"; then
AC_DEFINE(REGEX,0,[ ])
dnl Check if field re_magic exists in struct regex_t
AC_CACHE_CHECK([whether field re_magic exists in struct regex_t], ac_cv_regex_t_re_magic, [
AC_TRY_COMPILE([#include <sys/types.h>
#include <regex.h>], [regex_t rt; rt.re_magic;],
[ac_cv_regex_t_re_magic=yes], [ac_cv_regex_t_re_magic=no])
])
if test "$ac_cv_regex_t_re_magic" = "yes"; then
AC_DEFINE([HAVE_REGEX_T_RE_MAGIC], [ ], 1)
fi
fi
AC_MSG_CHECKING([which regex library to use])
AC_MSG_RESULT([$REGEX_TYPE])
if test "$REGEX_TYPE" = "php"; then
AC_DEFINE(HSREGEX,1,[ ])
AC_DEFINE(REGEX,1,[ ])
PHP_ADD_SOURCES(regex, regcomp.c regexec.c regerror.c regfree.c)
elif test "$REGEX_TYPE" = "system"; then
AC_DEFINE(REGEX,0,[ ])
fi
AC_MSG_CHECKING([which regex library to use])
AC_MSG_RESULT([$REGEX_TYPE])
])
dnl
@@ -1163,9 +1195,7 @@ main() {
int res = 0;
res = res || (snprintf(buf, 2, "marcus") != 6);
res = res || (buf[1] != '\0');
/* Implementations may consider this as an encoding error */
snprintf(buf, 0, "boerger");
/* However, they MUST ignore the pointer */
res = res || (snprintf(buf, 0, "boerger") != 7);
res = res || (buf[0] != 'm');
res = res || (snprintf(NULL, 0, "boerger") != 7);
res = res || (snprintf(buf, sizeof(buf), "%f", 0.12345678) != 8);
@@ -1186,37 +1216,20 @@ main() {
fi
])
dnl PHP_SHARED_MODULE(module-name, object-var, build-dir, cxx)
dnl PHP_SHARED_MODULE(module-name, object-var, build-dir)
dnl
dnl Basically sets up the link-stage for building module-name
dnl from object_var in build-dir.
dnl
AC_DEFUN([PHP_SHARED_MODULE],[
install_modules="install-modules"
case $host_alias in
*darwin*[)]
suffix=so
link_cmd='ifelse($4,,[$(CC)],[$(CXX)]) -dynamic -flat_namespace -bundle -undefined suppress $(COMMON_FLAGS) $(CFLAGS_CLEAN) $(EXTRA_CFLAGS) $(LDFLAGS) -o [$]@ $(EXTRA_LDFLAGS) $($2) $(translit($1,a-z_-,A-Z__)_SHARED_LIBADD)'
;;
*netware*[)]
suffix=nlm
link_cmd='$(LIBTOOL) --mode=link ifelse($4,,[$(CC)],[$(CXX)]) $(COMMON_FLAGS) $(CFLAGS_CLEAN) $(EXTRA_CFLAGS) $(LDFLAGS) -o [$]@ -shared -export-dynamic -avoid-version -prefer-pic -module -rpath $(phplibdir) $(EXTRA_LDFLAGS) $($2) ifelse($1, php4lib, , -L$(top_builddir)/netware -lphp4lib) $(translit(ifelse($1, php4lib, $1, m4_substr($1, 3)),a-z_-,A-Z__)_SHARED_LIBADD)'
;;
*[)]
suffix=la
link_cmd='$(LIBTOOL) --mode=link ifelse($4,,[$(CC)],[$(CXX)]) $(COMMON_FLAGS) $(CFLAGS_CLEAN) $(EXTRA_CFLAGS) $(LDFLAGS) -o [$]@ -export-dynamic -avoid-version -prefer-pic -module -rpath $(phplibdir) $(EXTRA_LDFLAGS) $($2) $(translit($1,a-z_-,A-Z__)_SHARED_LIBADD)'
;;
esac
PHP_MODULES="$PHP_MODULES \$(phplibdir)/$1.$suffix"
PHP_MODULES="$PHP_MODULES \$(phplibdir)/$1.la"
PHP_SUBST($2)
cat >>Makefile.objects<<EOF
\$(phplibdir)/$1.$suffix: $3/$1.$suffix
\$(LIBTOOL) --mode=install cp $3/$1.$suffix \$(phplibdir)
\$(phplibdir)/$1.la: $3/$1.la
\$(LIBTOOL) --mode=install cp $3/$1.la \$(phplibdir)
$3/$1.$suffix: \$($2) \$(translit($1,a-z_-,A-Z__)_SHARED_DEPENDENCIES)
$link_cmd
$3/$1.la: \$($2) \$(translit($1,a-z-,A-Z_)_SHARED_DEPENDENCIES)
\$(LIBTOOL) --mode=link \$(CC) \$(COMMON_FLAGS) \$(CFLAGS_CLEAN) \$(EXTRA_CFLAGS) \$(LDFLAGS) -o \[$]@ -export-dynamic -avoid-version -prefer-pic -module -rpath \$(phplibdir) \$(EXTRA_LDFLAGS) \$($2) \$(translit($1,a-z-,A-Z_)_SHARED_LIBADD)
EOF
])
@@ -1232,10 +1245,10 @@ AC_DEFUN([PHP_SELECT_SAPI],[
PHP_SAPI=$1
case "$2" in
static[)] PHP_BUILD_STATIC;;
shared[)] PHP_BUILD_SHARED;;
bundle[)] PHP_BUILD_BUNDLE;;
program[)] PHP_BUILD_PROGRAM($5);;
static) PHP_BUILD_STATIC;;
shared) PHP_BUILD_SHARED;;
bundle) PHP_BUILD_BUNDLE;;
program) PHP_BUILD_PROGRAM($5);;
esac
ifelse($3,,,[PHP_ADD_SOURCES([sapi/$1],[$3],[$4],[sapi])])
@@ -1243,7 +1256,7 @@ AC_DEFUN([PHP_SELECT_SAPI],[
dnl deprecated
AC_DEFUN([PHP_EXTENSION],[
sources=`$AWK -f $abs_srcdir/build/scan_makefile_in.awk < []PHP_EXT_SRCDIR($1)[]/Makefile.in`
sources=`awk -f $abs_srcdir/scan_makefile_in.awk < []PHP_EXT_SRCDIR($1)[]/Makefile.in`
PHP_NEW_EXTENSION($1, $sources, $2, $3)
@@ -1257,11 +1270,14 @@ 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
dnl PHP_NEW_EXTENSION(extname, sources [, shared [,sapi_class[, extra-cflags[, cxx]]]])
dnl PHP_NEW_EXTENSION(extname, sources [, shared [,sapi_class[, extra-cflags]]])
dnl
dnl Includes an extension in the build.
dnl
@@ -1291,14 +1307,7 @@ dnl ---------------------------------------------- Static module
if test "$3" = "shared" || test "$3" = "yes"; then
dnl ---------------------------------------------- Shared module
PHP_ADD_SOURCES_X(PHP_EXT_DIR($1),$2,$ac_extra,shared_objects_$1,yes)
case $host_alias in
*netware*)
PHP_SHARED_MODULE(php$1,shared_objects_$1, $ext_builddir, $6)
;;
*)
PHP_SHARED_MODULE($1,shared_objects_$1, $ext_builddir, $6)
;;
esac
PHP_SHARED_MODULE($1,shared_objects_$1, $ext_builddir)
AC_DEFINE_UNQUOTED([COMPILE_DL_]translit($1,a-z_-,A-Z__), 1, Whether to build $1 as dynamic module)
fi
fi
@@ -1328,13 +1337,13 @@ AC_DEFUN([PHP_SOLARIS_PIC_WEIRDNESS],[
if test -n "$EXT_SHARED"; then
os=`uname -sr 2>/dev/null`
case $os in
"SunOS 5.6"|"SunOS 5.7"[)]
"SunOS 5.6"|"SunOS 5.7")
case $CC in
gcc*|egcs*) CFLAGS="$CFLAGS -fPIC";;
*[)] CFLAGS="$CFLAGS -fpic";;
*) CFLAGS="$CFLAGS -fpic";;
esac
AC_MSG_RESULT([yes]);;
*[)]
*)
AC_MSG_RESULT([no]);;
esac
else
@@ -1372,8 +1381,8 @@ AC_DEFUN([PHP_SYS_LFS],
ac_shellvars='CPPFLAGS LDFLAGS LIBS'
for ac_shellvar in $ac_shellvars; do
case $ac_shellvar in
CPPFLAGS[)] ac_lfsvar=LFS_CFLAGS ;;
*[)] ac_lfsvar=LFS_$ac_shellvar ;;
CPPFLAGS) ac_lfsvar=LFS_CFLAGS ;;
*) ac_lfsvar=LFS_$ac_shellvar ;;
esac
eval test '"${'$ac_shellvar'+set}"' = set && ac_set=$ac_shellvar
(getconf $ac_lfsvar) >/dev/null 2>&1 || { ac_result=no; break; }
@@ -1382,14 +1391,14 @@ AC_DEFUN([PHP_SYS_LFS],
eval ac_test_$ac_shellvar=\$ac_getconf
done
case "$ac_result$ac_getconfs" in
yes[)] ac_result=no ;;
yes) ac_result=no ;;
esac
case "$ac_result$ac_set" in
yes?*[)] ac_result="yes, but $ac_set is already set, so use its settings"
yes?*) ac_result="yes, but $ac_set is already set, so use its settings"
esac
AC_MSG_RESULT([$ac_result])
case $ac_result in
yes[)]
yes)
for ac_shellvar in $ac_shellvars; do
eval $ac_shellvar=\$ac_test_$ac_shellvar
done ;;
@@ -1453,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 ])
@@ -1603,19 +1548,12 @@ dnl Wrapper for AC_CHECK_LIB
dnl
AC_DEFUN([PHP_CHECK_LIBRARY], [
save_old_LDFLAGS=$LDFLAGS
ac_stuff="$5"
save_ext_shared=$ext_shared
ext_shared=yes
PHP_EVAL_LIBLINE([$]ac_stuff, LDFLAGS)
LDFLAGS="$5 $LDFLAGS"
AC_CHECK_LIB([$1],[$2],[
LDFLAGS=$save_old_LDFLAGS
ext_shared=$save_ext_shared
$3
],[
LDFLAGS=$save_old_LDFLAGS
ext_shared=$save_ext_shared
unset ac_cv_lib_$1[]_$2
$4
])dnl
])
@@ -1640,182 +1578,6 @@ AC_DEFUN([PHP_CHECK_FRAMEWORK], [
])
])
dnl
dnl PHP_SETUP_KERBEROS(shared-add [, action-found [, action-not-found]])
dnl
dnl Common setup macro for kerberos
dnl
AC_DEFUN([PHP_SETUP_KERBEROS],[
found_kerberos=no
unset KERBEROS_CFLAGS
unset KERBEROS_LIBS
dnl First try to find krb5-config
if test -z "$KRB5_CONFIG"; then
AC_PATH_PROG(KRB5_CONFIG, krb5-config, no, [$PATH:/usr/kerberos/bin:/usr/local/bin])
fi
dnl If krb5-config is found try using it
if test "$PHP_KERBEROS" = "yes" && test -x "$KRB5_CONFIG"; then
KERBEROS_LIBS=`$KRB5_CONFIG --libs gssapi`
KERBEROS_CFLAGS=`$KRB5_CONFIG --cflags gssapi`
if test -n "$KERBEROS_LIBS" && test -n "$KERBEROS_CFLAGS"; then
found_kerberos=yes
PHP_EVAL_LIBLINE($KERBEROS_LIBS, $1)
PHP_EVAL_INCLINE($KERBEROS_CFLAGS)
fi
fi
dnl If still not found use old skool method
if test "$found_kerberos" = "no"; then
if test "$PHP_KERBEROS" = "yes"; then
PHP_KERBEROS="/usr/kerberos /usr/local /usr"
fi
for i in $PHP_KERBEROS; do
if test -f $i/lib/libkrb5.a || test -f $i/lib/libkrb5.$SHLIB_SUFFIX_NAME; then
PHP_KERBEROS_DIR=$i
break
fi
done
if test "$PHP_KERBEROS_DIR"; then
found_kerberos=yes
PHP_ADD_LIBPATH($PHP_KERBEROS_DIR/lib, $1)
PHP_ADD_LIBRARY(gssapi_krb5, 1, $1)
PHP_ADD_LIBRARY(krb5, 1, $1)
PHP_ADD_LIBRARY(k5crypto, 1, $1)
PHP_ADD_LIBRARY(com_err, 1, $1)
PHP_ADD_INCLUDE($PHP_KERBEROS_DIR/include)
fi
fi
if test "$found_kerberos" = "yes"; then
ifelse([$2],[],:,[$2])
ifelse([$3],[],,[else $3])
fi
])
dnl
dnl PHP_SETUP_OPENSSL(shared-add [, action-found [, action-not-found]])
dnl
dnl Common setup macro for openssl
dnl
AC_DEFUN([PHP_SETUP_OPENSSL],[
found_openssl=no
unset OPENSSL_INCDIR
unset OPENSSL_LIBDIR
dnl Empty variable means 'no'
test -z "$PHP_OPENSSL" && PHP_OPENSSL=no
test -z "$PHP_IMAP_SSL" && PHP_IMAP_SSL=no
dnl Fallbacks for different configure options
if test "$PHP_OPENSSL" != "no"; then
PHP_OPENSSL_DIR=$PHP_OPENSSL
elif test "$PHP_IMAP_SSL" != "no"; then
PHP_OPENSSL_DIR=$PHP_IMAP_SSL
fi
dnl First try to find pkg-config
if test -z "$PKG_CONFIG"; then
AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
fi
dnl If pkg-config is found try using it
if test "$PHP_OPENSSL_DIR" = "yes" && test -x "$PKG_CONFIG" && $PKG_CONFIG --exists openssl; then
if $PKG_CONFIG --atleast-version=0.9.6 openssl; then
found_openssl=yes
OPENSSL_LIBS=`$PKG_CONFIG --libs openssl`
OPENSSL_INCS=`$PKG_CONFIG --cflags-only-I openssl`
OPENSSL_INCDIR=`$PKG_CONFIG --variable=includedir openssl`
else
AC_MSG_ERROR([OpenSSL version 0.9.6 or greater required.])
fi
if test -n "$OPENSSL_LIBS" && test -n "$OPENSSL_INCS"; then
PHP_EVAL_LIBLINE($OPENSSL_LIBS, $1)
PHP_EVAL_INCLINE($OPENSSL_INCS)
fi
fi
dnl If pkg-config fails for some reason, revert to the old method
if test "$found_openssl" = "no"; then
if test "$PHP_OPENSSL_DIR" = "yes"; then
PHP_OPENSSL_DIR="/usr/local/ssl /usr/local /usr /usr/local/openssl"
fi
for i in $PHP_OPENSSL_DIR; do
if test -r $i/include/openssl/evp.h; then
OPENSSL_INCDIR=$i/include
fi
if test -r $i/lib/libssl.a -o -r $i/lib/libssl.$SHLIB_SUFFIX_NAME; then
OPENSSL_LIBDIR=$i/lib
fi
test -n "$OPENSSL_INCDIR" && test -n "$OPENSSL_LIBDIR" && break
done
if test -z "$OPENSSL_INCDIR"; then
AC_MSG_ERROR([Cannot find OpenSSL's <evp.h>])
fi
if test -z "$OPENSSL_LIBDIR"; then
AC_MSG_ERROR([Cannot find OpenSSL's libraries])
fi
old_CPPFLAGS=$CPPFLAGS
CPPFLAGS=-I$OPENSSL_INCDIR
AC_MSG_CHECKING([for OpenSSL version])
AC_EGREP_CPP(yes,[
#include <openssl/opensslv.h>
#if OPENSSL_VERSION_NUMBER >= 0x0090600fL
yes
#endif
],[
AC_MSG_RESULT([>= 0.9.6])
],[
AC_MSG_ERROR([OpenSSL version 0.9.6 or greater required.])
])
CPPFLAGS=$old_CPPFLAGS
PHP_ADD_INCLUDE($OPENSSL_INCDIR)
PHP_CHECK_LIBRARY(crypto, CRYPTO_free, [
PHP_ADD_LIBRARY(crypto,,$1)
],[
AC_MSG_ERROR([libcrypto not found!])
],[
-L$OPENSSL_LIBDIR
])
old_LIBS=$LIBS
LIBS="$LIBS -lcrypto"
PHP_CHECK_LIBRARY(ssl, SSL_CTX_set_ssl_version, [
found_openssl=yes
],[
AC_MSG_ERROR([libssl not found!])
],[
-L$OPENSSL_LIBDIR
])
LIBS=$old_LIBS
PHP_ADD_LIBRARY(ssl,,$1)
PHP_ADD_LIBPATH($OPENSSL_LIBDIR, $1)
fi
if test "$found_openssl" = "yes"; then
dnl For apache 1.3.x static build
OPENSSL_INCDIR_OPT=-I$OPENSSL_INCDIR
AC_SUBST(OPENSSL_INCDIR_OPT)
ifelse([$2],[],:,[$2])
ifelse([$3],[],,[else $3])
fi
])
dnl
dnl PHP_SETUP_ICONV(shared-add [, action-found [, action-not-found]])
dnl
@@ -1825,28 +1587,16 @@ AC_DEFUN([PHP_SETUP_ICONV], [
found_iconv=no
unset ICONV_DIR
# Create the directories for a VPATH build:
test -d ext || mkdir ext
test -d ext/iconv || mkdir ext/iconv
echo > ext/iconv/php_have_bsd_iconv.h
echo > ext/iconv/php_have_glibc_iconv.h
echo > ext/iconv/php_have_libiconv.h
echo > ext/iconv/php_have_iconv.h
echo > ext/iconv/php_php_iconv_impl.h
echo > ext/iconv/php_php_iconv_h_path.h
echo > ext/iconv/php_iconv_supports_errno.h
dnl
dnl Check libc first if no path is provided in --with-iconv
dnl
if test "$PHP_ICONV" = "yes"; then
AC_CHECK_FUNC(iconv, [
PHP_DEFINE(HAVE_ICONV,1,[ext/iconv])
PHP_DEFINE(HAVE_ICONV)
found_iconv=yes
],[
AC_CHECK_FUNC(libiconv,[
PHP_DEFINE(HAVE_LIBICONV,1,[ext/iconv])
PHP_DEFINE(HAVE_LIBICONV)
found_iconv=yes
])
])
@@ -1879,11 +1629,11 @@ AC_DEFUN([PHP_SETUP_ICONV], [
then
PHP_CHECK_LIBRARY($iconv_lib_name, libiconv, [
found_iconv=yes
PHP_DEFINE(HAVE_LIBICONV,1,[ext/iconv])
PHP_DEFINE(HAVE_LIBICONV)
], [
PHP_CHECK_LIBRARY($iconv_lib_name, iconv, [
found_iconv=yes
PHP_DEFINE(HAVE_ICONV,1,[ext/iconv])
PHP_DEFINE(HAVE_ICONV)
], [], [
-L$ICONV_DIR/lib
])
@@ -1962,12 +1712,12 @@ AC_DEFUN([PHP_CHECK_FUNC],[
AC_CHECK_FUNC($1, [found=yes],[ AC_CHECK_FUNC(__$1,[found=yes],[found=no]) ])
case $found in
yes[)]
yes)
PHP_DEF_HAVE($1)
ac_cv_func_$1=yes
;;
ifelse($#,1,,[
*[)] PHP_CHECK_FUNC_LIB($@) ;;
*) PHP_CHECK_FUNC_LIB($@) ;;
])
esac
])
@@ -1988,30 +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 PHP_C_BIGENDIAN
dnl Replacement macro for AC_C_BIGENDIAN
dnl
AC_DEFUN([PHP_C_BIGENDIAN],
[AC_CACHE_CHECK([whether byte ordering is bigendian], ac_cv_c_bigendian_php,
[
ac_cv_c_bigendian_php=unknown
AC_TRY_RUN(
[
int main(void)
{
short one = 1;
char *cp = (char *)&one;
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,
[
if (*cp == 0) {
return(0);
} else {
return(1);
}
# 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
}
], [ac_cv_c_bigendian_php=yes], [ac_cv_c_bigendian_php=no], [ac_cv_c_bigendian_php=unknown])
])
if test $ac_cv_c_bigendian_php = yes; then
AC_DEFINE(WORDS_BIGENDIAN, [], [Define if processor uses big-endian word])
fi
# 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
])
+7 -7
View File
@@ -1,12 +1,12 @@
# +----------------------------------------------------------------------+
# | PHP Version 4 |
# +----------------------------------------------------------------------+
# | Copyright (c) 1997-2006 The PHP Group |
# | Copyright (c) 1997-2002 The PHP Group |
# +----------------------------------------------------------------------+
# | This source file is subject to version 3.01 of the PHP license, |
# | 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 through the world-wide-web at the following url: |
# | http://www.php.net/license/3_01.txt |
# | 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. |
@@ -30,7 +30,7 @@ ALWAYS = generated_lists
all: $(STAMP) $(ALWAYS)
@$(MAKE) -s -f build/build2.mk
@$(MAKE) AMFLAGS=$(AMFLAGS) -s -f build/build2.mk
generated_lists:
@echo makefile_am_files = $(ZENDDIR)/Makefile.am \
@@ -55,7 +55,7 @@ snapshot:
test -d $$i || (test -d ../$$i && cp -rp ../$$i $$i); \
done; \
find . -type l -exec rm {} \; ; \
$(MAKE) -f build/build.mk; \
$(MAKE) AMFLAGS=--copy -f build/build.mk; \
cd ..; \
tar cf $$distname.tar $$distname; \
rm -rf $$distname $$distname.tar.*; \
@@ -65,7 +65,7 @@ snapshot:
md5sum $$distname.tar.bz2; \
bzip2 -t $$distname.tar.bz2
cvsclean-work:
cvsclean:
@for i in `find . -name .cvsignore`; do \
(cd `dirname $$i` 2>/dev/null && rm -rf `cat .cvsignore | grep -v config.nice` *.o *.a .libs || true); \
done
+14 -15
View File
@@ -1,12 +1,12 @@
# +----------------------------------------------------------------------+
# | PHP Version 4 |
# +----------------------------------------------------------------------+
# | Copyright (c) 1997-2006 The PHP Group |
# | Copyright (c) 1997-2002 The PHP Group |
# +----------------------------------------------------------------------+
# | This source file is subject to version 3.01 of the PHP license, |
# | 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 through the world-wide-web at the following url: |
# | http://www.php.net/license/3_01.txt |
# | 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. |
@@ -14,7 +14,7 @@
# | Author: Sascha Schumann <sascha@schumann.cx> |
# +----------------------------------------------------------------------+
#
# $Id$
# $Id$
#
include generated_lists
@@ -23,16 +23,15 @@ TOUCH_FILES = mkinstalldirs install-sh missing
LT_TARGETS = ltmain.sh config.guess config.sub
makefile_in_files = $(makefile_am_files:.am=.in)
makefile_files = $(makefile_am_files:e.am=e)
config_h_in = main/php_config.h.in
acconfig_h_SOURCES = acconfig.h.in $(config_h_files)
targets = $(TOUCH_FILES) configure $(config_h_in)
PHP_AUTOCONF ?= 'autoconf'
PHP_AUTOHEADER ?= 'autoheader'
SUPPRESS_WARNINGS ?= 2>&1 | (egrep -v '(AC_TRY_RUN called without default to allow cross compiling|AC_PROG_CXXCPP was called before AC_PROG_CXX|defined in acinclude.m4 but never used|AC_PROG_LEX invoked multiple times|AC_DECL_YYTEXT is expanded from...|the top level)'||true)
all: $(targets)
@@ -40,21 +39,21 @@ acconfig.h: $(acconfig_h_SOURCES)
@echo rebuilding $@
cat $(acconfig_h_SOURCES) > $@
SUPPRESS_WARNINGS = (egrep -v '(AC_TRY_RUN called without default to allow cross compiling|AC_PROG_CXXCPP was called before AC_PROG_CXX|defined in acinclude.m4 but never used|AC_PROG_LEX invoked multiple times)'||true)
$(config_h_in): configure acconfig.h
# explicitly remove target since autoheader does not seem to work
# correctly otherwise (timestamps are not updated)
@echo rebuilding $@
@rm -f $@
$(PHP_AUTOHEADER) $(SUPPRESS_WARNINGS)
@autoheader 2>&1 | $(SUPPRESS_WARNINGS)
$(TOUCH_FILES):
touch $(TOUCH_FILES)
aclocal.m4: configure.in acinclude.m4
@echo rebuilding $@
cat acinclude.m4 ./build/libtool.m4 > $@
aclocal 2>&1 | $(SUPPRESS_WARNINGS)
configure: aclocal.m4 configure.in $(config_m4_files)
@echo rebuilding $@
$(PHP_AUTOCONF) $(SUPPRESS_WARNINGS)
@autoconf 2>&1 | $(SUPPRESS_WARNINGS)
+61 -13
View File
@@ -2,34 +2,29 @@
# +----------------------------------------------------------------------+
# | PHP Version 4 |
# +----------------------------------------------------------------------+
# | Copyright (c) 1997-2006 The PHP Group |
# | Copyright (c) 1997-2002 The PHP Group |
# +----------------------------------------------------------------------+
# | This source file is subject to version 3.01 of the PHP license, |
# | 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 through the world-wide-web at the following url: |
# | http://www.php.net/license/3_01.txt |
# | 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. |
# +----------------------------------------------------------------------+
# | Authors: Stig Bakken <ssb@php.net> |
# | Authors: Stig Bakken <ssb@fast.no> |
# | Sascha Schumann <sascha@schumann.cx> |
# +----------------------------------------------------------------------+
#
# $Id: buildcheck.sh,v 1.21.2.13.2.2 2006-01-01 13:46:49 sniper Exp $
# $Id: buildcheck.sh,v 1.21 2002-10-30 11:42:22 sas Exp $
#
echo "buildconf: checking installation..."
stamp=$1
# Allow the autoconf executable to be overridden by $PHP_AUTOCONF.
if test -z "$PHP_AUTOCONF"; then
PHP_AUTOCONF='autoconf'
fi
# autoconf 2.13 or newer
ac_version=`$PHP_AUTOCONF --version 2>/dev/null|head -n 1|sed -e 's/^[^0-9]*//' -e 's/[a-z]* *$//'`
ac_version=`autoconf --version 2>/dev/null|head -1|sed -e 's/^[^0-9]*//' -e 's/[a-z]* *$//'`
if test -z "$ac_version"; then
echo "buildconf: autoconf not found."
echo " You need autoconf version 2.13 or newer installed"
@@ -46,14 +41,67 @@ else
echo "buildconf: autoconf version $ac_version (ok)"
fi
if test "$1" = "2" && test "$2" -ge "50"; then
echo "buildconf: Your version of autoconf likely contains buggy cache code."
echo " Running cvsclean for you."
echo " To avoid this, install autoconf-2.13."
echo " To avoid this, install autoconf-2.13 and automake-1.5."
./cvsclean
stamp=
fi
# automake 1.4 or newer
am_version=`automake --version 2>/dev/null|head -1|sed -e 's/^[^0-9]*//' -e 's/[a-z]* *$//'`
am_version_clean=`echo $am_version|sed -e 's/-p[0-9]*$//'`
if test "$am_version" = ""; then
echo "buildconf: automake not found."
echo " You need automake version 1.4 or newer installed"
echo " to build PHP from CVS."
exit 1
fi
IFS=.; set $am_version_clean; IFS=' '
if test "$1" = "1" -a "$2" -lt "4" || test "$1" -lt "1"; then
echo "buildconf: automake version $am_version found."
echo " You need automake version 1.4 or newer installed"
echo " to build PHP from CVS."
exit 1
else
echo "buildconf: automake version $am_version (ok)"
fi
# libtool 1.4 or newer
# Prefer glibtool over libtool for Mac OS X compatibility
libtool=`which glibtool 2> /dev/null`
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 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 "$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 or newer installed"
echo " to build PHP from CVS."
exit 1
fi
am_prefix=`which automake | sed -e 's#/[^/]*/[^/]*$##'`
lt_prefix=`echo $libtool | sed -e 's#/[^/]*/[^/]*$##'`
if test "$am_prefix" != "$lt_prefix"; then
echo "WARNING: automake and libtool are installed in different"
echo " directories. This may cause aclocal to fail."
echo " continuing anyway"
fi
test -n "$stamp" && touch $stamp
exit 0
-3728
View File
File diff suppressed because it is too large. Load diff
+4 -4
View File
@@ -1,12 +1,12 @@
# +----------------------------------------------------------------------+
# | PHP Version 4 |
# +----------------------------------------------------------------------+
# | Copyright (c) 2000-2006 The PHP Group |
# | Copyright (c) 2000 The PHP Group |
# +----------------------------------------------------------------------+
# | This source file is subject to version 3.01 of the PHP license, |
# | 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 through the world-wide-web at the following url: |
# | http://www.php.net/license/3_01.txt |
# | 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. |
+138 -215
View File
@@ -1,12 +1,12 @@
#!/bin/sh
##
## GNU shtool -- The GNU Portable Shell Tool
## Copyright (c) 1994-2005 Ralf S. Engelschall <rse@engelschall.com>
## Copyright (c) 1994-2002 Ralf S. Engelschall <rse@engelschall.com>
##
## See http://www.gnu.org/software/shtool/ for more information.
## See ftp://ftp.gnu.org/gnu/shtool/ for latest version.
##
## Version: 2.0.2 (15-Jun-2005)
## Version: 1.6.2 (02-Nov-2002)
## Contents: 4/19 available modules
##
@@ -54,7 +54,7 @@
## rotate Logfile rotation
## tarball Roll distribution tarballs
## subst Apply sed(1) substitution operations
## platform Platform Identification Utility
## guessos Simple operating system guesser
## arx Extended archive command
## slo Separate linker options by library class
## scpp Sharing C Pre-Processor
@@ -66,9 +66,9 @@ if [ $# -eq 0 ]; then
echo "$0:Hint: run \`$0 -h' for usage" 1>&2
exit 1
fi
if [ ".$1" = ".-h" ] || [ ".$1" = ".--help" ]; then
echo "This is GNU shtool, version 2.0.2 (15-Jun-2005)"
echo "Copyright (c) 1994-2005 Ralf S. Engelschall <rse@engelschall.com>"
if [ ".$1" = ".-h" -o ".$1" = ".--help" ]; then
echo "This is GNU shtool, version 1.6.2 (02-Nov-2002)"
echo "Copyright (c) 1994-2002 Ralf S. Engelschall <rse@engelschall.com>"
echo "Report bugs to <bug-shtool@gnu.org>"
echo ''
echo "Usage: shtool [<options>] [<cmd-name> [<cmd-options>] [<cmd-args>]]"
@@ -80,7 +80,7 @@ if [ ".$1" = ".-h" ] || [ ".$1" = ".--help" ]; then
echo ' -r, --recreate recreate this shtool script via shtoolize'
echo ''
echo 'Available <cmd-name> [<cmd-options>] [<cmd-args>]:'
echo ' echo [-n|--newline] [-e|--expand] [<string> ...]'
echo ' echo [-n|--newline] [-e|--expand] [<str> ...]'
echo ' install [-v|--verbose] [-t|--trace] [-d|--mkdir] [-c|--copy]'
echo ' [-C|--compare-copy] [-s|--strip] [-m|--mode <mode>]'
echo ' [-o|--owner <owner>] [-g|--group <group>] [-e|--exec'
@@ -106,21 +106,17 @@ if [ ".$1" = ".-h" ] || [ ".$1" = ".--help" ]; then
echo ' rotate [-v|--verbose] [-t|--trace] [-f|--force] [-n|--num-files'
echo ' <count>] [-s|--size <size>] [-c|--copy] [-r|--remove]'
echo ' [-a|--archive-dir <dir>] [-z|--compress [<tool>:]<level>]'
echo ' [-b|--background] [-d|--delay] [-p|--pad <len>] [-m|--mode'
echo ' <mode>] [-o|--owner <owner>] [-g|--group <group>] [-M|--migrate'
echo ' [-b|--background] [-d|--delay] [-p|--pad <len>] [-o|--owner'
echo ' <owner>] [-g|--group <group>] [-m|--mode <mode>] [-M|--migrate'
echo ' <cmd>] [-P|--prolog <cmd>] [-E|--epilog <cmd>] <file> [...]'
echo ' tarball [-t|--trace] [-v|--verbose] [-o|--output <tarball>]'
echo ' [-c|--compress <prog>] [-d|--directory <dir>] [-u|--user'
echo ' <user>] [-g|--group <group>] [-e|--exclude <pattern>]'
echo ' <path> [<path> ...]'
echo ' subst [-v|--verbose] [-t|--trace] [-n|--nop] [-w|--warning]'
echo ' [-q|--quiet] [-s|--stealth] [-i|--interactive] [-b|--backup'
echo ' <ext>] [-e|--exec <cmd>] [-f|--file <cmd-file>] [<file>]'
echo ' [...]'
echo ' platform [-F|--format <format>] [-S|--sep <string>] [-C|--conc'
echo ' <string>] [-L|--lower] [-U|--upper] [-v|--verbose]'
echo ' [-c|--concise] [-n|--no-newline] [-t|--type <type>]'
echo ' [-V|--version] [-h|--help]'
echo ' subst [-v|--verbose] [-t|--trace] [-n|--nop] [-s|--stealth]'
echo ' [-i|--interactive] [-b|--backup <ext>] [-e|--exec <cmd>]'
echo ' [-f|--file <cmd-file>] [<file>] [...]'
echo ' guessos '
echo ' arx [-t|--trace] [-C|--command <cmd>] <op> <archive> [<file>'
echo ' ...]'
echo ' slo [-p|--prefix <str>] -- -L<dir> -l<lib> [-L<dir> -l<lib>'
@@ -135,15 +131,15 @@ if [ ".$1" = ".-h" ] || [ ".$1" = ".--help" ]; then
echo ''
exit 0
fi
if [ ".$1" = ".-v" ] || [ ".$1" = ".--version" ]; then
echo "GNU shtool 2.0.2 (15-Jun-2005)"
if [ ".$1" = ".-v" -o ".$1" = ."--version" ]; then
echo "GNU shtool 1.6.2 (02-Nov-2002)"
exit 0
fi
if [ ".$1" = ".-r" ] || [ ".$1" = ".--recreate" ]; then
if [ ".$1" = ".-r" -o ".$1" = ."--recreate" ]; then
shtoolize -oshtool echo install mkdir path
exit 0
fi
if [ ".$1" = ".-d" ] || [ ".$1" = ".--debug" ]; then
if [ ".$1" = ".-d" -o ".$1" = ."--debug" ]; then
shift
set -x
fi
@@ -170,7 +166,7 @@ gen_tmpfile=no
case $tool in
echo )
str_tool="echo"
str_usage="[-n|--newline] [-e|--expand] [<string> ...]"
str_usage="[-n|--newline] [-e|--expand] [<str> ...]"
arg_spec="0+"
opt_spec="n.e."
opt_alias="n:newline,e:expand"
@@ -265,7 +261,7 @@ eval `echo h.$opt_spec |\
# parse option alias string
eval `echo h:help,$opt_alias |\
sed -e 's/-/_/g' -e 's/\([a-zA-Z0-9]\):\([^,]*\),*/opt_ALIAS_\2=\1;/g'`
tr 'x-' 'x_' | sed -e 's/\([a-zA-Z0-9]\):\([^,]*\),*/opt_ALIAS_\2=\1;/g'`
# interate over argument line
opt_PREV=''
@@ -290,12 +286,12 @@ while [ $# -gt 0 ]; do
--[a-zA-Z0-9]*=*)
eval `echo "x$1" |\
sed -e 's/^x--\([a-zA-Z0-9-]*\)=\(.*\)$/opt_OPT="\1";opt_ARG="\2"/'`
opt_STR=`echo $opt_OPT | sed -e 's/-/_/g'`
opt_STR=`echo $opt_OPT | tr 'x-' 'x_'`
eval "opt_OPT=\${opt_ALIAS_${opt_STR}-${opt_OPT}}"
;;
--[a-zA-Z0-9]*)
opt_OPT=`echo "x$1" | cut -c4-`
opt_STR=`echo $opt_OPT | sed -e 's/-/_/g'`
opt_STR=`echo $opt_OPT | tr 'x-' 'x_'`
eval "opt_OPT=\${opt_ALIAS_${opt_STR}-${opt_OPT}}"
opt_ARG=''
;;
@@ -319,8 +315,8 @@ while [ $# -gt 0 ]; do
# determine whether option needs an argument
eval "opt_MODE=\$opt_MODE_${opt_OPT}"
if [ ".$opt_ARG" = . ] && [ ".$opt_ARG_OK" != .yes ]; then
if [ ".$opt_MODE" = ".:" ] || [ ".$opt_MODE" = ".+" ]; then
if [ ".$opt_ARG" = . -a ".$opt_ARG_OK" != .yes ]; then
if [ ".$opt_MODE" = ".:" -o ".$opt_MODE" = ".+" ]; then
opt_PREV="$opt_OPT"
continue
fi
@@ -379,7 +375,6 @@ esac
# establish a temporary file on request
if [ ".$gen_tmpfile" = .yes ]; then
# create (explicitly) secure temporary directory
if [ ".$TMPDIR" != . ]; then
tmpdir="$TMPDIR"
elif [ ".$TEMPDIR" != . ]; then
@@ -387,40 +382,12 @@ if [ ".$gen_tmpfile" = .yes ]; then
else
tmpdir="/tmp"
fi
tmpdir="$tmpdir/.shtool.$$"
( umask 077
rm -rf "$tmpdir" >/dev/null 2>&1 || true
mkdir "$tmpdir" >/dev/null 2>&1
if [ $? -ne 0 ]; then
echo "$msgprefix:Error: failed to create temporary directory \`$tmpdir'" 1>&2
exit 1
fi
)
# create (implicitly) secure temporary file
tmpfile="$tmpdir/shtool.tmp"
touch "$tmpfile"
tmpfile="$tmpdir/.shtool.$$"
rm -f $tmpfile >/dev/null 2>&1
touch $tmpfile
chmod 600 $tmpfile
fi
# utility function: map string to lower case
util_lower () {
echo "$1" | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'
}
# utility function: map string to upper case
util_upper () {
echo "$1" | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
}
# cleanup procedure
shtool_exit () {
rc="$1"
if [ ".$gen_tmpfile" = .yes ]; then
rm -rf "$tmpdir" >/dev/null 2>&1 || true
fi
exit $rc
}
##
## DISPATCH INTO SCRIPT BODY
##
@@ -430,11 +397,12 @@ case $tool in
echo )
##
## echo -- Print string with optional construct expansion
## Copyright (c) 1998-2005 Ralf S. Engelschall <rse@engelschall.com>
## Copyright (c) 1998-2002 Ralf S. Engelschall <rse@engelschall.com>
## Originally written for WML as buildinfo
##
text="$*"
# check for broken escape sequence expansion
seo=''
bytes=`echo '\1' | wc -c | awk '{ printf("%s", $1); }'`
@@ -444,18 +412,18 @@ echo )
seo='-E'
fi
fi
# check for existing -n option (to suppress newline)
minusn=''
bytes=`echo -n 123 2>/dev/null | wc -c | awk '{ printf("%s", $1); }'`
if [ ".$bytes" = .3 ]; then
minusn='-n'
fi
# determine terminal bold sequence
term_bold=''
term_norm=''
if [ ".$opt_e" = .yes ] && [ ".`echo $text | grep '%[Bb]'`" != . ]; then
if [ ".$opt_e" = .yes -a ".`echo $text | egrep '%[Bb]'`" != . ]; then
case $TERM in
# for the most important terminal types we directly know the sequences
xterm|xterm*|vt220|vt220*)
@@ -491,139 +459,96 @@ echo )
break
fi
done
if [ ".$term_bold" != . ] && [ ".$term_norm" != . ]; then
if [ ".$term_bold" != . -a ".$term_norm" != . ]; then
break;
fi
done
;;
esac
if [ ".$term_bold" = . ] || [ ".$term_norm" = . ]; then
if [ ".$term_bold" = . -o ".$term_norm" = . ]; then
echo "$msgprefix:Warning: unable to determine terminal sequence for bold mode" 1>&2
term_bold=''
term_norm=''
fi
fi
# determine user name
username=''
if [ ".$opt_e" = .yes ] && [ ".`echo $text | grep '%[uUgG]'`" != . ]; then
username="`(id -un) 2>/dev/null`"
if [ ".$opt_e" = .yes -a ".`echo $text | egrep '%[uUgG]'`" != . ]; then
username="$LOGNAME"
if [ ".$username" = . ]; then
str="`(id) 2>/dev/null`"
if [ ".`echo $str | grep '^uid[ ]*=[ ]*[0-9]*('`" != . ]; then
username=`echo $str | sed -e 's/^uid[ ]*=[ ]*[0-9]*(//' -e 's/).*$//'`
fi
username="$USER"
if [ ".$username" = . ]; then
username="$LOGNAME"
username="`(whoami) 2>/dev/null |\
awk '{ printf("%s", $1); }'`"
if [ ".$username" = . ]; then
username="$USER"
username="`(who am i) 2>/dev/null |\
awk '{ printf("%s", $1); }'`"
if [ ".$username" = . ]; then
username="`(whoami) 2>/dev/null |\
awk '{ printf("%s", $1); }'`"
if [ ".$username" = . ]; then
username="`(who am i) 2>/dev/null |\
awk '{ printf("%s", $1); }'`"
if [ ".$username" = . ]; then
username='unknown'
fi
fi
username='unknown'
fi
fi
fi
fi
fi
# determine user id
userid=''
if [ ".$opt_e" = .yes ] && [ ".`echo $text | grep '%U'`" != . ]; then
if [ ".$opt_e" = .yes -a ".`echo $text | egrep '%U'`" != . ]; then
userid="`(id -u) 2>/dev/null`"
if [ ".$userid" = . ]; then
userid="`(id -u ${username}) 2>/dev/null`"
str="`(id) 2>/dev/null`"
if [ ".`echo $str | grep '^uid[ ]*=[ ]*[0-9]*('`" != . ]; then
userid=`echo $str | sed -e 's/^uid[ ]*=[ ]*//' -e 's/(.*//'`
fi
if [ ".$userid" = . ]; then
str="`(id) 2>/dev/null`"
if [ ".`echo $str | grep '^uid[ ]*=[ ]*[0-9]*('`" != . ]; then
userid=`echo $str | sed -e 's/^uid[ ]*=[ ]*//' -e 's/(.*$//'`
fi
userid=`egrep "^${username}:" /etc/passwd 2>/dev/null | \
sed -e 's/[^:]*:[^:]*://' -e 's/:.*$//'`
if [ ".$userid" = . ]; then
userid=`(getent passwd ${username}) 2>/dev/null | \
userid=`(ypcat passwd) 2>/dev/null |
egrep "^${username}:" | \
sed -e 's/[^:]*:[^:]*://' -e 's/:.*$//'`
if [ ".$userid" = . ]; then
userid=`grep "^${username}:" /etc/passwd 2>/dev/null | \
sed -e 's/[^:]*:[^:]*://' -e 's/:.*$//'`
if [ ".$userid" = . ]; then
userid=`(ypcat passwd) 2>/dev/null |
grep "^${username}:" | \
sed -e 's/[^:]*:[^:]*://' -e 's/:.*$//'`
if [ ".$userid" = . ]; then
userid='?'
fi
fi
userid='?'
fi
fi
fi
fi
fi
# determine (primary) group id
groupid=''
if [ ".$opt_e" = .yes ] && [ ".`echo $text | grep '%[gG]'`" != . ]; then
groupid="`(id -g ${username}) 2>/dev/null`"
if [ ".$opt_e" = .yes -a ".`echo $text | egrep '%[gG]'`" != . ]; then
groupid=`egrep "^${username}:" /etc/passwd 2>/dev/null | \
sed -e 's/[^:]*:[^:]*:[^:]*://' -e 's/:.*$//'`
if [ ".$groupid" = . ]; then
str="`(id) 2>/dev/null`"
if [ ".`echo $str | grep 'gid[ ]*=[ ]*[0-9]*('`" != . ]; then
groupid=`echo $str | sed -e 's/^.*gid[ ]*=[ ]*//' -e 's/(.*$//'`
fi
groupid=`(ypcat passwd) 2>/dev/null | egrep "^${username}:" | \
sed -e 's/[^:]*:[^:]*:[^:]*://' -e 's/:.*$//'`
if [ ".$groupid" = . ]; then
groupid=`(getent passwd ${username}) 2>/dev/null | \
sed -e 's/[^:]*:[^:]*:[^:]*://' -e 's/:.*$//'`
if [ ".$groupid" = . ]; then
groupid=`grep "^${username}:" /etc/passwd 2>/dev/null | \
sed -e 's/[^:]*:[^:]*:[^:]*://' -e 's/:.*$//'`
if [ ".$groupid" = . ]; then
groupid=`(ypcat passwd) 2>/dev/null | grep "^${username}:" | \
sed -e 's/[^:]*:[^:]*:[^:]*://' -e 's/:.*$//'`
if [ ".$groupid" = . ]; then
groupid='?'
fi
fi
fi
groupid='?'
fi
fi
fi
# determine (primary) group name
groupname=''
if [ ".$opt_e" = .yes ] && [ ".`echo $text | grep '%g'`" != . ]; then
groupname="`(id -gn ${username}) 2>/dev/null`"
if [ ".$opt_e" = .yes -a ".`echo $text | egrep '%g'`" != . ]; then
groupname=`egrep "^[^:]*:[^:]*:${groupid}:" /etc/group 2>/dev/null | \
sed -e 's/:.*$//'`
if [ ".$groupname" = . ]; then
str="`(id) 2>/dev/null`"
if [ ".`echo $str | grep 'gid[ ]*=[ ]*[0-9]*('`" != . ]; then
groupname=`echo $str | sed -e 's/^.*gid[ ]*=[ ]*[0-9]*(//' -e 's/).*$//'`
fi
groupname=`(ypcat group) 2>/dev/null | \
egrep "^[^:]*:[^:]*:${groupid}:" | \
sed -e 's/:.*$//'`
if [ ".$groupname" = . ]; then
groupname=`(getent group) 2>/dev/null | \
grep "^[^:]*:[^:]*:${groupid}:" | \
sed -e 's/:.*$//'`
if [ ".$groupname" = . ]; then
groupname=`grep "^[^:]*:[^:]*:${groupid}:" /etc/group 2>/dev/null | \
sed -e 's/:.*$//'`
if [ ".$groupname" = . ]; then
groupname=`(ypcat group) 2>/dev/null | \
grep "^[^:]*:[^:]*:${groupid}:" | \
sed -e 's/:.*$//'`
if [ ".$groupname" = . ]; then
groupname='?'
fi
fi
fi
groupname='?'
fi
fi
fi
# determine host and domain name
hostname=''
domainname=''
if [ ".$opt_e" = .yes ] && [ ".`echo $text | grep '%h'`" != . ]; then
if [ ".$opt_e" = .yes -a ".`echo $text | egrep '%h'`" != . ]; then
hostname="`(uname -n) 2>/dev/null |\
awk '{ printf("%s", $1); }'`"
if [ ".$hostname" = . ]; then
@@ -640,16 +565,16 @@ echo )
;;
esac
fi
if [ ".$opt_e" = .yes ] && [ ".`echo $text | grep '%d'`" != . ]; then
if [ ".$opt_e" = .yes -a ".`echo $text | egrep '%d'`" != . ]; then
if [ ".$domainname" = . ]; then
if [ -f /etc/resolv.conf ]; then
domainname="`grep '^[ ]*domain' /etc/resolv.conf | sed -e 'q' |\
domainname="`egrep '^[ ]*domain' /etc/resolv.conf | sed -e 'q' |\
sed -e 's/.*domain//' \
-e 's/^[ ]*//' -e 's/^ *//' -e 's/^ *//' \
-e 's/^\.//' -e 's/^/./' |\
awk '{ printf("%s", $1); }'`"
if [ ".$domainname" = . ]; then
domainname="`grep '^[ ]*search' /etc/resolv.conf | sed -e 'q' |\
domainname="`egrep '^[ ]*search' /etc/resolv.conf | sed -e 'q' |\
sed -e 's/.*search//' \
-e 's/^[ ]*//' -e 's/^ *//' -e 's/^ *//' \
-e 's/ .*//' -e 's/ .*//' \
@@ -659,13 +584,13 @@ echo )
fi
fi
fi
# determine current time
time_day=''
time_month=''
time_year=''
time_monthname=''
if [ ".$opt_e" = .yes ] && [ ".`echo $text | grep '%[DMYm]'`" != . ]; then
if [ ".$opt_e" = .yes -a ".`echo $text | egrep '%[DMYm]'`" != . ]; then
time_day=`date '+%d'`
time_month=`date '+%m'`
time_year=`date '+%Y' 2>/dev/null`
@@ -691,7 +616,7 @@ echo )
12) time_monthname='Dec' ;;
esac
fi
# expand special ``%x'' constructs
if [ ".$opt_e" = .yes ]; then
text=`echo $seo "$text" |\
@@ -708,7 +633,7 @@ echo )
-e "s/%Y/${time_year}/g" \
-e "s/%m/${time_monthname}/g" 2>/dev/null`
fi
# create output
if [ .$opt_n = .no ]; then
echo $seo "$text"
@@ -721,16 +646,15 @@ echo )
echo dummy | awk '{ printf("%s", TEXT); }' TEXT="$text"
fi
fi
shtool_exit 0
;;
install )
##
## install -- Install a program, script or datafile
## Copyright (c) 1997-2005 Ralf S. Engelschall <rse@engelschall.com>
## Copyright (c) 1997-2002 Ralf S. Engelschall <rse@engelschall.com>
## Originally written for shtool
##
# special case: "shtool install -d <dir> [...]" internally
# maps to "shtool mkdir -f -p -m 755 <dir> [...]"
if [ "$opt_d" = yes ]; then
@@ -748,11 +672,11 @@ install )
cmd="$cmd -t"
fi
for dir in "$@"; do
eval "$cmd $dir" || shtool_exit $?
eval "$cmd $dir" || exit $?
done
shtool_exit 0
exit 0
fi
# determine source(s) and destination
argc=$#
srcs=""
@@ -761,30 +685,30 @@ install )
shift
done
dstpath="$1"
# type check for destination
dstisdir=0
if [ -d $dstpath ]; then
dstpath=`echo "$dstpath" | sed -e 's:/$::'`
dstisdir=1
fi
# consistency check for destination
if [ $argc -gt 2 ] && [ $dstisdir = 0 ]; then
if [ $argc -gt 2 -a $dstisdir = 0 ]; then
echo "$msgprefix:Error: multiple sources require destination to be directory" 1>&2
shtool_exit 1
exit 1
fi
# iterate over all source(s)
for src in $srcs; do
dst=$dstpath
# if destination is a directory, append the input filename
if [ $dstisdir = 1 ]; then
dstfile=`echo "$src" | sed -e 's;.*/\([^/]*\)$;\1;'`
dst="$dst/$dstfile"
fi
# check for correct arguments
if [ ".$src" = ".$dst" ]; then
echo "$msgprefix:Warning: source and destination are the same - skipped" 1>&2
@@ -794,17 +718,17 @@ install )
echo "$msgprefix:Warning: source \`$src' is a directory - skipped" 1>&2
continue
fi
# make a temp file name in the destination directory
dsttmp=`echo $dst |\
sed -e 's;[^/]*$;;' -e 's;\(.\)/$;\1;' -e 's;^$;.;' \
-e "s;\$;/#INST@$$#;"`
# verbosity
if [ ".$opt_v" = .yes ]; then
echo "$src -> $dst" 1>&2
fi
# copy or move the file name to the temp name
# (because we might be not allowed to change the source)
if [ ".$opt_C" = .yes ]; then
@@ -814,14 +738,14 @@ install )
if [ ".$opt_t" = .yes ]; then
echo "cp $src $dsttmp" 1>&2
fi
cp $src $dsttmp || shtool_exit $?
cp $src $dsttmp || exit $?
else
if [ ".$opt_t" = .yes ]; then
echo "mv $src $dsttmp" 1>&2
fi
mv $src $dsttmp || shtool_exit $?
mv $src $dsttmp || exit $?
fi
# adjust the target file
if [ ".$opt_e" != . ]; then
sed='sed'
@@ -831,35 +755,34 @@ install )
sed="$sed -e '$e'"
done
cp $dsttmp $dsttmp.old
chmod u+w $dsttmp
eval "$sed <$dsttmp.old >$dsttmp" || shtool_exit $?
eval "$sed <$dsttmp.old >$dsttmp" || exit $?
rm -f $dsttmp.old
fi
if [ ".$opt_s" = .yes ]; then
if [ ".$opt_t" = .yes ]; then
echo "strip $dsttmp" 1>&2
fi
strip $dsttmp || shtool_exit $?
strip $dsttmp || exit $?
fi
if [ ".$opt_o" != . ]; then
if [ ".$opt_t" = .yes ]; then
echo "chown $opt_o $dsttmp" 1>&2
fi
chown $opt_o $dsttmp || shtool_exit $?
chown $opt_o $dsttmp || exit $?
fi
if [ ".$opt_g" != . ]; then
if [ ".$opt_t" = .yes ]; then
echo "chgrp $opt_g $dsttmp" 1>&2
fi
chgrp $opt_g $dsttmp || shtool_exit $?
chgrp $opt_g $dsttmp || exit $?
fi
if [ ".$opt_m" != ".-" ]; then
if [ ".$opt_t" = .yes ]; then
echo "chmod $opt_m $dsttmp" 1>&2
fi
chmod $opt_m $dsttmp || shtool_exit $?
chmod $opt_m $dsttmp || exit $?
fi
# determine whether to do a quick install
# (has to be done _after_ the strip was already done)
quick=no
@@ -870,7 +793,7 @@ install )
fi
fi
fi
# finally, install the file to the real destination
if [ $quick = yes ]; then
if [ ".$opt_t" = .yes ]; then
@@ -884,21 +807,21 @@ install )
rm -f $dst && mv $dsttmp $dst
fi
done
shtool_exit 0
;;
mkdir )
##
## mkdir -- Make one or more directories
## Copyright (c) 1996-2005 Ralf S. Engelschall <rse@engelschall.com>
## Copyright (c) 1996-2002 Ralf S. Engelschall <rse@engelschall.com>
## Originally written for public domain by Noah Friedman <friedman@prep.ai.mit.edu>
## Cleaned up and enhanced for shtool
##
errstatus=0
for p in ${1+"$@"}; do
# if the directory already exists...
if [ -d "$p" ]; then
if [ ".$opt_f" = .no ] && [ ".$opt_p" = .no ]; then
if [ ".$opt_f" = .no -a ".$opt_p" = .no ]; then
echo "$msgprefix:Error: directory already exists: $p" 1>&2
errstatus=1
break
@@ -972,32 +895,32 @@ mkdir )
done
fi
done
shtool_exit $errstatus
exit $errstatus
;;
path )
##
## path -- Deal with program paths
## Copyright (c) 1998-2005 Ralf S. Engelschall <rse@engelschall.com>
## Copyright (c) 1998-2002 Ralf S. Engelschall <rse@engelschall.com>
## Originally written for Apache
##
namelist="$*"
# check whether the test command supports the -x option
if [ -x /bin/sh ] 2>/dev/null; then
minusx="-x"
else
minusx="-r"
fi
# split path string
paths="`echo $opt_p |\
sed -e 's/^:/.:/' \
-e 's/::/:.:/g' \
-e 's/:$/:./' \
-e 's/:/ /g'`"
# SPECIAL REQUEST
# translate forward to reverse path
if [ ".$opt_r" = .yes ]; then
@@ -1010,25 +933,25 @@ path )
done
fi
echo $rp | sed -e 's:/$::'
shtool_exit 0
exit 0
fi
# SPECIAL REQUEST
# strip out directory or base name
if [ ".$opt_d" = .yes ]; then
echo "$namelist" |\
sed -e 's;[^/]*$;;' -e 's;\(.\)/$;\1;'
shtool_exit 0
exit 0
fi
if [ ".$opt_b" = .yes ]; then
echo "$namelist" |\
sed -e 's;.*/\([^/]*\)$;\1;'
shtool_exit 0
exit 0
fi
# MAGIC SITUATION
# Perl Interpreter (perl)
if [ ".$opt_m" = .yes ] && [ ".$namelist" = .perl ]; then
if [ ".$opt_m" = .yes -a ".$namelist" = .perl ]; then
rm -f $tmpfile >/dev/null 2>&1
touch $tmpfile
found=0
@@ -1037,7 +960,7 @@ path )
dir=`echo $dir | sed -e 's;/*$;;'`
nc=99
for name in perl perl5 miniperl; do
if [ $minusx "$dir/$name" ] && [ ! -d "$dir/$name" ]; then
if [ $minusx "$dir/$name" -a ! -d "$dir/$name" ]; then
perl="$dir/$name"
pv=`$perl -e 'printf("%.3f", $]);'`
echo "$pv:$pc:$nc:$perl" >>$tmpfile
@@ -1051,15 +974,15 @@ path )
perl="`cat $tmpfile | sort -r -u | sed -e 'q' | cut -d: -f4`"
rm -f $tmpfile >/dev/null 2>&1
echo "$perl"
shtool_exit 0
exit 0
fi
rm -f $tmpfile >/dev/null 2>&1
shtool_exit 1
exit 1
fi
# MAGIC SITUATION
# C pre-processor (cpp)
if [ ".$opt_m" = .yes ] && [ ".$namelist" = .cpp ]; then
if [ ".$opt_m" = .yes -a ".$namelist" = .cpp ]; then
echo >$tmpfile.c "#include <assert.h>"
echo >>$tmpfile.c "Syntax Error"
# 1. try the standard cc -E approach
@@ -1075,7 +998,7 @@ path )
# 3. try a standalone cpp command in path and lib dirs
for path in $paths /lib /usr/lib /usr/local/lib; do
path=`echo $path | sed -e 's;/*$;;'`
if [ $minusx "$path/cpp" ] && [ ! -d "$path/cpp" ]; then
if [ $minusx "$path/cpp" -a ! -d "$path/cpp" ]; then
cpp="$path/cpp"
break
fi
@@ -1094,30 +1017,30 @@ path )
rm -f $tmpfile.c $tmpfile.out >/dev/null 2>&1
if [ ".$cpp" != . ]; then
echo "$cpp"
shtool_exit 0
exit 0
fi
shtool_exit 1
exit 1
fi
# STANDARD SITUATION
# iterate over names
for name in $namelist; do
# iterate over paths
for path in $paths; do
path=`echo $path | sed -e 's;/*$;;'`
if [ $minusx "$path/$name" ] && [ ! -d "$path/$name" ]; then
if [ $minusx "$path/$name" -a ! -d "$path/$name" ]; then
if [ ".$opt_s" != .yes ]; then
echo "$path/$name"
fi
shtool_exit 0
exit 0
fi
done
done
shtool_exit 1
exit 1
;;
esac
shtool_exit 0
exit 0
##EOF##
+11 -56
View File
@@ -1,69 +1,24 @@
#!/bin/sh
# $Id$
eval `grep '^EXTRA_VERSION=' configure.in`
case "$EXTRA_VERSION" in
*-dev)
dev=1
;;
*)
dev=0
;;
esac
devok=0
debug=no
while test $# -gt 0; do
if test "$1" = "--force"; then
devok=1
echo "Forcing buildconf"
fi
if test "$1" = "--copy"; then
automake_flags=--copy
fi
if test "$1" = "--debug"; then
debug=yes
fi
if test "$1" = "--ZendEngine2"; then
ZENDDIR=ZendEngine2
echo "Using Zend Engine 2 code"
fi
shift
shift
done
if test "$dev" = "0" -a "$devok" = "0"; then
echo "You should not run buildconf in a release package."
echo "use buildconf --force to override this check."
exit 1
fi
if test -z "$ZENDDIR"; then
if grep "PHP_MAJOR_VERSION 5" main/php_version.h >/dev/null; then
v=5
else
v=4
fi
if test "$v" = "5"; then
if test -r "Zend/OBJECTS2_HOWTO"; then
:
else
mv Zend ZendEngine1 2>/dev/null
mv ZendEngine2 Zend
fi
else
if test -r "Zend/zend_execute_globals.h"; then
:
else
mv Zend ZendEngine2 2>/dev/null
mv ZendEngine1 Zend
fi
fi
ZENDDIR=Zend
echo "using default Zend directory"
ZENDDIR=Zend
echo "using default Zend directory"
fi
rm -f generated_lists
if test "$debug" = "yes"; then
${MAKE:-make} -s -f build/build.mk ZENDDIR="$ZENDDIR" SUPPRESS_WARNINGS=""
else
${MAKE:-make} -s -f build/build.mk ZENDDIR="$ZENDDIR"
fi
${MAKE:-make} -s -f build/build.mk AMFLAGS="$automake_flags" ZENDDIR="$ZENDDIR"
+60 -144
View File
@@ -1,9 +1,9 @@
#! /bin/sh
# Attempt to guess a canonical system name.
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
# 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
# 2000, 2001, 2002 Free Software Foundation, Inc.
timestamp='2003-01-10'
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,41 +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.
# Portable tmp directory creation inspired by the Autoconf team.
set_cc_for_build='
trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ;
trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ;
: ${TMPDIR=/tmp} ;
{ tmp=`(umask 077 && mktemp -d -q "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
{ test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } ||
{ echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ;
dummy=$tmp/dummy ;
tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ;
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 $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 ;'
esac'
# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
# (ghazi@noc.rutgers.edu 1994-08-24)
@@ -179,18 +168,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
;;
esac
# The OS release
# Debian GNU/NetBSD machines have a different userland, and
# thus, need a distinct triplet. However, they do not need
# kernel version information, so it can be replaced with a
# suitable tag, in the style of linux-gnu.
case "${UNAME_VERSION}" in
Debian*)
release='-gnu'
;;
*)
release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
;;
esac
release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
# Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
# contains redundant information, the shorter form:
# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
@@ -235,9 +213,6 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
*:OpenBSD:*:*)
echo ${UNAME_MACHINE}-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
*:MicroBSD:*:*)
echo ${UNAME_MACHINE}-unknown-microbsd${UNAME_RELEASE}
exit 0 ;;
alpha:OSF1:*:*)
if test $UNAME_RELEASE = "V4.0"; then
UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
@@ -246,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:
@@ -272,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"
;;
@@ -296,11 +271,9 @@ EOF
2-1307)
UNAME_MACHINE="alphaev68"
;;
3-1307)
UNAME_MACHINE="alphaev7"
;;
esac
fi
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*:*)
@@ -341,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 ;;
@@ -451,18 +420,16 @@ EOF
exit (-1);
}
EOF
$CC_FOR_BUILD -o $dummy $dummy.c \
&& $dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \
&& exit 0
$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 | Synergy:PowerMAX_OS:*:*)
Night_Hawk:*:*:PowerMAX_OS)
echo powerpc-harris-powermax
exit 0 ;;
Night_Hawk:Power_UNIX:*:*)
@@ -537,7 +504,8 @@ EOF
exit(0);
}
EOF
$CC_FOR_BUILD -o $dummy $dummy.c && $dummy && exit 0
$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
@@ -635,21 +603,11 @@ EOF
exit (0);
}
EOF
(CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
test -z "$HP_ARCH" && HP_ARCH=hppa
(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
fi ;;
esac
if [ ${HP_ARCH} = "hppa2.0w" ]
then
# avoid double evaluation of $set_cc_for_build
test -n "$CC_FOR_BUILD" || eval $set_cc_for_build
if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E -) | grep __LP64__ >/dev/null
then
HP_ARCH="hppa2.0w"
else
HP_ARCH="hppa64"
fi
fi
echo ${HP_ARCH}-hp-hpux${HPUX_REV}
exit 0 ;;
ia64:HP-UX:*:*)
@@ -683,7 +641,8 @@ EOF
exit (0);
}
EOF
$CC_FOR_BUILD -o $dummy $dummy.c && $dummy && exit 0
$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:*:* )
@@ -741,15 +700,15 @@ EOF
CRAY*TS:*:*:*)
echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
exit 0 ;;
CRAY*T3D:*:*:*)
echo alpha-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
exit 0 ;;
CRAY*T3E:*:*:*)
echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
exit 0 ;;
CRAY*SV1:*:*:*)
echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
exit 0 ;;
*:UNICOS/mp:*:*)
echo nv1-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
exit 0 ;;
F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
@@ -766,18 +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=`
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
@@ -789,16 +737,13 @@ EOF
echo ${UNAME_MACHINE}-pc-pw32
exit 0 ;;
x86:Interix*:3*)
echo i586-pc-interix3
exit 0 ;;
[345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
echo i${UNAME_MACHINE}-pc-mks
echo i386-pc-interix3
exit 0 ;;
i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
# How do we know it's Interix rather than the generic POSIX subsystem?
# It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
# UNAME_MACHINE based on the output of uname instead of i386?
echo i586-pc-interix
echo i386-pc-interix
exit 0 ;;
i*:UWIN*:*)
echo ${UNAME_MACHINE}-pc-uwin
@@ -841,26 +786,8 @@ EOF
#endif
EOF
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=`
test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0
;;
mips64:Linux:*:*)
eval $set_cc_for_build
sed 's/^ //' << EOF >$dummy.c
#undef CPU
#undef mips64
#undef mips64el
#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
CPU=mips64el
#else
#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
CPU=mips64
#else
CPU=
#endif
#endif
EOF
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=`
test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0
rm -f $dummy.c
test x"${CPU}" != x && echo "${CPU}-pc-linux-gnu" && exit 0
;;
ppc:Linux:*:*)
echo powerpc-unknown-linux-gnu
@@ -922,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 ;;
@@ -955,6 +882,7 @@ EOF
#endif
EOF
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=`
rm -f $dummy.c
test x"${LIBC}" != x && echo "${UNAME_MACHINE}-pc-linux-${LIBC}" && exit 0
test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0
;;
@@ -972,23 +900,6 @@ EOF
# Use sysv4.2uw... so that sysv4* matches it.
echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
exit 0 ;;
i*86:OS/2:*:*)
# If we were able to find `uname', then EMX Unix compatibility
# is probably installed.
echo ${UNAME_MACHINE}-pc-os2-emx
exit 0 ;;
i*86:XTS-300:*:STOP)
echo ${UNAME_MACHINE}-unknown-stop
exit 0 ;;
i*86:atheos:*:*)
echo ${UNAME_MACHINE}-unknown-atheos
exit 0 ;;
i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*)
echo i386-unknown-lynxos${UNAME_RELEASE}
exit 0 ;;
i*86:*DOS:*:*)
echo ${UNAME_MACHINE}-pc-msdosdjgpp
exit 0 ;;
i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*)
UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
@@ -1023,6 +934,9 @@ EOF
echo ${UNAME_MACHINE}-pc-sysv32
fi
exit 0 ;;
i*86:*DOS:*:*)
echo ${UNAME_MACHINE}-pc-msdosdjgpp
exit 0 ;;
pc:*:*:*)
# Left here for compatibility:
# uname -m prints for DJGPP always 'pc', but it prints nothing about
@@ -1046,15 +960,9 @@ EOF
# "miniframe"
echo m68010-convergent-sysv
exit 0 ;;
mc68k:UNIX:SYSTEM5:3.51m)
echo m68k-convergent-sysv
exit 0 ;;
M680?0:D-NIX:5.3:*)
echo m68k-diab-dnix
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 | SDS2:*:4.0:3.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)
OS_REL=''
test -r /etc/.relid \
&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
@@ -1071,6 +979,9 @@ EOF
mc68030:UNIX_System_V:4.*:*)
echo m68k-atari-sysv4
exit 0 ;;
i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*)
echo i386-unknown-lynxos${UNAME_RELEASE}
exit 0 ;;
TSUNAMI:LynxOS:2.*:*)
echo sparc-unknown-lynxos${UNAME_RELEASE}
exit 0 ;;
@@ -1142,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 ;;
@@ -1152,11 +1060,7 @@ EOF
echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
exit 0 ;;
*:Darwin:*:*)
case `uname -p` in
*86) UNAME_PROCESSOR=i686 ;;
powerpc) UNAME_PROCESSOR=powerpc ;;
esac
echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
echo `uname -p`-apple-darwin${UNAME_RELEASE}
exit 0 ;;
*:procnto*:*:* | *:QNX:[0123456789]*:*)
UNAME_PROCESSOR=`uname -p`
@@ -1169,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:*:*)
@@ -1192,6 +1096,11 @@ EOF
fi
echo ${UNAME_MACHINE}-unknown-plan9
exit 0 ;;
i*86:OS/2:*:*)
# If we were able to find `uname', then EMX Unix compatibility
# is probably installed.
echo ${UNAME_MACHINE}-pc-os2-emx
exit 0 ;;
*:TOPS-10:*:*)
echo pdp10-unknown-tops10
exit 0 ;;
@@ -1210,6 +1119,12 @@ EOF
*:ITS:*:*)
echo pdp10-unknown-its
exit 0 ;;
i*86:XTS-300:*:STOP)
echo ${UNAME_MACHINE}-unknown-stop
exit 0 ;;
i*86:atheos:*:*)
echo ${UNAME_MACHINE}-unknown-atheos
exit 0 ;;
esac
#echo '(No uname command or uname output not recognized.)' 1>&2
@@ -1330,7 +1245,8 @@ main ()
}
EOF
$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && $dummy && exit 0
$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
+61 -87
View File
@@ -1,9 +1,9 @@
#! /bin/sh
# Configuration validation subroutine script.
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
# 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
# 2000, 2001, 2002 Free Software Foundation, Inc.
timestamp='2003-01-03'
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* | netbsd*-gnu* | storm-chaos* | os2-emx* | rtmk-nova*)
nto-qnx* | linux-gnu* | storm-chaos* | os2-emx* | windows32-* | rtmk-nova*)
os=-$maybe_os
basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
;;
@@ -229,37 +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 \
| mipsisa32r2 | mipsisa32r2el \
| 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 \
| msp430 \
| ns16k | ns32k \
| openrisc | or32 \
| pdp10 | pdp11 | pj | pjl \
| powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
| pyramid \
| s390 | s390x \
| 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 \
@@ -297,45 +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-* \
| mipsisa32r2-* | mipsisa32r2el-* \
| mipsisa64-* | mipsisa64el-* \
| mipsisa64sb1-* | mipsisa64sb1el-* \
| mipsisa64sr71k-* | mipsisa64sr71kel-* \
| mipstx39-* | mipstx39el-* \
| msp430-* \
| none-* | np1-* | nv1-* | ns16k-* | ns32k-* \
| 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-* \
| s390-* | s390x-* \
| 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-* \
@@ -722,10 +695,6 @@ case $basic_machine in
np1)
basic_machine=np1-gould
;;
nv1)
basic_machine=nv1-cray
os=-unicosmp
;;
nsr-tandem)
basic_machine=nsr-tandem
;;
@@ -759,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)
@@ -786,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,16 +791,16 @@ case $basic_machine in
rtpc | rtpc-*)
basic_machine=romp-ibm
;;
s390 | s390-*)
basic_machine=s390-ibm
;;
s390x | s390x-*)
basic_machine=s390x-ibm
;;
sa29200)
basic_machine=a29k-amd
os=-udi
;;
sb1)
basic_machine=mipsisa64sb1-unknown
;;
sb1el)
basic_machine=mipsisa64sb1el-unknown
;;
sequent)
basic_machine=i386-sequent
;;
@@ -897,7 +866,7 @@ case $basic_machine in
sun386 | sun386i | roadrunner)
basic_machine=i386-sun
;;
sv1)
sv1)
basic_machine=sv1-cray
os=-unicos
;;
@@ -905,6 +874,10 @@ case $basic_machine in
basic_machine=i386-sequent
os=-dynix
;;
t3d)
basic_machine=alpha-cray
os=-unicos
;;
t3e)
basic_machine=alphaev5-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
@@ -977,7 +946,11 @@ case $basic_machine in
basic_machine=hppa1.1-winbond
os=-proelf
;;
xps | xps100)
windows32)
basic_machine=i386-pc
os=-windows32-msvcrt
;;
xps | xps100)
basic_machine=xps100-honeywell
;;
ymp)
@@ -1023,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)
@@ -1032,7 +1005,7 @@ case $basic_machine in
sparc | sparcv9 | sparcv9b)
basic_machine=sparc-sun
;;
cydra)
cydra)
basic_machine=cydra-cydrome
;;
orion)
@@ -1047,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.
;;
@@ -1109,12 +1086,11 @@ case $os in
| -chorusos* | -chorusrdb* \
| -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
| -mingw32* | -linux-gnu* | -uxpv* | -beos* | -mpeix* | -udk* \
| -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
| -interix* | -uwin* | -rhapsody* | -darwin* | -opened* \
| -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
| -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
| -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
| -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
| -powermax* | -dnix* | -microbsd*)
| -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* | -powermax*)
# Remember, each alternative MUST END IN *, to match a version number.
;;
-qnx*)
@@ -1126,10 +1102,8 @@ case $os in
;;
esac
;;
-nto-qnx*)
;;
-nto*)
os=`echo $os | sed -e 's|nto|nto-qnx|'`
os=-nto-qnx
;;
-sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \
| -windows* | -osx | -abug | -netware* | -os9* | -beos* \
@@ -1181,7 +1155,7 @@ case $os in
os=-rtmk-nova
;;
-ns2 )
os=-nextstep2
os=-nextstep2
;;
-nsk*)
os=-nsk
@@ -1220,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)
;;
@@ -1258,7 +1232,7 @@ case $basic_machine in
pdp10-*)
os=-tops20
;;
pdp11-*)
pdp11-*)
os=-none
;;
*-dec | vax-*)
@@ -1351,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)
+143 -308
View File
@@ -30,25 +30,28 @@ 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'"
done
PHP_CANONICAL_HOST
AC_CANONICAL_HOST
AC_CONFIG_HEADER(main/php_config.h)
MAJOR_VERSION=4
MINOR_VERSION=4
RELEASE_VERSION=3
EXTRA_VERSION="RC2"
MINOR_VERSION=3
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
AC_DEFUN([PHP_EXT_BUILDDIR],[ext/$1])dnl
AC_DEFUN([PHP_EXT_DIR],[ext/$1])dnl
AC_DEFUN([PHP_EXT_SRCDIR],[$abs_srcdir/ext/$1])dnl
AC_DEFUN([PHP_ALWAYS_SHARED],[])dnl
AC_DEFUN(PHP_EXT_BUILDDIR,[ext/$1])dnl
AC_DEFUN(PHP_EXT_DIR,[ext/$1])dnl
AC_DEFUN(PHP_EXT_SRCDIR,[$abs_srcdir/ext/$1])dnl
AC_DEFUN(PHP_ALWAYS_SHARED,[])dnl
dnl Setting up the PHP version based on the information above.
dnl -------------------------------------------------------------------------
@@ -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 -------------------------------------------------------------------------
@@ -81,22 +85,18 @@ if test -n "$with_apache" && test -n "$with_apxs"; then
AC_MSG_ERROR([--with-apache and --with-apxs cannot be used together])
fi
if test -n "$with_apxs2filter" && test -n "$with_apxs2"; then
AC_MSG_ERROR([--with-apxs2filter and --with-apxs2 cannot be used together])
fi
dnl Settings we want to make before the checks.
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
@@ -131,7 +131,7 @@ dnl AC_PROG_CXXCPP
dnl check for -R, etc. switch
PHP_RUNPATH_SWITCH
PHP_PROG_RE2C
AC_PROG_RANLIB
AC_PROG_LN_S
AC_PROG_AWK
AC_PROG_YACC
@@ -139,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}" -ne "1" -o "(" "${2}" != "28" -a "${2}" != "35" -a "${2}" != "75" -a "${2}" != "875" ")"; then
AC_MSG_WARN(You will need bison 1.28, 1.35, 1.75 or 1.875 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
@@ -159,37 +159,19 @@ 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
dnl Check whether byte ordering is bigendian
PHP_C_BIGENDIAN
AC_MSG_RESULT(${1}.${2}.${3} (ok))
dnl Platform-specific compile settings.
dnl -------------------------------------------------------------------------
dnl See bug #28605
case $host_cpu in
alpha*)
if test "$GCC" = "yes"; then
CFLAGS="$CFLAGS -mieee"
else
CFLAGS="$CFLAGS -ieee"
fi
;;
esac
dnl if host_alias is empty, ac_cv_host_alias may still have the info
if test -z "$host_alias"; then
host_alias=$ac_cv_host_alias
fi
case $host_alias in
*solaris*)
@@ -202,42 +184,12 @@ case $host_alias in
CPPFLAGS="$CPPFLAGS -D_BSD_TIMEOFDAY_FLAVOR";;
*darwin*|*rhapsody*)
CPPFLAGS="$CPPFLAGS -no-cpp-precomp"
AC_DEFINE(BIND_8_COMPAT, 1, [Enabling BIND8 compatibility for Panther])
php_multiple_shlib_versions_ok=yes;;
*beos*)
beos_threads=1
LIBS="$LIBS -lbe -lroot";;
*mips*)
CPPFLAGS="$CPPFLAGS -D_XPG_IV";;
*hpux*)
if test "$GCC" = "yes"; then
CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE_EXTENDED"
fi
;;
*netware*)
PHP_BUILD_PROGRAM
PHP_ADD_SOURCES(/main, internal_functions.c,,PHP_GLOBAL_OBJS)
PHP_ADD_SOURCES(win32, sendmail.c, -I$CFLAGS, PHP_GLOBAL_OBJS)
PHP4LIB_SHARED_LIBADD=\$\(EXTRA_LIBS\)
EXTENSION_DIR=sys:/php$MAJOR_VERSION/ext
PHP_SUBST(PHP4LIB_SHARED_LIBADD)
PHP_SHARED_MODULE(php4lib, PHP_GLOBAL_OBJS, netware)
;;
esac
# Disable PIC mode by default where it is known to be safe to do so,
# to avoid the performance hit from the lost register
AC_MSG_CHECKING([whether to force non-PIC code in shared modules])
case $host_alias in
i?86-*-linux*|i?86-*-freebsd*)
if test "${with_pic+set}" != "set" || test "$with_pic" = "no"; then
with_pic=no
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
fi
;;
*) AC_MSG_RESULT(no) ;;
esac
@@ -279,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])
@@ -320,6 +272,7 @@ if test -d /usr/pkg/include -a -d /usr/pkg/lib ; then
CPPFLAGS="$CPPFLAGS -I/usr/pkg/include"
LDFLAGS="$LDFLAGS -L/usr/pkg/lib"
fi
INCLUDES="$INCLUDES -I\$(top_builddir)/Zend"
test -d /usr/ucblib && PHP_ADD_LIBPATH(/usr/ucblib)
@@ -359,16 +312,17 @@ dnl -------------------------------------------------------------------------
dnl Checks for header files.
AC_HEADER_STDC
AC_HEADER_DIRENT
dnl In QNX opendir resides in libc but dirent.h is still required
if test "`uname -s 2>/dev/null`" != "QNX"; then
AC_HEADER_DIRENT
else
AC_CHECK_HEADERS(dirent.h)
fi
PHP_MISSING_FCLOSE_DECL
dnl QNX requires unix.h to allow functions in libunix to work properly
AC_CHECK_HEADERS([ \
inttypes.h \
stdint.h \
dirent.h \
ApplicationServices/ApplicationServices.h \
sys/param.h \
sys/types.h \
sys/time.h \
netinet/in.h \
@@ -412,11 +366,7 @@ unix.h \
utime.h \
sys/utsname.h \
sys/ipc.h \
dlfcn.h
],[],[],[
#ifdef HAVE_SYS_PARAM_H
#include <sys/param.h>
#endif
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
@@ -432,8 +382,6 @@ dlfcn.h
])
PHP_FOPENCOOKIE
PHP_BROKEN_GETCWD
PHP_BROKEN_GLIBC_FOPEN_APPEND
dnl Checks for typedefs, structures, and compiler characteristics.
dnl -------------------------------------------------------------------------
@@ -445,12 +393,6 @@ PHP_TM_GMTOFF
PHP_STRUCT_FLOCK
PHP_SOCKLEN_T
AC_CHECK_SIZEOF(intmax_t, 0)
AC_CHECK_SIZEOF(size_t, 8)
AC_CHECK_SIZEOF(ssize_t, 8)
AC_CHECK_SIZEOF(ptrdiff_t, 8)
AC_CHECK_SIZEOF(long long, 8)
AC_CHECK_SIZEOF(long long int, 8)
AC_CHECK_SIZEOF(long, 8)
AC_CHECK_SIZEOF(int, 4)
@@ -502,7 +444,6 @@ dnl -------------------------------------------------------------------------
AC_FUNC_VPRINTF
AC_CHECK_FUNCS(
alphasort \
asctime_r \
chroot \
ctime_r \
@@ -531,7 +472,6 @@ memmove \
mkstemp \
mmap \
nl_langinfo \
perror \
poll \
putenv \
realpath \
@@ -539,7 +479,6 @@ random \
rand_r \
regcomp \
res_search \
scandir \
setitimer \
setlocale \
localeconv \
@@ -570,48 +509,10 @@ vsnprintf \
)
dnl Check for getaddrinfo, should be a better way, but...
dnl Also check for working getaddrinfo
AC_CACHE_CHECK([for getaddrinfo], ac_cv_func_getaddrinfo,
[AC_TRY_LINK([#include <netdb.h>],
[struct addrinfo *g,h;g=&h;getaddrinfo("","",g,&g);],
AC_TRY_RUN([
#include <netdb.h>
#include <sys/types.h>
#ifndef AF_INET
# include <sys/socket.h>
#endif
int main(void) {
struct addrinfo *ai, *pai, hints;
memset(&hints, 0, sizeof(hints));
hints.ai_flags = AI_NUMERICHOST;
if (getaddrinfo("127.0.0.1", 0, &hints, &ai) < 0) {
exit(1);
}
if (ai == 0) {
exit(1);
}
pai = ai;
while (pai) {
if (pai->ai_family != AF_INET) {
/* 127.0.0.1/NUMERICHOST should only resolve ONE way */
exit(1);
}
if (pai->ai_addr->sa_family != AF_INET) {
/* 127.0.0.1/NUMERICHOST should only resolve ONE way */
exit(1);
}
pai = pai->ai_next;
}
freeaddrinfo(ai);
exit(0);
}
],ac_cv_func_getaddrinfo=yes, ac_cv_func_getaddrinfo=no),
ac_cv_func_getaddrinfo=no)])
[AC_TRY_COMPILE([#include <netdb.h>],
[struct addrinfo *g,h;g=&h;getaddrinfo("","",g,&g);],
ac_cv_func_getaddrinfo=yes, ac_cv_func_getaddrinfo=no)])
if test "$ac_cv_func_getaddrinfo" = yes; then
AC_DEFINE(HAVE_GETADDRINFO,1,[Define if you have the getaddrinfo function])
fi
@@ -619,8 +520,8 @@ fi
AC_REPLACE_FUNCS(strlcat strlcpy getopt)
AC_FUNC_UTIME_NULL
AC_FUNC_ALLOCA
dnl PHP_AC_BROKEN_SPRINTF
dnl PHP_AC_BROKEN_SNPRINTF
PHP_AC_BROKEN_SPRINTF
PHP_AC_BROKEN_SNPRINTF
PHP_DECLARED_TIMEZONE
PHP_TIME_R_TYPE
PHP_READDIR_R_TYPE
@@ -653,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:])
@@ -703,6 +604,27 @@ if test "$PHP_CONFIG_FILE_SCAN_DIR" = "DEFAULT"; then
PHP_CONFIG_FILE_SCAN_DIR=""
fi
# compatibility
if test -z "$with_pear" && test "$enable_pear" = "no"; then
with_pear=no
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, no)
if test "$PHP_PEAR" != "no" && test "$disable_cli" != "1"; then
install_pear="install-pear install-build install-headers install-programs"
PEAR_INSTALLDIR=$PHP_PEAR
fi
if test "$PHP_PEAR" = "DEFAULT" || test "$PHP_PEAR" = "yes"; then
case $PHP_LAYOUT in
GNU) PEAR_INSTALLDIR=$datadir/pear;;
*) PEAR_INSTALLDIR=$libdir/php;;
esac
fi
test -n "$DEBUG_CFLAGS" && CFLAGS="$CFLAGS $DEBUG_CFLAGS"
PHP_ARG_ENABLE(safe-mode, whether to enable safe mode by default,
@@ -800,19 +722,24 @@ if test "$PHP_IPV6" != "no" && test "$ac_cv_ipv6_support" = yes; then
AC_DEFINE(HAVE_IPV6,1,[Whether to enable IPv6 support])
fi
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
],[
PHP_VERSIONING=no
dnl
dnl OpenSSL configure
dnl
PHP_ARG_WITH(openssl,for OpenSSL support,
[ --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,[ ])
])
AC_MSG_RESULT([$PHP_VERSIONING])
divert(5)
@@ -842,25 +769,40 @@ 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 Extensions post-config
dnl Other settings.
dnl -------------------------------------------------------------------------
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],[
PHP_VERSIONING=$enableval
],[
PHP_VERSIONING=no
])
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
enable_shared=yes
enable_static=yes
unset with_pic
case $php_build_target in
program|static)
@@ -871,95 +813,28 @@ program|static)
;;
shared)
enable_static=no
case $with_pic in
yes) standard_libtool_flag='-prefer-pic';;
no) standard_libtool_flag='-prefer-non-pic';;
esac
standard_libtool_flag=-prefer-pic
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -avoid-version -module"
;;
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 PEAR
dnl -------------------------------------------------------------------------
PHP_HELP_SEPARATOR([PEAR:])
PHP_CONFIGURE_PART(Configuring PEAR)
# compatibility
if test -z "$with_pear" && test "$enable_pear" = "no"; then
with_pear=no
fi
# If CLI is disabled -> disable PEAR
if test "$PHP_SAPI_CLI" = "no"; then
with_pear=no
fi
PHP_ARG_WITH(pear, [whether to install PEAR],
[ --with-pear=DIR Install PEAR in DIR (default PREFIX/lib/php)
--without-pear Do not install PEAR], DEFAULT, yes)
if test "$PHP_PEAR" != "no"; then
dnl
dnl PEAR dependancies
dnl
if test "$PHP_PCRE_REGEX" = "no"; then
pear_error_msg="$pear_error_msg
PEAR requires PCRE to be enabled. Add --with-pcre-regex to the configure line. (or --without-pear)"
fi
if test "$PHP_XML" = "no"; then
pear_error_msg="$pear_error_msg
PEAR requires XML to be enabled. Add --enable-xml to the configure line. (or --without-pear)"
fi
dnl
dnl ext/xmlrpc is not really there yet to be a requirement..
dnl
dnl if test "$PHP_XMLRPC" = "no"; then
dnl pear_error_msg="$pear_error_msg
dnl PEAR requires XML-RPC to be enabled. Add --with-xmlrpc to the configure line. (or --without-pear)"
dnl fi
dnl
if test "$pear_error_msg"; then
AC_MSG_ERROR([$pear_error_msg])
fi
install_pear="install-pear"
PEAR_INSTALLDIR=$PHP_PEAR
if test "$PHP_PEAR" = "DEFAULT" || test "$PHP_PEAR" = "yes"; then
case $PHP_LAYOUT in
GNU) PEAR_INSTALLDIR=$datadir/pear;;
*) PEAR_INSTALLDIR=$libdir/php;;
esac
fi
PHP_ADD_MAKEFILE_FRAGMENT($abs_srcdir/pear/Makefile.frag,$abs_srcdir/pear,pear)
fi
dnl Configuring Zend and TSRM.
dnl -------------------------------------------------------------------------
PHP_HELP_SEPARATOR([Zend:])
PHP_CONFIGURE_PART(Configuring Zend)
LIBZEND_BASIC_CHECKS
LIBZEND_DLSYM_CHECK
LIBZEND_OTHER_CHECKS
TSRM_LIB='TSRM/libtsrm.la'
TSRM_DIR=TSRM
CPPFLAGS="$CPPFLAGS -I\$(top_builddir)/TSRM"
if test "$ZEND_EXPERIMENTAL_ZTS" = "yes"; then
AC_DEFINE(ZTS,1,[ ])
PHP_THREAD_SAFETY=yes
@@ -967,32 +842,25 @@ else
PHP_THREAD_SAFETY=no
fi
INCLUDES="$INCLUDES -I\$(top_builddir)/TSRM"
INCLUDES="$INCLUDES -I\$(top_builddir)/Zend"
if test "$abs_srcdir" != "$abs_builddir"; then
INCLUDES="$INCLUDES -I\$(top_srcdir)/main -I\$(top_srcdir)/Zend"
INCLUDES="$INCLUDES -I\$(top_srcdir)/TSRM -I\$(top_builddir)/"
INCLUDES="$INCLUDES -I\$(top_srcdir)/TSRM"
fi
ZEND_EXTRA_LIBS="$LIBS"
unset LIBS LDFLAGS
PHP_HELP_SEPARATOR([TSRM:])
PHP_CONFIGURE_PART(Configuring TSRM)
TSRM_BASIC_CHECKS
if test "$PHP_THREAD_SAFETY" = "yes"; then
TSRM_THREADS_CHECKS
fi
EXTRA_LDFLAGS="$EXTRA_LDFLAGS $LDFLAGS"
EXTRA_LDFLAGS_PROGRAM="$EXTRA_LDFLAGS_PROGRAM $LDFLAGS"
EXTRA_LIBS="$EXTRA_LIBS $LIBS"
unset LIBS LDFLAGS
test "$prefix" = "NONE" && prefix=/usr/local
test "$exec_prefix" = "NONE" && exec_prefix='${prefix}'
test "$program_prefix" = "NONE" && program_prefix=
test "$program_suffix" = "NONE" && program_suffix=
case $libdir in
'${exec_prefix}/lib')
@@ -1087,24 +955,13 @@ if test -z "$php_ldflags_add_usr_lib"; then
fi
EXTRA_LDFLAGS="$EXTRA_LDFLAGS $PHP_LDFLAGS"
EXTRA_LDFLAGS_PROGRAM="$EXTRA_LDFLAGS_PROGRAM $PHP_LDFLAGS"
PHP_BUILD_DATE=`date '+%Y-%m-%d'`
AC_DEFINE_UNQUOTED(PHP_BUILD_DATE,"$PHP_BUILD_DATE",[PHP build date])
case $host_alias in
*netware*)
PHP_OS="NetWare"
PHP_UNAME="NetWare"
AC_DEFINE_UNQUOTED(PHP_OS,"$PHP_OS",[hardcode for each of the cross compiler host])
AC_DEFINE_UNQUOTED(PHP_UNAME,"$PHP_UNAME",[hardcode for each of the cross compiler host])
;;
*)
PHP_UNAME=`uname -a | xargs`
AC_DEFINE_UNQUOTED(PHP_UNAME,"$PHP_UNAME",[uname -a output])
PHP_OS=`uname | xargs`
AC_DEFINE_UNQUOTED(PHP_OS,"$PHP_OS",[uname output])
;;
esac
PHP_UNAME=`uname -a | xargs`
AC_DEFINE_UNQUOTED(PHP_UNAME,"$PHP_UNAME",[uname -a output])
PHP_OS=`uname | xargs`
AC_DEFINE_UNQUOTED(PHP_OS,"$PHP_OS",[uname output])
if test "$disable_cli" != "1"; then
PHP_CLI_TARGET="\$(SAPI_CLI_PATH)"
@@ -1128,11 +985,8 @@ PHP_SUBST_OLD(php_abs_top_srcdir)
PHP_SUBST(bindir)
PHP_SUBST(exec_prefix)
PHP_SUBST(program_prefix)
PHP_SUBST(program_suffix)
PHP_SUBST(includedir)
PHP_SUBST(libdir)
PHP_SUBST(mandir)
PHP_SUBST(phplibdir)
PHP_SUBST(phptempdir)
PHP_SUBST(prefix)
@@ -1152,9 +1006,9 @@ PHP_SUBST(CXXFLAGS)
PHP_SUBST(CXXFLAGS_CLEAN)
PHP_SUBST(CXX_PHP_COMPILE)
PHP_SUBST_OLD(DEBUG_CFLAGS)
PHP_SUBST(DEFS)
PHP_SUBST_OLD(EXTENSION_DIR)
PHP_SUBST_OLD(EXTRA_LDFLAGS)
PHP_SUBST_OLD(EXTRA_LDFLAGS_PROGRAM)
PHP_SUBST_OLD(EXTRA_LIBS)
PHP_SUBST_OLD(ZEND_EXTRA_LIBS)
PHP_SUBST_OLD(INCLUDES)
@@ -1177,9 +1031,10 @@ PHP_SUBST(PHP_RPATHS)
PHP_SUBST(PHP_SAPI)
PHP_SUBST_OLD(PHP_VERSION)
PHP_SUBST(PROG_SENDMAIL)
PHP_SUBST(RE2C)
PHP_SUBST(SHELL)
PHP_SUBST(SHARED_LIBTOOL)
PHP_SUBST(TSRM_DIR)
PHP_SUBST(TSRM_LIB)
PHP_SUBST(WARNING_LEVEL)
PHP_SUBST(PHP_FRAMEWORKS)
PHP_SUBST(PHP_FRAMEWORKPATH)
@@ -1205,21 +1060,11 @@ if test "$PHP_THREAD_SAFETY" = "yes" && test "$PHP_MYSQL" = "yes"; then
CPPFLAGS="$CPPFLAGS -DTHREAD=1"
fi
dnl
dnl Libtool creation
dnl
PHP_HELP_SEPARATOR([Libtool:])
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 $<'
@@ -1236,19 +1081,10 @@ INLINE_CFLAGS="$INLINE_CFLAGS $standard_libtool_flag"
CXXFLAGS="$CXXFLAGS $standard_libtool_flag"
all_targets='$(OVERALL_TARGET) $(PHP_MODULES) $(PHP_CLI_TARGET)'
install_targets="$install_modules $install_pear install-build install-headers install-programs"
case $PHP_SAPI in
cgi)
install_targets="install-sapi $install_targets"
;;
cli)
install_targets="$PHP_INSTALL_CLI_TARGET $install_targets"
;;
*)
install_targets="install-sapi $PHP_INSTALL_CLI_TARGET $install_targets"
;;
esac
install_targets="install-sapi install-modules $install_pear"
if test "$PHP_SAPI" != "cgi"; then
install_targets="$PHP_INSTALL_CLI_TARGET $install_targets"
fi
PHP_SUBST(all_targets)
PHP_SUBST(install_targets)
@@ -1256,23 +1092,15 @@ 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 \
output.c memory_streams.c user_streams.c)
PHP_ADD_SOURCES(/main, internal_functions.c,, sapi)
case $host_alias in
*netware*)
PHP_ADD_BUILD_DIR(win32)
PHP_ADD_BUILD_DIR(netware)
;;
*)
PHP_ADD_SOURCES(/main, internal_functions_cli.c,, cli)
;;
esac
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, \
@@ -1281,7 +1109,7 @@ PHP_ADD_SOURCES(Zend, \
zend_opcode.c zend_operators.c zend_ptr_stack.c zend_stack.c \
zend_variables.c zend.c zend_API.c zend_extensions.c zend_hash.c \
zend_list.c zend_indent.c zend_builtin_functions.c zend_sprintf.c \
zend_ini.c zend_qsort.c zend_multibyte.c zend_strtod.c)
zend_ini.c zend_qsort.c zend_multibyte.c)
if test -r "$abs_srcdir/Zend/zend_objects.c"; then
PHP_ADD_SOURCES(Zend, zend_objects.c zend_object_handlers.c zend_objects_API.c zend_mm.c)
@@ -1303,7 +1131,8 @@ 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)
PHP_GEN_BUILD_DIRS
@@ -1312,12 +1141,8 @@ PHP_GEN_GLOBAL_MAKEFILE
AC_DEFINE([HAVE_BUILD_DEFS_H], 1, [ ])
$php_shtool mkdir -p pear/scripts
$php_shtool mkdir -p scripts
$php_shtool mkdir -p scripts/man1
ALL_OUTPUT_FILES="php4.spec main/build-defs.h \
scripts/phpize scripts/man1/phpize.1 \
scripts/php-config scripts/man1/php-config.1 \
pear/scripts/phpize pear/scripts/php-config \
$PHP_OUTPUT_FILES"
AC_OUTPUT($ALL_OUTPUT_FILES, [], [
@@ -1326,17 +1151,24 @@ if test "\$CONFIG_FILES" = "$ALL_OUTPUT_FILES" || test "\$CONFIG_FILES" = " $ALL
REDO_ALL=yes
fi
if test ! -f $srcdir/ext/bcmath/number.c; then
echo "creating number.c"
echo "/* Dummy File */" > $srcdir/ext/bcmath/number.c
echo "creating number.h"
echo "/* Dummy File */" > $srcdir/ext/bcmath/number.h
fi
################################################################
# Create configuration headers
#
test -d TSRM || $php_shtool mkdir TSRM
echo '#include <../main/php_config.h>' > TSRM/tsrm_config.h
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>
#include "../main/php_config.h"
#if defined(APACHE) && defined(PHP_API_VERSION)
#undef HAVE_DLFCN_H
#endif
@@ -1419,7 +1251,7 @@ cat <<X
| *** WARNING *** |
| |
| You chose to compile PHP with DB extension. This extension is |
| deprecated and does not support database locking correctly. Please |
| deprecated and does not support databse locking correctly. Please |
| use DBA extension which is a fully operational superset. |
X
fi
@@ -1464,7 +1296,7 @@ X
fi
fi
cat <<X
cat<<X
+--------------------------------------------------------------------+
| License: |
| This software is subject to the PHP License, available in this |
@@ -1479,12 +1311,15 @@ cat <<X
| If your application relies on register_globals being ON, you |
| should explicitly set it to on in your php.ini file. |
| Note that you are strongly encouraged to read |
| http://www.php.net/manual/en/security.globals.php |
| http://www.php.net/manual/en/security.registerglobals.php |
| about the implications of having register_globals set to on, and |
| avoid using it if possible. |
+--------------------------------------------------------------------+
Thank you for using PHP.
X
PHP_CONFIGURE_PART(Thank you for using PHP.)
cat<<X
X
+1 -1
View File
@@ -1,3 +1,3 @@
#! /bin/sh
${MAKE:-make} -f build/build.mk cvsclean-work
${MAKE:-make} -f build/build.mk cvsclean
+26 -54
View File
@@ -2,12 +2,12 @@
+----------------------------------------------------------------------+
| PHP Version 4 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2006 The PHP Group |
| Copyright (c) 1997-2002 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| 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 through the world-wide-web at the following url: |
| http://www.php.net/license/3_01.txt |
| 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. |
@@ -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;
@@ -439,7 +412,7 @@ PHP_FUNCTION(bcsqrt)
}
/* }}} */
/* {{{ proto int bccomp(string left_operand, string right_operand [, int scale])
/* {{{ proto string bccomp(string left_operand, string right_operand [, int scale])
Compares two arbitrary precision numbers */
PHP_FUNCTION(bccomp)
{
@@ -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;
@@ -481,7 +454,7 @@ PHP_FUNCTION(bccomp)
}
/* }}} */
/* {{{ proto bool bcscale(int scale)
/* {{{ proto string bcscale(int scale)
Sets default scale parameter for all bc math functions */
PHP_FUNCTION(bcscale)
{
@@ -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
@@ -7,7 +7,7 @@ PHP_ARG_ENABLE(bcmath, whether to enable bc style precision math functions,
if test "$PHP_BCMATH" != "no"; then
AC_DEFINE(WITH_BCMATH, 1, [Whether you have bcmath])
PHP_NEW_EXTENSION(bcmath, bcmath.c \
PHP_NEW_EXTENSION(bcmath, bcmath.c number.c \
libbcmath/src/add.c libbcmath/src/div.c libbcmath/src/init.c libbcmath/src/neg.c libbcmath/src/outofmem.c libbcmath/src/raisemod.c libbcmath/src/rt.c libbcmath/src/sub.c \
libbcmath/src/compare.c libbcmath/src/divmod.c libbcmath/src/int2num.c libbcmath/src/num2long.c libbcmath/src/output.c libbcmath/src/recmul.c \
libbcmath/src/sqrt.c libbcmath/src/zero.c libbcmath/src/debug.c libbcmath/src/doaddsub.c libbcmath/src/nearzero.c libbcmath/src/num2str.c libbcmath/src/raise.c \
+4 -4
View File
@@ -19,7 +19,7 @@ dnl PARTICULAR PURPOSE.
dnl Usage:
dnl AM_INIT_AUTOMAKE(package,version, [no-define])
AC_DEFUN([AM_INIT_AUTOMAKE],
AC_DEFUN(AM_INIT_AUTOMAKE,
[AC_REQUIRE([AC_PROG_INSTALL])
PACKAGE=[$1]
AC_SUBST(PACKAGE)
@@ -47,7 +47,7 @@ AC_REQUIRE([AC_PROG_MAKE_SET])])
# Check to make sure that the build environment is sane.
#
AC_DEFUN([AM_SANITY_CHECK],
AC_DEFUN(AM_SANITY_CHECK,
[AC_MSG_CHECKING([whether build environment is sane])
# Just in case
sleep 1
@@ -88,7 +88,7 @@ AC_MSG_RESULT(yes)])
dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY)
dnl The program must properly implement --version.
AC_DEFUN([AM_MISSING_PROG],
AC_DEFUN(AM_MISSING_PROG,
[AC_MSG_CHECKING(for working $2)
# Run test in a subshell; some versions of sh will print an error if
# an executable is not found, even if stderr is redirected.
@@ -104,7 +104,7 @@ AC_SUBST($1)])
# Like AC_CONFIG_HEADER, but automatically create stamp file.
AC_DEFUN([AM_CONFIG_HEADER],
AC_DEFUN(AM_CONFIG_HEADER,
[AC_PREREQ([2.12])
AC_CONFIG_HEADER([$1])
dnl When config.status generates a header, we must update the stamp-h file.
+2 -5
View File
@@ -52,12 +52,9 @@ typedef struct bc_struct
in the case of leading zeros generated. */
} bc_struct;
#ifdef HAVE_CONFIG_H
#include "../../config.h"
#endif
#include <php.h>
#include <ext/bcmath/php_bcmath.h>
#include "php.h"
#include "../../php_bcmath.h"
/* The base used in storing the numbers in n_value above.
Currently this MUST be 10. */
+3 -1
View File
@@ -1,7 +1,9 @@
#if PHP_WIN32
#include "../../../../main/config.w32.h"
#elif defined(NETWARE)
#include "config.nw.h"
#else
#include <php_config.h>
#include "php_config.h"
#endif
#include <string.h>
-1
View File
@@ -92,7 +92,6 @@ bc_raisemod (bc_num base, bc_num expo, bc_num mod, bc_num *result, int scale TSR
bc_free_num (&power);
bc_free_num (&exponent);
bc_free_num (result);
bc_free_num (&parity);
*result = temp;
return 0; /* Everything is OK. */
}
+4 -4
View File
@@ -2,12 +2,12 @@
+----------------------------------------------------------------------+
| PHP Version 4 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2006 The PHP Group |
| Copyright (c) 1997-2002 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| 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 through the world-wide-web at the following url: |
| http://www.php.net/license/3_01.txt |
| 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. |
+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
-2
View File
@@ -1,2 +0,0 @@
Bzip2
Sterling Hughes
-536
View File
@@ -1,536 +0,0 @@
/*
+----------------------------------------------------------------------+
| PHP version 4.0 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2006 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.php.net/license/3_01.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: Sterling Hughes <sterling@php.net> |
+----------------------------------------------------------------------+
*/
/* $Id$ */
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "php.h"
#include "php_bz2.h"
#if HAVE_BZ2
/* PHP Includes */
#include "ext/standard/file.h"
#include "ext/standard/info.h"
#include "ext/standard/php_string.h"
/* for fileno() */
#include <stdio.h>
/* Internal error constants */
#define PHP_BZ_ERRNO 0
#define PHP_BZ_ERRSTR 1
#define PHP_BZ_ERRBOTH 2
function_entry bz2_functions[] = {
PHP_FE(bzopen, NULL)
PHP_FE(bzread, NULL)
PHP_FALIAS(bzwrite, fwrite, NULL)
PHP_FALIAS(bzflush, fflush, NULL)
PHP_FALIAS(bzclose, fclose, NULL)
PHP_FE(bzerrno, NULL)
PHP_FE(bzerrstr, NULL)
PHP_FE(bzerror, NULL)
PHP_FE(bzcompress, NULL)
PHP_FE(bzdecompress, NULL)
{NULL, NULL, NULL}
};
zend_module_entry bz2_module_entry = {
STANDARD_MODULE_HEADER,
"bz2",
bz2_functions,
PHP_MINIT(bz2),
PHP_MSHUTDOWN(bz2),
NULL,
NULL,
PHP_MINFO(bz2),
NO_VERSION_YET,
STANDARD_MODULE_PROPERTIES
};
#ifdef COMPILE_DL_BZ2
ZEND_GET_MODULE(bz2)
#endif
struct php_bz2_stream_data_t {
BZFILE *bz_file;
php_stream *stream;
};
/* {{{ BZip2 stream implementation */
static size_t php_bz2iop_read(php_stream *stream, char *buf, size_t count TSRMLS_DC)
{
struct php_bz2_stream_data_t *self = (struct php_bz2_stream_data_t *) stream->abstract;
size_t ret;
ret = BZ2_bzread(self->bz_file, buf, count);
if (ret == 0) {
stream->eof = 1;
}
return ret;
}
static size_t php_bz2iop_write(php_stream *stream, const char *buf, size_t count TSRMLS_DC)
{
struct php_bz2_stream_data_t *self = (struct php_bz2_stream_data_t *) stream->abstract;
return BZ2_bzwrite(self->bz_file, (char*)buf, count);
}
static int php_bz2iop_close(php_stream *stream, int close_handle TSRMLS_DC)
{
struct php_bz2_stream_data_t *self = (struct php_bz2_stream_data_t *)stream->abstract;
int ret = EOF;
if (close_handle) {
BZ2_bzclose(self->bz_file);
}
if (self->stream) {
php_stream_free(self->stream, PHP_STREAM_FREE_CLOSE | (close_handle == 0 ? PHP_STREAM_FREE_PRESERVE_HANDLE : 0));
}
efree(self);
return ret;
}
static int php_bz2iop_flush(php_stream *stream TSRMLS_DC)
{
struct php_bz2_stream_data_t *self = (struct php_bz2_stream_data_t *)stream->abstract;
return BZ2_bzflush(self->bz_file);
}
/* }}} */
php_stream_ops php_stream_bz2io_ops = {
php_bz2iop_write, php_bz2iop_read,
php_bz2iop_close, php_bz2iop_flush,
"BZip2",
NULL, /* seek */
NULL, /* cast */
NULL, /* stat */
NULL /* set_option */
};
/* {{{ Bzip2 stream openers */
PHP_BZ2_API php_stream *_php_stream_bz2open_from_BZFILE(BZFILE *bz,
char *mode, php_stream *innerstream STREAMS_DC TSRMLS_DC)
{
struct php_bz2_stream_data_t *self;
self = emalloc(sizeof(*self));
self->stream = innerstream;
self->bz_file = bz;
return php_stream_alloc_rel(&php_stream_bz2io_ops, self, 0, mode);
}
PHP_BZ2_API php_stream *_php_stream_bz2open(php_stream_wrapper *wrapper,
char *path,
char *mode,
int options,
char **opened_path,
php_stream_context *context STREAMS_DC TSRMLS_DC)
{
php_stream *retstream = NULL, *stream = NULL;
char *path_copy = NULL;
BZFILE *bz_file = NULL;
if (strncasecmp("compress.bzip2://", path, 17) == 0) {
path += 17;
}
if (mode[0] != 'w' && mode[0] != 'r' && mode[1] != '\0') {
return NULL;
}
#ifdef VIRTUAL_DIR
virtual_filepath_ex(path, &path_copy, NULL TSRMLS_CC);
#else
path_copy = path;
#endif
/* try and open it directly first */
bz_file = BZ2_bzopen(path_copy, mode);
if (opened_path && bz_file) {
*opened_path = estrdup(path_copy);
}
path_copy = NULL;
if (bz_file == NULL) {
/* that didn't work, so try and get something from the network/wrapper */
stream = php_stream_open_wrapper(path, mode, options | STREAM_WILL_CAST, opened_path);
if (stream) {
int fd;
if (SUCCESS == php_stream_cast(stream, PHP_STREAM_AS_FD, (void **) &fd, REPORT_ERRORS)) {
bz_file = BZ2_bzdopen(fd, mode);
}
}
/* remove the file created by php_stream_open_wrapper(), it is not needed since BZ2 functions
* failed.
*/
if (opened_path && !bz_file && mode[0] == 'w') {
VCWD_UNLINK(*opened_path);
}
}
if (bz_file) {
retstream = _php_stream_bz2open_from_BZFILE(bz_file, mode, stream STREAMS_REL_CC TSRMLS_CC);
if (retstream) {
return retstream;
}
BZ2_bzclose(bz_file);
}
if (stream) {
php_stream_close(stream);
}
return NULL;
}
/* }}} */
static php_stream_wrapper_ops bzip2_stream_wops = {
_php_stream_bz2open,
NULL, /* close */
NULL, /* fstat */
NULL, /* stat */
NULL, /* opendir */
"BZip2"
};
php_stream_wrapper php_stream_bzip2_wrapper = {
&bzip2_stream_wops,
NULL,
0 /* is_url */
};
static void php_bz2_error(INTERNAL_FUNCTION_PARAMETERS, int);
PHP_MINIT_FUNCTION(bz2)
{
php_register_url_stream_wrapper("compress.bzip2", &php_stream_bzip2_wrapper TSRMLS_CC);
return SUCCESS;
}
PHP_MSHUTDOWN_FUNCTION(bz2)
{
php_unregister_url_stream_wrapper("compress.bzip2" TSRMLS_CC);
return SUCCESS;
}
PHP_MINFO_FUNCTION(bz2)
{
php_info_print_table_start();
php_info_print_table_row(2, "BZip2 Support", "Enabled");
php_info_print_table_row(2, "BZip2 Version", (char *) BZ2_bzlibVersion());
php_info_print_table_end();
}
/* {{{ proto string bzread(int bz[, int length])
Reads up to length bytes from a BZip2 stream, or 1024 bytes if length is not specified */
PHP_FUNCTION(bzread)
{
zval *bz;
long len = 1024;
php_stream *stream;
if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|l", &bz, &len)) {
RETURN_FALSE;
}
php_stream_from_zval(stream, &bz);
if (len < 0) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "length may not be negative");
RETURN_FALSE;
}
Z_STRVAL_P(return_value) = emalloc(len + 1);
Z_STRLEN_P(return_value) = php_stream_read(stream, Z_STRVAL_P(return_value), len);
if (Z_STRLEN_P(return_value) < 0) {
efree(Z_STRVAL_P(return_value));
php_error_docref(NULL TSRMLS_CC, E_WARNING, "could not read valid bz2 data from stream");
RETURN_FALSE;
}
Z_STRVAL_P(return_value)[Z_STRLEN_P(return_value)] = 0;
if (PG(magic_quotes_runtime)) {
Z_STRVAL_P(return_value) = php_addslashes( Z_STRVAL_P(return_value),
Z_STRLEN_P(return_value),
&Z_STRLEN_P(return_value), 1 TSRMLS_CC);
}
Z_TYPE_P(return_value) = IS_STRING;
}
/* }}} */
/* {{{ proto resource bzopen(string|int file|fp, string mode)
Opens a new BZip2 stream */
PHP_FUNCTION(bzopen)
{
zval **file, /* The file to open */
**mode; /* The mode to open the stream with */
BZFILE *bz; /* The compressed file stream */
php_stream *stream = NULL;
if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &file, &mode) == FAILURE) {
WRONG_PARAM_COUNT;
}
convert_to_string_ex(mode);
if (Z_STRVAL_PP(mode)[0] != 'r' && Z_STRVAL_PP(mode)[0] != 'w' && Z_STRVAL_PP(mode)[1] != '\0') {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "'%s' is not a valid mode for bzopen(). Only 'w' and 'r' are supported.", Z_STRVAL_PP(mode));
RETURN_FALSE;
}
/* If it's not a resource its a string containing the filename to open */
if (Z_TYPE_PP(file) != IS_RESOURCE) {
convert_to_string_ex(file);
stream = php_stream_bz2open(NULL,
Z_STRVAL_PP(file),
Z_STRVAL_PP(mode),
ENFORCE_SAFE_MODE | REPORT_ERRORS,
NULL);
} else {
/* If it is a resource, than its a stream resource */
int fd;
php_stream_from_zval(stream, file);
if (FAILURE == php_stream_cast(stream, PHP_STREAM_AS_FD, (void *) &fd, REPORT_ERRORS)) {
RETURN_FALSE;
}
bz = BZ2_bzdopen(fd, Z_STRVAL_PP(mode));
stream = php_stream_bz2open_from_BZFILE(bz, Z_STRVAL_PP(mode), stream);
}
if (stream) {
php_stream_to_zval(stream, return_value);
} else {
RETURN_FALSE;
}
}
/* }}} */
/* {{{ proto int bzerrno(resource bz)
Returns the error number */
PHP_FUNCTION(bzerrno)
{
php_bz2_error(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_BZ_ERRNO);
}
/* }}} */
/* {{{ proto string bzerrstr(resource bz)
Returns the error string */
PHP_FUNCTION(bzerrstr)
{
php_bz2_error(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_BZ_ERRSTR);
}
/* }}} */
/* {{{ proto array bzerror(resource bz)
Returns the error number and error string in an associative array */
PHP_FUNCTION(bzerror)
{
php_bz2_error(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_BZ_ERRBOTH);
}
/* }}} */
/* {{{ proto string bzcompress(string source [, int blocksize100k [, int workfactor]])
Compresses a string into BZip2 encoded data */
PHP_FUNCTION(bzcompress)
{
zval **source, /* Source data to compress */
**zblock_size, /* Optional block size to use */
**zwork_factor; /* Optional work factor to use */
char *dest = NULL; /* Destination to place the compressed data into */
int error, /* Error Container */
block_size = 4, /* Block size for compression algorithm */
work_factor = 0, /* Work factor for compression algorithm */
argc; /* Argument count */
unsigned int source_len, /* Length of the source data */
dest_len; /* Length of the destination buffer */
argc = ZEND_NUM_ARGS();
if (argc < 1 || argc > 3 || zend_get_parameters_ex(argc, &source, &zblock_size, &zwork_factor) == FAILURE) {
WRONG_PARAM_COUNT;
}
convert_to_string_ex(source);
/* Assign them to easy to use variables, dest_len is initially the length of the data
+ .01 x length of data + 600 which is the largest size the results of the compression
could possibly be, at least that's what the libbz2 docs say (thanks to jeremy@nirvani.net
for pointing this out). */
source_len = Z_STRLEN_PP(source);
dest_len = Z_STRLEN_PP(source) + (0.01 * Z_STRLEN_PP(source)) + 600;
/* Allocate the destination buffer */
dest = emalloc(dest_len + 1);
/* Handle the optional arguments */
if (argc > 1) {
convert_to_long_ex(zblock_size);
block_size = Z_LVAL_PP(zblock_size);
}
if (argc > 2) {
convert_to_long_ex(zwork_factor);
work_factor = Z_LVAL_PP(zwork_factor);
}
error = BZ2_bzBuffToBuffCompress(dest, &dest_len, Z_STRVAL_PP(source), source_len, block_size, 0, work_factor);
if (error != BZ_OK) {
efree(dest);
RETURN_LONG(error);
} else {
/* Copy the buffer, we have perhaps allocate alot more than we need,
so we erealloc() the buffer to the proper size */
dest = erealloc(dest, dest_len + 1);
dest[dest_len] = 0;
RETURN_STRINGL(dest, dest_len, 0);
}
}
/* }}} */
/* {{{ proto string bzdecompress(string source [, int small])
Decompresses BZip2 compressed data */
PHP_FUNCTION(bzdecompress)
{
char *source, *dest;
int source_len, error;
long small = 0;
#if defined(PHP_WIN32) && _MSC_VER < 1300
unsigned __int64 size = 0;
#else
unsigned long long size = 0;
#endif
bz_stream bzs;
if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &source, &source_len, &small)) {
RETURN_FALSE;
}
bzs.bzalloc = NULL;
bzs.bzfree = NULL;
if (BZ2_bzDecompressInit(&bzs, 0, small) != BZ_OK) {
RETURN_FALSE;
}
bzs.next_in = source;
bzs.avail_in = source_len;
/* in most cases bz2 offers at least 2:1 compression, so we use that as our base */
bzs.avail_out = source_len * 2;
bzs.next_out = dest = emalloc(bzs.avail_out + 1);
while ((error = BZ2_bzDecompress(&bzs)) == BZ_OK && bzs.avail_in > 0) {
/* compression is better then 2:1, need to allocate more memory */
bzs.avail_out = source_len;
size = (bzs.total_out_hi32 * (unsigned int) -1) + bzs.total_out_lo32;
dest = erealloc(dest, size + bzs.avail_out + 1);
bzs.next_out = dest + size;
}
if (error == BZ_STREAM_END || error == BZ_OK) {
size = (bzs.total_out_hi32 * (unsigned int) -1) + bzs.total_out_lo32;
dest = erealloc(dest, size + 1);
dest[size] = '\0';
RETVAL_STRINGL(dest, size, 0);
} else { /* real error */
efree(dest);
RETVAL_LONG(error);
}
BZ2_bzDecompressEnd(&bzs);
}
/* }}} */
/* {{{ php_bz2_error()
The central error handling interface, does the work for bzerrno, bzerrstr and bzerror */
static void php_bz2_error(INTERNAL_FUNCTION_PARAMETERS, int opt)
{
zval **bzp; /* BZip2 Resource Pointer */
php_stream *stream;
const char *errstr; /* Error string */
int errnum; /* Error number */
struct php_bz2_stream_data_t *self;
if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &bzp) == FAILURE) {
WRONG_PARAM_COUNT;
}
php_stream_from_zval(stream, bzp);
if (!php_stream_is(stream, PHP_STREAM_IS_BZIP2)) {
RETURN_FALSE;
}
self = (struct php_bz2_stream_data_t *) stream->abstract;
/* Fetch the error information */
errstr = BZ2_bzerror(self->bz_file, &errnum);
/* Determine what to return */
switch (opt) {
case PHP_BZ_ERRNO:
RETURN_LONG(errnum);
break;
case PHP_BZ_ERRSTR:
RETURN_STRING((char*)errstr, 1);
break;
case PHP_BZ_ERRBOTH:
array_init(return_value);
add_assoc_long (return_value, "errno", errnum);
add_assoc_string(return_value, "errstr", (char*)errstr, 1);
break;
}
}
/* }}} */
#endif
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* End:
* vim600: fdm=marker
* vim: noet sw=4 ts=4
*/
-108
View File
@@ -1,108 +0,0 @@
# Microsoft Developer Studio Project File - Name="bz2" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
CFG=bz2 - Win32 Debug_TS
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "bz2.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "bz2.mak" CFG="bz2 - Win32 Debug_TS"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "bz2 - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE "bz2 - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
MTL=midl.exe
RSC=rc.exe
!IF "$(CFG)" == "bz2 - Win32 Release_TS"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release_TS"
# PROP BASE Intermediate_Dir "Release_TS"
# PROP BASE Ignore_Export_Lib 0
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release_TS"
# PROP Intermediate_Dir "Release_TS"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "BZ2_EXPORTS" /YX /FD /c
# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\..\php_build\includes" /D ZEND_DEBUG=0 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "COMPILE_DL_BZ2" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_BZ2=1 /D "PHP_BZ2_EXPORTS" /FR /YX /FD /c
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x407 /d "NDEBUG"
# ADD RSC /l 0x407 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
# ADD LINK32 libbz2.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS/php_bz2.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline" /libpath:"..\..\..\php_build\release"
!ELSEIF "$(CFG)" == "bz2 - Win32 Debug_TS"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug_TS"
# PROP BASE Intermediate_Dir "Debug_TS"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug_TS"
# PROP Intermediate_Dir "Debug_TS"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "BZ2_EXPORTS" /YX /FD /GZ /c
# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\..\php_build\includes" /D ZEND_DEBUG=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "COMPILE_DL_BZ2" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_BZ2=1 /D "PHP_BZ2_EXPORTS" /YX /FD /GZ /c
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x407 /d "_DEBUG"
# ADD RSC /l 0x407 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
# ADD LINK32 php4ts_debug.lib libbz2.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"..\..\Debug_TS/php_bz2.dll" /pdbtype:sept /libpath:"..\..\Debug_TS" /libpath:"..\..\..\php_build\release"
!ENDIF
# Begin Target
# Name "bz2 - Win32 Release_TS"
# Name "bz2 - Win32 Debug_TS"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=.\bz2.c
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# Begin Source File
SOURCE=.\php_bz2.h
# End Source File
# End Group
# End Target
# End Project
-40
View File
@@ -1,40 +0,0 @@
dnl
dnl $Id$
dnl
PHP_ARG_WITH(bz2, for BZip2 support,
[ --with-bz2[=DIR] Include BZip2 support])
if test "$PHP_BZ2" != "no"; then
if test -r $PHP_BZ2/include/bzlib.h; then
BZIP_DIR=$PHP_BZ2
else
AC_MSG_CHECKING(for BZip2 in default path)
for i in /usr/local /usr; do
if test -r $i/include/bzlib.h; then
BZIP_DIR=$i
AC_MSG_RESULT(found in $i)
break
fi
done
fi
if test -z "$BZIP_DIR"; then
AC_MSG_RESULT(not found)
AC_MSG_ERROR(Please reinstall the BZip2 distribution)
fi
PHP_CHECK_LIBRARY(bz2, BZ2_bzerror,
[
PHP_ADD_INCLUDE($BZIP_DIR/include)
PHP_ADD_LIBRARY_WITH_PATH(bz2, $BZIP_DIR/lib, BZ2_SHARED_LIBADD)
AC_DEFINE(HAVE_BZ2,1,[ ])
], [
AC_MSG_ERROR(bz2 module requires libbz2 >= 1.0.0)
], [
-L$BZIP_DIR/lib
])
PHP_NEW_EXTENSION(bz2, bz2.c, $ext_shared)
PHP_SUBST(BZ2_SHARED_LIBADD)
fi
-35
View File
@@ -1,35 +0,0 @@
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!-- do not use the "Type" attribute here, that one is only for
generated package.xml files -->
<package>
<name>bz2</name>
<summary>A Bzip2 management extension</summary>
<description>
Bz2 is an extension to create and parse bzip2 compressed data.
</description>
<license>PHP License</license>
<maintainers>
<maintainer>
<user>sterling</user>
<name>Sterling Hughes</name>
<email>sterling@php.net</email>
</maintainer>
</maintainers>
<release>
<version>1.0</version>
<date>2003-05-17</date>
<state>stable</state>
<notes>
Initial Release in PECL
</notes>
</release>
<filelist>
<dir role="src" name="/">
<file role="doc">CREDITS</file>
<file role="src">config.m4</file>
<file role="doc">php_bz2.h</file>
<file role="src">bz2.c</file>
<file role="src">bz2.dsp</file>
</dir>
</filelist>
</package>
-72
View File
@@ -1,72 +0,0 @@
/*
+----------------------------------------------------------------------+
| PHP Version 4 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2006 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.php.net/license/3_01.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: Sterling Hughes <sterling@php.net> |
+----------------------------------------------------------------------+
*/
#ifndef PHP_BZ2_H
#define PHP_BZ2_H
#if HAVE_BZ2
extern zend_module_entry bz2_module_entry;
#define phpext_bz2_ptr &bz2_module_entry
/* Bzip2 includes */
#include <bzlib.h>
PHP_MINIT_FUNCTION(bz2);
PHP_MSHUTDOWN_FUNCTION(bz2);
PHP_MINFO_FUNCTION(bz2);
PHP_FUNCTION(bzopen);
PHP_FUNCTION(bzread);
PHP_FUNCTION(bzerrno);
PHP_FUNCTION(bzerrstr);
PHP_FUNCTION(bzerror);
PHP_FUNCTION(bzcompress);
PHP_FUNCTION(bzdecompress);
#else
#define phpext_bz2_ptr NULL
#endif
#ifdef PHP_WIN32
# ifdef PHP_BZ2_EXPORTS
# define PHP_BZ2_API __declspec(dllexport)
# else
# define PHP_BZ2_API __declspec(dllimport)
# endif
#else
# define PHP_BZ2_API
#endif
PHP_BZ2_API PHPAPI php_stream *_php_stream_bz2open(php_stream_wrapper *wrapper, char *path, char *mode, int options, char **opened_path, php_stream_context *context STREAMS_DC TSRMLS_DC);
PHP_BZ2_API PHPAPI php_stream *_php_stream_bz2open_from_BZFILE(BZFILE *bz, char *mode, php_stream *innerstream STREAMS_DC TSRMLS_DC);
#define php_stream_bz2open_from_BZFILE(bz, mode, innerstream) _php_stream_bz2open_from_BZFILE((bz), (mode), (innerstream) STREAMS_CC TSRMLS_CC)
#define php_stream_bz2open(wrapper, path, mode, options, opened_path) _php_stream_bz2open((wrapper), (path), (mode), (options), (opened_path), NULL STREAMS_CC TSRMLS_CC)
php_stream_ops php_stream_bz2io_ops;
#define PHP_STREAM_IS_BZIP2 &php_stream_bz2io_ops
#endif
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* End:
*/
-25
View File
@@ -1,25 +0,0 @@
--TEST--
BZ2 with files
--SKIPIF--
<?php if (!extension_loaded("bz2")) print "skip"; ?>
--POST--
--GET--
--FILE--
<?php // $Id$
error_reporting(E_ALL);
$filename = "testfile.bz2";
$str = "This is a test string.\n";
$bz = bzopen($filename, "w");
bzwrite($bz, $str);
bzclose($bz);
$bz = bzopen($filename, "r");
print bzread($bz, 10);
print bzread($bz);
bzclose($bz);
unlink($filename);
--EXPECT--
This is a test string.
-28
View File
@@ -1,28 +0,0 @@
--TEST--
BZ2 with strings
--SKIPIF--
<?php if (!extension_loaded("bz2")) print "skip"; ?>
--POST--
--GET--
--FILE--
<?php // $Id$
error_reporting(E_ALL);
# This FAILS
$blaat = <<<HEREDOC
This is some random data
HEREDOC;
# This Works: (so, is heredoc related)
#$blaat= 'This is some random data';
$blaat2 = bzdecompress(bzcompress($blaat));
$tests = <<<TESTS
\$blaat === \$blaat2
TESTS;
include(dirname(__FILE__) . '/../../../tests/quicktester.inc');
--EXPECT--
OK
+4 -4
View File
@@ -2,12 +2,12 @@
+----------------------------------------------------------------------+
| PHP Version 4 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2006 The PHP Group |
| Copyright (c) 1997-2002 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| 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 through the world-wide-web at the following url: |
| http://www.php.net/license/3_01.txt |
| 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. |
+304 -306
View File
@@ -2,19 +2,19 @@
+----------------------------------------------------------------------+
| PHP Version 4 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2006 The PHP Group |
| Copyright (c) 1997-2002 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| 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 through the world-wide-web at the following url: |
| http://www.php.net/license/3_01.txt |
| 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. |
+----------------------------------------------------------------------+
| Authors: Shane Caraveo <shane@caraveo.com> |
| Colin Viebrock <colin@easydns.com> |
| Hartmut Holzgraefe <hholzgra@php.net> |
| Hartmut Holzgraefe <hartmut@six.de> |
| Wez Furlong <wez@thebrainroom.com> |
+----------------------------------------------------------------------+
*/
@@ -34,7 +34,7 @@
#include "sdncal.h"
#include <stdio.h>
function_entry calendar_functions[] = {
PHP_FE(jdtogregorian, NULL)
PHP_FE(gregoriantojd, NULL)
@@ -48,10 +48,10 @@ function_entry calendar_functions[] = {
PHP_FE(jdmonthname, NULL)
PHP_FE(easter_date, NULL)
PHP_FE(easter_days, NULL)
PHP_FE(unixtojd, NULL)
PHP_FE(jdtounix, NULL)
PHP_FE(cal_to_jd, NULL)
PHP_FE(cal_from_jd, NULL)
PHP_FE(unixtojd, NULL)
PHP_FE(jdtounix, NULL)
PHP_FE(cal_to_jd, NULL)
PHP_FE(cal_from_jd, NULL)
PHP_FE(cal_days_in_month, NULL)
PHP_FE(cal_info, NULL)
{NULL, NULL, NULL}
@@ -60,8 +60,8 @@ function_entry calendar_functions[] = {
zend_module_entry calendar_module_entry = {
STANDARD_MODULE_HEADER,
"calendar",
calendar_functions,
"calendar",
calendar_functions,
PHP_MINIT(calendar),
NULL,
NULL,
@@ -83,76 +83,60 @@ enum cal_name_type_t {
CAL_FRENCH,
CAL_NUM_CALS
};
typedef long int (*cal_to_jd_func_t) (int month, int day, int year);
typedef void (*cal_from_jd_func_t) (long int jd, int *year, int *month, int *day);
typedef char *(*cal_as_string_func_t) (int year, int month, int day);
typedef long int (*cal_to_jd_func_t)(int month, int day, int year);
typedef void (*cal_from_jd_func_t)(long int jd, int* year, int* month, int* day);
typedef char* (*cal_as_string_func_t)(int year, int month, int day);
struct cal_entry_t {
char *name;
char *symbol;
cal_to_jd_func_t to_jd;
cal_from_jd_func_t from_jd;
int num_months;
int max_days_in_month;
char **month_name_short;
char **month_name_long;
char *name;
char *symbol;
cal_to_jd_func_t to_jd;
cal_from_jd_func_t from_jd;
int num_months;
int max_days_in_month;
char **month_name_short;
char **month_name_long;
};
static struct cal_entry_t cal_conversion_table[CAL_NUM_CALS] = {
{"Gregorian", "CAL_GREGORIAN", GregorianToSdn, SdnToGregorian, 12, 31,
MonthNameShort, MonthNameLong},
{"Julian", "CAL_JULIAN", JulianToSdn, SdnToJulian, 12, 31,
MonthNameShort, MonthNameLong},
{"Jewish", "CAL_JEWISH", JewishToSdn, SdnToJewish, 13, 30,
JewishMonthName, JewishMonthName},
{"French", "CAL_FRENCH", FrenchToSdn, SdnToFrench, 13, 30,
FrenchMonthName, FrenchMonthName}
{ "Gregorian", "CAL_GREGORIAN", GregorianToSdn, SdnToGregorian, 12, 31, MonthNameShort, MonthNameLong },
{ "Julian", "CAL_JULIAN", JulianToSdn, SdnToJulian, 12, 31, MonthNameShort, MonthNameLong },
{ "Jewish", "CAL_JEWISH", JewishToSdn, SdnToJewish, 13, 30, JewishMonthName, JewishMonthName },
{ "French", "CAL_FRENCH", FrenchToSdn, SdnToFrench, 13, 30, FrenchMonthName, FrenchMonthName }
};
/* For jddayofweek */
enum { CAL_DOW_DAYNO, CAL_DOW_SHORT, CAL_DOW_LONG };
enum { CAL_DOW_DAYNO, CAL_DOW_SHORT, CAL_DOW_LONG };
/* For jdmonthname */
enum { CAL_MONTH_GREGORIAN_SHORT, CAL_MONTH_GREGORIAN_LONG,
enum { CAL_MONTH_GREGORIAN_SHORT, CAL_MONTH_GREGORIAN_LONG,
CAL_MONTH_JULIAN_SHORT, CAL_MONTH_JULIAN_LONG, CAL_MONTH_JEWISH,
CAL_MONTH_FRENCH
};
CAL_MONTH_FRENCH };
/* for heb_number_to_chars */
static char alef_bet[25] = "0àáâãäåæçèéëìîðñòôö÷øùú";
#define CAL_JEWISH_ADD_ALAFIM_GERESH 0x2
#define CAL_JEWISH_ADD_ALAFIM 0x4
#define CAL_JEWISH_ADD_GERESHAYIM 0x8
PHP_MINIT_FUNCTION(calendar)
{
REGISTER_LONG_CONSTANT("CAL_GREGORIAN", CAL_GREGORIAN, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("CAL_JULIAN", CAL_JULIAN, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("CAL_JEWISH", CAL_JEWISH, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("CAL_FRENCH", CAL_FRENCH, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("CAL_NUM_CALS", CAL_NUM_CALS, CONST_CS | CONST_PERSISTENT);
/* constants for jddayofweek */
REGISTER_LONG_CONSTANT("CAL_DOW_DAYNO", CAL_DOW_DAYNO, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("CAL_DOW_SHORT", CAL_DOW_SHORT, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("CAL_DOW_LONG", CAL_DOW_LONG, CONST_CS | CONST_PERSISTENT);
/* constants for jdmonthname */
REGISTER_LONG_CONSTANT("CAL_MONTH_GREGORIAN_SHORT", CAL_MONTH_GREGORIAN_SHORT, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("CAL_MONTH_GREGORIAN_LONG", CAL_MONTH_GREGORIAN_LONG, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("CAL_MONTH_JULIAN_SHORT", CAL_MONTH_JULIAN_SHORT, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("CAL_MONTH_JULIAN_LONG", CAL_MONTH_JULIAN_LONG, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("CAL_MONTH_JEWISH", CAL_MONTH_JEWISH, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("CAL_MONTH_FRENCH", CAL_MONTH_FRENCH, CONST_CS | CONST_PERSISTENT);
/* constants for easter calculation */
REGISTER_LONG_CONSTANT("CAL_EASTER_DEFAULT", CAL_EASTER_DEFAULT, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("CAL_EASTER_ROMAN", CAL_EASTER_ROMAN, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("CAL_EASTER_ALWAYS_GREGORIAN", CAL_EASTER_ALWAYS_GREGORIAN, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("CAL_EASTER_ALWAYS_JULIAN", CAL_EASTER_ALWAYS_JULIAN, CONST_CS | CONST_PERSISTENT);
/* constants for Jewish date formatting */
REGISTER_LONG_CONSTANT("CAL_JEWISH_ADD_ALAFIM_GERESH", CAL_JEWISH_ADD_ALAFIM_GERESH, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("CAL_JEWISH_ADD_ALAFIM", CAL_JEWISH_ADD_ALAFIM, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("CAL_JEWISH_ADD_GERESHAYIM", CAL_JEWISH_ADD_GERESHAYIM, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("CAL_GREGORIAN", CAL_GREGORIAN, CONST_CS|CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("CAL_JULIAN", CAL_JULIAN, CONST_CS|CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("CAL_JEWISH", CAL_JEWISH, CONST_CS|CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("CAL_FRENCH", CAL_FRENCH, CONST_CS|CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("CAL_NUM_CALS", CAL_NUM_CALS, CONST_CS|CONST_PERSISTENT);
/* constants for jddayofweek */
REGISTER_LONG_CONSTANT("CAL_DOW_DAYNO", CAL_DOW_DAYNO, CONST_CS|CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("CAL_DOW_SHORT", CAL_DOW_SHORT, CONST_CS|CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("CAL_DOW_LONG", CAL_DOW_LONG, CONST_CS|CONST_PERSISTENT);
/* constants for jdmonthname */
REGISTER_LONG_CONSTANT("CAL_MONTH_GREGORIAN_SHORT", CAL_MONTH_GREGORIAN_SHORT, CONST_CS|CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("CAL_MONTH_GREGORIAN_LONG", CAL_MONTH_GREGORIAN_LONG, CONST_CS|CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("CAL_MONTH_JULIAN_SHORT", CAL_MONTH_JULIAN_SHORT, CONST_CS|CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("CAL_MONTH_JULIAN_LONG", CAL_MONTH_JULIAN_LONG, CONST_CS|CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("CAL_MONTH_JEWISH", CAL_MONTH_JEWISH, CONST_CS|CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("CAL_MONTH_FRENCH", CAL_MONTH_FRENCH, CONST_CS|CONST_PERSISTENT);
/* constants for easter calculation */
REGISTER_LONG_CONSTANT("CAL_EASTER_DEFAULT", CAL_EASTER_DEFAULT, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("CAL_EASTER_ROMAN", CAL_EASTER_ROMAN, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("CAL_EASTER_ALWAYS_GREGORIAN", CAL_EASTER_ALWAYS_GREGORIAN, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("CAL_EASTER_ALWAYS_JULIAN", CAL_EASTER_ALWAYS_JULIAN, CONST_CS | CONST_PERSISTENT);
return SUCCESS;
}
@@ -163,65 +147,42 @@ PHP_MINFO_FUNCTION(calendar)
php_info_print_table_end();
}
static void _php_cal_info(int cal, zval **ret)
/* {{{ proto array cal_info(int calendar)
Returns information about a particular calendar */
PHP_FUNCTION(cal_info)
{
zval *months, *smonths;
zval ** cal;
zval * months, *smonths;
int i;
struct cal_entry_t *calendar;
struct cal_entry_t * calendar;
if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &cal) != SUCCESS) {
WRONG_PARAM_COUNT;
}
convert_to_long_ex(cal);
if (Z_LVAL_PP(cal) < 0 || Z_LVAL_PP(cal) >= CAL_NUM_CALS) {
zend_error(E_WARNING, "%s(): invalid calendar ID %d", get_active_function_name(TSRMLS_C), Z_LVAL_PP(cal));
RETURN_FALSE;
}
calendar = &cal_conversion_table[cal];
array_init(*ret);
calendar = &cal_conversion_table[Z_LVAL_PP(cal)];
array_init(return_value);
MAKE_STD_ZVAL(months);
MAKE_STD_ZVAL(smonths);
array_init(months);
array_init(smonths);
for (i = 1; i <= calendar->num_months; i++) {
for (i=1; i<= calendar->num_months; i++) {
add_index_string(months, i, calendar->month_name_long[i], 1);
add_index_string(smonths, i, calendar->month_name_short[i], 1);
}
add_assoc_zval(*ret, "months", months);
add_assoc_zval(*ret, "abbrevmonths", smonths);
add_assoc_long(*ret, "maxdaysinmonth", calendar->max_days_in_month);
add_assoc_string(*ret, "calname", calendar->name, 1);
add_assoc_string(*ret, "calsymbol", calendar->symbol, 1);
add_assoc_zval(return_value, "months", months);
add_assoc_zval(return_value, "abbrevmonths", smonths);
add_assoc_long(return_value, "maxdaysinmonth", calendar->max_days_in_month);
add_assoc_string(return_value, "calname", calendar->name, 1);
add_assoc_string(return_value, "calsymbol", calendar->symbol, 1);
}
/* {{{ proto array cal_info(int calendar)
Returns information about a particular calendar */
PHP_FUNCTION(cal_info)
{
long cal = -1;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &cal) == FAILURE) {
RETURN_FALSE;
}
if (cal == -1) {
int i;
zval *val;
array_init(return_value);
for (i = 0; i < CAL_NUM_CALS; i++) {
MAKE_STD_ZVAL(val);
_php_cal_info(i, &val);
add_index_zval(return_value, i, val);
}
return;
}
if (cal != -1 && (cal < 0 || cal >= CAL_NUM_CALS)) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "invalid calendar ID %ld.", cal);
RETURN_FALSE;
}
_php_cal_info(cal, &return_value);
}
/* }}} */
@@ -229,35 +190,34 @@ PHP_FUNCTION(cal_info)
Returns the number of days in a month for a given year and calendar */
PHP_FUNCTION(cal_days_in_month)
{
long cal, month, year;
struct cal_entry_t *calendar;
zval ** cal, **month, **year;
struct cal_entry_t * calendar;
long sdn_start, sdn_next;
if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &cal, &month, &year) != SUCCESS) {
WRONG_PARAM_COUNT;
}
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lll", &cal, &month, &year) == FAILURE) {
convert_to_long_ex(cal);
convert_to_long_ex(month);
convert_to_long_ex(year);
if (Z_LVAL_PP(cal) < 0 || Z_LVAL_PP(cal) >= CAL_NUM_CALS) {
zend_error(E_WARNING, "%s(): invalid calendar ID %d", get_active_function_name(TSRMLS_C), Z_LVAL_PP(cal));
RETURN_FALSE;
}
if (cal < 0 || cal >= CAL_NUM_CALS) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "invalid calendar ID %ld.", cal);
RETURN_FALSE;
calendar = &cal_conversion_table[Z_LVAL_PP(cal)];
sdn_start = calendar->to_jd(Z_LVAL_PP(year), Z_LVAL_PP(month), 1);
sdn_next = calendar->to_jd(Z_LVAL_PP(year), 1 + Z_LVAL_PP(month), 1);
if (sdn_next == 0) {
/* if invalid, try first month of the next year... */
sdn_next = calendar->to_jd(Z_LVAL_PP(year) + 1, 1, 1);
}
calendar = &cal_conversion_table[cal];
sdn_start = calendar->to_jd(year, month, 1);
if (sdn_start == 0) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "invalid date.");
RETURN_FALSE;
}
sdn_next = calendar->to_jd(year, 1 + month, 1);
if (sdn_next == 0) {
/* if invalid, try first month of the next year... */
sdn_next = calendar->to_jd(year + 1, 1, 1);
}
RETURN_LONG(sdn_next - sdn_start);
}
/* }}} */
@@ -266,18 +226,26 @@ PHP_FUNCTION(cal_days_in_month)
Converts from a supported calendar to Julian Day Count */
PHP_FUNCTION(cal_to_jd)
{
long cal, month, day, year;
zval ** cal, **month, **day, **year;
long jdate;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "llll", &cal, &month, &day, &year) != SUCCESS) {
if (ZEND_NUM_ARGS() != 4 || zend_get_parameters_ex(4, &cal, &month, &day, &year) != SUCCESS) {
WRONG_PARAM_COUNT;
}
convert_to_long_ex(cal);
convert_to_long_ex(month);
convert_to_long_ex(day);
convert_to_long_ex(year);
if (Z_LVAL_PP(cal) < 0 || Z_LVAL_PP(cal) >= CAL_NUM_CALS) {
zend_error(E_WARNING, "%s(): invalid calendar ID %d", get_active_function_name(TSRMLS_C), Z_LVAL_PP(cal));
RETURN_FALSE;
}
if (cal < 0 || cal >= CAL_NUM_CALS) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "invalid calendar ID %ld.", cal);
RETURN_FALSE;
}
RETURN_LONG(cal_conversion_table[cal].to_jd(year, month, day));
jdate = cal_conversion_table[Z_LVAL_PP(cal)].to_jd(
Z_LVAL_PP(year), Z_LVAL_PP(month), Z_LVAL_PP(day));
RETURN_LONG(jdate);
}
/* }}} */
@@ -285,38 +253,42 @@ PHP_FUNCTION(cal_to_jd)
Converts from Julian Day Count to a supported calendar and return extended information */
PHP_FUNCTION(cal_from_jd)
{
long jd, cal;
zval ** jd, ** cal;
int month, day, year, dow;
char date[16];
struct cal_entry_t *calendar;
struct cal_entry_t * calendar;
if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &jd, &cal) != SUCCESS) {
WRONG_PARAM_COUNT;
}
convert_to_long_ex(jd);
convert_to_long_ex(cal);
if (zend_parse_parameters(ZEND_NUM_ARGS()TSRMLS_CC, "ll", &jd, &cal) == FAILURE) {
if (Z_LVAL_PP(cal) < 0 || Z_LVAL_PP(cal) >= CAL_NUM_CALS) {
zend_error(E_WARNING, "%s(): invalid calendar ID %d", get_active_function_name(TSRMLS_C), Z_LVAL_PP(cal));
RETURN_FALSE;
}
if (cal < 0 || cal >= CAL_NUM_CALS) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "invalid calendar ID %ld", cal);
RETURN_FALSE;
}
calendar = &cal_conversion_table[cal];
calendar = &cal_conversion_table[Z_LVAL_PP(cal)];
array_init(return_value);
calendar->from_jd(jd, &year, &month, &day);
calendar->from_jd(
Z_LVAL_PP(jd),
&year, &month, &day);
sprintf(date, "%i/%i/%i", month, day, year);
add_assoc_string(return_value, "date", date, 1);
add_assoc_long(return_value, "month", month);
add_assoc_long(return_value, "day", day);
add_assoc_long(return_value, "year", year);
/* day of week */
dow = DayOfWeek(jd);
/* day of week */
dow = DayOfWeek(Z_LVAL_PP(jd));
add_assoc_long(return_value, "dow", dow);
add_assoc_string(return_value, "abbrevdayname", DayNameShort[dow], 1);
add_assoc_string(return_value, "dayname", DayNameLong[dow], 1);
/* month name */
/* month name */
add_assoc_string(return_value, "abbrevmonth", calendar->month_name_short[month], 1);
add_assoc_string(return_value, "monthname", calendar->month_name_long[month], 1);
}
@@ -326,15 +298,16 @@ PHP_FUNCTION(cal_from_jd)
Converts a julian day count to a gregorian calendar date */
PHP_FUNCTION(jdtogregorian)
{
long julday;
pval **julday;
int year, month, day;
char date[16];
char date[10];
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &julday) == FAILURE) {
RETURN_FALSE;
if (zend_get_parameters_ex(1, &julday) != SUCCESS) {
WRONG_PARAM_COUNT;
}
SdnToGregorian(julday, &year, &month, &day);
convert_to_long_ex(julday);
SdnToGregorian(Z_LVAL_PP(julday), &year, &month, &day);
sprintf(date, "%i/%i/%i", month, day, year);
RETURN_STRING(date, 1);
@@ -345,29 +318,37 @@ PHP_FUNCTION(jdtogregorian)
Converts a gregorian calendar date to julian day count */
PHP_FUNCTION(gregoriantojd)
{
long year, month, day;
pval **year, **month, **day;
int jdate;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lll", &month, &day, &year) == FAILURE) {
RETURN_FALSE;
if (zend_get_parameters_ex(3, &month, &day, &year) != SUCCESS) {
WRONG_PARAM_COUNT;
}
convert_to_long_ex(month);
convert_to_long_ex(day);
convert_to_long_ex(year);
RETURN_LONG(GregorianToSdn(year, month, day));
jdate = GregorianToSdn(Z_LVAL_PP(year), Z_LVAL_PP(month), Z_LVAL_PP(day));
RETURN_LONG(jdate);
}
/* }}} */
/* {{{ proto string jdtojulian(int juliandaycount)
Convert a julian day count to a julian calendar date */
PHP_FUNCTION(jdtojulian)
PHP_FUNCTION(jdtojulian)
{
long julday;
pval **julday;
int year, month, day;
char date[16];
char date[10];
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &julday) == FAILURE) {
RETURN_FALSE;
if (zend_get_parameters_ex(1, &julday) != SUCCESS) {
WRONG_PARAM_COUNT;
}
SdnToJulian(julday, &year, &month, &day);
convert_to_long_ex(julday);
SdnToJulian(Z_LVAL_PP(julday), &year, &month, &day);
sprintf(date, "%i/%i/%i", month, day, year);
RETURN_STRING(date, 1);
@@ -378,146 +359,137 @@ PHP_FUNCTION(jdtojulian)
Converts a julian calendar date to julian day count */
PHP_FUNCTION(juliantojd)
{
long year, month, day;
pval **year, **month, **day;
int jdate;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lll", &month, &day, &year) == FAILURE) {
RETURN_FALSE;
if (zend_get_parameters_ex(3, &month, &day, &year) != SUCCESS) {
WRONG_PARAM_COUNT;
}
convert_to_long_ex(month);
convert_to_long_ex(day);
convert_to_long_ex(year);
RETURN_LONG(JulianToSdn(year, month, day));
jdate = JulianToSdn(Z_LVAL_PP(year), Z_LVAL_PP(month), Z_LVAL_PP(day));
RETURN_LONG(jdate);
}
/* }}} */
/* {{{ heb_number_to_chars*/
/*
caution: the Hebrew format produces non unique result.
for example both: year '5' and year '5000' produce 'ä'.
use the numeric one for calculations.
/*
caution: the hebrew format product non unique result.
for example both: year '5' and year '5000' product 'ä'.
use the numeric one for calculations.
*/
static char *heb_number_to_chars(int n, int fl, char **ret)
static char* heb_number_to_chars(int n, char **ret)
{
char *p, old[18], *endofalafim;
char *p, *old;
p = endofalafim = old;
/*
prevents the option breaking the jewish beliefs, and some other
critical resources ;)
*/
p = emalloc(10);
old = p;
/*
prevents the option breaking the jewish beliefs, and some other
critical resources ;)
*/
if (n > 9999 || n < 1) {
efree(old);
*ret = NULL;
return NULL;
}
/* alafim (thousands) case */
/* alafim case */
if (n / 1000) {
*p = alef_bet[n / 1000];
p++;
if (CAL_JEWISH_ADD_ALAFIM_GERESH & fl) {
*p = '\'';
p++;
}
if (CAL_JEWISH_ADD_ALAFIM & fl) {
strcpy(p, " àìôéí ");
p += 7;
}
endofalafim = p;
n = n % 1000;
}
/* tav-tav (tav=400) case */
/* taf-taf case */
while (n >= 400) {
*p = alef_bet[22];
p++;
n -= 400;
n-=400;
}
/* meot (hundreads) case */
if (n >= 100) {
*p = alef_bet[18 + n / 100];
/* meot case */
if (n >= 100) {
*p = alef_bet[18+n/100];
p++;
n = n % 100;
}
/* tet-vav & tet-zain case (special case for 15 and 16) */
/* tet-vav tet-zain case */
if (n == 15 || n == 16) {
*p = alef_bet[9];
p++;
*p = alef_bet[n - 9];
*p = alef_bet[n-9];
p++;
} else {
/* asarot (tens) case */
if (n >= 10) {
*p = alef_bet[9 + n / 10];
/* asarot case */
if (n >= 10) {
*p = alef_bet[9+n/10];
p++;
n = n % 10;
}
/* yehidot (ones) case */
/* yeihot case */
if (n > 0) {
*p = alef_bet[n];
p++;
}
}
if (CAL_JEWISH_ADD_GERESHAYIM & fl) {
switch (p - endofalafim) {
case 0:
break;
case 1:
*p = '\'';
p++;
break;
default:
*(p) = *(p - 1);
*(p - 1) = '"';
p++;
}
}
*p = '\0';
*ret = estrndup(old, (p - old) + 1);
p = *ret;
efree(old);
return p;
}
/* }}} */
/* {{{ proto string jdtojewish(int juliandaycount [, bool hebrew [, int fl]])
/* {{{ proto string jdtojewish(int juliandaycount)
Converts a julian day count to a jewish calendar date */
PHP_FUNCTION(jdtojewish)
PHP_FUNCTION(jdtojewish)
{
long julday, fl = 0;
zend_bool heb = 0;
long julday, fl;
int year, month, day;
char date[16], hebdate[25];
char date[10], hebdate[25];
char *dayp, *yearp;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l|bl", &julday, &heb, &fl) == FAILURE) {
RETURN_FALSE;
if (ZEND_NUM_ARGS() == 1) {
if (zend_parse_parameters(1 TSRMLS_CC,"l", &julday) != SUCCESS) {
RETURN_FALSE;
}
fl=0;
} else if (ZEND_NUM_ARGS() == 2) {
if (zend_parse_parameters(2 TSRMLS_CC,"ll", &julday, &fl) != SUCCESS) {
RETURN_FALSE;
}
} else {
WRONG_PARAM_COUNT;
}
SdnToJewish(julday, &year, &month, &day);
if (!heb) {
if(!fl) {
sprintf(date, "%i/%i/%i", month, day, year);
RETURN_STRING(date, 1);
} else {
if (year <= 0 || year > 9999) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Year out of range (0-9999).");
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Out of range year.");
RETURN_FALSE;
}
sprintf(hebdate, "%s %s %s", heb_number_to_chars(day, fl, &dayp), JewishMonthHebName[month], heb_number_to_chars(year, fl, &yearp));
sprintf(hebdate, "%s %s %s", heb_number_to_chars(day, &dayp), JewishMonthHebName[month], heb_number_to_chars(year, &yearp));
if (dayp) {
efree(dayp);
}
if (yearp) {
efree(yearp);
efree(yearp);
}
RETURN_STRING(hebdate, 1);
}
}
/* }}} */
@@ -526,13 +498,20 @@ PHP_FUNCTION(jdtojewish)
Converts a jewish calendar date to a julian day count */
PHP_FUNCTION(jewishtojd)
{
long year, month, day;
pval **year, **month, **day;
int jdate;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lll", &month, &day, &year) == FAILURE) {
RETURN_FALSE;
if (zend_get_parameters_ex(3, &month, &day, &year) != SUCCESS) {
WRONG_PARAM_COUNT;
}
RETURN_LONG(JewishToSdn(year, month, day));
convert_to_long_ex(month);
convert_to_long_ex(day);
convert_to_long_ex(year);
jdate = JewishToSdn(Z_LVAL_PP(year), Z_LVAL_PP(month), Z_LVAL_PP(day));
RETURN_LONG(jdate);
}
/* }}} */
@@ -540,15 +519,17 @@ PHP_FUNCTION(jewishtojd)
Converts a julian day count to a french republic calendar date */
PHP_FUNCTION(jdtofrench)
{
long julday;
pval **julday;
int year, month, day;
char date[16];
char date[10];
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &julday) == FAILURE) {
RETURN_FALSE;
if (zend_get_parameters_ex(1, &julday) != SUCCESS) {
WRONG_PARAM_COUNT;
}
SdnToFrench(julday, &year, &month, &day);
convert_to_long_ex(julday);
SdnToFrench(Z_LVAL_PP(julday), &year, &month, &day);
sprintf(date, "%i/%i/%i", month, day, year);
RETURN_STRING(date, 1);
@@ -559,13 +540,20 @@ PHP_FUNCTION(jdtofrench)
Converts a french republic calendar date to julian day count */
PHP_FUNCTION(frenchtojd)
{
long year, month, day;
pval **year, **month, **day;
int jdate;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lll", &month, &day, &year) == FAILURE) {
RETURN_FALSE;
if (zend_get_parameters_ex(3, &month, &day, &year) != SUCCESS) {
WRONG_PARAM_COUNT;
}
convert_to_long_ex(month);
convert_to_long_ex(day);
convert_to_long_ex(year);
RETURN_LONG(FrenchToSdn(year, month, day));
jdate = FrenchToSdn(Z_LVAL_PP(year), Z_LVAL_PP(month), Z_LVAL_PP(day));
RETURN_LONG(jdate);
}
/* }}} */
@@ -573,30 +561,37 @@ PHP_FUNCTION(frenchtojd)
Returns name or number of day of week from julian day count */
PHP_FUNCTION(jddayofweek)
{
long julday, mode = CAL_DOW_DAYNO;
pval *julday, *mode;
int day;
char *daynamel, *daynames;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l|l", &julday, &mode) == FAILURE) {
RETURN_FALSE;
int myargc=ZEND_NUM_ARGS(), mymode=0;
if ((myargc < 1) || (myargc > 2) || (zend_get_parameters(ht, myargc, &julday, &mode) != SUCCESS)) {
WRONG_PARAM_COUNT;
}
convert_to_long(julday);
if(myargc==2) {
convert_to_long(mode);
mymode = Z_LVAL_P(mode);
}
day = DayOfWeek(julday);
day = DayOfWeek(Z_LVAL_P(julday));
daynamel = DayNameLong[day];
daynames = DayNameShort[day];
switch (mode) {
case CAL_DOW_SHORT:
RETURN_STRING(daynamel, 1);
break;
case CAL_DOW_LONG:
RETURN_STRING(daynames, 1);
break;
case CAL_DOW_DAYNO:
default:
RETURN_LONG(day);
break;
}
switch (mymode) {
case CAL_DOW_SHORT:
RETURN_STRING(daynamel, 1);
break;
case CAL_DOW_LONG:
RETURN_STRING(daynames, 1);
break;
case CAL_DOW_DAYNO:
default:
RETURN_LONG(day);
break;
}
}
/* }}} */
@@ -604,40 +599,43 @@ PHP_FUNCTION(jddayofweek)
Returns name of month for julian day count */
PHP_FUNCTION(jdmonthname)
{
long julday, mode;
pval **julday, **mode;
char *monthname = NULL;
int month, day, year;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ll", &julday, &mode) == FAILURE) {
RETURN_FALSE;
if (zend_get_parameters_ex(2, &julday, &mode) != SUCCESS) {
WRONG_PARAM_COUNT;
}
switch (mode) {
case CAL_MONTH_GREGORIAN_LONG: /* gregorian or julian month */
SdnToGregorian(julday, &year, &month, &day);
monthname = MonthNameLong[month];
break;
case CAL_MONTH_JULIAN_SHORT: /* gregorian or julian month */
SdnToJulian(julday, &year, &month, &day);
monthname = MonthNameShort[month];
break;
case CAL_MONTH_JULIAN_LONG: /* gregorian or julian month */
SdnToJulian(julday, &year, &month, &day);
monthname = MonthNameLong[month];
break;
case CAL_MONTH_JEWISH: /* jewish month */
SdnToJewish(julday, &year, &month, &day);
monthname = JewishMonthName[month];
break;
case CAL_MONTH_FRENCH: /* french month */
SdnToFrench(julday, &year, &month, &day);
monthname = FrenchMonthName[month];
break;
default: /* default gregorian */
case CAL_MONTH_GREGORIAN_SHORT: /* gregorian or julian month */
SdnToGregorian(julday, &year, &month, &day);
monthname = MonthNameShort[month];
break;
convert_to_long_ex(julday);
convert_to_long_ex(mode);
switch(Z_LVAL_PP(mode)) {
case CAL_MONTH_GREGORIAN_LONG: /* gregorian or julian month */
SdnToGregorian(Z_LVAL_PP(julday), &year, &month, &day);
monthname = MonthNameLong[month];
break;
case CAL_MONTH_JULIAN_SHORT: /* gregorian or julian month */
SdnToJulian(Z_LVAL_PP(julday), &year, &month, &day);
monthname = MonthNameShort[month];
break;
case CAL_MONTH_JULIAN_LONG: /* gregorian or julian month */
SdnToJulian(Z_LVAL_PP(julday), &year, &month, &day);
monthname = MonthNameLong[month];
break;
case CAL_MONTH_JEWISH: /* jewish month */
SdnToJewish(Z_LVAL_PP(julday), &year, &month, &day);
monthname = JewishMonthName[month];
break;
case CAL_MONTH_FRENCH: /* french month */
SdnToFrench(Z_LVAL_PP(julday), &year, &month, &day);
monthname = FrenchMonthName[month];
break;
default: /* default gregorian */
case CAL_MONTH_GREGORIAN_SHORT: /* gregorian or julian month */
SdnToGregorian(Z_LVAL_PP(julday), &year, &month, &day);
monthname = MonthNameShort[month];
break;
}
RETURN_STRING(monthname, 1);
+4 -4
View File
@@ -2,12 +2,12 @@
+----------------------------------------------------------------------+
| PHP Version 4 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2006 The PHP Group |
| Copyright (c) 1997-2002 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| 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 through the world-wide-web at the following url: |
| http://www.php.net/license/3_01.txt |
| 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. |
-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
+185 -95
View File
@@ -2,12 +2,12 @@
+----------------------------------------------------------------------+
| PHP Version 4 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2006 The PHP Group |
| Copyright (c) 1997-2002 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| 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 through the world-wide-web at the following url: |
| http://www.php.net/license/3_01.txt |
| 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. |
@@ -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$ */
@@ -55,7 +55,7 @@
#ifdef PHP_WIN32
#define _WIN32_DCOM
#define COBJMACROS
#include <iostream.h>
#include <math.h>
#include <ocidl.h>
@@ -122,7 +122,24 @@ PHPAPI HRESULT php_COM_invoke(comval *obj, DISPID dispIdMember, WORD wFlags, DIS
*ErrString = NULL;
/* @todo use DispInvoke here ? */
if (C_ISREFD(obj)) {
hr = C_DISPATCH_VT(obj)->Invoke(C_DISPATCH(obj), dispIdMember, &IID_NULL, LOCALE_SYSTEM_DEFAULT, wFlags, pDispParams, pVarResult, &ExceptInfo, &ArgErr);
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 = C_DISPATCH_VT(obj)->Invoke(C_DISPATCH(obj), dispIdMember, &IID_NULL, LOCALE_SYSTEM_DEFAULT, wFlags, pDispParams, pVarResult, &ExceptInfo, &ArgErr);
if (SUCCEEDED(hr)) {
/*
* ITypLib doesn't work
* Release ITypeLib and fall back to IDispatch
*/
C_TYPEINFO_VT(obj)->Release(C_TYPEINFO(obj));
C_HASTLIB(obj) = FALSE;
C_TYPEINFO(obj) = NULL;
}
}
} else {
hr = C_DISPATCH_VT(obj)->Invoke(C_DISPATCH(obj), dispIdMember, &IID_NULL, LOCALE_SYSTEM_DEFAULT, wFlags, pDispParams, pVarResult, &ExceptInfo, &ArgErr);
}
if (FAILED(hr)) {
switch (hr) {
@@ -709,7 +726,7 @@ PHP_FUNCTION(com_load)
}
}
RETVAL_COM(obj);
RETURN_RESOURCE(zend_list_insert(obj, IS_COM));
}
/* }}} */
@@ -727,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();
@@ -879,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]);
}
@@ -901,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)
@@ -931,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);
@@ -956,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;
@@ -971,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);
@@ -998,6 +1030,7 @@ PHP_FUNCTION(com_release)
{
pval *object;
comval *obj;
int type;
int arg_count = ZEND_NUM_ARGS();
if (arg_count != 1) {
@@ -1009,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))
}
@@ -1022,6 +1060,7 @@ PHP_FUNCTION(com_addref)
{
pval *object;
comval *obj;
int type;
int arg_count = ZEND_NUM_ARGS();
if (arg_count != 1) {
@@ -1033,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));
}
@@ -1408,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);
@@ -1443,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;
@@ -1610,11 +1665,6 @@ static void do_COM_propput(pval *return_value, comval *obj, pval *arg_property,
FREE_VARIANT(var_result);
/* free the string we allocated; invoked object made its own copy */
if (V_VT(new_value) == VT_BSTR) {
VariantClear(new_value);
}
efree(new_value);
efree(propname);
@@ -1632,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);
}
@@ -1643,15 +1691,11 @@ static void do_COM_propput(pval *return_value, comval *obj, pval *arg_property,
if (ErrString) {
pefree(ErrString, 1);
}
} else {
FREE_VARIANT(var_result);
}
/* free the string we allocated; invoked object made its own copy */
if (V_VT(new_value) == VT_BSTR) {
VariantClear(new_value);
}
efree(new_value);
FREE_VARIANT(var_result);
efree(new_value); // FREE_VARIANT does a VariantClear() which is not desired here !
efree(propname);
}
@@ -1677,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);
@@ -1719,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);
@@ -1780,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;
@@ -1788,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);
@@ -1809,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;
@@ -1818,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;
@@ -1826,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 */
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;
@@ -1859,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;
}
@@ -1934,8 +2001,8 @@ PHPAPI int php_COM_set_property_handler(zend_property_reference *property_refere
return FAILURE;
}
VariantInit(var_result); /* to protect C_DISPATCH(obj) from being freed when var_result is destructed */
zval_dtor(&overloaded_property->element);
VariantInit(var_result); // to protect C_DISPATCH(obj) from being freed when var_result is destructed
pval_destructor(&overloaded_property->element);
}
FREE_VARIANT(var_result);
@@ -1943,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;
}
@@ -1972,19 +2039,22 @@ PHPAPI void php_COM_call_function_handler(INTERNAL_FUNCTION_PARAMETERS, zend_pro
int type;
if (zend_llist_count(property_reference->elements_list)==1
&& !strcmp(Z_STRVAL(function_name->element), "com")) {
zval *tmp;
&& !strcmp(Z_STRVAL(function_name->element), "com")) {
/* constructor */
pval *object_handle;
PHP_FN(com_load)(INTERNAL_FUNCTION_PARAM_PASSTHRU);
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);
}
zend_hash_index_find(Z_OBJPROP_P(return_value), 0, (void**)&handle);
zend_list_addref(Z_RESVAL_PP(handle));
MAKE_STD_ZVAL(tmp);
ZVAL_RESOURCE(tmp, Z_RESVAL_PP(handle));
zend_hash_index_update(Z_OBJPROP_P(object), 0, &tmp, sizeof(tmp), NULL);
zval_dtor(&function_name->element);
return;
}
@@ -1992,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;
@@ -2003,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;
}
@@ -2022,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);
}
@@ -2209,6 +2283,7 @@ static ITypeLib *php_COM_find_typelib(char *search_string, int mode TSRMLS_DC)
PHPAPI int php_COM_load_typelib(ITypeLib *TypeLib, int mode TSRMLS_DC)
{
ITypeComp *TypeComp;
int i;
int interfaces;
@@ -2216,33 +2291,40 @@ PHPAPI int php_COM_load_typelib(ITypeLib *TypeLib, int mode TSRMLS_DC)
return FAILURE;
}
interfaces = ITypeLib_GetTypeInfoCount(TypeLib);
interfaces = TypeLib->lpVtbl->GetTypeInfoCount(TypeLib);
TypeLib->lpVtbl->GetTypeComp(TypeLib, &TypeComp);
for (i=0; i<interfaces; i++) {
TYPEKIND pTKind;
ITypeLib_GetTypeInfoType(TypeLib, i, &pTKind);
if (pTKind == TKIND_ENUM) {
TypeLib->lpVtbl->GetTypeInfoType(TypeLib, i, &pTKind);
if (pTKind==TKIND_ENUM) {
ITypeInfo *TypeInfo;
VARDESC *pVarDesc;
UINT NameCount;
int j;
#if 0
BSTR bstr_EnumId;
char *EnumId;
ITypeLib_GetTypeInfo(TypeLib, i, &TypeInfo);
TypeLib->lpVtbl->GetDocumentation(TypeLib, i, &bstr_EnumId, NULL, NULL, NULL);
EnumId = php_OLECHAR_to_char(bstr_EnumId, NULL, codepage);
printf("Enumeration %d - %s:\n", i, EnumId);
efree(EnumId);
#endif
for (j = 0; ; j++) {
TypeLib->lpVtbl->GetTypeInfo(TypeLib, i, &TypeInfo);
j=0;
while (SUCCEEDED(TypeInfo->lpVtbl->GetVarDesc(TypeInfo, j, &pVarDesc))) {
BSTR bstr_ids;
zend_constant c;
zval exists, results, value;
char *const_name;
if (FAILED(ITypeInfo_GetVarDesc(TypeInfo, j, &pVarDesc))) {
break;
}
ITypeInfo_GetNames(TypeInfo, pVarDesc->memid, &bstr_ids, 1, &NameCount);
if (NameCount != 1) {
ITypeInfo_ReleaseVarDesc(TypeInfo, pVarDesc);
TypeInfo->lpVtbl->GetNames(TypeInfo, pVarDesc->memid, &bstr_ids, 1, &NameCount);
if (NameCount!=1) {
j++;
continue;
}
const_name = php_OLECHAR_to_char(bstr_ids, &c.name_len, codepage TSRMLS_CC);
@@ -2259,7 +2341,7 @@ PHPAPI int php_COM_load_typelib(ITypeLib *TypeLib, int mode TSRMLS_DC)
php_error(E_WARNING, "%s(): Type library value %s is already defined and has a different value", get_active_function_name(TSRMLS_C), c.name);
}
free(c.name);
ITypeInfo_ReleaseVarDesc(TypeInfo, pVarDesc);
j++;
continue;
}
@@ -2273,9 +2355,10 @@ PHPAPI int php_COM_load_typelib(ITypeLib *TypeLib, int mode TSRMLS_DC)
zend_register_constant(&c TSRMLS_CC);
}
ITypeInfo_ReleaseVarDesc(TypeInfo, pVarDesc);
j++;
}
ITypeInfo_Release(TypeInfo);
TypeInfo->lpVtbl->Release(TypeInfo);
}
}
@@ -2287,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();
@@ -2296,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));
}
+5 -5
View File
@@ -2,12 +2,12 @@
+----------------------------------------------------------------------+
| PHP Version 4 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2006 The PHP Group |
| Copyright (c) 1997-2002 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| 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 through the world-wide-web at the following url: |
| http://www.php.net/license/3_01.txt |
| 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. |
@@ -181,7 +181,7 @@ static pval php_VARIANT_get_property_handler(zend_property_reference *property_r
case OE_IS_OBJECT:
if (!strcmp(Z_STRVAL(overloaded_property->element), "value")) {
/* var_arg can't be an idispatch, so we don't care for the implicit AddRef() call here */
// var_arg can't be an idispatch, so we don't care for the implicit AddRef() call here
php_variant_to_pval(var_arg, &result, codepage TSRMLS_CC);
} else if (!strcmp(Z_STRVAL(overloaded_property->element), "type")) {
ZVAL_LONG(&result, V_VT(var_arg))
+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)
+6 -5
View File
@@ -2,12 +2,12 @@
+----------------------------------------------------------------------+
| PHP Version 4 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2006 The PHP Group |
| Copyright (c) 1997-2002 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| 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 through the world-wide-web at the following url: |
| http://www.php.net/license/3_01.txt |
| 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. |
@@ -119,7 +119,7 @@ PHPAPI void php_pval_to_variant_ex2(pval *pval_arg, VARIANT *var_arg, VARTYPE ty
var_arg = V_VARIANTREF(var_arg); /* put the array in that VARIANT */
}
if (!type) {
/* if no type is given we take the variant type */
// if no type is given we take the variant type
type = VT_VARIANT;
}
@@ -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;
+5 -5
View File
@@ -2,12 +2,12 @@
+----------------------------------------------------------------------+
| PHP Version 4 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2006 The PHP Group |
| Copyright (c) 1997-2002 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| 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 through the world-wide-web at the following url: |
| http://www.php.net/license/3_01.txt |
| 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. |
@@ -280,7 +280,7 @@ static HRESULT STDMETHODCALLTYPE disp_invokeex(
ZVAL_NULL(zarg);
}
} else {
/* arg can't be an idispatch, so we don't care for the implicit AddRef() call here */
// arg can't be an idispatch, so we don't care for the implicit AddRef() call here
if (FAILURE == php_variant_to_pval(arg, zarg, codepage TSRMLS_CC)) {
trace("failed to convert arg %d to zval\n", i);
ZVAL_NULL(zarg);
+1 -1
View File
@@ -58,7 +58,7 @@ ZEND_BEGIN_MODULE_GLOBALS(com)
int nothing;
ZEND_END_MODULE_GLOBALS(com)
PHPAPI ZEND_EXTERN_MODULE_GLOBALS(com)
PHPAPI ZEND_EXTERN_MODULE_GLOBALS(com);
#ifdef ZTS
#define COMG(v) TSRMG(com_globals_id, zend_com_globals *, v)
+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));
+67 -81
View File
@@ -1,84 +1,70 @@
dnl $Id$
AC_DEFUN([CPDF_JPEG_TEST],[
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_ERROR([libjpeg.(a|so) not found.])
fi
PHP_CHECK_LIBRARY(jpeg, jpeg_read_header, [
PHP_ADD_LIBRARY_WITH_PATH(jpeg, $CPDF_JPEG_DIR/lib, CPDF_SHARED_LIBADD)
] ,[
AC_MSG_ERROR([CPDF: Problem with libjpeg.(a|so). Please check config.log for more information.])
], [
-L$CPDF_JPEG_DIR/lib
])
],)
AC_MSG_CHECKING(for cpdflib support)
AC_ARG_WITH(cpdflib,
[ --with-cpdflib[=DIR] Include cpdflib support (requires cpdflib >= 2).],
[
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)
])
AC_DEFUN([CPDF_TIFF_TEST],[
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_ERROR([libtiff.(a|so) not found.])
fi
PHP_CHECK_LIBRARY(tiff, TIFFOpen, [
PHP_ADD_LIBRARY_WITH_PATH(tiff, $CPDF_TIFF_DIR/lib, CPDF_SHARED_LIBADD)
] ,[
AC_MSG_ERROR([CPDF: Problem with libtiff.(a|so). Please check config.log for more information.])
], [
-L$CPDF_TIFF_DIR/lib
])
],)
])
PHP_ARG_WITH(cpdflib, for cpdflib support,
[ --with-cpdflib[=DIR] Include cpdflib support (requires cpdflib >= 2).])
if test "$PHP_CPDFLIB" != "no"; then
PHP_NEW_EXTENSION(cpdf, cpdf.c, $ext_shared,, \\$(GDLIB_CFLAGS))
PHP_SUBST(CPDF_SHARED_LIBADD)
CPDF_JPEG_TEST
CPDF_TIFF_TEST
for i in $PHP_CPDFLIB /usr/local /usr; do
if test -f "$i/include/cpdflib.h"; then
CPDFLIB_INCLUDE=$i/include
PHP_CHECK_LIBRARY(cpdf, cpdf_open, [
cpdf_libname=cpdf
], [
PHP_CHECK_LIBRARY(cpdfm, cpdf_open, [
cpdf_libname=cpdfm
], [
AC_MSG_ERROR([Cpdflib module requires cpdflib >= 2.])
], [
-L$i/lib $CPDF_SHARED_LIBADD
])
], [
-L$i/lib $CPDF_SHARED_LIBADD
])
PHP_ADD_LIBRARY_WITH_PATH($cpdf_libname, $i/lib, CPDF_SHARED_LIBADD)
PHP_ADD_INCLUDE($CPDFLIB_INCLUDE)
AC_DEFINE(HAVE_CPDFLIB,1,[Whether you have cpdflib])
break
fi
done
if test -z "$CPDFLIB_INCLUDE"; then
AC_MSG_ERROR([cpdflib.h not found])
fi
fi
+74 -110
View File
@@ -2,12 +2,12 @@
+----------------------------------------------------------------------+
| PHP Version 4 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2006 The PHP Group |
| Copyright (c) 1997-2002 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| 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 through the world-wide-web at the following url: |
| http://www.php.net/license/3_01.txt |
| 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. |
@@ -41,8 +41,6 @@
#include <gd.h>
#endif
#include <cpdflib.h>
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
@@ -222,7 +220,7 @@ PHP_MSHUTDOWN_FUNCTION(cpdf)
return SUCCESS;
}
/* {{{ proto bool cpdf_global_set_document_limits(int maxPages, int maxFonts, int maxImages, int maxAnnots, int maxObjects)
/* {{{ proto void cpdf_global_set_document_limits(int maxPages, int maxFonts, int maxImages, int maxAnnots, int maxObjects)
Sets document settings for all documents */
PHP_FUNCTION(cpdf_global_set_document_limits)
{
@@ -356,7 +354,7 @@ PHP_FUNCTION(cpdf_set_keywords)
}
/* }}} */
/* {{{ proto bool cpdf_set_viewer_preferences(int pdfdoc, array preferences)
/* {{{ proto void cpdf_set_viewer_preferences(int pdfdoc, array preferences)
How to show the document in the viewer */
PHP_FUNCTION(cpdf_set_viewer_preferences)
{
@@ -475,11 +473,6 @@ PHP_FUNCTION(cpdf_open)
if(strcmp(Z_STRVAL_P(arg2), "-") == 0)
php_error(E_WARNING, "%s(): Writing to stdout as described in the ClibPDF manual is not possible if php is used as an Apache module. Write to a memory stream and use cpdf_output_buffer() instead.", get_active_function_name(TSRMLS_C));
#endif
if (php_check_open_basedir(Z_STRVAL_P(arg2) TSRMLS_CC) || (PG(safe_mode) && !php_checkuid(Z_STRVAL_P(arg2), "rb+", CHECKUID_CHECK_MODE_PARAM))) {
cpdf_close(cpdf);
RETURN_FALSE;
}
cpdf_setOutputFilename(cpdf, Z_STRVAL_P(arg2));
}
cpdf_init(cpdf);
@@ -515,7 +508,7 @@ PHP_FUNCTION(cpdf_close)
/* }}} */
#define BUFFERLEN 40
/* {{{ proto bool cpdf_page_init(int pdfdoc, int pagenr, int orientation, int height, int width [, float unit])
/* {{{ proto void cpdf_page_init(int pdfdoc, int pagenr, int orientation, int height, int width [, float unit])
Starts page */
PHP_FUNCTION(cpdf_page_init)
{
@@ -560,7 +553,7 @@ PHP_FUNCTION(cpdf_page_init)
/* }}} */
#undef BUFFERLEN
/* {{{ proto bool cpdf_finalize_page(int pdfdoc, int pagenr)
/* {{{ proto void cpdf_finalize_page(int pdfdoc, int pagenr)
Ends the page to save memory */
PHP_FUNCTION(cpdf_finalize_page)
{
@@ -588,7 +581,7 @@ PHP_FUNCTION(cpdf_finalize_page)
}
/* }}} */
/* {{{ proto bool cpdf_set_current_page(int pdfdoc, int pagenr)
/* {{{ proto void cpdf_set_current_page(int pdfdoc, int pagenr)
Sets page for output */
PHP_FUNCTION(cpdf_set_current_page)
{
@@ -616,7 +609,7 @@ PHP_FUNCTION(cpdf_set_current_page)
}
/* }}} */
/* {{{ proto bool cpdf_begin_text(int pdfdoc)
/* {{{ proto void cpdf_begin_text(int pdfdoc)
Starts text section */
PHP_FUNCTION(cpdf_begin_text)
{
@@ -642,7 +635,7 @@ PHP_FUNCTION(cpdf_begin_text)
}
/* }}} */
/* {{{ proto bool cpdf_end_text(int pdfdoc)
/* {{{ proto void cpdf_end_text(int pdfdoc)
Ends text section */
PHP_FUNCTION(cpdf_end_text)
{
@@ -668,7 +661,7 @@ PHP_FUNCTION(cpdf_end_text)
}
/* }}} */
/* {{{ proto bool cpdf_show(int pdfdoc, string text)
/* {{{ proto void cpdf_show(int pdfdoc, string text)
Output text at current position */
PHP_FUNCTION(cpdf_show)
{
@@ -695,7 +688,7 @@ PHP_FUNCTION(cpdf_show)
}
/* }}} */
/* {{{ proto bool cpdf_show_xy(int pdfdoc, string text, float x-koor, float y-koor [, int mode])
/* {{{ proto void cpdf_show_xy(int pdfdoc, string text, float x-koor, float y-koor [, int mode])
Output text at position */
PHP_FUNCTION(cpdf_show_xy)
{
@@ -733,7 +726,7 @@ PHP_FUNCTION(cpdf_show_xy)
}
/* }}} */
/* {{{ proto bool cpdf_continue_text(int pdfdoc, string text)
/* {{{ proto void cpdf_continue_text(int pdfdoc, string text)
Outputs text in next line */
PHP_FUNCTION(cpdf_continue_text)
{
@@ -760,7 +753,7 @@ PHP_FUNCTION(cpdf_continue_text)
}
/* }}} */
/* {{{ proto bool cpdf_text(int pdfdoc, string text [, float x-koor, float y-koor [, int mode [, float orientation [, int alignmode]]]])
/* {{{ proto void cpdf_text(int pdfdoc, string text [, float x-koor, float y-koor [, int mode [, float orientation [, int alignmode]]]])
Outputs text */
PHP_FUNCTION(cpdf_text)
{
@@ -850,7 +843,7 @@ PHP_FUNCTION(cpdf_text)
}
/* }}} */
/* {{{ proto bool cpdf_set_font(int pdfdoc, string font, float size, string encoding)
/* {{{ proto void cpdf_set_font(int pdfdoc, string font, float size, string encoding)
Selects the current font face, size and encoding */
PHP_FUNCTION(cpdf_set_font)
{
@@ -884,7 +877,7 @@ PHP_FUNCTION(cpdf_set_font)
}
/* }}} */
/* {{{ proto bool cpdf_set_font_directories(int pdfdoc, string pfmdir, string pfbdir)
/* {{{ proto void cpdf_set_font_directories(int pdfdoc, string pfmdir, string pfbdir)
Sets directories to search when using external fonts */
PHP_FUNCTION(cpdf_set_font_directories)
{
@@ -912,7 +905,7 @@ PHP_FUNCTION(cpdf_set_font_directories)
}
/* }}} */
/* {{{ proto bool cpdf_set_font_map_file(int pdfdoc, string filename)
/* {{{ proto void cpdf_set_font_map_file(int pdfdoc, string filename)
Sets fontname to filename translation map when using external fonts */
PHP_FUNCTION(cpdf_set_font_map_file)
{
@@ -933,17 +926,13 @@ PHP_FUNCTION(cpdf_set_font_map_file)
RETURN_FALSE;
}
if (php_check_open_basedir(Z_STRVAL_P(arg2) TSRMLS_CC) || (PG(safe_mode) && !php_checkuid(Z_STRVAL_P(arg2), "rb+", CHECKUID_CHECK_MODE_PARAM))) {
RETURN_FALSE;
}
cpdf_setFontMapFile(pdf, Z_STRVAL_P(arg2));
RETURN_TRUE;
}
/* }}} */
/* {{{ proto bool cpdf_set_leading(int pdfdoc, float distance)
/* {{{ proto void cpdf_set_leading(int pdfdoc, float distance)
Sets distance between text lines */
PHP_FUNCTION(cpdf_set_leading)
{
@@ -970,7 +959,7 @@ PHP_FUNCTION(cpdf_set_leading)
}
/* }}} */
/* {{{ proto bool cpdf_set_text_rendering(int pdfdoc, int rendermode)
/* {{{ proto void cpdf_set_text_rendering(int pdfdoc, int rendermode)
Determines how text is rendered */
PHP_FUNCTION(cpdf_set_text_rendering)
{
@@ -997,7 +986,7 @@ PHP_FUNCTION(cpdf_set_text_rendering)
}
/* }}} */
/* {{{ proto bool cpdf_set_horiz_scaling(int pdfdoc, float scale)
/* {{{ proto void cpdf_set_horiz_scaling(int pdfdoc, float scale)
Sets horizontal scaling of text */
PHP_FUNCTION(cpdf_set_horiz_scaling)
{
@@ -1024,7 +1013,7 @@ PHP_FUNCTION(cpdf_set_horiz_scaling)
}
/* }}} */
/* {{{ proto bool cpdf_set_text_rise(int pdfdoc, float value)
/* {{{ proto void cpdf_set_text_rise(int pdfdoc, float value)
Sets the text rise */
PHP_FUNCTION(cpdf_set_text_rise)
{
@@ -1051,7 +1040,7 @@ PHP_FUNCTION(cpdf_set_text_rise)
}
/* }}} */
/* {{{ proto bool cpdf_set_text_matrix(int pdfdoc, arry matrix)
/* {{{ proto void cpdf_set_text_matrix(int pdfdoc, arry matrix)
Sets the text matrix */
PHP_FUNCTION(cpdf_set_text_matrix)
{
@@ -1104,7 +1093,7 @@ PHP_FUNCTION(cpdf_set_text_matrix)
}
/* }}} */
/* {{{ proto bool cpdf_set_text_pos(int pdfdoc, float x, float y [, int mode])
/* {{{ proto void cpdf_set_text_pos(int pdfdoc, float x, float y [, int mode])
Sets the position of text for the next cpdf_show call */
PHP_FUNCTION(cpdf_set_text_pos)
{
@@ -1141,7 +1130,7 @@ PHP_FUNCTION(cpdf_set_text_pos)
}
/* }}} */
/* {{{ proto bool cpdf_rotate_text(int pdfdoc, float angle)
/* {{{ proto void cpdf_rotate_text(int pdfdoc, float angle)
Sets text rotation angle */
PHP_FUNCTION(cpdf_rotate_text)
{
@@ -1168,7 +1157,7 @@ PHP_FUNCTION(cpdf_rotate_text)
}
/* }}} */
/* {{{ proto bool cpdf_set_char_spacing(int pdfdoc, float space)
/* {{{ proto void cpdf_set_char_spacing(int pdfdoc, float space)
Sets character spacing */
PHP_FUNCTION(cpdf_set_char_spacing)
{
@@ -1195,7 +1184,7 @@ PHP_FUNCTION(cpdf_set_char_spacing)
}
/* }}} */
/* {{{ proto bool cpdf_set_word_spacing(int pdfdoc, float space)
/* {{{ proto void cpdf_set_word_spacing(int pdfdoc, float space)
Sets spacing between words */
PHP_FUNCTION(cpdf_set_word_spacing)
{
@@ -1250,7 +1239,7 @@ PHP_FUNCTION(cpdf_stringwidth)
}
/* }}} */
/* {{{ proto bool cpdf_save(int pdfdoc)
/* {{{ proto void cpdf_save(int pdfdoc)
Saves current enviroment */
PHP_FUNCTION(cpdf_save)
{
@@ -1276,7 +1265,7 @@ PHP_FUNCTION(cpdf_save)
}
/* }}} */
/* {{{ proto bool cpdf_restore(int pdfdoc)
/* {{{ proto void cpdf_restore(int pdfdoc)
Restores formerly saved enviroment */
PHP_FUNCTION(cpdf_restore)
{
@@ -1302,7 +1291,7 @@ PHP_FUNCTION(cpdf_restore)
}
/* }}} */
/* {{{ proto bool cpdf_translate(int pdfdoc, float x, float y)
/* {{{ proto void cpdf_translate(int pdfdoc, float x, float y)
Sets origin of coordinate system */
PHP_FUNCTION(cpdf_translate)
{
@@ -1330,7 +1319,7 @@ PHP_FUNCTION(cpdf_translate)
}
/* }}} */
/* {{{ proto bool cpdf_scale(int pdfdoc, float x_scale, float y_scale)
/* {{{ proto void cpdf_scale(int pdfdoc, float x_scale, float y_scale)
Sets scaling */
PHP_FUNCTION(cpdf_scale)
{
@@ -1358,7 +1347,7 @@ PHP_FUNCTION(cpdf_scale)
}
/* }}} */
/* {{{ proto bool cpdf_rotate(int pdfdoc, float angle)
/* {{{ proto void cpdf_rotate(int pdfdoc, float angle)
Sets rotation */
PHP_FUNCTION(cpdf_rotate)
{
@@ -1385,7 +1374,7 @@ PHP_FUNCTION(cpdf_rotate)
}
/* }}} */
/* {{{ proto bool cpdf_setflat(int pdfdoc, float value)
/* {{{ proto void cpdf_setflat(int pdfdoc, float value)
Sets flatness */
PHP_FUNCTION(cpdf_setflat)
{
@@ -1417,7 +1406,7 @@ PHP_FUNCTION(cpdf_setflat)
}
/* }}} */
/* {{{ proto bool cpdf_setlinejoin(int pdfdoc, int value)
/* {{{ proto void cpdf_setlinejoin(int pdfdoc, int value)
Sets linejoin parameter */
PHP_FUNCTION(cpdf_setlinejoin)
{
@@ -1449,7 +1438,7 @@ PHP_FUNCTION(cpdf_setlinejoin)
}
/* }}} */
/* {{{ proto bool cpdf_setlinecap(int pdfdoc, int value)
/* {{{ proto void cpdf_setlinecap(int pdfdoc, int value)
Sets linecap parameter */
PHP_FUNCTION(cpdf_setlinecap)
{
@@ -1481,7 +1470,7 @@ PHP_FUNCTION(cpdf_setlinecap)
}
/* }}} */
/* {{{ proto bool cpdf_setmiterlimit(int pdfdoc, float value)
/* {{{ proto void cpdf_setmiterlimit(int pdfdoc, float value)
Sets miter limit */
PHP_FUNCTION(cpdf_setmiterlimit)
{
@@ -1513,7 +1502,7 @@ PHP_FUNCTION(cpdf_setmiterlimit)
}
/* }}} */
/* {{{ proto bool cpdf_setlinewidth(int pdfdoc, float width)
/* {{{ proto void cpdf_setlinewidth(int pdfdoc, float width)
Sets line width */
PHP_FUNCTION(cpdf_setlinewidth)
{
@@ -1541,7 +1530,7 @@ PHP_FUNCTION(cpdf_setlinewidth)
/* }}} */
#define BUFFERLEN 20
/* {{{ proto bool cpdf_setdash(int pdfdoc, long white, long black)
/* {{{ proto void cpdf_setdash(int pdfdoc, long white, long black)
Sets dash pattern */
PHP_FUNCTION(cpdf_setdash)
{
@@ -1563,9 +1552,7 @@ PHP_FUNCTION(cpdf_setdash)
php_error(E_WARNING, "%s(): Unable to find identifier %d", get_active_function_name(TSRMLS_C), id);
RETURN_FALSE;
}
if (!pdf->currentMemStream) {
RETURN_FALSE;
}
snprintf(buffer, BUFFERLEN, "[%d %d] 0", (int) Z_LVAL_P(arg2), (int) Z_LVAL_P(arg3));
cpdf_setdash(pdf, buffer);
@@ -1574,7 +1561,7 @@ PHP_FUNCTION(cpdf_setdash)
/* }}} */
#undef BUFFERLEN
/* {{{ proto bool cpdf_moveto(int pdfdoc, float x, float y [, int mode])
/* {{{ proto void cpdf_moveto(int pdfdoc, float x, float y [, int mode])
Sets current point */
PHP_FUNCTION(cpdf_moveto)
{
@@ -1611,7 +1598,7 @@ PHP_FUNCTION(cpdf_moveto)
}
/* }}} */
/* {{{ proto bool cpdf_rmoveto(int pdfdoc, float x, float y [, int mode])
/* {{{ proto void cpdf_rmoveto(int pdfdoc, float x, float y [, int mode])
Sets current point */
PHP_FUNCTION(cpdf_rmoveto)
{
@@ -1648,7 +1635,7 @@ PHP_FUNCTION(cpdf_rmoveto)
}
/* }}} */
/* {{{ proto bool cpdf_curveto(int pdfdoc, float x1, float y1, float x2, float y2, float x3, float y3 [, int mode])
/* {{{ proto void cpdf_curveto(int pdfdoc, float x1, float y1, float x2, float y2, float x3, float y3 [, int mode])
Draws a curve */
PHP_FUNCTION(cpdf_curveto)
{
@@ -1699,7 +1686,7 @@ PHP_FUNCTION(cpdf_curveto)
}
/* }}} */
/* {{{ proto bool cpdf_lineto(int pdfdoc, float x, float y [, int mode])
/* {{{ proto void cpdf_lineto(int pdfdoc, float x, float y [, int mode])
Draws a line */
PHP_FUNCTION(cpdf_lineto)
{
@@ -1736,7 +1723,7 @@ PHP_FUNCTION(cpdf_lineto)
}
/* }}} */
/* {{{ proto bool cpdf_rlineto(int pdfdoc, float x, float y [, int mode])
/* {{{ proto void cpdf_rlineto(int pdfdoc, float x, float y [, int mode])
Draws a line relative to current point */
PHP_FUNCTION(cpdf_rlineto)
{
@@ -1773,7 +1760,7 @@ PHP_FUNCTION(cpdf_rlineto)
}
/* }}} */
/* {{{ proto bool cpdf_circle(int pdfdoc, float x, float y, float radius [, int mode])
/* {{{ proto void cpdf_circle(int pdfdoc, float x, float y, float radius [, int mode])
Draws a circle */
PHP_FUNCTION(cpdf_circle)
{
@@ -1811,7 +1798,7 @@ PHP_FUNCTION(cpdf_circle)
}
/* }}} */
/* {{{ proto bool cpdf_arc(int pdfdoc, float x, float y, float radius, float start, float end [, int mode])
/* {{{ proto void cpdf_arc(int pdfdoc, float x, float y, float radius, float start, float end [, int mode])
Draws an arc */
PHP_FUNCTION(cpdf_arc)
{
@@ -1851,7 +1838,7 @@ PHP_FUNCTION(cpdf_arc)
}
/* }}} */
/* {{{ proto bool cpdf_rect(int pdfdoc, float x, float y, float width, float height [, int mode])
/* {{{ proto void cpdf_rect(int pdfdoc, float x, float y, float width, float height [, int mode])
Draws a rectangle */
PHP_FUNCTION(cpdf_rect)
{
@@ -1896,7 +1883,7 @@ PHP_FUNCTION(cpdf_rect)
}
/* }}} */
/* {{{ proto bool cpdf_newpath(int pdfdoc)
/* {{{ proto void cpdf_newpath(int pdfdoc)
Starts new path */
PHP_FUNCTION(cpdf_newpath)
{
@@ -1922,7 +1909,7 @@ PHP_FUNCTION(cpdf_newpath)
}
/* }}} */
/* {{{ proto bool cpdf_closepath(int pdfdoc)
/* {{{ proto void cpdf_closepath(int pdfdoc)
Close path */
PHP_FUNCTION(cpdf_closepath)
{
@@ -1948,7 +1935,7 @@ PHP_FUNCTION(cpdf_closepath)
}
/* }}} */
/* {{{ proto bool cpdf_closepath_stroke(int pdfdoc)
/* {{{ proto void cpdf_closepath_stroke(int pdfdoc)
Close path and draw line along path */
PHP_FUNCTION(cpdf_closepath_stroke)
{
@@ -1975,7 +1962,7 @@ PHP_FUNCTION(cpdf_closepath_stroke)
}
/* }}} */
/* {{{ proto bool cpdf_stroke(int pdfdoc)
/* {{{ proto void cpdf_stroke(int pdfdoc)
Draws line along path path */
PHP_FUNCTION(cpdf_stroke)
{
@@ -2001,7 +1988,7 @@ PHP_FUNCTION(cpdf_stroke)
}
/* }}} */
/* {{{ proto bool cpdf_fill(int pdfdoc)
/* {{{ proto void cpdf_fill(int pdfdoc)
Fills current path */
PHP_FUNCTION(cpdf_fill)
{
@@ -2027,7 +2014,7 @@ PHP_FUNCTION(cpdf_fill)
}
/* }}} */
/* {{{ proto bool cpdf_fill_stroke(int pdfdoc)
/* {{{ proto void cpdf_fill_stroke(int pdfdoc)
Fills and stroke current path */
PHP_FUNCTION(cpdf_fill_stroke)
{
@@ -2054,7 +2041,7 @@ PHP_FUNCTION(cpdf_fill_stroke)
}
/* }}} */
/* {{{ proto bool cpdf_closepath_fill_stroke(int pdfdoc)
/* {{{ proto void cpdf_closepath_fill_stroke(int pdfdoc)
Close, fill and stroke current path */
PHP_FUNCTION(cpdf_closepath_fill_stroke)
{
@@ -2082,7 +2069,7 @@ PHP_FUNCTION(cpdf_closepath_fill_stroke)
}
/* }}} */
/* {{{ proto bool cpdf_clip(int pdfdoc)
/* {{{ proto void cpdf_clip(int pdfdoc)
Clips to current path */
PHP_FUNCTION(cpdf_clip)
{
@@ -2108,7 +2095,7 @@ PHP_FUNCTION(cpdf_clip)
}
/* }}} */
/* {{{ proto bool cpdf_setgray_fill(int pdfdoc, float value)
/* {{{ proto void cpdf_setgray_fill(int pdfdoc, float value)
Sets filling color to gray value */
PHP_FUNCTION(cpdf_setgray_fill)
{
@@ -2135,7 +2122,7 @@ PHP_FUNCTION(cpdf_setgray_fill)
}
/* }}} */
/* {{{ proto bool cpdf_setgray_stroke(int pdfdoc, float value)
/* {{{ proto void cpdf_setgray_stroke(int pdfdoc, float value)
Sets drawing color to gray value */
PHP_FUNCTION(cpdf_setgray_stroke)
{
@@ -2162,7 +2149,7 @@ PHP_FUNCTION(cpdf_setgray_stroke)
}
/* }}} */
/* {{{ proto bool cpdf_setgray(int pdfdoc, float value)
/* {{{ proto void cpdf_setgray(int pdfdoc, float value)
Sets drawing and filling color to gray value */
PHP_FUNCTION(cpdf_setgray)
{
@@ -2189,7 +2176,7 @@ PHP_FUNCTION(cpdf_setgray)
}
/* }}} */
/* {{{ proto bool cpdf_setrgbcolor_fill(int pdfdoc, float red, float green, float blue)
/* {{{ proto void cpdf_setrgbcolor_fill(int pdfdoc, float red, float green, float blue)
Sets filling color to rgb color value */
PHP_FUNCTION(cpdf_setrgbcolor_fill)
{
@@ -2218,7 +2205,7 @@ PHP_FUNCTION(cpdf_setrgbcolor_fill)
}
/* }}} */
/* {{{ proto bool cpdf_setrgbcolor_stroke(int pdfdoc, float red, float green, float blue)
/* {{{ proto void cpdf_setrgbcolor_stroke(int pdfdoc, float red, float green, float blue)
Sets drawing color to RGB color value */
PHP_FUNCTION(cpdf_setrgbcolor_stroke)
{
@@ -2247,7 +2234,7 @@ PHP_FUNCTION(cpdf_setrgbcolor_stroke)
}
/* }}} */
/* {{{ proto bool cpdf_setrgbcolor(int pdfdoc, float red, float green, float blue)
/* {{{ proto void cpdf_setrgbcolor(int pdfdoc, float red, float green, float blue)
Sets drawing and filling color to RGB color value */
PHP_FUNCTION(cpdf_setrgbcolor)
{
@@ -2276,7 +2263,7 @@ PHP_FUNCTION(cpdf_setrgbcolor)
}
/* }}} */
/* {{{ proto bool cpdf_set_page_animation(int pdfdoc, int transition, float duration, float direction, int orientation, int inout)
/* {{{ proto void cpdf_set_page_animation(int pdfdoc, int transition, float duration, float direction, int orientation, int inout)
Sets transition between pages */
PHP_FUNCTION(cpdf_set_page_animation)
{
@@ -2308,7 +2295,7 @@ PHP_FUNCTION(cpdf_set_page_animation)
}
/* }}} */
/* {{{ proto bool cpdf_finalize(int pdfdoc)
/* {{{ proto array cpdf_finalize(int pdfdoc)
Creates PDF doc in memory */
PHP_FUNCTION(cpdf_finalize)
{
@@ -2334,7 +2321,7 @@ PHP_FUNCTION(cpdf_finalize)
}
/* }}} */
/* {{{ proto bool cpdf_output_buffer(int pdfdoc)
/* {{{ proto array cpdf_output_buffer(int pdfdoc)
Returns the internal memory stream as string */
PHP_FUNCTION(cpdf_output_buffer)
{
@@ -2363,7 +2350,7 @@ PHP_FUNCTION(cpdf_output_buffer)
}
/* }}} */
/* {{{ proto bool cpdf_save_to_file(int pdfdoc, string filename)
/* {{{ proto array cpdf_save_to_file(int pdfdoc, string filename)
Saves the internal memory stream to a file */
PHP_FUNCTION(cpdf_save_to_file)
{
@@ -2389,17 +2376,13 @@ PHP_FUNCTION(cpdf_save_to_file)
php_error(E_WARNING, "%s(): Writing to stdout as described in the ClibPDF manual is not possible if php is used as an Apache module. Use cpdf_output_buffer() instead.", get_active_function_name(TSRMLS_C));
#endif
if (php_check_open_basedir(Z_STRVAL_P(arg2) TSRMLS_CC) || (PG(safe_mode) && !php_checkuid(Z_STRVAL_P(arg2), "wb+", CHECKUID_CHECK_MODE_PARAM))) {
RETURN_FALSE;
}
cpdf_savePDFmemoryStreamToFile(pdf, Z_STRVAL_P(arg2));
RETURN_TRUE;
}
/* }}} */
/* {{{ proto bool cpdf_import_jpeg(int pdfdoc, string filename, float x, float y, float angle, float width, float height, float x_scale, float y_scale, int gsave [, int mode])
/* {{{ proto void cpdf_import_jpeg(int pdfdoc, string filename, float x, float y, float angle, float width, float height, float x_scale, float y_scale, int gsave [, int mode])
Includes JPEG image */
PHP_FUNCTION(cpdf_import_jpeg)
{
@@ -2416,11 +2399,6 @@ PHP_FUNCTION(cpdf_import_jpeg)
convert_to_long(argv[0]);
convert_to_string(argv[1]);
if (php_check_open_basedir(Z_STRVAL_P(argv[1]) TSRMLS_CC) || (PG(safe_mode) && !php_checkuid(Z_STRVAL_P(argv[1]), "rb+", CHECKUID_CHECK_MODE_PARAM))) {
RETURN_FALSE;
}
convert_to_double(argv[2]);
convert_to_double(argv[3]);
convert_to_double(argv[4]);
@@ -2472,7 +2450,7 @@ PHP_FUNCTION(cpdf_import_jpeg)
/* }}} */
#if HAVE_LIBGD13
/* {{{ proto bool cpdf_place_inline_image(int pdfdoc, int gdimage, float x, float y, float angle, fload width, float height, int gsave [, int mode])
/* {{{ proto void cpdf_place_inline_image(int pdfdoc, int gdimage, float x, float y, float angle, fload width, float height, int gsave [, int mode])
Includes image */
PHP_FUNCTION(cpdf_place_inline_image)
{
@@ -2524,30 +2502,16 @@ PHP_FUNCTION(cpdf_place_inline_image)
}
count = 3 * im->sx * im->sy;
buffer = (unsigned char *) safe_emalloc(3 * im->sx, im->sy, 0);
if(NULL == (buffer = (unsigned char *) emalloc(count)))
RETURN_FALSE;
ptr = buffer;
for(i=0; i<im->sy; i++) {
for(j=0; j<im->sx; j++) {
#if HAVE_LIBGD20
if(gdImageTrueColor(im)) {
if (im->tpixels && gdImageBoundsSafe(im, j, i)) {
color = gdImageTrueColorPixel(im, j, i);
*ptr++ = (color >> 16) & 0xFF;
*ptr++ = (color >> 8) & 0xFF;
*ptr++ = color & 0xFF;
}
} else {
#endif
if (im->pixels && gdImageBoundsSafe(im, j, i)) {
color = im->pixels[i][j];
*ptr++ = im->red[color];
*ptr++ = im->green[color];
*ptr++ = im->blue[color];
}
#if HAVE_LIBGD20
}
#endif
color = im->pixels[i][j];
*ptr++ = im->red[color];
*ptr++ = im->green[color];
*ptr++ = im->blue[color];
}
}
@@ -2578,7 +2542,7 @@ PHP_FUNCTION(cpdf_place_inline_image)
/* }}} */
#endif
/* {{{ proto bool cpdf_add_annotation(int pdfdoc, float xll, float yll, float xur, float xur, string title, string text [, int mode])
/* {{{ proto void cpdf_add_annotation(int pdfdoc, float xll, float yll, float xur, float xur, string title, string text [, int mode])
Sets annotation */
PHP_FUNCTION(cpdf_add_annotation)
{
+6 -4
View File
@@ -2,12 +2,12 @@
+----------------------------------------------------------------------+
| PHP Version 4 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2006 The PHP Group |
| Copyright (c) 1997-2002 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| 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 through the world-wide-web at the following url: |
| http://www.php.net/license/3_01.txt |
| 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. |
@@ -29,6 +29,8 @@
#undef T
#endif
#include <cpdflib.h>
extern zend_module_entry cpdf_module_entry;
#define cpdf_module_ptr &cpdf_module_entry
+19 -19
View File
@@ -7,27 +7,27 @@ PHP_ARG_WITH(crack, for CRACKlib support,
if test "$PHP_CRACK" != "no"; then
for i in $PHP_CRACK/lib $PHP_CRACK/cracklib /usr/local/lib /usr/lib; do
test -f $i/libcrack.$SHLIB_SUFFIX_NAME -o -f $i/libcrack.a && CRACK_LIBDIR=$i && break
test -f $i/libcrack_krb5.$SHLIB_SUFFIX_NAME -o -f $i/libcrack_krb5.a && CRACK_LIBDIR=$i && break
done
for i in /usr/local/lib /usr/lib $PHP_CRACK/lib $PHP_CRACK/cracklib; do
test -f $i/libcrack.$SHLIB_SUFFIX_NAME -o -f $i/libcrack.a && CRACK_LIBDIR=$i
done
if test -z "$CRACK_LIBDIR"; then
AC_MSG_ERROR(Cannot find the cracklib library file)
fi
for i in $PHP_CRACK/include $PHP_CRACK/cracklib /usr/local/include /usr/include; do
test -f $i/packer.h && CRACK_INCLUDEDIR=$i && break
done
for i in /usr/local/include /usr/include $PHP_CRACK/include $PHP_CRACK/cracklib; do
test -f $i/packer.h && CRACK_INCLUDEDIR=$i
done
if test -z "$CRACK_INCLUDEDIR"; then
AC_MSG_ERROR(Cannot find a cracklib header file)
fi
if test -z "$CRACK_LIBDIR"; then
AC_MSG_ERROR(Cannot find the cracklib library file)
fi
PHP_ADD_INCLUDE($CRACK_INCLUDEDIR)
PHP_ADD_LIBRARY_WITH_PATH(crack, $CRACK_LIBDIR, CRACK_SHARED_LIBADD)
if test -z "$CRACK_INCLUDEDIR"; then
AC_MSG_ERROR(Cannot find a cracklib header file)
fi
PHP_NEW_EXTENSION(crack, crack.c, $ext_shared)
PHP_SUBST(CRACK_SHARED_LIBADD)
AC_DEFINE(HAVE_CRACK, 1, [ ])
PHP_ADD_INCLUDE($CRACK_INCLUDEDIR)
PHP_ADD_LIBRARY_WITH_PATH(crack, $CRACK_LIBDIR, CRACK_SHARED_LIBADD)
PHP_NEW_EXTENSION(crack, crack.c, $ext_shared)
PHP_SUBST(CRACK_SHARED_LIBADD)
AC_DEFINE(HAVE_CRACK, 1, [ ])
fi
+12 -28
View File
@@ -2,12 +2,12 @@
+----------------------------------------------------------------------+
| PHP Version 4 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2006 The PHP Group |
| Copyright (c) 1997-2002 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| 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 through the world-wide-web at the following url: |
| http://www.php.net/license/3_01.txt |
| 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. |
@@ -29,13 +29,6 @@
#include <packer.h>
#ifndef STRINGSIZE
#define STRINGSIZE 1024
#endif
extern char * FascistLook(PWDICT *pwp, char *instring);
extern int PWClose(PWDICT *pwp);
ZEND_DECLARE_MODULE_GLOBALS(crack)
/* True global resources - no need for thread safety here */
@@ -76,16 +69,11 @@ long _crack_open_dict(char *dictpath TSRMLS_DC)
long resource;
if (CRACKG(current_id) != -1) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Can not use more than one open dictionary with this implementation of libcrack");
zend_error(E_WARNING, "Can not use more than one open dictionary with this implementation of libcrack");
return -1;
}
if ((PG(safe_mode) && (!php_checkuid(dictpath, NULL, CHECKUID_CHECK_FILE_AND_DIR))) || php_check_open_basedir(dictpath TSRMLS_CC)) {
return -1;
}
if (NULL == (pwdict = PWOpen(dictpath, "r"))) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to open a crack dictionary");
zend_error(E_WARNING, "Unable to open a crack dictionary");
return -1;
}
@@ -152,7 +140,7 @@ ZEND_MODULE_INFO_D(crack)
DISPLAY_INI_ENTRIES();
}
/* {{{ proto resource crack_opendict(string dictionary)
/* {{{ proto string crack_opendict(string dictionary)
Opens a new cracklib dictionary */
ZEND_FUNCTION(crack_opendict)
{
@@ -168,12 +156,12 @@ ZEND_FUNCTION(crack_opendict)
if (-1 == (resource = _crack_open_dict(Z_STRVAL_PP(dictpath) TSRMLS_CC))) {
RETURN_FALSE;
}
RETURN_RESOURCE(resource);
}
/* }}} */
/* {{{ proto bool crack_closedict([resource dictionary])
/* {{{ proto string crack_closedict([int link_identifier])
Closes an open cracklib dictionary */
ZEND_FUNCTION(crack_closedict)
{
@@ -196,10 +184,6 @@ ZEND_FUNCTION(crack_closedict)
break;
}
if (id < 1) {
RETURN_FALSE;
}
ZEND_FETCH_RESOURCE(pwdict, PWDICT *, dictionary, id, "cracklib dictionary", le_crack);
if (CRACKG(current_id) == id) {
CRACKG(current_id) = -1;
@@ -210,7 +194,7 @@ ZEND_FUNCTION(crack_closedict)
}
/* }}} */
/* {{{ proto bool crack_check([resource dictionary,] string password)
/* {{{ proto string crack_check([int dictionary,] string password)
Performs an obscure check with the given password */
ZEND_FUNCTION(crack_check)
{
@@ -234,7 +218,7 @@ ZEND_FUNCTION(crack_check)
if (zend_get_parameters_ex(2, &dictionary, &password) == FAILURE) {
RETURN_FALSE;
}
id = Z_LVAL_PP(dictionary);
id = -1;
break;
default:
WRONG_PARAM_COUNT;
@@ -272,7 +256,7 @@ ZEND_FUNCTION(crack_getlastmessage)
}
if (NULL == CRACKG(last_message)) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "No obscure checks in this session");
zend_error(E_WARNING, "No obscure checks in this session");
RETURN_FALSE;
}
+3 -3
View File
@@ -4,10 +4,10 @@
+----------------------------------------------------------------------+
| Copyright (c) 1997, 1998, 1999, 2000, 2001 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| 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 through the world-wide-web at the following url: |
| http://www.php.net/license/3_01.txt |
| 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. |
+21 -32
View File
@@ -2,12 +2,12 @@
+----------------------------------------------------------------------+
| PHP Version 4 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2006 The PHP Group |
| Copyright (c) 1997-2002 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| 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 through the world-wide-web at the following url: |
| http://www.php.net/license/3_01.txt |
| 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. |
@@ -92,39 +92,28 @@ PHP_MINFO_FUNCTION(ctype)
/* {{{ ctype
*/
#define CTYPE(iswhat) \
zval *c, tmp; \
zval *c; \
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &c) == FAILURE) \
return; \
if (Z_TYPE_P(c) == IS_LONG) { \
if (Z_LVAL_P(c) <= 255 && Z_LVAL_P(c) >= 0) { \
RETURN_BOOL(iswhat(Z_LVAL_P(c))); \
} else if (Z_LVAL_P(c) >= -128 && Z_LVAL_P(c) < 0) { \
RETURN_BOOL(iswhat(Z_LVAL_P(c) + 256)); \
} \
tmp = *c; \
zval_copy_ctor(&tmp); \
convert_to_string(&tmp); \
} else { \
tmp = *c; \
} \
if (Z_TYPE(tmp) == IS_STRING) { \
char *p = Z_STRVAL(tmp), *e = Z_STRVAL(tmp) + Z_STRLEN(tmp); \
if (e == p) { \
if (Z_TYPE_P(c) == IS_LONG) zval_dtor(&tmp); \
RETURN_FALSE; \
} \
while (p < e) { \
if(!iswhat((int)*(unsigned char *)(p++))) { \
if (Z_TYPE_P(c) == IS_LONG) zval_dtor(&tmp); \
RETURN_FALSE; \
switch (Z_TYPE_P(c)) { \
case IS_LONG: \
RETURN_BOOL(iswhat(Z_LVAL_P(c))); \
case IS_STRING: \
{ \
char *p; \
int n, len; \
p=Z_STRVAL_P(c); \
len = Z_STRLEN_P(c); \
for(n=0;n<len;n++) { \
if(!iswhat(*p++)) RETURN_FALSE; \
} \
RETURN_TRUE; \
} \
if (Z_TYPE_P(c) == IS_LONG) zval_dtor(&tmp); \
RETURN_TRUE; \
} else { \
RETURN_FALSE; \
default: \
break; \
} \
RETURN_FALSE;
/* }}} */
/* {{{ proto bool ctype_alnum(mixed c)
+4 -4
View File
@@ -2,12 +2,12 @@
+----------------------------------------------------------------------+
| PHP Version 4 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2006 The PHP Group |
| Copyright (c) 1997-2002 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| 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 through the world-wide-web at the following url: |
| http://www.php.net/license/3_01.txt |
| 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. |
-24
View File
@@ -1,24 +0,0 @@
--TEST--
Bug #25745 (ctype functions fail with non-ascii characters)
--FILE--
<?php
$funcs = array(
"ctype_alnum", "ctype_alpha", "ctype_cntrl", "ctype_digit",
"ctype_graph", "ctype_lower", "ctype_print", "ctype_punct",
"ctype_space", "ctype_upper", "ctype_xdigit"
);
foreach ($funcs as $ctype_func) {
for ($i = 0; $i < 256; $i++) {
$a = $ctype_func($i);
$b = $ctype_func(chr($i));
if ($a != $b) {
echo "broken... $ctype_func($i) = $a, $ctype_func(chr($i)) = $b\n";
exit;
}
}
}
echo "ok\n";
?>
--EXPECT--
ok
-11
View File
@@ -1,11 +0,0 @@
--TEST--
Bug #34645 (ctype corrupts memory when validating large numbers)
--FILE--
<?php
$id = 394829384;
var_dump(ctype_digit($id));
var_dump($id);
?>
--EXPECT--
bool(true)
int(394829384)
+2 -35
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
@@ -32,10 +31,10 @@ if test "$PHP_CURL" != "no"; then
CURL_CONFIG="curl-config"
AC_MSG_CHECKING(for cURL 7.9.8 or greater)
if ${CURL_DIR}/bin/curl-config --libs > /dev/null 2>&1; then
if ${CURL_DIR}/bin/curl-config --libs print > /dev/null 2>&1; then
CURL_CONFIG=${CURL_DIR}/bin/curl-config
else
if ${CURL_DIR}/curl-config --libs > /dev/null 2>&1; then
if ${CURL_DIR}/curl-config --libs print > /dev/null 2>&1; then
CURL_CONFIG=${CURL_DIR}/curl-config
fi
fi
@@ -48,38 +47,6 @@ if test "$PHP_CURL" != "no"; then
else
AC_MSG_ERROR(cURL version 7.9.8 or later is required to compile php with cURL support)
fi
AC_MSG_CHECKING([for SSL support in libcurl])
CURL_SSL=`$CURL_CONFIG --feature | $EGREP SSL`
if test "$CURL_SSL" = "SSL"; then
AC_MSG_RESULT([yes])
AC_DEFINE([HAVE_CURL_SSL], [1], [Have cURL with SSL support])
AC_MSG_CHECKING([for SSL library used])
CURL_SSL_FLAVOUR=
for i in $CURL_LIBS; do
if test "$i" = "-lssl"; then
CURL_SSL_FLAVOUR="openssl"
AC_MSG_RESULT([openssl])
AC_DEFINE([HAVE_CURL_OPENSSL], [1], [Have cURL with OpenSSL support])
AC_CHECK_HEADERS([openssl/crypto.h])
break
elif test "$i" = "-lgnutls"; then
CURL_SSL_FLAVOUR="gnutls"
AC_MSG_RESULT([gnutls])
AC_DEFINE([HAVE_CURL_GNUTLS], [1], [Have cURL with GnuTLS support])
AC_CHECK_HEADERS([gcrypt.h])
break
fi
done
if test -z "$CURL_SSL_FLAVOUR"; then
AC_MSG_RESULT([unknown!])
AC_MSG_WARN([Could not determine the type of SSL library used!])
AC_MSG_WARN([Building will fail in ZTS mode!])
fi
else
AC_MSG_RESULT([no])
fi
PHP_ADD_INCLUDE($CURL_DIR/include)
PHP_EVAL_LIBLINE($CURL_LIBS, CURL_SHARED_LIBADD)
+95 -413
View File
@@ -2,12 +2,12 @@
+----------------------------------------------------------------------+
| PHP Version 4 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2006 The PHP Group |
| Copyright (c) 1997-2002 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| 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 through the world-wide-web at the following url: |
| http://www.php.net/license/3_01.txt |
| 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. |
@@ -22,10 +22,6 @@
#include "config.h"
#endif
#ifdef PHP_WIN32
#include <winsock2.h>
#endif
#include "php.h"
#if HAVE_CURL
@@ -34,121 +30,23 @@
#include <string.h>
#ifdef PHP_WIN32
#include <winsock.h>
#include <sys/types.h>
#endif
#include <curl/curl.h>
#include <curl/easy.h>
/* As of curl 7.11.1 this is no longer defined inside curl.h */
#ifndef HttpPost
#define HttpPost curl_httppost
#endif
/* {{{ cruft for thread safe SSL crypto locks */
#if defined(ZTS) && defined(HAVE_CURL_SSL)
# ifdef PHP_WIN32
# define PHP_CURL_NEED_OPENSSL_TSL
# include <openssl/crypto.h>
# else /* !PHP_WIN32 */
# if defined(HAVE_CURL_OPENSSL)
# if defined(HAVE_OPENSSL_CRYPTO_H)
# define PHP_CURL_NEED_OPENSSL_TSL
# include <openssl/crypto.h>
# else
# warning \
"libcurl was compiled with OpenSSL support, but configure could not find " \
"openssl/crypto.h; thus no SSL crypto locking callbacks will be set, which may " \
"cause random crashes on SSL requests"
# endif
# elif defined(HAVE_CURL_GNUTLS)
# if defined(HAVE_GCRYPT_H)
# define PHP_CURL_NEED_GNUTLS_TSL
# include <gcrypt.h>
# else
# warning \
"libcurl was compiled with GnuTLS support, but configure could not find " \
"gcrypt.h; thus no SSL crypto locking callbacks will be set, which may " \
"cause random crashes on SSL requests"
# endif
# else
# warning \
"libcurl was compiled with SSL support, but configure could not determine which" \
"library was used; thus no SSL crypto locking callbacks will be set, which may " \
"cause random crashes on SSL requests"
# endif /* HAVE_CURL_OPENSSL || HAVE_CURL_GNUTLS */
# endif /* PHP_WIN32 */
#endif /* ZTS && HAVE_CURL_SSL */
/* }}} */
#define SMART_STR_PREALLOC 4096
#include "ext/standard/php_smart_str.h"
#include "ext/standard/php_string.h"
#include "ext/standard/info.h"
#include "ext/standard/file.h"
#include "ext/standard/url.h"
#include "php_curl.h"
static int le_curl;
#define le_curl_name "cURL handle"
#ifdef PHP_CURL_NEED_OPENSSL_TSL /* {{{ */
static MUTEX_T *php_curl_openssl_tsl = NULL;
static void php_curl_ssl_lock(int mode, int n, const char * file, int line)
{
if (mode & CRYPTO_LOCK) {
tsrm_mutex_lock(php_curl_openssl_tsl[n]);
} else {
tsrm_mutex_unlock(php_curl_openssl_tsl[n]);
}
}
static unsigned long php_curl_ssl_id(void)
{
return (unsigned long) tsrm_thread_id();
}
#endif
/* }}} */
#ifdef PHP_CURL_NEED_GNUTLS_TSL /* {{{ */
static int php_curl_ssl_mutex_create(void **m)
{
if (*((MUTEX_T *) m) = tsrm_mutex_alloc()) {
return SUCCESS;
} else {
return FAILURE;
}
}
static int php_curl_ssl_mutex_destroy(void **m)
{
tsrm_mutex_free(*((MUTEX_T *) m));
return SUCCESS;
}
static int php_curl_ssl_mutex_lock(void **m)
{
return tsrm_mutex_lock(*((MUTEX_T *) m));
}
static int php_curl_ssl_mutex_unlock(void **m)
{
return tsrm_mutex_unlock(*((MUTEX_T *) m));
}
static struct gcry_thread_cbs php_curl_gnutls_tsl = {
GCRY_THREAD_OPTION_USER,
NULL,
php_curl_ssl_mutex_create,
php_curl_ssl_mutex_destroy,
php_curl_ssl_mutex_lock,
php_curl_ssl_mutex_unlock
};
#endif
/* }}} */
static void _php_curl_close(zend_rsrc_list_entry *rsrc TSRMLS_DC);
#define SAVE_CURL_ERROR(__handle, __err) (__handle)->err.no = (int) __err;
@@ -158,31 +56,6 @@ static void _php_curl_close(zend_rsrc_list_entry *rsrc TSRMLS_DC);
#define CAAS(s, v) add_assoc_string_ex(return_value, s, sizeof(s), (char *) v, 1);
#define CAAZ(s, v) add_assoc_zval_ex(return_value, s, sizeof(s), (zval *) v);
#define PHP_CURL_CHECK_OPEN_BASEDIR(str, len) \
if (((PG(open_basedir) && *PG(open_basedir)) || PG(safe_mode)) && \
strncasecmp(str, "file:", sizeof("file:") - 1) == 0) \
{ \
php_url *tmp_url; \
\
if (!(tmp_url = php_url_parse_ex(str, len))) { \
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid url '%s'", str); \
RETURN_FALSE; \
} \
\
if (php_memnstr(str, tmp_url->path, strlen(tmp_url->path), str + len)) { \
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Url '%s' contains unencoded control characters.", str); \
RETURN_FALSE; \
} \
\
if (tmp_url->query || tmp_url->fragment || php_check_open_basedir(tmp_url->path TSRMLS_CC) || \
(PG(safe_mode) && !php_checkuid(tmp_url->path, "rb+", CHECKUID_CHECK_MODE_PARAM)) \
) { \
php_url_free(tmp_url); \
RETURN_FALSE; \
} \
php_url_free(tmp_url); \
}
/* {{{ curl_functions[]
*/
function_entry curl_functions[] = {
@@ -260,9 +133,7 @@ PHP_MINIT_FUNCTION(curl)
REGISTER_CURL_CONSTANT(CURLOPT_FOLLOWLOCATION);
REGISTER_CURL_CONSTANT(CURLOPT_FTPASCII);
REGISTER_CURL_CONSTANT(CURLOPT_PUT);
#if CURLOPT_MUTE != 0
REGISTER_CURL_CONSTANT(CURLOPT_MUTE);
#endif
REGISTER_CURL_CONSTANT(CURLOPT_USERPWD);
REGISTER_CURL_CONSTANT(CURLOPT_PROXYUSERPWD);
REGISTER_CURL_CONSTANT(CURLOPT_RANGE);
@@ -320,28 +191,7 @@ PHP_MINIT_FUNCTION(curl)
REGISTER_CURL_CONSTANT(CURLOPT_SSLENGINE);
REGISTER_CURL_CONSTANT(CURLOPT_SSLENGINE_DEFAULT);
REGISTER_CURL_CONSTANT(CURLOPT_CRLF);
REGISTER_CURL_CONSTANT(CURL_TIMECOND_IFMODSINCE);
REGISTER_CURL_CONSTANT(CURL_TIMECOND_IFUNMODSINCE);
REGISTER_CURL_CONSTANT(CURL_TIMECOND_LASTMOD);
#if LIBCURL_VERSION_NUM >= 0x070a00
REGISTER_CURL_CONSTANT(CURLOPT_ENCODING);
#endif
#if LIBCURL_VERSION_NUM > 0x070a05 /* CURLOPT_HTTPAUTH is available since curl 7.10.6 */
REGISTER_CURL_CONSTANT(CURLOPT_HTTPAUTH);
/* http authentication options */
REGISTER_CURL_CONSTANT(CURLAUTH_BASIC);
REGISTER_CURL_CONSTANT(CURLAUTH_DIGEST);
REGISTER_CURL_CONSTANT(CURLAUTH_GSSNEGOTIATE);
REGISTER_CURL_CONSTANT(CURLAUTH_NTLM);
REGISTER_CURL_CONSTANT(CURLAUTH_ANY);
REGISTER_CURL_CONSTANT(CURLAUTH_ANYSAFE);
#endif
#if LIBCURL_VERSION_NUM > 0x070a06 /* CURLOPT_PROXYAUTH is available since curl 7.10.7 */
REGISTER_CURL_CONSTANT(CURLOPT_PROXYAUTH);
#endif
/* Constants effecting the way CURLOPT_CLOSEPOLICY works */
REGISTER_CURL_CONSTANT(CURLCLOSEPOLICY_LEAST_RECENTLY_USED);
REGISTER_CURL_CONSTANT(CURLCLOSEPOLICY_LEAST_TRAFFIC);
@@ -424,35 +274,6 @@ PHP_MINIT_FUNCTION(curl)
REGISTER_CURL_CONSTANT(CURLE_TELNET_OPTION_SYNTAX);
REGISTER_CURL_CONSTANT(CURLE_OBSOLETE);
REGISTER_CURL_CONSTANT(CURLE_SSL_PEER_CERTIFICATE);
REGISTER_CURL_CONSTANT(CURLE_GOT_NOTHING);
REGISTER_CURL_CONSTANT(CURLE_SSL_ENGINE_NOTFOUND);
REGISTER_CURL_CONSTANT(CURLE_SSL_ENGINE_SETFAILED);
REGISTER_CURL_CONSTANT(CURLE_SEND_ERROR);
REGISTER_CURL_CONSTANT(CURLE_RECV_ERROR);
#ifdef CURLE_SHARE_IN_USE
REGISTER_CURL_CONSTANT(CURLE_SHARE_IN_USE);
#endif
#ifdef CURLE_SSL_CERTPROBLEM
REGISTER_CURL_CONSTANT(CURLE_SSL_CERTPROBLEM);
#endif
#ifdef CURLE_SSL_CIPHER
REGISTER_CURL_CONSTANT(CURLE_SSL_CIPHER);
#endif
#ifdef CURLE_SSL_CACERT
REGISTER_CURL_CONSTANT(CURLE_SSL_CACERT);
#endif
#ifdef CURLE_BAD_CONTENT_ENCODING
REGISTER_CURL_CONSTANT(CURLE_BAD_CONTENT_ENCODING);
#endif
#ifdef CURLE_LDAP_INVALID_URL
REGISTER_CURL_CONSTANT(CURLE_LDAP_INVALID_URL);
#endif
#ifdef CURLE_FILESIZE_EXCEEDED
REGISTER_CURL_CONSTANT(CURLE_FILESIZE_EXCEEDED);
#endif
#ifdef CURLE_FTP_SSL_FAILED
REGISTER_CURL_CONSTANT(CURLE_FTP_SSL_FAILED);
#endif
REGISTER_CURL_CONSTANT(CURL_NETRC_OPTIONAL);
REGISTER_CURL_CONSTANT(CURL_NETRC_IGNORED);
@@ -462,23 +283,6 @@ PHP_MINIT_FUNCTION(curl)
REGISTER_CURL_CONSTANT(CURL_HTTP_VERSION_1_0);
REGISTER_CURL_CONSTANT(CURL_HTTP_VERSION_1_1);
#ifdef PHP_CURL_NEED_OPENSSL_TSL
{
int i, c = CRYPTO_num_locks();
php_curl_openssl_tsl = malloc(c * sizeof(MUTEX_T));
for (i = 0; i < c; ++i) {
php_curl_openssl_tsl[i] = tsrm_mutex_alloc();
}
CRYPTO_set_id_callback(php_curl_ssl_id);
CRYPTO_set_locking_callback(php_curl_ssl_lock);
}
#endif
#ifdef PHP_CURL_NEED_GNUTLS_TSL
gcry_control(GCRYCTL_SET_THREAD_CBS, &php_curl_gnutls_tsl);
#endif
if (curl_global_init(CURL_GLOBAL_SSL) != CURLE_OK) {
return FAILURE;
@@ -504,28 +308,9 @@ PHP_MSHUTDOWN_FUNCTION(curl)
php_unregister_url_stream_wrapper("https" TSRMLS_CC);
php_unregister_url_stream_wrapper("ftp" TSRMLS_CC);
php_unregister_url_stream_wrapper("ldap" TSRMLS_CC);
#endif
#ifdef PHP_CURL_NEED_OPENSSL_TSL
/* ensure there are valid callbacks set */
CRYPTO_set_id_callback(php_curl_ssl_id);
CRYPTO_set_locking_callback(php_curl_ssl_lock);
#endif
curl_global_cleanup();
#ifdef PHP_CURL_NEED_OPENSSL_TSL
if (php_curl_openssl_tsl) {
int i, c = CRYPTO_num_locks();
CRYPTO_set_id_callback(NULL);
CRYPTO_set_locking_callback(NULL);
for (i = 0; i < c; ++i) {
tsrm_mutex_free(php_curl_openssl_tsl[i]);
}
free(php_curl_openssl_tsl);
php_curl_openssl_tsl = NULL;
}
#endif
return SUCCESS;
}
/* }}} */
@@ -550,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, length);
PUTS(data);
break;
case PHP_CURL_FILE:
return fwrite(data, size, nmemb, t->fp);
@@ -561,6 +346,7 @@ static size_t curl_write(char *data, size_t size, size_t nmemb, void *ctx)
zval *argv[2];
zval *retval;
int error;
TSRMLS_FETCH();
MAKE_STD_ZVAL(argv[0]);
MAKE_STD_ZVAL(argv[1]);
@@ -570,21 +356,16 @@ static size_t curl_write(char *data, size_t size, size_t nmemb, void *ctx)
zend_list_addref(ch->id);
ZVAL_STRINGL(argv[1], data, length, 1);
ch->in_callback = 1;
error = call_user_function(EG(function_table),
NULL,
t->func,
retval, 2, argv TSRMLS_CC);
ch->in_callback = 0;
if (error == FAILURE) {
php_error(E_WARNING, "%s(): Couldn't call the CURLOPT_WRITEFUNCTION",
get_active_function_name(TSRMLS_C));
length = -1;
}
else {
if (Z_TYPE_P(retval) != IS_LONG) {
convert_to_long_ex(&retval);
}
length = Z_LVAL_P(retval);
}
@@ -610,13 +391,12 @@ 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];
zval *retval;
int length;
int error;
TSRMLS_FETCH();
@@ -631,18 +411,18 @@ static size_t curl_read(char *data, size_t size, size_t nmemb, void *ctx)
zend_list_addref(t->fd);
ZVAL_LONG(argv[2], (int) size * nmemb);
ch->in_callback = 1;
error = call_user_function(EG(function_table),
NULL,
t->func,
retval, 3, argv TSRMLS_CC);
ch->in_callback = 0;
if (error == FAILURE) {
php_error(E_WARNING, "%s(): Cannot call the CURLOPT_READFUNCTION",
get_active_function_name(TSRMLS_C));
} else if (Z_TYPE_P(retval) == IS_STRING) {
length = MIN(size * nmemb, Z_STRLEN_P(retval));
memcpy(data, Z_STRVAL_P(retval), length);
length = -1;
}
else {
memcpy(data, Z_STRVAL_P(retval), size * nmemb);
length = Z_STRLEN_P(retval);
}
zval_ptr_dtor(&argv[0]);
@@ -673,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, length);
PUTS(data);
break;
case PHP_CURL_FILE:
return fwrite(data, size, nmemb, t->fp);
@@ -691,21 +471,16 @@ static size_t curl_write_header(char *data, size_t size, size_t nmemb, void *ctx
zend_list_addref(ch->id);
ZVAL_STRINGL(argv[1], data, length, 1);
ch->in_callback = 1;
error = call_user_function(EG(function_table),
NULL,
t->func,
retval, 2, argv TSRMLS_CC);
ch->in_callback = 0;
if (error == FAILURE) {
php_error(E_WARNING, "%s(): Couldn't call the CURLOPT_HEADERFUNCTION",
get_active_function_name(TSRMLS_C));
length = -1;
}
else {
if (Z_TYPE_P(retval) != IS_LONG) {
convert_to_long_ex(&retval);
}
length = Z_LVAL_P(retval);
}
zval_ptr_dtor(&argv[0]);
@@ -713,18 +488,13 @@ static size_t curl_write_header(char *data, size_t size, size_t nmemb, void *ctx
zval_ptr_dtor(&retval);
break;
}
case PHP_CURL_IGNORE:
return length;
default:
return -1;
}
return length;
}
/* }}} */
#if CURLOPT_PASSWDFUNCTION != 0
/* {{{ curl_passwd
*/
static size_t curl_passwd(void *ctx, char *prompt, char *buf, int buflen)
@@ -734,7 +504,7 @@ static size_t curl_passwd(void *ctx, char *prompt, char *buf, int buflen)
zval *argv[3];
zval *retval = NULL;
int error;
int ret = -1;
int ret = 0;
TSRMLS_FETCH();
MAKE_STD_ZVAL(argv[0]);
@@ -746,23 +516,23 @@ static size_t curl_passwd(void *ctx, char *prompt, char *buf, int buflen)
ZVAL_STRING(argv[1], prompt, 1);
ZVAL_LONG(argv[2], buflen);
ch->in_callback = 1;
error = call_user_function(EG(function_table),
NULL,
func,
retval, 2, argv TSRMLS_CC);
ch->in_callback = 0;
if (error == FAILURE) {
php_error(E_WARNING, "%s(): Couldn't call the CURLOPT_PASSWDFUNCTION", get_active_function_name(TSRMLS_C));
} else if (Z_TYPE_P(retval) == IS_STRING) {
ret = -1;
}
else {
if (Z_STRLEN_P(retval) > buflen) {
php_error(E_WARNING, "%s(): Returned password is too long for libcurl to handle",
get_active_function_name(TSRMLS_C));
} else {
strlcpy(buf, Z_STRVAL_P(retval), Z_STRLEN_P(retval));
ret = -1;
}
else {
strlcpy(buf, Z_STRVAL_P(retval), buflen);
}
} else {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "User handler '%s' did not return a string.", Z_STRVAL_P(func));
}
zval_ptr_dtor(&argv[0]);
@@ -773,7 +543,6 @@ static size_t curl_passwd(void *ctx, char *prompt, char *buf, int buflen)
return ret;
}
/* }}} */
#endif
/* {{{ curl_free_string
*/
@@ -800,7 +569,7 @@ static void curl_free_slist(void **slist)
/* }}} */
/* {{{ proto string curl_version(void)
/* {{{ proto array curl_version(void)
Return cURL version information. */
PHP_FUNCTION(curl_version)
{
@@ -822,9 +591,7 @@ static void alloc_curl_handle(php_curl **ch)
(*ch)->handlers->write_header = ecalloc(1, sizeof(php_curl_write));
(*ch)->handlers->read = ecalloc(1, sizeof(php_curl_read));
memset(&(*ch)->err, 0, sizeof((*ch)->err));
(*ch)->in_callback = 0;
zend_llist_init(&(*ch)->to_free.str, sizeof(char *),
(void(*)(void *)) curl_free_string, 0);
zend_llist_init(&(*ch)->to_free.slist, sizeof(struct curl_slist),
@@ -847,11 +614,6 @@ PHP_FUNCTION(curl_init)
WRONG_PARAM_COUNT;
}
if (argc > 0) {
convert_to_string_ex(url);
PHP_CURL_CHECK_OPEN_BASEDIR(Z_STRVAL_PP(url), Z_STRLEN_PP(url));
}
alloc_curl_handle(&ch);
ch->cp = curl_easy_init();
@@ -865,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);
@@ -878,10 +638,10 @@ PHP_FUNCTION(curl_init)
curl_easy_setopt(ch->cp, CURLOPT_WRITEHEADER, (void *) ch);
curl_easy_setopt(ch->cp, CURLOPT_DNS_USE_GLOBAL_CACHE, 1);
curl_easy_setopt(ch->cp, CURLOPT_DNS_CACHE_TIMEOUT, 120);
curl_easy_setopt(ch->cp, CURLOPT_MAXREDIRS, 20); /* prevent infinite redirects */
if (argc > 0) {
char *urlcopy;
convert_to_string_ex(url);
urlcopy = estrndup(Z_STRVAL_PP(url), Z_STRLEN_PP(url));
curl_easy_setopt(ch->cp, CURLOPT_URL, urlcopy);
@@ -893,7 +653,7 @@ PHP_FUNCTION(curl_init)
}
/* }}} */
/* {{{ proto bool curl_setopt(resource ch, int option, mixed value)
/* {{{ proto bool curl_setopt(resource ch, string option, mixed value)
Set an option for a CURL transfer */
PHP_FUNCTION(curl_setopt)
{
@@ -926,9 +686,7 @@ PHP_FUNCTION(curl_setopt)
case CURLOPT_NETRC:
case CURLOPT_FOLLOWLOCATION:
case CURLOPT_PUT:
#if CURLOPT_MUTE != 0
case CURLOPT_MUTE:
#endif
case CURLOPT_MUTE:
case CURLOPT_TIMEOUT:
case CURLOPT_FTP_USE_EPSV:
case CURLOPT_LOW_SPEED_LIMIT:
@@ -952,12 +710,6 @@ PHP_FUNCTION(curl_setopt)
case CURLOPT_HTTPGET:
case CURLOPT_HTTP_VERSION:
case CURLOPT_CRLF:
#if LIBCURL_VERSION_NUM > 0x070a05 /* CURLOPT_HTTPAUTH is available since curl 7.10.6 */
case CURLOPT_HTTPAUTH:
#endif
#if LIBCURL_VERSION_NUM > 0x070a06 /* CURLOPT_PROXYAUTH is available since curl 7.10.7 */
case CURLOPT_PROXYAUTH:
#endif
convert_to_long_ex(zvalue);
error = curl_easy_setopt(ch->cp, option, Z_LVAL_PP(zvalue));
break;
@@ -970,30 +722,27 @@ PHP_FUNCTION(curl_setopt)
case CURLOPT_USERAGENT:
case CURLOPT_FTPPORT:
case CURLOPT_COOKIE:
case CURLOPT_COOKIEFILE:
case CURLOPT_REFERER:
case CURLOPT_INTERFACE:
case CURLOPT_KRB4LEVEL:
case CURLOPT_RANDOM_FILE:
case CURLOPT_EGDSOCKET:
case CURLOPT_CAINFO:
case CURLOPT_CAPATH:
case CURLOPT_COOKIEJAR:
case CURLOPT_SSL_CIPHER_LIST:
case CURLOPT_SSLKEY:
case CURLOPT_SSLCERT:
case CURLOPT_SSLKEYTYPE:
case CURLOPT_SSLKEYPASSWD:
case CURLOPT_SSLKEYPASSWD:
case CURLOPT_SSLENGINE:
#if LIBCURL_VERSION_NUM >= 0x070a00
case CURLOPT_ENCODING:
#endif
case CURLOPT_SSLENGINE_DEFAULT: {
char *copystr = NULL;
convert_to_string_ex(zvalue);
if (option == CURLOPT_URL) {
PHP_CURL_CHECK_OPEN_BASEDIR(Z_STRVAL_PP(zvalue), Z_STRLEN_PP(zvalue));
}
copystr = estrndup(Z_STRVAL_PP(zvalue), Z_STRLEN_PP(zvalue));
error = curl_easy_setopt(ch->cp, option, copystr);
zend_llist_add_element(&ch->to_free.str, &copystr);
@@ -1048,9 +797,7 @@ PHP_FUNCTION(curl_setopt)
if (Z_LVAL_PP(zvalue)) {
ch->handlers->write->method = PHP_CURL_RETURN;
} else {
ch->handlers->write->method = PHP_CURL_STDOUT;
}
}
break;
case CURLOPT_BINARYTRANSFER:
convert_to_long_ex(zvalue);
@@ -1083,7 +830,6 @@ PHP_FUNCTION(curl_setopt)
ch->handlers->write_header->func = *zvalue;
ch->handlers->write_header->method = PHP_CURL_USER;
break;
#if CURLOPT_PASSWDFUNCTION != 0
case CURLOPT_PASSWDFUNCTION:
if (ch->handlers->passwd) {
zval_ptr_dtor(&ch->handlers->passwd);
@@ -1093,7 +839,6 @@ PHP_FUNCTION(curl_setopt)
error = curl_easy_setopt(ch->cp, CURLOPT_PASSWDFUNCTION, curl_passwd);
error = curl_easy_setopt(ch->cp, CURLOPT_PASSWDDATA, (void *) ch);
break;
#endif
case CURLOPT_POSTFIELDS:
if (Z_TYPE_PP(zvalue) == IS_ARRAY || Z_TYPE_PP(zvalue) == IS_OBJECT) {
zval **current;
@@ -1126,23 +871,18 @@ PHP_FUNCTION(curl_setopt)
postval = Z_STRVAL_PP(current);
if (*postval == '@') {
++postval;
/* safe_mode / open_basedir check */
if (php_check_open_basedir(postval TSRMLS_CC) || (PG(safe_mode) && !php_checkuid(postval, "rb+", CHECKUID_CHECK_MODE_PARAM))) {
RETURN_FALSE;
}
error = curl_formadd(&first, &last,
CURLFORM_COPYNAME, string_key,
CURLFORM_NAMELENGTH, (long)string_key_len - 1,
CURLFORM_FILE, postval,
CURLFORM_NAMELENGTH, string_key_len - 1,
CURLFORM_FILE, ++postval,
CURLFORM_END);
}
else {
error = curl_formadd(&first, &last,
CURLFORM_COPYNAME, string_key,
CURLFORM_NAMELENGTH, (long)string_key_len - 1,
CURLFORM_COPYCONTENTS, postval,
CURLFORM_CONTENTSLENGTH, (long)Z_STRLEN_PP(current),
CURLFORM_NAMELENGTH, string_key_len - 1,
CURLFORM_PTRCONTENTS, postval,
CURLFORM_CONTENTSLENGTH, Z_STRLEN_PP(current),
CURLFORM_END);
}
}
@@ -1204,28 +944,6 @@ PHP_FUNCTION(curl_setopt)
error = curl_easy_setopt(ch->cp, option, slist);
break;
}
/* the following options deal with files, therefor safe_mode & open_basedir checks
* are required.
*/
case CURLOPT_COOKIEJAR:
case CURLOPT_SSLCERT:
case CURLOPT_RANDOM_FILE:
case CURLOPT_COOKIEFILE: {
char *copystr = NULL;
convert_to_string_ex(zvalue);
if (php_check_open_basedir(Z_STRVAL_PP(zvalue) TSRMLS_CC) || (PG(safe_mode) && !php_checkuid(Z_STRVAL_PP(zvalue), "rb+", CHECKUID_CHECK_MODE_PARAM))) {
RETURN_FALSE;
}
copystr = estrndup(Z_STRVAL_PP(zvalue), Z_STRLEN_PP(zvalue));
error = curl_easy_setopt(ch->cp, option, copystr);
zend_llist_add_element(&ch->to_free.str, &copystr);
break;
}
}
@@ -1275,8 +993,7 @@ PHP_FUNCTION(curl_exec)
error = curl_easy_perform(ch->cp);
SAVE_CURL_ERROR(ch, error);
/* CURLE_PARTIAL_FILE is returned by HEAD requests */
if (error != CURLE_OK && error != CURLE_PARTIAL_FILE) {
if (error != CURLE_OK) {
if (ch->handlers->write->buf.len > 0) {
smart_str_free(&ch->handlers->write->buf);
}
@@ -1296,7 +1013,7 @@ PHP_FUNCTION(curl_exec)
}
/* }}} */
/* {{{ proto mixed curl_getinfo(resource ch, int opt)
/* {{{ proto string curl_getinfo(resource ch, int opt)
Get information regarding a specific transfer */
PHP_FUNCTION(curl_getinfo)
{
@@ -1319,80 +1036,55 @@ 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) {
case CURLINFO_EFFECTIVE_URL:
case CURLINFO_CONTENT_TYPE: {
char *s_code = NULL;
char *s_code;
if (curl_easy_getinfo(ch->cp, option, &s_code) == CURLE_OK && s_code) {
RETURN_STRING(s_code, 1);
} else {
RETURN_FALSE;
}
curl_easy_getinfo(ch->cp, option, &s_code);
RETURN_STRING(s_code, 1);
break;
}
@@ -1402,13 +1094,10 @@ PHP_FUNCTION(curl_getinfo)
case CURLINFO_FILETIME:
case CURLINFO_SSL_VERIFYRESULT:
case CURLINFO_REDIRECT_COUNT: {
long code = 0;
long code;
if (curl_easy_getinfo(ch->cp, option, &code) == CURLE_OK) {
RETURN_LONG(code);
} else {
RETURN_FALSE;
}
curl_easy_getinfo(ch->cp, option, &code);
RETURN_LONG(code);
break;
}
@@ -1424,13 +1113,10 @@ PHP_FUNCTION(curl_getinfo)
case CURLINFO_CONTENT_LENGTH_UPLOAD:
case CURLINFO_STARTTRANSFER_TIME:
case CURLINFO_REDIRECT_TIME: {
double code = 0.0;
double code;
if (curl_easy_getinfo(ch->cp, option, &code) == CURLE_OK) {
RETURN_DOUBLE(code);
} else {
RETURN_FALSE;
}
curl_easy_getinfo(ch->cp, option, &code);
RETURN_DOUBLE(code);
break;
}
@@ -1486,11 +1172,7 @@ PHP_FUNCTION(curl_close)
WRONG_PARAM_COUNT;
}
ZEND_FETCH_RESOURCE(ch, php_curl *, zid, -1, le_curl_name, le_curl);
if (ch->in_callback) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Attempt to close CURL handle from a callback");
return;
}
zend_list_delete(Z_LVAL_PP(zid));
}
/* }}} */
@@ -1523,7 +1205,7 @@ static void _php_curl_close(zend_rsrc_list_entry *rsrc TSRMLS_DC)
}
/* }}} */
#endif /* HAVE_CURL */
#endif
/*
* Local variables:
+2 -2
View File
@@ -113,7 +113,7 @@ BSC32=bscmake.exe
LINK32=link.exe
# ADD BASE LINK32 php4ts_debug.lib libcurl.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /incremental:yes /debug /machine:I386 /nodefaultlib:"msvcrtd.lib" /out:"..\..\Debug_TS/php_curl.dll" /libpath:"..\..\Debug_TS"
# SUBTRACT BASE LINK32 /pdb:none
# ADD LINK32 php4ts_debug.lib libcurl.lib ssleay32.lib libeay32.lib msvcrt.lib ws2_32.lib winmm.lib zlib.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib /nologo /dll /incremental:yes /debug /machine:I386 /nodefaultlib:"MSVCRTD" /out:"..\..\Debug_TS/php_curl.dll" /libpath:"..\..\Debug_TS" /libpath:"..\..\..\php_build\curl\lib"
# ADD LINK32 php4ts_debug.lib libcurl.lib ssleay32.lib libeay32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib /nologo /dll /incremental:yes /debug /machine:I386 /nodefaultlib:"MSVCRTD" /out:"..\..\Debug_TS/php_curl.dll" /libpath:"..\..\Debug_TS" /libpath:"..\..\..\php_build\curl\lib"
# SUBTRACT LINK32 /pdb:none /nodefaultlib
!ELSEIF "$(CFG)" == "curl - Win32 Release_TS_SSL"
@@ -142,7 +142,7 @@ BSC32=bscmake.exe
LINK32=link.exe
# ADD BASE LINK32 php4ts.lib libcurl.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /nodefaultlib:"msvcrt.lib" /out:"..\..\Release_TS/php_curl.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline"
# SUBTRACT BASE LINK32 /pdb:none
# ADD LINK32 php4ts.lib libcurl.lib ssleay32.lib libeay32.lib msvcrt.lib ws2_32.lib winmm.lib zlib.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib /nologo /dll /machine:I386 /nodefaultlib:"MSVCRT" /out:"..\..\Release_TS/php_curl.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline" /libpath:"..\..\..\php_build\curl\lib"
# ADD LINK32 php4ts.lib libcurl.lib ssleay32.lib libeay32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib /nologo /dll /machine:I386 /nodefaultlib:"MSVCRT" /out:"..\..\Release_TS/php_curl.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline" /libpath:"..\..\..\php_build\curl\lib"
# SUBTRACT LINK32 /pdb:none
!ENDIF
+5 -5
View File
@@ -2,12 +2,12 @@
+----------------------------------------------------------------------+
| PHP Version 4 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2006 The PHP Group |
| Copyright (c) 1997-2002 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| 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 through the world-wide-web at the following url: |
| http://www.php.net/license/3_01.txt |
| 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. |
@@ -307,7 +307,7 @@ PHPAPI php_stream *php_curl_stream_opener(php_stream_wrapper *wrapper, char *fil
curl_easy_setopt(curlstream->curl, CURLOPT_PROGRESSDATA, stream);
curl_easy_setopt(curlstream->curl, CURLOPT_NOPROGRESS, 0);
curl_easy_setopt(curlstream->curl, CURLOPT_USERAGENT, FG(user_agent) ? FG(user_agent) : "PHP/" PHP_VERSION);
curl_easy_setopt(curlstream->curl, CURLOPT_USERAGENT, "PHP/" PHP_VERSION);
/* TODO: read cookies and options from context */
+4 -5
View File
@@ -2,12 +2,12 @@
+----------------------------------------------------------------------+
| PHP Version 4 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2006 The PHP Group |
| Copyright (c) 1997-2002 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| 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 through the world-wide-web at the following url: |
| http://www.php.net/license/3_01.txt |
| 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. |
@@ -93,7 +93,6 @@ typedef struct {
struct _php_curl_free to_free;
long id;
unsigned int uses;
zend_bool in_callback;
} php_curl;
/* streams support */
+1 -1
View File
@@ -3,7 +3,7 @@ dnl $Id$
dnl
PHP_ARG_WITH(cyrus, for cyrus imap support,
[ --with-cyrus[=DIR] Include Cyrus IMAP support])
[ --with-cyrus[=dir] Include Cyrus IMAP support])
if test "$PHP_CYRUS" != "no"; then
found_cyrus=no
+47 -47
View File
@@ -2,12 +2,12 @@
+----------------------------------------------------------------------+
| PHP Version 4 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2006 The PHP Group |
| Copyright (c) 1997-2002 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| 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 through the world-wide-web at the following url: |
| http://www.php.net/license/3_01.txt |
| 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. |
@@ -53,7 +53,7 @@ zend_module_entry cyrus_module_entry = {
cyrus_functions,
PHP_MINIT(cyrus),
NULL,
NULL,
NULL,
NULL,
PHP_MINFO(cyrus),
NO_VERSION_YET,
@@ -71,7 +71,7 @@ static void cyrus_free(zend_rsrc_list_entry *rsrc)
if (conn->client)
imclient_close(conn->client);
if (conn->host)
if (conn->host)
efree(conn->host);
if (conn->port)
@@ -79,16 +79,16 @@ static void cyrus_free(zend_rsrc_list_entry *rsrc)
efree(conn);
}
PHP_MINIT_FUNCTION(cyrus)
{
le_cyrus = zend_register_list_destructors_ex(cyrus_free, NULL,
le_cyrus = zend_register_list_destructors_ex(cyrus_free, NULL,
le_cyrus_name, module_number);
REGISTER_LONG_CONSTANT("CYRUS_CONN_NONSYNCLITERAL",
REGISTER_LONG_CONSTANT("CYRUS_CONN_NONSYNCLITERAL",
IMCLIENT_CONN_NONSYNCLITERAL,
CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("CYRUS_CONN_INITIALRESPONSE",
REGISTER_LONG_CONSTANT("CYRUS_CONN_INITIALRESPONSE",
IMCLIENT_CONN_INITIALRESPONSE,
CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("CYRUS_CALLBACK_NUMBERED", CALLBACK_NUMBERED,
@@ -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]]])
@@ -125,7 +125,7 @@ PHP_FUNCTION(cyrus_connect)
int flags = 0;
int error;
int argc = ZEND_NUM_ARGS();
if (argc < 0 || argc > 3 ||
zend_get_parameters_ex(argc, &z_host, &z_port, &z_flags) == FAILURE) {
WRONG_PARAM_COUNT;
@@ -169,7 +169,7 @@ PHP_FUNCTION(cyrus_connect)
case -1:
php_error(E_WARNING, "%s(): Invalid hostname: %s", get_active_function_name(TSRMLS_C), host);
RETURN_FALSE;
case -2:
php_error(E_WARNING, "%s(): Invalid port: %d", get_active_function_name(TSRMLS_C), port);
RETURN_FALSE;
@@ -181,14 +181,14 @@ PHP_FUNCTION(cyrus_connect)
/* }}} */
static void cyrus_capable_callback(struct imclient *client, void *rock,
static void cyrus_capable_callback(struct imclient *client, void *rock,
struct imclient_reply *reply)
{
char *token = NULL;
char *token_buf;
char *mechanism = rock;
/* We need to split the reply up by the whitespace */
token = php_strtok_r(reply->text, " ", &token_buf);
while (token != NULL) {
@@ -202,7 +202,7 @@ static void cyrus_capable_callback(struct imclient *client, void *rock,
}
/* {{{ proto void cyrus_authenticate( resource connection [, string mechlist [, string service [, string user [, int minssf [, int maxssf]]]]])
/* {{{ proto bool cyrus_authenticate( resource connection [, string mechlist [, string service [, string user [, int minssf [, int maxssf]]]]])
Authenticate agaings a Cyrus IMAP server */
PHP_FUNCTION(cyrus_authenticate)
{
@@ -235,26 +235,26 @@ PHP_FUNCTION(cyrus_authenticate)
else {
char tmp_mechlist[100];
int pos = 0;
/* NULL out the buffer, ensures it has a safe ending and allows us to
* test properly for the end of the buffer
*/
memset(tmp_mechlist, 0, sizeof tmp_mechlist);
/* We'll be calling the "CAPABILITY" command, which will give us a list
* of the types of authorization the server is capable of
* of the types of authorization the server is capable of
*/
imclient_addcallback(conn->client, "CAPABILITY", 0,
imclient_addcallback(conn->client, "CAPABILITY", 0,
cyrus_capable_callback, (void *) tmp_mechlist, 0);
imclient_send(conn->client, NULL, NULL, "CAPABILITY");
/* Grab the end of string position into pos */
while (tmp_mechlist[pos++] != 0)
while (tmp_mechlist[pos++] != 0)
;
/* Tack on PLAIN to whatever the auth string is */
memcpy(tmp_mechlist + pos, " PLAIN", 6);
/* Copy it onto the main buffer */
mechlist = estrndup(tmp_mechlist, pos + 6);
}
@@ -277,22 +277,22 @@ PHP_FUNCTION(cyrus_authenticate)
/* XXX: UGLY, but works, determines the username to use */
user = (char *) sapi_getenv("USER", 4);
if (! user) {
user = (char *) getenv("USER");
user = (char *) getenv("USER");
if (! user) {
user = (char *) sapi_getenv("LOGNAME", 7);
if (! user) {
user = (char *) sapi_getenv("LOGNAME", 7);
if (! user) {
user = (char *) getenv("LOGNAME");
if (! user) {
struct passwd *pwd = getpwuid(getuid());
if (! pwd) {
php_error(E_WARNING, "%s(): Couldn't determine user id", get_active_function_name(TSRMLS_C));
RETURN_FALSE;
}
user = estrdup(pwd->pw_name);
}
user = (char *) getenv("LOGNAME");
if (! user) {
struct passwd *pwd = getpwuid(getuid());
if (! pwd) {
php_error(E_WARNING, "%s(): Couldn't determine user id", get_active_function_name(TSRMLS_C));
RETURN_FALSE;
}
user = estrdup(pwd->pw_name);
}
}
}
}
}
@@ -314,7 +314,7 @@ PHP_FUNCTION(cyrus_authenticate)
maxssf = 1000;
}
imclient_authenticate(conn->client, mechlist, service,
imclient_authenticate(conn->client, mechlist, service,
user, minssf, maxssf);
efree(mechlist);
@@ -324,8 +324,8 @@ PHP_FUNCTION(cyrus_authenticate)
/* }}} */
static void cyrus_generic_callback(struct imclient *client,
void *rock,
static void cyrus_generic_callback(struct imclient *client,
void *rock,
struct imclient_reply *reply)
{
php_cyrus_callback *callback = rock;
@@ -356,7 +356,7 @@ static void cyrus_generic_callback(struct imclient *client,
argv[2] = &text;
argv[3] = &msgno;
if (call_user_function_ex(EG(function_table), NULL, callback->function,
if (call_user_function_ex(EG(function_table), NULL, callback->function,
&retval, 4, argv, 0, NULL TSRMLS_CC) == FAILURE) {
php_error(E_WARNING, "%s(): Couldn't call the %s handler",
get_active_function_name(TSRMLS_C), callback->trigger);
@@ -374,8 +374,8 @@ static void cyrus_generic_callback(struct imclient *client,
}
}
/* {{{ proto bool cyrus_bind( resource connection, array callbacks)
/* {{{ proto bool cyrus_bind( resource connection, array callbacks)
Bind callbacks to a Cyrus IMAP connection */
PHP_FUNCTION(cyrus_bind)
{
@@ -397,7 +397,7 @@ PHP_FUNCTION(cyrus_bind)
hash = HASH_OF(*z_callback);
if (! hash) {
php_error(E_WARNING,
php_error(E_WARNING,
"%s(): Second argument must be an array or object", get_active_function_name(TSRMLS_C));
RETURN_FALSE;
}
@@ -407,9 +407,9 @@ PHP_FUNCTION(cyrus_bind)
zend_hash_move_forward(hash)) {
SEPARATE_ZVAL(tmp);
zend_hash_get_current_key(hash, &string_key, &num_key, 0);
if (! string_key)
if (! string_key)
continue;
if (! strcasecmp(string_key, "trigger")) {
convert_to_string_ex(tmp);
callback.trigger = estrndup(Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp));
@@ -436,7 +436,7 @@ PHP_FUNCTION(cyrus_bind)
callback.le = conn->id;
imclient_addcallback(conn->client, callback.trigger, callback.flags,
imclient_addcallback(conn->client, callback.trigger, callback.flags,
cyrus_generic_callback, (void **) &callback, 0);
RETURN_TRUE;
@@ -458,14 +458,14 @@ PHP_FUNCTION(cyrus_unbind)
ZEND_FETCH_RESOURCE(conn, php_cyrus *, z_conn, -1, le_cyrus_name, le_cyrus);
convert_to_string_ex(trigger_name);
imclient_addcallback(conn->client, Z_STRVAL_PP(trigger_name), 0,
imclient_addcallback(conn->client, Z_STRVAL_PP(trigger_name), 0,
NULL, NULL, 0);
RETURN_TRUE;
}
/* }}} */
/* {{{ proto bool cyrus_query( resource connection, string query)
/* {{{ proto bool cyrus_query( resource connection, string query)
Send a query to a Cyrus IMAP server */
PHP_FUNCTION(cyrus_query)
{
@@ -480,7 +480,7 @@ PHP_FUNCTION(cyrus_query)
ZEND_FETCH_RESOURCE(conn, php_cyrus *, z_conn, -1, le_cyrus_name, le_cyrus);
convert_to_string_ex(query);
imclient_send(conn->client, NULL, NULL, Z_STRVAL_PP(query));
imclient_send(conn->client, NULL, NULL, Z_STRVAL_PP(query));
RETURN_TRUE;
}
+4 -4
View File
@@ -2,12 +2,12 @@
+----------------------------------------------------------------------+
| PHP Version 4 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2006 The PHP Group |
| Copyright (c) 1997-2002 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| 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 through the world-wide-web at the following url: |
| http://www.php.net/license/3_01.txt |
| 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. |
+2 -2
View File
@@ -4,7 +4,7 @@ dnl
# Checks for libraries.
# Prefer gdbm, Berkeley DB and ndbm/dbm, in that order
AC_DEFUN([AC_PREFERRED_DB_LIB],[
AC_DEFUN(AC_PREFERRED_DB_LIB,[
AC_CHECK_LIB(gdbm, gdbm_open,[AC_DEFINE(GDBM,1, [Whether you have GDBM]) DBM_TYPE=gdbm; DBM_LIB=-lgdbm],
[AC_CHECK_LIB(c, dbm_open,[AC_DEFINE(NDBM,1,[ ]) DBM_TYPE=ndbm; DBM_LIB=],
[AC_CHECK_LIB(dbm, dbm_open,[AC_DEFINE(NDBM,1,[ ]) DBM_TYPE=ndbm; DBM_LIB=-ldbm],
@@ -26,7 +26,7 @@ AC_DEFUN([AC_PREFERRED_DB_LIB],[
PHP_ARG_WITH(db, for xDBM support,
[ --with-db Include old xDBM support (deprecated, use --enable-dba instead)])
[ --with-db Include old xDBM support (deprecated use --with-dba)])
if test "$PHP_DB" != "no"; then
+12 -12
View File
@@ -2,12 +2,12 @@
+----------------------------------------------------------------------+
| PHP Version 4 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2006 The PHP Group |
| Copyright (c) 1997-2002 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| 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 through the world-wide-web at the following url: |
| http://www.php.net/license/3_01.txt |
| 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. |
@@ -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();
}
/* }}} */
@@ -513,7 +513,7 @@ PHP_FUNCTION(dbminsert)
info = php_find_dbm(id TSRMLS_CC);
if (!info) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid database identifier %ld", Z_LVAL_P(id));
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid database identifier %d", Z_LVAL_P(id));
RETURN_FALSE;
}
@@ -539,7 +539,7 @@ PHP_FUNCTION(dbmreplace)
info = php_find_dbm(id TSRMLS_CC);
if (!info) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid database identifier %ld", Z_LVAL_P(id));
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid database identifier %d", Z_LVAL_P(id));
RETURN_FALSE;
}
@@ -607,7 +607,7 @@ PHP_FUNCTION(dbmfetch)
info = php_find_dbm(id TSRMLS_CC);
if (!info) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid database identifier %ld", Z_LVAL_P(id));
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid database identifier %d", Z_LVAL_P(id));
RETURN_FALSE;
}
@@ -683,7 +683,7 @@ PHP_FUNCTION(dbmexists)
info = php_find_dbm(id TSRMLS_CC);
if (!info) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid database identifier %ld", Z_LVAL_P(id));
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid database identifier %d", Z_LVAL_P(id));
RETURN_FALSE;
}
@@ -732,7 +732,7 @@ PHP_FUNCTION(dbmdelete)
info = php_find_dbm(id TSRMLS_CC);
if (!info) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid database identifier %ld", Z_LVAL_P(id));
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid database identifier %d", Z_LVAL_P(id));
RETURN_FALSE;
}
@@ -779,7 +779,7 @@ PHP_FUNCTION(dbmfirstkey)
info = php_find_dbm(id TSRMLS_CC);
if (!info) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid database identifier %ld", Z_LVAL_P(id));
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid database identifier %d", Z_LVAL_P(id));
RETURN_FALSE;
}
@@ -841,7 +841,7 @@ PHP_FUNCTION(dbmnextkey)
info = php_find_dbm(id TSRMLS_CC);
if (!info) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid database identifier %ld", Z_LVAL_P(id));
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid database identifier %d", Z_LVAL_P(id));
RETURN_FALSE;
}
+4 -4
View File
@@ -2,12 +2,12 @@
+----------------------------------------------------------------------+
| PHP Version 4 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2006 The PHP Group |
| Copyright (c) 1997-2002 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| 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 through the world-wide-web at the following url: |
| http://www.php.net/license/3_01.txt |
| 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. |
-48
View File
@@ -1,48 +0,0 @@
These functions build the foundation for accessing Berkeley DB style
databases.
This is a general abstraction layer for several file-based databases. As
such, functionality is limited to a common subset of features supported
by modern databases such as Sleepycat Software's DB2. (This is not to be
confused with IBM's DB2 software, which is supported through the ODBC
functions.)
This extensions allows to work with the following databases:
dbm DBM is the oldest (original) type of Berkeley DB style databases.
You should avoid it, if possible. We do not support the
compatibility functions built into DB2 and gdbm, because they are
only compatible on the source code level, but cannot handle the
original dbm format.
ndbm NDBM is a newer type and more flexible than dbm. It still has
most of the arbitrary limits of dbm (therefore it is deprecated).
gdbm GDBM is the GNU database manager.
db2 DB2 is Sleepycat Software's DB2. It's described as "a programmatic
toolkit that provides high-performance built-in database support
for both standalone and client/server applications.
db3 DB3 is Sleepycat Software's DB3.
db4 DB4 is Sleepycat Software's DB4. This is available since PHP 5.0.
cdb CDB is "a fast, reliable, lightweight package for creating and
reading constant databases." It is from the author of qmail and
can be found at http://cr.yp.to/cdb.html. Since it is constant,
we support only reading operations. And since PHP 4.3.0 we support
writing (not updating) through the internal cdb library.
cdb_make Since PHP 4.3.0 we support creation (not updating) of cdb files
when the bundled cdb library is used.
flatfile This is available since PHP 4.3.0 for compatibility with the
deprecated dbm extension only and should be avoided. However you
may use this where files were created in this format. That happens
when configure could not find any external library.
inifile This is available since PHP 4.3.3 to be able to modify php.ini
files from within PHP scripts. When working with ini files you
can pass arrays of the form array(0=>group,1=>value_name) or
strings of the form "[group]value_name" where group is optional.
After configuring and compiling PHP you must execute the following test
from commandline:
php run-tests.php ext/dba.
This shows whether your combination of handlers works. Most problematic
are dbm and ndbm which conflict with many installations. The reason for
this is that on several systems these libraries are part of more than one
other library. The configuration test only prevents you from configuring
malfaunctioning single handlers but not combinations.
+149 -306
View File
@@ -2,347 +2,218 @@ dnl
dnl $Id$
dnl
dnl Suppose we need FlatFile if no support or only CDB is used.
dnl Suppose we need FlatFile if no or only CDB is used.
AC_DEFUN([PHP_DBA_STD_BEGIN],[
unset THIS_INCLUDE THIS_LIBS THIS_LFLAGS THIS_PREFIX THIS_RESULT
])
AC_DEFUN([PHP_TEMP_LDFLAGS],[
AC_DEFUN(PHP_TEMP_LDFLAGS,[
old_LDFLAGS=$LDFLAGS
LDFLAGS="$1 $LDFLAGS"
old_LIBS=$LIBS
LIBS="$2 $LIBS"
$3
$2
LDFLAGS=$old_LDFLAGS
LIBS=$old_LIBS
])
dnl Assign INCLUDE/LFLAGS from PREFIX
AC_DEFUN([PHP_DBA_STD_ASSIGN],[
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
])
dnl Standard check
AC_DEFUN([PHP_DBA_STD_CHECK],[
AC_DEFUN(PHP_DBA_STD_CHECK,[
THIS_RESULT="yes"
if test -z "$THIS_INCLUDE"; then
AC_MSG_ERROR([DBA: Could not find necessary header file(s).])
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
AC_MSG_ERROR([DBA: Could not find necessary library.])
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],[
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
AC_DEFUN(AC_DBA_STD_RESULT,[
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
PHP_CHECK_LIBRARY(gdbm, gdbm_open, [
AC_DEFINE_UNQUOTED(GDBM_INCLUDE_FILE, "$THIS_INCLUDE", [ ])
AC_DEFINE(DBA_GDBM, 1, [ ])
THIS_LIBS=gdbm
], [], [-L$THIS_PREFIX/lib])
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_CHECK_LIBRARY($LIB, dbm_open, [
AC_DEFINE_UNQUOTED(NDBM_INCLUDE_FILE, "$THIS_INCLUDE", [ ])
AC_DEFINE(DBA_NDBM, 1, [ ])
THIS_LIBS=$LIB
], [], [-L$THIS_PREFIX/lib])
if test -n "$THIS_LIBS"; then
break
fi
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 dba 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.2 /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.3 db-4.2 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_CHECK_LIBRARY($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
], [], [-L$THIS_PREFIX/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_DEFUN([PHP_DBA_BUILTIN_CDB],[
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)
AC_DEFINE(DBA_CDB_BUILTIN, 1, [ ])
AC_DEFINE(DBA_CDB_MAKE, 1, [ ])
AC_DEFINE(DBA_CDB, 1, [ ])
@@ -351,64 +222,38 @@ AC_DEFUN([PHP_DBA_BUILTIN_CDB],[
])
AC_ARG_WITH(cdb,
[ --with-cdb[=DIR] DBA: Include CDB support],[
if test "$withval" = "yes" -o "$HAVE_DBA" = "1"; 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_CHECK_LIBRARY($LIB, cdb_read, [
AC_DEFINE_UNQUOTED(CDB_INCLUDE_FILE, "$THIS_INCLUDE", [ ])
AC_DEFINE(DBA_CDB, 1, [ ])
THIS_LIBS=$LIB
], [], [-L$THIS_PREFIX/lib])
if test -n "$THIS_LIBS"; then
break
fi
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
PHP_DBA_STD_ATTACH
fi
],[
if test "$PHP_DBA" != "no" -o "$HAVE_DBA" = "1"; then
if test "$PHP_DBA" != "no"; then
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_INI],[
AC_DEFINE(DBA_INIFILE, 1, [ ])
ini_sources="libinifile/inifile.c"
THIS_RESULT="builtin"
])
AC_ARG_WITH(inifile,
[ --with-inifile DBA: Include INI support],[
if test "$withval" != "no"; then
PHP_DBA_BUILTIN_INI
fi
],[
if test "$PHP_DBA" != "no" -o "$HAVE_DBA" = "1"; then
PHP_DBA_BUILTIN_INI
fi
])
AC_DBA_STD_RESULT(inifile,INI File)
AC_DEFUN([PHP_DBA_BUILTIN_FLATFILE],[
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"
])
@@ -416,25 +261,23 @@ 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
],[
if test "$PHP_DBA" != "no" -o "$HAVE_DBA" = "1"; then
if test "$PHP_DBA" != "no"; then
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 dba_inifile.c $cdb_sources $flat_sources $ini_sources, $ext_shared)
PHP_ADD_BUILD_DIR($ext_builddir/libinifile)
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)
+104 -344
View File
@@ -2,12 +2,12 @@
+----------------------------------------------------------------------+
| PHP Version 4 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2006 The PHP Group |
| Copyright (c) 1997-2002 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| 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 through the world-wide-web at the following url: |
| http://www.php.net/license/3_01.txt |
| 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. |
@@ -27,7 +27,7 @@
#if HAVE_DBA
#include "php_ini.h"
#include "ext/standard/flock_compat.h"
#include <stdio.h>
#include <fcntl.h>
#ifdef HAVE_SYS_FILE_H
@@ -37,7 +37,6 @@
#include "php_dba.h"
#include "ext/standard/info.h"
#include "ext/standard/php_string.h"
#include "ext/standard/flock_compat.h"
#include "php_gdbm.h"
#include "php_ndbm.h"
@@ -45,15 +44,15 @@
#include "php_cdb.h"
#include "php_db2.h"
#include "php_db3.h"
#include "php_db4.h"
#include "php_flatfile.h"
#include "php_inifile.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)
PHP_FE(dba_delete, NULL)
PHP_FE(dba_exists, 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 \
@@ -105,56 +118,15 @@ ZEND_GET_MODULE(dba)
WRONG_PARAM_COUNT; \
}
/* {{{ php_dba_myke_key */
static size_t php_dba_make_key(zval **key, char **key_str, char **key_free TSRMLS_DC)
{
if (Z_TYPE_PP(key) == IS_ARRAY) {
zval **group, **name;
HashPosition pos;
size_t len;
if (zend_hash_num_elements(Z_ARRVAL_PP(key)) != 2) {
php_error_docref(NULL TSRMLS_CC, E_ERROR, "Key does not have exactly two elements: (key, name)");
return -1;
}
zend_hash_internal_pointer_reset_ex(Z_ARRVAL_PP(key), &pos);
zend_hash_get_current_data_ex(Z_ARRVAL_PP(key), (void **) &group, &pos);
zend_hash_move_forward_ex(Z_ARRVAL_PP(key), &pos);
zend_hash_get_current_data_ex(Z_ARRVAL_PP(key), (void **) &name, &pos);
convert_to_string_ex(group);
convert_to_string_ex(name);
if (Z_STRLEN_PP(group) == 0) {
*key_str = Z_STRVAL_PP(name);
*key_free = NULL;
return Z_STRLEN_PP(name);
}
len = spprintf(key_str, 0, "[%s]%s", Z_STRVAL_PP(group), Z_STRVAL_PP(name));
*key_free = *key_str;
return len;
} else {
convert_to_string_ex(key);
*key_str = Z_STRVAL_PP(key);
*key_free = NULL;
return Z_STRLEN_PP(key);
}
}
/* }}} */
#define DBA_GET2 \
zval **key; \
char *key_str, *key_free; \
size_t key_len; \
if(ac != 2 || zend_get_parameters_ex(ac, &key, &id) != SUCCESS) { \
WRONG_PARAM_COUNT; \
} \
if ((key_len = php_dba_make_key(key, &key_str, &key_free TSRMLS_CC)) == 0) {\
RETURN_FALSE; \
}
convert_to_string_ex(key)
#define DBA_GET2_3 \
zval **key; \
char *key_str, *key_free; \
size_t key_len; \
zval **tmp; \
int skip = 0; \
switch(ac) { \
@@ -173,21 +145,7 @@ static size_t php_dba_make_key(zval **key, char **key_str, char **key_free TSRML
default: \
WRONG_PARAM_COUNT; \
} \
if ((key_len = php_dba_make_key(key, &key_str, &key_free TSRMLS_CC)) == 0) {\
RETURN_FALSE; \
}
#define DBA_GET3 \
zval **key, **val; \
char *key_str, *key_free; \
size_t key_len; \
if(ac != 3 || zend_get_parameters_ex(ac, &key, &val, &id) != SUCCESS) { \
WRONG_PARAM_COUNT; \
} \
convert_to_string_ex(val); \
if ((key_len = php_dba_make_key(key, &key_str, &key_free TSRMLS_CC)) == 0) {\
RETURN_FALSE; \
}
convert_to_string_ex(key)
#define DBA_ID_GET \
ZEND_FETCH_RESOURCE2(info, dba_info *, id, -1, "DBA identifier", le_db, le_pdb);
@@ -195,20 +153,17 @@ static size_t php_dba_make_key(zval **key, char **key_str, char **key_free TSRML
#define DBA_ID_GET1 DBA_ID_PARS; DBA_GET1; DBA_ID_GET
#define DBA_ID_GET2 DBA_ID_PARS; DBA_GET2; DBA_ID_GET
#define DBA_ID_GET2_3 DBA_ID_PARS; DBA_GET2_3; DBA_ID_GET
#define DBA_ID_GET3 DBA_ID_PARS; DBA_GET3; DBA_ID_GET
#define DBA_ID_DONE \
if (key_free) efree(key_free)
/* 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 \
@@ -243,105 +198,30 @@ 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_INIFILE
DBA_HND(inifile, DBA_STREAM_OPEN|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 }
};
#if DBA_FLATFILE
#define DBA_DEFAULT "flatfile"
#elif DBA_DB4
#define DBA_DEFAULT "db4"
#elif DBA_DB3
#define DBA_DEFAULT "db3"
#elif DBA_DB2
#define DBA_DEFAULT "db2"
#elif DBA_GDBM
#define DBA_DEFAULT "gdbm"
#elif DBA_NBBM
#define DBA_DEFAULT "ndbm"
#elif DBA_DBM
#define DBA_DEFAULT "dbm"
#else
#define DBA_DEFAULT ""
#endif
/* cdb/cdb_make and ini are no option here */
ZEND_BEGIN_MODULE_GLOBALS(dba)
char *default_handler;
dba_handler *default_hptr;
ZEND_END_MODULE_GLOBALS(dba)
ZEND_DECLARE_MODULE_GLOBALS(dba)
#ifdef ZTS
#define DBA_G(v) TSRMG(dba_globals_id, zend_dba_globals *, v)
#else
#define DBA_G(v) (dba_globals.v)
#endif
static int le_db;
static int le_pdb;
/* {{{ dba_fetch_resource
PHPAPI void dba_fetch_resource(dba_info **pinfo, zval **id TSRMLS_DC)
{
dba_info *info;
DBA_ID_FETCH
*pinfo = info;
}
*/
/* }}} */
/* {{{ dba_get_handler
PHPAPI dba_handler *dba_get_handler(const char* handler_name)
{
dba_handler *hptr;
for (hptr = handler; hptr->name && strcasecmp(hptr->name, handler_name); hptr++);
return hptr;
}
*/
/* }}} */
/* {{{ dba_close
*/
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) {
if(info->flags&DBA_PERSISTENT) {
php_stream_pclose(info->fp);
} else {
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) {
if(info->flags&DBA_PERSISTENT) {
php_stream_pclose(info->lock.fp);
} else {
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);
}
/* }}} */
@@ -356,66 +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_INI
*/
ZEND_INI_MH(OnUpdateDefaultHandler)
{
dba_handler *hptr;
if (!strlen(new_value)) {
DBA_G(default_hptr) = NULL;
return OnUpdateString(entry, new_value, new_value_length, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC);
}
for (hptr = handler; hptr->name && strcasecmp(hptr->name, new_value); hptr++);
if (!hptr->name) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "No such handler: %s", new_value);
return FAILURE;
}
DBA_G(default_hptr) = hptr;
return OnUpdateString(entry, new_value, new_value_length, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC);
}
PHP_INI_BEGIN()
STD_PHP_INI_ENTRY("dba.default_handler", DBA_DEFAULT, PHP_INI_ALL, OnUpdateDefaultHandler, default_handler, zend_dba_globals, dba_globals)
PHP_INI_END()
/* }}} */
/* {{{ php_dba_init_globals
*/
static void php_dba_init_globals(zend_dba_globals *dba_globals)
{
dba_globals->default_handler = "";
dba_globals->default_hptr = NULL;
}
/* }}} */
/* {{{ PHP_MINIT_FUNCTION
*/
PHP_MINIT_FUNCTION(dba)
{
ZEND_INIT_MODULE_GLOBALS(dba, php_dba_init_globals, NULL);
REGISTER_INI_ENTRIES();
le_db = zend_register_list_destructors_ex(dba_close_rsrc, NULL, "dba", module_number);
le_pdb = zend_register_list_destructors_ex(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;
}
/* }}} */
@@ -424,7 +250,6 @@ PHP_MINIT_FUNCTION(dba)
*/
PHP_MSHUTDOWN_FUNCTION(dba)
{
UNREGISTER_INI_ENTRIES();
return SUCCESS;
}
/* }}} */
@@ -460,9 +285,17 @@ PHP_MINFO_FUNCTION(dba)
*/
static void php_dba_update(INTERNAL_FUNCTION_PARAMETERS, int mode)
{
DBA_ID_PARS;
zval **val, **key;
char *v;
int len;
DBA_ID_GET3;
if(ac != 3 || zend_get_parameters_ex(ac, &key, &val, &id) != SUCCESS) {
WRONG_PARAM_COUNT;
}
convert_to_string_ex(key);
convert_to_string_ex(val);
DBA_ID_GET;
DBA_WRITE_CHECK;
@@ -470,20 +303,15 @@ static void php_dba_update(INTERNAL_FUNCTION_PARAMETERS, int mode)
len = Z_STRLEN_PP(val);
v = estrndup(Z_STRVAL_PP(val), len);
php_stripslashes(v, &len TSRMLS_CC);
if(info->hnd->update(info, key_str, key_len, v, len, mode TSRMLS_CC) == SUCCESS) {
if(info->hnd->update(info, VALLEN(key), v, len, mode TSRMLS_CC) == SUCCESS) {
efree(v);
DBA_ID_DONE;
RETURN_TRUE;
}
efree(v);
} else {
if(info->hnd->update(info, key_str, key_len, VALLEN(val), mode TSRMLS_CC) == SUCCESS)
{
DBA_ID_DONE;
if(info->hnd->update(info, VALLEN(key), VALLEN(val), mode TSRMLS_CC) == SUCCESS)
RETURN_TRUE;
}
}
DBA_ID_DONE;
RETURN_FALSE;
}
/* }}} */
@@ -529,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 < 2) {
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;
@@ -553,8 +380,7 @@ static void php_dba_open(INTERNAL_FUNCTION_PARAMETERS, int persistent)
list_entry *le;
/* calculate hash */
key = safe_emalloc(keylen, 1, 1);
key[keylen] = '\0';
key = emalloc(keylen);
keylen = 0;
for(i = 0; i < ac; i++) {
@@ -577,16 +403,7 @@ static void php_dba_open(INTERNAL_FUNCTION_PARAMETERS, int persistent)
}
}
if (ac==2) {
hptr = DBA_G(default_hptr);
if (!hptr) {
php_error_docref2(NULL TSRMLS_CC, Z_STRVAL_PP(args[0]), Z_STRVAL_PP(args[1]), E_WARNING, "No default handler selected");
FREENOW;
RETURN_FALSE;
}
} else {
for (hptr = handler; hptr->name && strcasecmp(hptr->name, Z_STRVAL_PP(args[2])); hptr++);
}
for (hptr = handler; hptr->name && strcasecmp(hptr->name, Z_STRVAL_PP(args[2])); hptr++);
if (!hptr->name) {
php_error_docref2(NULL TSRMLS_CC, Z_STRVAL_PP(args[0]), Z_STRVAL_PP(args[1]), E_WARNING, "No such handler: %s", Z_STRVAL_PP(args[2]));
@@ -612,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;
@@ -648,39 +461,20 @@ static void php_dba_open(INTERNAL_FUNCTION_PARAMETERS, int persistent)
lock_mode = (lock_flag & DBA_LOCK_WRITER) ? LOCK_EX : 0;
file_mode = "r+b";
break;
case 'c':
modenr = DBA_CREAT;
lock_mode = (lock_flag & DBA_LOCK_CREAT) ? LOCK_EX : 0;
if (lock_mode) {
if (lock_dbf) {
/* the create/append check will be done on the lock
* when the lib opens the file it is already created
*/
file_mode = "r+b"; /* read & write, seek 0 */
lock_file_mode = "a+b"; /* append */
} else {
file_mode = "a+b"; /* append */
lock_file_mode = "w+b"; /* create/truncate */
}
} else {
file_mode = "a+b";
}
/* In case of the 'a+b' append mode, the handler is responsible
* to handle any rewind problems (see flatfile handler).
*/
break;
case 'n':
modenr = DBA_TRUNC;
lock_mode = (lock_flag & DBA_LOCK_TRUNC) ? LOCK_EX : 0;
file_mode = "w+b";
break;
case 'c':
modenr = DBA_CREAT;
lock_mode = (lock_flag & DBA_LOCK_CREAT) ? LOCK_EX : 0;
file_mode = "a+b";
break;
default:
php_error_docref2(NULL TSRMLS_CC, Z_STRVAL_PP(args[0]), Z_STRVAL_PP(args[1]), E_WARNING, "Illegal DBA mode");
FREENOW;
RETURN_FALSE;
}
if (!lock_file_mode) {
lock_file_mode = file_mode;
modenr = 0;
lock_mode = 0;
file_mode = "";
}
if (*pmode=='d' || *pmode=='l' || *pmode=='-') {
pmode++; /* done already - skip here */
@@ -688,7 +482,7 @@ static void php_dba_open(INTERNAL_FUNCTION_PARAMETERS, int persistent)
if (*pmode=='t') {
pmode++;
if (!lock_flag) {
php_error_docref2(NULL TSRMLS_CC, Z_STRVAL_PP(args[0]), Z_STRVAL_PP(args[1]), E_WARNING, "You cannot combine modifiers - (no lock) and t (test lock)");
php_error_docref2(NULL TSRMLS_CC, Z_STRVAL_PP(args[0]), Z_STRVAL_PP(args[1]), E_WARNING, "You cannot combine modifiers - (no lock) and t (test lock)", hptr->name);
FREENOW;
RETURN_FALSE;
}
@@ -706,7 +500,7 @@ static void php_dba_open(INTERNAL_FUNCTION_PARAMETERS, int persistent)
lock_mode |= LOCK_NB; /* test =: non blocking */
}
}
if (*pmode) {
if (*pmode || !modenr) {
php_error_docref2(NULL TSRMLS_CC, Z_STRVAL_PP(args[0]), Z_STRVAL_PP(args[1]), E_WARNING, "Illegal DBA mode");
FREENOW;
RETURN_FALSE;
@@ -738,13 +532,14 @@ static void php_dba_open(INTERNAL_FUNCTION_PARAMETERS, int persistent)
if (!error && lock_mode) {
if (lock_dbf) {
info->lock.name = pestrdup(info->path, persistent);
lock_file_mode = file_mode;
} else {
spprintf(&info->lock.name, 0, "%s.lck", info->path);
if (!strcmp(file_mode, "r")) {
/* 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 */
@@ -752,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);
@@ -760,13 +555,13 @@ static void php_dba_open(INTERNAL_FUNCTION_PARAMETERS, int persistent)
FREENOW;
RETURN_FALSE;
}
if (php_stream_cast(info->lock.fp, PHP_STREAM_AS_FD, (void*)&info->lock.fd, 1) == FAILURE) {
if (php_stream_cast(info->lock.fp, PHP_STREAM_AS_FD, (void*)&info->lock.fd, 1) == FAILURE) {
dba_close(info TSRMLS_CC);
/* stream operation already wrote an error message */
FREENOW;
RETURN_FALSE;
}
if (php_flock(info->lock.fd, lock_mode)) {
if (php_flock(info->lock.fd, lock_mode)) {
error = "Unable to establish lock"; /* force failure exit */
}
}
@@ -776,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);
@@ -788,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;
}
@@ -803,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;
}
@@ -816,7 +609,7 @@ static void php_dba_open(INTERNAL_FUNCTION_PARAMETERS, int persistent)
/* }}} */
#undef FREENOW
/* {{{ proto resource dba_popen(string path, string mode [, string handlername, string ...])
/* {{{ proto int dba_popen(string path, string mode, string handlername [, string ...])
Opens path using the specified handler in mode persistently */
PHP_FUNCTION(dba_popen)
{
@@ -824,7 +617,7 @@ PHP_FUNCTION(dba_popen)
}
/* }}} */
/* {{{ proto resource dba_open(string path, string mode [, string handlername, string ...])
/* {{{ proto int dba_open(string path, string mode, string handlername [, string ...])
Opens path using the specified handler in mode*/
PHP_FUNCTION(dba_open)
{
@@ -842,22 +635,20 @@ PHP_FUNCTION(dba_close)
}
/* }}} */
/* {{{ proto bool dba_exists(string key, resource handle)
/* {{{ proto bool dba_exists(string key, int handle)
Checks, if the specified key exists */
PHP_FUNCTION(dba_exists)
{
DBA_ID_GET2;
if(info->hnd->exists(info, key_str, key_len TSRMLS_CC) == SUCCESS) {
DBA_ID_DONE;
if(info->hnd->exists(info, VALLEN(key) TSRMLS_CC) == SUCCESS) {
RETURN_TRUE;
}
DBA_ID_DONE;
RETURN_FALSE;
}
/* }}} */
/* {{{ proto string dba_fetch(string key, [int skip ,] resource handle)
/* {{{ proto string dba_fetch(string key, [int skip ,] int handle)
Fetches the data associated with key */
PHP_FUNCTION(dba_fetch)
{
@@ -865,43 +656,20 @@ PHP_FUNCTION(dba_fetch)
int len = 0;
DBA_ID_GET2_3;
if (ac==3) {
if (!strcmp(info->hnd->name, "cdb")) {
if (skip < 0) {
php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Handler %s accepts only skip values greater than or equal to zero, using skip=0", info->hnd->name);
skip = 0;
}
} else if (!strcmp(info->hnd->name, "inifile")) {
/* "-1" is compareable to 0 but allows a non restrictive
* access which is fater. For example 'inifile' uses this
* to allow faster access when the key was already found
* using firstkey/nextkey. However explicitly setting the
* value to 0 ensures the first value.
*/
if (skip < -1) {
php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Handler %s accepts only skip value -1 and greater, using skip=0", info->hnd->name);
skip = 0;
}
} else {
php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Handler %s does not support optional skip parameter, the value will be ignored", info->hnd->name);
skip = 0;
}
} else {
skip = 0;
if (ac==3 && strcmp(info->hnd->name, "cdb")) {
php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Handler %s does not support optional skip parameter", info->hnd->name);
}
if((val = info->hnd->fetch(info, key_str, key_len, skip, &len TSRMLS_CC)) != NULL) {
if((val = info->hnd->fetch(info, VALLEN(key), skip, &len TSRMLS_CC)) != NULL) {
if (val && PG(magic_quotes_runtime)) {
val = php_addslashes(val, len, &len, 1 TSRMLS_CC);
}
DBA_ID_DONE;
RETURN_STRINGL(val, len, 0);
}
DBA_ID_DONE;
RETURN_FALSE;
}
/* }}} */
/* {{{ proto string dba_firstkey(resource handle)
/* {{{ proto string dba_firstkey(int handle)
Resets the internal key pointer and returns the first key */
PHP_FUNCTION(dba_firstkey)
{
@@ -916,7 +684,7 @@ PHP_FUNCTION(dba_firstkey)
}
/* }}} */
/* {{{ proto string dba_nextkey(resource handle)
/* {{{ proto string dba_nextkey(int handle)
Returns the next key */
PHP_FUNCTION(dba_nextkey)
{
@@ -931,44 +699,37 @@ PHP_FUNCTION(dba_nextkey)
}
/* }}} */
/* {{{ proto bool dba_delete(string key, resource handle)
Deletes the entry associated with key
If inifile: remove all other key lines */
/* {{{ proto bool dba_delete(string key, int handle)
Deletes the entry associated with key */
PHP_FUNCTION(dba_delete)
{
DBA_ID_GET2;
DBA_WRITE_CHECK;
if(info->hnd->delete(info, key_str, key_len TSRMLS_CC) == SUCCESS)
{
DBA_ID_DONE;
if(info->hnd->delete(info, VALLEN(key) TSRMLS_CC) == SUCCESS)
RETURN_TRUE;
}
DBA_ID_DONE;
RETURN_FALSE;
}
/* }}} */
/* {{{ proto bool dba_insert(string key, string value, resource handle)
If not inifile: Insert value as key, return false, if key exists already
If inifile: Add vakue as key (next instance of key) */
/* {{{ proto bool dba_insert(string key, string value, int handle)
Inserts value as key, returns false, if key exists already */
PHP_FUNCTION(dba_insert)
{
php_dba_update(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
}
/* }}} */
/* {{{ proto bool dba_replace(string key, string value, resource handle)
Inserts value as key, replaces key, if key exists already
If inifile: remove all other key lines */
/* {{{ proto bool dba_replace(string key, string value, int handle)
Inserts value as key, replaces key, if key exists already */
PHP_FUNCTION(dba_replace)
{
php_dba_update(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
}
/* }}} */
/* {{{ proto bool dba_optimize(resource handle)
/* {{{ proto bool dba_optimize(int handle)
Optimizes (e.g. clean up, vacuum) database */
PHP_FUNCTION(dba_optimize)
{
@@ -982,7 +743,7 @@ PHP_FUNCTION(dba_optimize)
}
/* }}} */
/* {{{ proto bool dba_sync(resource handle)
/* {{{ proto bool dba_sync(int handle)
Synchronizes database */
PHP_FUNCTION(dba_sync)
{
@@ -995,32 +756,29 @@ PHP_FUNCTION(dba_sync)
}
/* }}} */
/* {{{ proto array dba_handlers([bool full_info])
List configured database handlers */
/* {{{ 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);
}
}
/* }}} */
/* {{{ proto array dba_list()
List opened databases */
List configured databases */
PHP_FUNCTION(dba_list)
{
ulong numitems, i;
@@ -1032,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) {
@@ -1047,7 +807,7 @@ PHP_FUNCTION(dba_list)
}
/* }}} */
#endif /* HAVE_DBA */
#endif
/*
* Local variables:
+2 -18
View File
@@ -44,7 +44,7 @@ RSC=rc.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\main" /D ZEND_DEBUG=0 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "COMPILE_DL_DBA" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_DBA=1 /D DBA_DB3=1 /D DB3_INCLUDE_FILE="db.h" /YX /FD /c
# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\main" /D ZEND_DEBUG=0 /D DBA_DB3=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "COMPILE_DL_DBA" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_DBA=1 /D DBA_FLATFILE=1 /D DBA_CDB=1 /D DBA_CDB_MAKE=1 /D DBA_CDB_BUILTIN=1 /D DBA_INIFILE=1 /YX /FD /c
# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\main" /D ZEND_DEBUG=0 /D DBA_DB3=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "COMPILE_DL_DBA" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_DBA=1 /D DBA_FLATFILE=1 /D DBA_CDB=1 /D DBA_CDB_MAKE=1 /D DBA_CDB_BUILTIN=1 /YX /FD /c
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x407 /d "NDEBUG"
@@ -71,7 +71,7 @@ LINK32=link.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\.." /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\main" /D ZEND_DEBUG=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "COMPILE_DL_DBA" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_DBA=1 /D "DBA_DB3" /D DB3_INCLUDE_FILE="db.h" /YX /FD /GZ /c
# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\.." /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\main" /D ZEND_DEBUG=1 /D "DBA_DB3" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "COMPILE_DL_DBA" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_DBA=1 /D DBA_FLATFILE=1 /D DBA_CDB=1 /D DBA_CDB_MAKE=1 /D DBA_CDB_BUILTIN=1 /D DBA_INIFILE=1 /YX /FD /GZ /c
# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\.." /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\main" /D ZEND_DEBUG=1 /D "DBA_DB3" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "COMPILE_DL_DBA" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_DBA=1 /D DBA_FLATFILE=1 /D DBA_CDB=1 /D DBA_CDB_MAKE=1 /D DBA_CDB_BUILTIN=1 /YX /FD /GZ /c
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x407 /d "_DEBUG"
@@ -130,10 +130,6 @@ SOURCE=.\dba_gdbm.c
# End Source File
# Begin Source File
SOURCE=.\dba_inifile.c
# End Source File
# Begin Source File
SOURCE=.\dba_ndbm.c
# End Source File
# Begin Source File
@@ -142,10 +138,6 @@ SOURCE=.\libflatfile\flatfile.c
# End Source File
# Begin Source File
SOURCE=.\libinifile\inifile.c
# End Source File
# Begin Source File
SOURCE=.\libcdb\uint32.c
# End Source File
# End Group
@@ -194,20 +186,12 @@ SOURCE=.\php_gdbm.h
# End Source File
# Begin Source File
SOURCE=.\php_inifile.h
# End Source File
# Begin Source File
SOURCE=.\php_ndbm.h
# End Source File
# Begin Source File
SOURCE=.\libcdb\uint32.h
# End Source File
# Begin Source File
SOURCE=.\libinifile\inifile.h
# End Source File
# End Group
# End Target
# End Project
+13 -27
View File
@@ -2,12 +2,12 @@
+----------------------------------------------------------------------+
| PHP Version 4 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2006 The PHP Group |
| Copyright (c) 1997-2002 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| 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 through the world-wide-web at the following url: |
| http://www.php.net/license/3_01.txt |
| 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. |
@@ -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
/*
+4 -13
View File
@@ -2,12 +2,12 @@
+----------------------------------------------------------------------+
| PHP Version 4 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2006 The PHP Group |
| Copyright (c) 1997-2002 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| 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 through the world-wide-web at the following url: |
| http://www.php.net/license/3_01.txt |
| 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. |
@@ -53,10 +53,6 @@ DBA_OPEN_FUNC(db2)
struct stat check_stat;
int s = VCWD_STAT(info->path, &check_stat);
if (!s && !check_stat.st_size) {
info->mode = DBA_TRUNC; /* force truncate */
}
type = info->mode == DBA_READER ? DB_UNKNOWN :
info->mode == DBA_TRUNC ? DB_BTREE :
s ? DB_BTREE : DB_UNKNOWN;
@@ -192,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
/*
Loaded 100 of 1725 files, more files were not shown because too many files have changed in this diff. Show more