mirror of
https://github.com/bdnugget/php-src.git
synced 2026-11-11 11:10:49 +00:00
Compare commits
156
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
674328d1fa | ||
|
|
ef03277c51 | ||
|
|
02cc197a77 | ||
|
|
253b53296c | ||
|
|
40796e5be2 | ||
|
|
bcdbc527b6 | ||
|
|
7e5fd5048a | ||
|
|
2da6392297 | ||
|
|
5ead13b0d7 | ||
|
|
e0108f79e1 | ||
|
|
d28453af34 | ||
|
|
bb369d7f91 | ||
|
|
f8159f4f20 | ||
|
|
f7a54490c0 | ||
|
|
d1336b2fce | ||
|
|
cfe1d84628 | ||
|
|
882415354a | ||
|
|
c4f239e6ab | ||
|
|
3ea732bb4f | ||
|
|
f4a3603d48 | ||
|
|
2da3aa1e3c | ||
|
|
debfb9626c | ||
|
|
647ecadc0e | ||
|
|
3256f775cd | ||
|
|
e5f7ed8d21 | ||
|
|
1e5919277c | ||
|
|
5385e1f258 | ||
|
|
0f958cdf3b | ||
|
|
e835de81f2 | ||
|
|
05fc73701f | ||
|
|
e28724787b | ||
|
|
0e5b273b0f | ||
|
|
7e15bdcb58 | ||
|
|
25fa7f7411 | ||
|
|
adffaad9f4 | ||
|
|
e2fb9282aa | ||
|
|
f04e7b251c | ||
|
|
dfa94d4b9f | ||
|
|
2fdac23dfb | ||
|
|
86bb6388c0 | ||
|
|
0215d17907 | ||
|
|
2c25be52f4 | ||
|
|
b337bf3f97 | ||
|
|
f63dd3cc7e | ||
|
|
bb31b98137 | ||
|
|
a686d91177 | ||
|
|
34f95edd9b | ||
|
|
f5ce52c8f1 | ||
|
|
6a92f0dcc5 | ||
|
|
0d46db0ded | ||
|
|
5ba92f6b53 | ||
|
|
6b13a53a20 | ||
|
|
31be1c0ce1 | ||
|
|
605e8a0502 | ||
|
|
a9914c9a99 | ||
|
|
52a26baead | ||
|
|
e152dd3cee | ||
|
|
cbce251dab | ||
|
|
c939250414 | ||
|
|
a36c434dbb | ||
|
|
8e46600166 | ||
|
|
d07a60c3d0 | ||
|
|
0858af07ec | ||
|
|
a096235f8f | ||
|
|
8244f0f628 | ||
|
|
3cdc24790e | ||
|
|
80df8e6b0a | ||
|
|
b228115b64 | ||
|
|
cdedea01c1 | ||
|
|
c0e263c1a1 | ||
|
|
91889eeb93 | ||
|
|
5c74aa0f0f | ||
|
|
501aa09789 | ||
|
|
16d5e9f108 | ||
|
|
195a756477 | ||
|
|
09fb81a8f3 | ||
|
|
21ff8ec819 | ||
|
|
6d1374480e | ||
|
|
7e33f0b17b | ||
|
|
0be29a4861 | ||
|
|
bcf3204bd3 | ||
|
|
dee465139f | ||
|
|
f5b7714238 | ||
|
|
747258e34f | ||
|
|
66c1d632c1 | ||
|
|
b9d6136a28 | ||
|
|
aaa9baa57f | ||
|
|
549164e1fe | ||
|
|
36f572a5b9 | ||
|
|
2a985b94e0 | ||
|
|
3f783ff20b | ||
|
|
43a661c2ac | ||
|
|
958a5a1311 | ||
|
|
0aca2443d7 | ||
|
|
032765f467 | ||
|
|
ef3912a195 | ||
|
|
0a862aff6f | ||
|
|
38cd9d70d5 | ||
|
|
5031e0dab8 | ||
|
|
40b988316b | ||
|
|
bca8ddd083 | ||
|
|
6d47a2d60f | ||
|
|
96c421553f | ||
|
|
30f0fa9262 | ||
|
|
2a1ac78a9d | ||
|
|
6b702ced00 | ||
|
|
edc32c8faa | ||
|
|
18e7796470 | ||
|
|
4e7c35b1e2 | ||
|
|
5d1e3b81d4 | ||
|
|
e8a7dbe010 | ||
|
|
d205634a58 | ||
|
|
91f27074fc | ||
|
|
c3a83e4c12 | ||
|
|
989fc05c1c | ||
|
|
63f504192e | ||
|
|
07156d5fc5 | ||
|
|
dd96ef8151 | ||
|
|
f467121516 | ||
|
|
27592372cc | ||
|
|
b73a2081ab | ||
|
|
2b85be3c48 | ||
|
|
87166f6978 | ||
|
|
cab6cfa680 | ||
|
|
3c2de4ce6f | ||
|
|
896cf60aff | ||
|
|
2c7191b5ce | ||
|
|
896e2e810d | ||
|
|
1a3f3309a5 | ||
|
|
1bc5e9ffc4 | ||
|
|
33e4ade668 | ||
|
|
2e8fc85965 | ||
|
|
4a04971bed | ||
|
|
cd9e4f37a2 | ||
|
|
8a58067dd5 | ||
|
|
84f1093658 | ||
|
|
1103c8306f | ||
|
|
7755c18735 | ||
|
|
19f20337f4 | ||
|
|
684c1fefc3 | ||
|
|
45e8587fa3 | ||
|
|
120e9fa63f | ||
|
|
8b4d5cefea | ||
|
|
f10d1f8f01 | ||
|
|
740073c795 | ||
|
|
8e0cad5b50 | ||
|
|
040e59eb6d | ||
|
|
e75fa38d9d | ||
|
|
0a1c75a106 | ||
|
|
b9f4c04888 | ||
|
|
49beadaa03 | ||
|
|
2eee05cb5d | ||
|
|
f5a5a7e518 | ||
|
|
43f418accd | ||
|
|
725100424b | ||
|
|
9261ba3e70 |
No files matched your search
@@ -1,36 +1,83 @@
|
||||
PHP 4.0 NEWS
|
||||
PHP 4 NEWS
|
||||
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||
?? ??? 200?, Version 4.1.0
|
||||
- Now bundling Dan Libby's xmlrpc-epi extension
|
||||
- Introduced extension version numbers (Stig)
|
||||
- Added version_compare() function (Stig)
|
||||
- Fixed pg_last_notice() (could cause random crashes in PostgreSQL applications,
|
||||
even if they didn't use pg_last_notice()) (Zeev)
|
||||
- Fixed DOM-XML's error reporting, so E_WARNING errors are given instead of
|
||||
27 Feb 2002, Version 4.1.2
|
||||
- Fixed start up failure when mm save handler is used and there is multiple
|
||||
SAPIs are working at the same time. (Yasuo)
|
||||
- Fixed the Roxen SAPI (Yasuo)
|
||||
- Fixed a buffer overflow in the RFC-1867 file upload code (Stefan)
|
||||
- Fixed a crash in the session module (Yasuo)
|
||||
- Fixed a crash in the pspell module (Yasuo)
|
||||
- Changed the default output encoding of mbstring 'pass' to fix
|
||||
initialization problem (Rui)
|
||||
|
||||
26 Dec 2001, Version 4.1.1
|
||||
- Fixed incompatibility with Windows .NET / IIS 6 - may improve stability
|
||||
under other versions of IIS. (Zeev)
|
||||
- Fixed bug that caused crashes or error notices on shutdown on threaded
|
||||
platforms. (Zeev)
|
||||
- Fixed several crash bugs in the xslt extension. (Markus, Derick)
|
||||
- Fixed problem with dbase not returning very large (larger than long)
|
||||
integers properly. (Vlad)
|
||||
- Fixed several bugs and memleaks in the domxml extension. (Markus)
|
||||
- Fixed bug in gmmktime() which was one hour off during standard time -
|
||||
bug #9878. Patch by bfoddy@mediaone.net. (jmoore)
|
||||
- Fixed bug in gmdate() timezone handling on Windows - bug #13885. (jmoore)
|
||||
- Fixed several crash bugs in the mcrypt extension. (Derick)
|
||||
- Made the mcrypt extension compile with the libmcrypt 2.2 series again.
|
||||
(Sterling)
|
||||
- Fixed a bug where the is_file() family of functions would in-correctly give
|
||||
an error when they were given filenames that didn't exist. (Sterling)
|
||||
- Fixed a bug in the strtotime() function where it was incorrectly recognizing
|
||||
GMT +0100 and GMT -0100. (Derick)
|
||||
|
||||
10 Dec 2001, Version 4.1.0
|
||||
- Worked around a bug in the MySQL client library that could cause PHP to hang
|
||||
when using unbuffered queries. (Zeev)
|
||||
- Fixed a bug which caused set_time_limit() to affect all subsequent requests
|
||||
to running Apache child process. (Zeev)
|
||||
- Removed the sablotron extension in favor of the new XSLT extension.
|
||||
(Sterling)
|
||||
- Fixed a bug in WDDX deserialization that would sometimes corrupt the root
|
||||
element if it was a scalar one. (Andrei)
|
||||
- Make ImageColorAt() and ImageColorsForIndex() work with TrueColor images.
|
||||
(Rasmus)
|
||||
- Fixed a bug in preg_match_all() that would return results under improper
|
||||
indices in certain cases. (Andrei)
|
||||
- Fixed a crash in str_replace() that would happen if search parameter was an
|
||||
array and one of the replacements resulted in subject string being empty.
|
||||
(Andrei)
|
||||
- Fixed MySQL extension to work with MySQL 4.0. (Jani)
|
||||
- Fixed a crash bug within Cobalt systems. Patch by tomc@tripac.com. (Jani)
|
||||
- Bundled Dan Libby's xmlrpc-epi extension.
|
||||
- Introduced extension version numbers. (Stig)
|
||||
- Added version_compare() function. (Stig)
|
||||
- Fixed pg_last_notice() (could cause random crashes in PostgreSQL
|
||||
applications, even if they didn't use pg_last_notice()). (Zeev)
|
||||
- Fixed DOM-XML's error reporting, so E_WARNING errors are given instead of
|
||||
E_ERROR error's, this allows you to trap errors thrown by DOMXML functions.
|
||||
(Sterling)
|
||||
- Fixed a bug in the mcrypt extension, where list destructors were not
|
||||
properly being allocated. (Sterling)
|
||||
- Better Interbase blob, null and error handling (Patch by Jeremy Bettis)
|
||||
- Better Interbase blob, null and error handling. (Patch by Jeremy Bettis)
|
||||
- Fixed a crash bug in array_map() if the input arrays had string or
|
||||
non-sequential keys. Also modified it so that if a single array is passed,
|
||||
its keys are preserved in the resulting array. (Andrei)
|
||||
- Fixed a crash in dbase_replace_record (Patch by robin.marlow@dps-int.com)
|
||||
- Fixed a crash in msql_result() (Zeev)
|
||||
- Fixed a crash in dbase_replace_record. (Patch by robin.marlow@dps-int.com)
|
||||
- Fixed a crash in msql_result(). (Zeev)
|
||||
- Added support for single dimensional SafeArrays and Enumerations.
|
||||
Added an is_enum() function to check if a component implements an
|
||||
enumeration. (Alan, Harald)
|
||||
- Fixed a bug in dbase_get_record() and dbase_get_record_with_names().
|
||||
boolean fields are now returned correctly.
|
||||
Patch by Lawrence E. Widman <widman@cardiothink.com> (Jani)
|
||||
- Added --version option to php-config (Stig)
|
||||
- Added --version option to php-config. (Stig)
|
||||
- Improved support for thttpd-2.21b by incorporating patches for all known
|
||||
bugs (Sascha)
|
||||
bugs. (Sascha)
|
||||
- Added ircg_get_username, a roomkey argument to ircg_join, error fetching
|
||||
infrastructure, a tokenizer to speed up message processing, and fixed
|
||||
a lot of bugs in the IRCG extension (Sascha)
|
||||
- Improved speed of the serializer/deserializer (Thies, Sascha)
|
||||
- Floating point numbers are better detected when converting from strings
|
||||
a lot of bugs in the IRCG extension. (Sascha)
|
||||
- Improved speed of the serializer/deserializer. (Thies, Sascha)
|
||||
- Floating point numbers are better detected when converting from strings.
|
||||
(Zeev, Zend Engine)
|
||||
- Replaced php.ini-optimized with php.ini-recommended. As the name implies,
|
||||
it's warmly recommended to use this file as the basis for your PHP
|
||||
|
||||
@@ -553,7 +553,7 @@ CWD_API int virtual_open(const char *path TSRMLS_DC, int flags, ...)
|
||||
va_list arg;
|
||||
|
||||
va_start(arg, flags);
|
||||
mode = va_arg(arg, mode_t);
|
||||
mode = (mode_t) va_arg(arg, int);
|
||||
va_end(arg);
|
||||
|
||||
f = open(new_state.cwd, flags, mode);
|
||||
|
||||
@@ -928,12 +928,6 @@ dnl ---------------------------------------------- Shared module
|
||||
PHP_FAST_OUTPUT($ext_builddir/Makefile)
|
||||
])
|
||||
|
||||
PHP_SUBST(EXT_SUBDIRS)
|
||||
PHP_SUBST(EXT_STATIC)
|
||||
PHP_SUBST(EXT_SHARED)
|
||||
PHP_SUBST(EXT_LIBS)
|
||||
PHP_SUBST(EXT_LTLIBS)
|
||||
|
||||
dnl
|
||||
dnl Solaris requires main code to be position independent in order
|
||||
dnl to let shared objects find symbols. Weird. Ugly.
|
||||
|
||||
Vendored
+142
-205
@@ -3,7 +3,7 @@
|
||||
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
|
||||
# Free Software Foundation, Inc.
|
||||
|
||||
timestamp='2001-04-20'
|
||||
timestamp='2001-11-08'
|
||||
|
||||
# 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
|
||||
@@ -24,8 +24,9 @@ timestamp='2001-04-20'
|
||||
# configuration script generated by Autoconf, you may include it under
|
||||
# the same distribution terms that you use for the rest of that program.
|
||||
|
||||
# Written by Per Bothner <bothner@cygnus.com>.
|
||||
# Please send patches to <config-patches@gnu.org>.
|
||||
# Originally written by Per Bothner <bothner@cygnus.com>.
|
||||
# Please send patches to <config-patches@gnu.org>. Submit a context
|
||||
# diff and a properly formatted ChangeLog entry.
|
||||
#
|
||||
# This script attempts to guess a canonical system name similar to
|
||||
# config.sub. If it succeeds, it prints the system name on stdout, and
|
||||
@@ -52,7 +53,7 @@ version="\
|
||||
GNU config.guess ($timestamp)
|
||||
|
||||
Originally written by Per Bothner.
|
||||
Copyright (C) 1992, 93, 94, 95, 96, 97, 98, 99, 2000
|
||||
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
|
||||
Free Software Foundation, Inc.
|
||||
|
||||
This is free software; see the source for copying conditions. There is NO
|
||||
@@ -95,25 +96,25 @@ trap 'rm -f $dummy.c $dummy.o $dummy.rel $dummy; exit 1' 1 2 15
|
||||
# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
|
||||
# use `HOST_CC' if defined, but it is deprecated.
|
||||
|
||||
case $CC_FOR_BUILD,$HOST_CC,$CC in
|
||||
,,) echo "int dummy(){}" > $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 ; do
|
||||
($c $dummy.c -c -o $dummy.o) >/dev/null 2>&1
|
||||
($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
|
||||
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
|
||||
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 8/24/94.)
|
||||
# (ghazi@noc.rutgers.edu 1994-08-24)
|
||||
if (test -f /.attbin/uname) >/dev/null 2>&1 ; then
|
||||
PATH=$PATH:/.attbin ; export PATH
|
||||
fi
|
||||
@@ -127,7 +128,7 @@ UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
|
||||
|
||||
case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
|
||||
*:NetBSD:*:*)
|
||||
# Netbsd (nbsd) targets should (where applicable) match one or
|
||||
# NetBSD (nbsd) targets should (where applicable) match one or
|
||||
# more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*,
|
||||
# *-*-netbsdecoff* and *-*-netbsd*. For targets that recently
|
||||
# switched to ELF, *-*-netbsd* would select the old
|
||||
@@ -144,12 +145,14 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
|
||||
macppc) machine=powerpc-apple ;;
|
||||
hp3[0-9][05]) machine=m68k-hp ;;
|
||||
ibmrt|romp-ibm) machine=romp-ibm ;;
|
||||
sparc*) machine=`uname -p`-unknown ;;
|
||||
*) machine=${UNAME_MACHINE}-unknown ;;
|
||||
esac
|
||||
# The Operating System including object format, if it has switched
|
||||
# to ELF recently, or will in the future.
|
||||
case "${UNAME_MACHINE}" in
|
||||
i386|sparc|amiga|arm*|hp300|mvme68k|vax|atari|luna68k|mac68k|news68k|next68k|pc532|sun3*|x68k)
|
||||
eval $set_cc_for_build
|
||||
if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
|
||||
| grep __ELF__ >/dev/null
|
||||
then
|
||||
@@ -171,6 +174,45 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
|
||||
# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
|
||||
echo "${machine}-${os}${release}"
|
||||
exit 0 ;;
|
||||
amiga:OpenBSD:*:*)
|
||||
echo m68k-unknown-openbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
arc:OpenBSD:*:*)
|
||||
echo mipsel-unknown-openbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
hp300:OpenBSD:*:*)
|
||||
echo m68k-unknown-openbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
mac68k:OpenBSD:*:*)
|
||||
echo m68k-unknown-openbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
macppc:OpenBSD:*:*)
|
||||
echo powerpc-unknown-openbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
mvme68k:OpenBSD:*:*)
|
||||
echo m68k-unknown-openbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
mvme88k:OpenBSD:*:*)
|
||||
echo m88k-unknown-openbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
mvmeppc:OpenBSD:*:*)
|
||||
echo powerpc-unknown-openbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
pmax:OpenBSD:*:*)
|
||||
echo mipsel-unknown-openbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
sgi:OpenBSD:*:*)
|
||||
echo mipseb-unknown-openbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
sun3:OpenBSD:*:*)
|
||||
echo m68k-unknown-openbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
wgrisc:OpenBSD:*:*)
|
||||
echo mipsel-unknown-openbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
*:OpenBSD:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-openbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
alpha:OSF1:*:*)
|
||||
if test $UNAME_RELEASE = "V4.0"; then
|
||||
UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
|
||||
@@ -204,6 +246,7 @@ main:
|
||||
jsr \$26,exit
|
||||
.end main
|
||||
EOF
|
||||
eval $set_cc_for_build
|
||||
$CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null
|
||||
if test "$?" = 0 ; then
|
||||
case `./$dummy` in
|
||||
@@ -225,6 +268,9 @@ EOF
|
||||
2-307)
|
||||
UNAME_MACHINE="alphaev67"
|
||||
;;
|
||||
2-1307)
|
||||
UNAME_MACHINE="alphaev68"
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
rm -f $dummy.s $dummy
|
||||
@@ -242,30 +288,9 @@ EOF
|
||||
Amiga*:UNIX_System_V:4.0:*)
|
||||
echo m68k-unknown-sysv4
|
||||
exit 0;;
|
||||
amiga:OpenBSD:*:*)
|
||||
echo m68k-unknown-openbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
*:[Aa]miga[Oo][Ss]:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-amigaos
|
||||
exit 0 ;;
|
||||
arc64:OpenBSD:*:*)
|
||||
echo mips64el-unknown-openbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
arc:OpenBSD:*:*)
|
||||
echo mipsel-unknown-openbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
hkmips:OpenBSD:*:*)
|
||||
echo mips-unknown-openbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
pmax:OpenBSD:*:*)
|
||||
echo mipsel-unknown-openbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
sgi:OpenBSD:*:*)
|
||||
echo mips-unknown-openbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
wgrisc:OpenBSD:*:*)
|
||||
echo mipsel-unknown-openbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
*:OS/390:*:*)
|
||||
echo i370-ibm-openedition
|
||||
exit 0 ;;
|
||||
@@ -328,9 +353,6 @@ EOF
|
||||
aushp:SunOS:*:*)
|
||||
echo sparc-auspex-sunos${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
atari*:OpenBSD:*:*)
|
||||
echo m68k-unknown-openbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
# The situation for MiNT is a little confusing. The machine name
|
||||
# can be virtually everything (everything which is not
|
||||
# "atarist" or "atariste" at least should have a processor
|
||||
@@ -357,18 +379,6 @@ EOF
|
||||
*:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
|
||||
echo m68k-unknown-mint${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
sun3*:OpenBSD:*:*)
|
||||
echo m68k-unknown-openbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
mac68k:OpenBSD:*:*)
|
||||
echo m68k-unknown-openbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
mvme68k:OpenBSD:*:*)
|
||||
echo m68k-unknown-openbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
mvme88k:OpenBSD:*:*)
|
||||
echo m88k-unknown-openbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
powerpc:machten:*:*)
|
||||
echo powerpc-apple-machten${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
@@ -385,6 +395,7 @@ EOF
|
||||
echo clipper-intergraph-clix${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
mips:*:*:UMIPS | mips:*:*:RISCos)
|
||||
eval $set_cc_for_build
|
||||
sed 's/^ //' << EOF >$dummy.c
|
||||
#ifdef __cplusplus
|
||||
#include <stdio.h> /* for printf() prototype */
|
||||
@@ -475,6 +486,7 @@ EOF
|
||||
exit 0 ;;
|
||||
*:AIX:2:3)
|
||||
if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
|
||||
eval $set_cc_for_build
|
||||
sed 's/^ //' << EOF >$dummy.c
|
||||
#include <sys/systemcfg.h>
|
||||
|
||||
@@ -536,10 +548,8 @@ EOF
|
||||
9000/31? ) HP_ARCH=m68000 ;;
|
||||
9000/[34]?? ) HP_ARCH=m68k ;;
|
||||
9000/[678][0-9][0-9])
|
||||
case "${HPUX_REV}" in
|
||||
11.[0-9][0-9])
|
||||
if [ -x /usr/bin/getconf ]; then
|
||||
sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
|
||||
if [ -x /usr/bin/getconf ]; then
|
||||
sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
|
||||
sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
|
||||
case "${sc_cpu_version}" in
|
||||
523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
|
||||
@@ -548,12 +558,13 @@ EOF
|
||||
case "${sc_kernel_bits}" in
|
||||
32) HP_ARCH="hppa2.0n" ;;
|
||||
64) HP_ARCH="hppa2.0w" ;;
|
||||
'') HP_ARCH="hppa2.0" ;; # HP-UX 10.20
|
||||
esac ;;
|
||||
esac
|
||||
fi ;;
|
||||
esac
|
||||
if [ "${HP_ARCH}" = "" ]; then
|
||||
sed 's/^ //' << EOF >$dummy.c
|
||||
fi
|
||||
if [ "${HP_ARCH}" = "" ]; then
|
||||
eval $set_cc_for_build
|
||||
sed 's/^ //' << EOF >$dummy.c
|
||||
|
||||
#define _HPUX_SOURCE
|
||||
#include <stdlib.h>
|
||||
@@ -586,10 +597,10 @@ EOF
|
||||
exit (0);
|
||||
}
|
||||
EOF
|
||||
(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 ;;
|
||||
(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
|
||||
echo ${HP_ARCH}-hp-hpux${HPUX_REV}
|
||||
exit 0 ;;
|
||||
@@ -598,6 +609,7 @@ EOF
|
||||
echo ia64-hp-hpux${HPUX_REV}
|
||||
exit 0 ;;
|
||||
3050*:HI-UX:*:*)
|
||||
eval $set_cc_for_build
|
||||
sed 's/^ //' << EOF >$dummy.c
|
||||
#include <unistd.h>
|
||||
int
|
||||
@@ -633,7 +645,7 @@ EOF
|
||||
9000/8??:4.3bsd:*:*)
|
||||
echo hppa1.0-hp-bsd
|
||||
exit 0 ;;
|
||||
*9??*:MPE/iX:*:*)
|
||||
*9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
|
||||
echo hppa1.0-hp-mpeix
|
||||
exit 0 ;;
|
||||
hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
|
||||
@@ -652,9 +664,6 @@ EOF
|
||||
parisc*:Lites*:*:*)
|
||||
echo hppa1.1-hp-lites
|
||||
exit 0 ;;
|
||||
hppa*:OpenBSD:*:*)
|
||||
echo hppa-unknown-openbsd
|
||||
exit 0 ;;
|
||||
C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
|
||||
echo c1-convex-bsd
|
||||
exit 0 ;;
|
||||
@@ -677,12 +686,13 @@ EOF
|
||||
echo xmp-cray-unicos
|
||||
exit 0 ;;
|
||||
CRAY*Y-MP:*:*:*)
|
||||
echo ymp-cray-unicos${UNAME_RELEASE}
|
||||
echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
|
||||
exit 0 ;;
|
||||
CRAY*[A-Z]90:*:*:*)
|
||||
echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
|
||||
| sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
|
||||
-e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/
|
||||
-e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
|
||||
-e 's/\.[^.]*$/.X/'
|
||||
exit 0 ;;
|
||||
CRAY*TS:*:*:*)
|
||||
echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
|
||||
@@ -705,9 +715,6 @@ EOF
|
||||
FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
|
||||
echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
|
||||
exit 0 ;;
|
||||
hp300:OpenBSD:*:*)
|
||||
echo m68k-unknown-openbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
|
||||
echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
@@ -720,9 +727,6 @@ EOF
|
||||
*:FreeBSD:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
|
||||
exit 0 ;;
|
||||
*:OpenBSD:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-openbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
|
||||
exit 0 ;;
|
||||
i*:CYGWIN*:*)
|
||||
echo ${UNAME_MACHINE}-pc-cygwin
|
||||
exit 0 ;;
|
||||
@@ -763,97 +767,29 @@ EOF
|
||||
echo ${UNAME_MACHINE}-unknown-linux-gnu
|
||||
exit 0 ;;
|
||||
mips:Linux:*:*)
|
||||
cat >$dummy.c <<EOF
|
||||
#ifdef __cplusplus
|
||||
#include <stdio.h> /* for printf() prototype */
|
||||
int main (int argc, char *argv[]) {
|
||||
#else
|
||||
int main (argc, argv) int argc; char *argv[]; {
|
||||
#endif
|
||||
#ifdef __MIPSEB__
|
||||
printf ("%s-unknown-linux-gnu\n", argv[1]);
|
||||
#endif
|
||||
#ifdef __MIPSEL__
|
||||
printf ("%sel-unknown-linux-gnu\n", argv[1]);
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
EOF
|
||||
$CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy "${UNAME_MACHINE}" && rm -f $dummy.c $dummy && exit 0
|
||||
rm -f $dummy.c $dummy
|
||||
case `sed -n '/^byte/s/^.*: \(.*\) endian/\1/p' < /proc/cpuinfo` in
|
||||
big) echo mips-unknown-linux-gnu && exit 0 ;;
|
||||
little) echo mipsel-unknown-linux-gnu && exit 0 ;;
|
||||
esac
|
||||
;;
|
||||
ppc:Linux:*:*)
|
||||
# Determine Lib Version
|
||||
cat >$dummy.c <<EOF
|
||||
#include <features.h>
|
||||
#if defined(__GLIBC__)
|
||||
extern char __libc_version[];
|
||||
extern char __libc_release[];
|
||||
#endif
|
||||
main(argc, argv)
|
||||
int argc;
|
||||
char *argv[];
|
||||
{
|
||||
#if defined(__GLIBC__)
|
||||
printf("%s %s\n", __libc_version, __libc_release);
|
||||
#else
|
||||
printf("unknown\n");
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
EOF
|
||||
LIBC=""
|
||||
$CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null
|
||||
if test "$?" = 0 ; then
|
||||
./$dummy | grep 1\.99 > /dev/null
|
||||
if test "$?" = 0 ; then LIBC="libc1" ; fi
|
||||
fi
|
||||
rm -f $dummy.c $dummy
|
||||
echo powerpc-unknown-linux-gnu${LIBC}
|
||||
echo powerpc-unknown-linux-gnu
|
||||
exit 0 ;;
|
||||
ppc64:Linux:*:*)
|
||||
echo powerpc64-unknown-linux-gnu
|
||||
exit 0 ;;
|
||||
alpha:Linux:*:*)
|
||||
cat <<EOF >$dummy.s
|
||||
.data
|
||||
\$Lformat:
|
||||
.byte 37,100,45,37,120,10,0 # "%d-%x\n"
|
||||
.text
|
||||
.globl main
|
||||
.align 4
|
||||
.ent main
|
||||
main:
|
||||
.frame \$30,16,\$26,0
|
||||
ldgp \$29,0(\$27)
|
||||
.prologue 1
|
||||
.long 0x47e03d80 # implver \$0
|
||||
lda \$2,-1
|
||||
.long 0x47e20c21 # amask \$2,\$1
|
||||
lda \$16,\$Lformat
|
||||
mov \$0,\$17
|
||||
not \$1,\$18
|
||||
jsr \$26,printf
|
||||
ldgp \$29,0(\$26)
|
||||
mov 0,\$16
|
||||
jsr \$26,exit
|
||||
.end main
|
||||
EOF
|
||||
LIBC=""
|
||||
$CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null
|
||||
if test "$?" = 0 ; then
|
||||
case `./$dummy` in
|
||||
0-0) UNAME_MACHINE="alpha" ;;
|
||||
1-0) UNAME_MACHINE="alphaev5" ;;
|
||||
1-1) UNAME_MACHINE="alphaev56" ;;
|
||||
1-101) UNAME_MACHINE="alphapca56" ;;
|
||||
2-303) UNAME_MACHINE="alphaev6" ;;
|
||||
2-307) UNAME_MACHINE="alphaev67" ;;
|
||||
esac
|
||||
objdump --private-headers $dummy | \
|
||||
grep ld.so.1 > /dev/null
|
||||
if test "$?" = 0 ; then
|
||||
LIBC="libc1"
|
||||
fi
|
||||
fi
|
||||
rm -f $dummy.s $dummy
|
||||
case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
|
||||
EV5) UNAME_MACHINE=alphaev5 ;;
|
||||
EV56) UNAME_MACHINE=alphaev56 ;;
|
||||
PCA56) UNAME_MACHINE=alphapca56 ;;
|
||||
PCA57) UNAME_MACHINE=alphapca56 ;;
|
||||
EV6) UNAME_MACHINE=alphaev6 ;;
|
||||
EV67) UNAME_MACHINE=alphaev67 ;;
|
||||
EV68*) UNAME_MACHINE=alphaev68 ;;
|
||||
esac
|
||||
objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null
|
||||
if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
|
||||
echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
|
||||
exit 0 ;;
|
||||
parisc:Linux:*:* | hppa:Linux:*:*)
|
||||
@@ -883,40 +819,30 @@ EOF
|
||||
# The BFD linker knows what the default object file format is, so
|
||||
# first see if it will tell us. cd to the root directory to prevent
|
||||
# problems with other programs or directories called `ld' in the path.
|
||||
ld_supported_emulations=`cd /; ld --help 2>&1 \
|
||||
| sed -ne '/supported emulations:/!d
|
||||
ld_supported_targets=`cd /; ld --help 2>&1 \
|
||||
| sed -ne '/supported targets:/!d
|
||||
s/[ ][ ]*/ /g
|
||||
s/.*supported emulations: *//
|
||||
s/.*supported targets: *//
|
||||
s/ .*//
|
||||
p'`
|
||||
case "$ld_supported_emulations" in
|
||||
i*86linux)
|
||||
echo "${UNAME_MACHINE}-pc-linux-gnuaout"
|
||||
exit 0
|
||||
;;
|
||||
elf_i*86)
|
||||
case "$ld_supported_targets" in
|
||||
elf32-i386)
|
||||
TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu"
|
||||
;;
|
||||
i*86coff)
|
||||
a.out-i386-linux)
|
||||
echo "${UNAME_MACHINE}-pc-linux-gnuaout"
|
||||
exit 0 ;;
|
||||
coff-i386)
|
||||
echo "${UNAME_MACHINE}-pc-linux-gnucoff"
|
||||
exit 0
|
||||
;;
|
||||
esac
|
||||
# Either a pre-BFD a.out linker (linux-gnuoldld)
|
||||
# or one that does not give us useful --help.
|
||||
# GCC wants to distinguish between linux-gnuoldld and linux-gnuaout.
|
||||
# If ld does not provide *any* "supported emulations:"
|
||||
# that means it is gnuoldld.
|
||||
test -z "$ld_supported_emulations" && echo "${UNAME_MACHINE}-pc-linux-gnuoldld" && exit 0
|
||||
case "${UNAME_MACHINE}" in
|
||||
i*86)
|
||||
VENDOR=pc;
|
||||
;;
|
||||
*)
|
||||
VENDOR=unknown;
|
||||
;;
|
||||
exit 0 ;;
|
||||
"")
|
||||
# Either a pre-BFD a.out linker (linux-gnuoldld) or
|
||||
# one that does not give us useful --help.
|
||||
echo "${UNAME_MACHINE}-pc-linux-gnuoldld"
|
||||
exit 0 ;;
|
||||
esac
|
||||
# Determine whether the default compiler is a.out or elf
|
||||
eval $set_cc_for_build
|
||||
cat >$dummy.c <<EOF
|
||||
#include <features.h>
|
||||
#ifdef __cplusplus
|
||||
@@ -928,15 +854,15 @@ EOF
|
||||
#ifdef __ELF__
|
||||
# ifdef __GLIBC__
|
||||
# if __GLIBC__ >= 2
|
||||
printf ("%s-${VENDOR}-linux-gnu\n", argv[1]);
|
||||
printf ("%s-pc-linux-gnu\n", argv[1]);
|
||||
# else
|
||||
printf ("%s-${VENDOR}-linux-gnulibc1\n", argv[1]);
|
||||
printf ("%s-pc-linux-gnulibc1\n", argv[1]);
|
||||
# endif
|
||||
# else
|
||||
printf ("%s-${VENDOR}-linux-gnulibc1\n", argv[1]);
|
||||
printf ("%s-pc-linux-gnulibc1\n", argv[1]);
|
||||
# endif
|
||||
#else
|
||||
printf ("%s-${VENDOR}-linux-gnuaout\n", argv[1]);
|
||||
printf ("%s-pc-linux-gnuaout\n", argv[1]);
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
@@ -945,9 +871,10 @@ EOF
|
||||
rm -f $dummy.c $dummy
|
||||
test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0
|
||||
;;
|
||||
# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. earlier versions
|
||||
# are messed up and put the nodename in both sysname and nodename.
|
||||
i*86:DYNIX/ptx:4*:*)
|
||||
# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
|
||||
# earlier versions are messed up and put the nodename in both
|
||||
# sysname and nodename.
|
||||
echo i386-sequent-sysv4
|
||||
exit 0 ;;
|
||||
i*86:UNIX_SV:4.2MP:2.*)
|
||||
@@ -966,14 +893,13 @@ EOF
|
||||
echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL}
|
||||
fi
|
||||
exit 0 ;;
|
||||
i*86:*:5:7*)
|
||||
# Fixed at (any) Pentium or better
|
||||
UNAME_MACHINE=i586
|
||||
if [ ${UNAME_SYSTEM} = "UnixWare" ] ; then
|
||||
echo ${UNAME_MACHINE}-sco-sysv${UNAME_RELEASE}uw${UNAME_VERSION}
|
||||
else
|
||||
echo ${UNAME_MACHINE}-pc-sysv${UNAME_RELEASE}
|
||||
fi
|
||||
i*86:*:5:[78]*)
|
||||
case `/bin/uname -X | grep "^Machine"` in
|
||||
*486*) UNAME_MACHINE=i486 ;;
|
||||
*Pentium) UNAME_MACHINE=i586 ;;
|
||||
*Pent*|*Celeron) UNAME_MACHINE=i686 ;;
|
||||
esac
|
||||
echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
|
||||
exit 0 ;;
|
||||
i*86:*:3.2:*)
|
||||
if test -f /usr/options/cb.name; then
|
||||
@@ -1021,7 +947,7 @@ EOF
|
||||
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 | 4850:*: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 | 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`
|
||||
@@ -1067,8 +993,8 @@ EOF
|
||||
echo ns32k-sni-sysv
|
||||
fi
|
||||
exit 0 ;;
|
||||
PENTIUM:CPunix:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
|
||||
# says <Richard.M.Bartel@ccMail.Census.GOV>
|
||||
PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
|
||||
# says <Richard.M.Bartel@ccMail.Census.GOV>
|
||||
echo i586-unisys-sysv4
|
||||
exit 0 ;;
|
||||
*:UNIX_System_V:4*:FTX*)
|
||||
@@ -1080,6 +1006,10 @@ EOF
|
||||
# From seanf@swdc.stratus.com.
|
||||
echo i860-stratus-sysv4
|
||||
exit 0 ;;
|
||||
*:VOS:*:*)
|
||||
# From Paul.Green@stratus.com.
|
||||
echo hppa1.1-stratus-vos
|
||||
exit 0 ;;
|
||||
mc68*:A/UX:*:*)
|
||||
echo m68k-apple-aux${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
@@ -1172,11 +1102,18 @@ 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
|
||||
#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
|
||||
|
||||
eval $set_cc_for_build
|
||||
cat >$dummy.c <<EOF
|
||||
#ifdef _SEQUENT_
|
||||
# include <sys/types.h>
|
||||
|
||||
Vendored
+109
-54
@@ -3,7 +3,7 @@
|
||||
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
|
||||
# Free Software Foundation, Inc.
|
||||
|
||||
timestamp='2001-04-20'
|
||||
timestamp='2001-11-08'
|
||||
|
||||
# This file is (in principle) common to ALL GNU software.
|
||||
# The presence of a machine in this file suggests that SOME GNU software
|
||||
@@ -29,7 +29,8 @@ timestamp='2001-04-20'
|
||||
# configuration script generated by Autoconf, you may include it under
|
||||
# the same distribution terms that you use for the rest of that program.
|
||||
|
||||
# Please send patches to <config-patches@gnu.org>.
|
||||
# Please send patches to <config-patches@gnu.org>. Submit a context
|
||||
# diff and a properly formatted ChangeLog entry.
|
||||
#
|
||||
# Configuration subroutine to validate and canonicalize a configuration type.
|
||||
# Supply the specified configuration type as an argument.
|
||||
@@ -117,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* | storm-chaos* | os2-emx*)
|
||||
nto-qnx* | linux-gnu* | storm-chaos* | os2-emx* | windows32-*)
|
||||
os=-$maybe_os
|
||||
basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
|
||||
;;
|
||||
@@ -157,6 +158,14 @@ case $os in
|
||||
os=-vxworks
|
||||
basic_machine=$1
|
||||
;;
|
||||
-chorusos*)
|
||||
os=-chorusos
|
||||
basic_machine=$1
|
||||
;;
|
||||
-chorusrdb)
|
||||
os=-chorusrdb
|
||||
basic_machine=$1
|
||||
;;
|
||||
-hiux*)
|
||||
os=-hiuxwe2
|
||||
;;
|
||||
@@ -215,26 +224,35 @@ esac
|
||||
case $basic_machine in
|
||||
# Recognize the basic CPU types without company name.
|
||||
# Some are omitted here because they have special meanings below.
|
||||
tahoe | i860 | ia64 | m32r | m68k | m68000 | m88k | ns32k | arc \
|
||||
| arm | arme[lb] | arm[bl]e | armv[2345] | armv[345][lb] | strongarm | xscale \
|
||||
| pyramid | mn10200 | mn10300 | tron | a29k \
|
||||
| 580 | i960 | h8300 \
|
||||
| x86 | ppcbe | mipsbe | mipsle | shbe | shle \
|
||||
| hppa | hppa1.0 | hppa1.1 | hppa2.0 | hppa2.0w | hppa2.0n \
|
||||
| hppa64 \
|
||||
| alpha | alphaev[4-8] | alphaev56 | alphapca5[67] \
|
||||
| alphaev6[78] \
|
||||
| we32k | ns16k | clipper | i370 | sh | sh[34] \
|
||||
| powerpc | powerpcle \
|
||||
| 1750a | dsp16xx | pdp10 | pdp11 \
|
||||
| mips16 | mips64 | mipsel | mips64el \
|
||||
| mips64orion | mips64orionel | mipstx39 | mipstx39el \
|
||||
| mips64vr4300 | mips64vr4300el | mips64vr4100 | mips64vr4100el \
|
||||
| mips64vr5000 | miprs64vr5000el | mcore | s390 | s390x \
|
||||
| sparc | sparclet | sparclite | sparc64 | sparcv9 | sparcv9b \
|
||||
| v850 | c4x \
|
||||
| thumb | d10v | d30v | fr30 | avr | openrisc | tic80 \
|
||||
| pj | pjl | h8500)
|
||||
1750a | 580 \
|
||||
| a29k \
|
||||
| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
|
||||
| arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \
|
||||
| c4x | clipper \
|
||||
| d10v | d30v | dsp16xx \
|
||||
| fr30 \
|
||||
| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
|
||||
| i370 | i860 | i960 | ia64 \
|
||||
| m32r | m68000 | m68k | m88k | mcore \
|
||||
| mips16 | mips64 | mips64el | mips64orion | mips64orionel \
|
||||
| mips64vr4100 | mips64vr4100el | mips64vr4300 \
|
||||
| mips64vr4300el | mips64vr5000 | mips64vr5000el \
|
||||
| mipsbe | mipseb | mipsel | mipsle | mipstx39 | mipstx39el \
|
||||
| mipsisa32 \
|
||||
| mn10200 | mn10300 \
|
||||
| ns16k | ns32k \
|
||||
| openrisc \
|
||||
| pdp10 | pdp11 | pj | pjl \
|
||||
| powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
|
||||
| pyramid \
|
||||
| sh | sh[34] | sh[34]eb | shbe | shle \
|
||||
| sparc | sparc64 | sparclet | sparclite | sparcv9 | sparcv9b \
|
||||
| strongarm \
|
||||
| tahoe | thumb | tic80 | tron \
|
||||
| v850 \
|
||||
| we32k \
|
||||
| x86 | xscale | xstormy16 \
|
||||
| z8k)
|
||||
basic_machine=$basic_machine-unknown
|
||||
;;
|
||||
m6811 | m68hc11 | m6812 | m68hc12)
|
||||
@@ -242,7 +260,7 @@ case $basic_machine in
|
||||
basic_machine=$basic_machine-unknown
|
||||
os=-none
|
||||
;;
|
||||
m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | z8k | v70 | w65)
|
||||
m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k)
|
||||
;;
|
||||
|
||||
# We use `pc' rather than `unknown'
|
||||
@@ -257,31 +275,43 @@ case $basic_machine in
|
||||
exit 1
|
||||
;;
|
||||
# Recognize the basic CPU types with company name.
|
||||
# FIXME: clean up the formatting here.
|
||||
vax-* | tahoe-* | i*86-* | i860-* | ia64-* | m32r-* | m68k-* | m68000-* \
|
||||
| m88k-* | sparc-* | ns32k-* | fx80-* | arc-* | c[123]* \
|
||||
| arm-* | armbe-* | armle-* | armv*-* | strongarm-* | xscale-* \
|
||||
| mips-* | pyramid-* | tron-* | a29k-* | romp-* | rs6000-* \
|
||||
| power-* | none-* | 580-* | cray2-* | h8300-* | h8500-* | i960-* \
|
||||
| xmp-* | ymp-* \
|
||||
| x86-* | ppcbe-* | mipsbe-* | mipsle-* | shbe-* | shle-* \
|
||||
| hppa-* | hppa1.0-* | hppa1.1-* | hppa2.0-* | hppa2.0w-* \
|
||||
| hppa2.0n-* | hppa64-* \
|
||||
| alpha-* | alphaev[4-8]-* | alphaev56-* | alphapca5[67]-* \
|
||||
| alphaev6[78]-* \
|
||||
| we32k-* | cydra-* | ns16k-* | pn-* | np1-* | xps100-* \
|
||||
| clipper-* | orion-* \
|
||||
| sparclite-* | pdp10-* | pdp11-* | sh-* | powerpc-* | powerpcle-* \
|
||||
| sparc64-* | sparcv9-* | sparcv9b-* | sparc86x-* \
|
||||
| mips16-* | mips64-* | mipsel-* \
|
||||
| mips64el-* | mips64orion-* | mips64orionel-* \
|
||||
| mips64vr4100-* | mips64vr4100el-* | mips64vr4300-* | mips64vr4300el-* \
|
||||
| mipstx39-* | mipstx39el-* | mcore-* \
|
||||
| f30[01]-* | f700-* | s390-* | s390x-* | sv1-* | t3e-* \
|
||||
| [cjt]90-* \
|
||||
| m88110-* | m680[01234]0-* | m683?2-* | m68360-* | z8k-* | d10v-* \
|
||||
| thumb-* | v850-* | d30v-* | tic30-* | tic80-* | c30-* | fr30-* \
|
||||
| bs2000-* | tic54x-* | c54x-* | x86_64-* | pj-* | pjl-*)
|
||||
580-* \
|
||||
| a29k-* \
|
||||
| alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
|
||||
| alphapca5[67]-* | arc-* \
|
||||
| arm-* | armbe-* | armle-* | armv*-* \
|
||||
| avr-* \
|
||||
| bs2000-* \
|
||||
| c[123]* | c30-* | [cjt]90-* | c54x-* \
|
||||
| clipper-* | cray2-* | cydra-* \
|
||||
| d10v-* | d30v-* \
|
||||
| elxsi-* \
|
||||
| f30[01]-* | f700-* | fr30-* | fx80-* \
|
||||
| h8300-* | h8500-* \
|
||||
| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
|
||||
| i*86-* | i860-* | i960-* | ia64-* \
|
||||
| m32r-* \
|
||||
| m68000-* | m680[01234]0-* | m68360-* | m683?2-* | m68k-* \
|
||||
| m88110-* | m88k-* | mcore-* \
|
||||
| mips-* | mips16-* | mips64-* | mips64el-* | mips64orion-* \
|
||||
| mips64orionel-* | mips64vr4100-* | mips64vr4100el-* \
|
||||
| mips64vr4300-* | mips64vr4300el-* | mipsbe-* | mipseb-* \
|
||||
| mipsle-* | mipsel-* | mipstx39-* | mipstx39el-* \
|
||||
| none-* | np1-* | ns16k-* | ns32k-* \
|
||||
| orion-* \
|
||||
| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
|
||||
| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
|
||||
| pyramid-* \
|
||||
| romp-* | rs6000-* \
|
||||
| sh-* | sh[34]-* | sh[34]eb-* | shbe-* | shle-* \
|
||||
| sparc-* | sparc64-* | sparc86x-* | sparclite-* \
|
||||
| sparcv9-* | sparcv9b-* | strongarm-* | sv1-* \
|
||||
| t3e-* | tahoe-* | thumb-* | tic30-* | tic54x-* | tic80-* | tron-* \
|
||||
| v850-* | vax-* \
|
||||
| we32k-* \
|
||||
| x86-* | x86_64-* | xmp-* | xps100-* | xscale-* | xstormy16-* \
|
||||
| ymp-* \
|
||||
| z8k-*)
|
||||
;;
|
||||
# Recognize the various machine names and aliases which stand
|
||||
# for a CPU type and a company and sometimes even an OS.
|
||||
@@ -694,7 +724,7 @@ case $basic_machine in
|
||||
pc532 | pc532-*)
|
||||
basic_machine=ns32k-pc532
|
||||
;;
|
||||
pentium | p5 | k5 | k6 | nexgen)
|
||||
pentium | p5 | k5 | k6 | nexgen | viac3)
|
||||
basic_machine=i586-pc
|
||||
;;
|
||||
pentiumpro | p6 | 6x86 | athlon)
|
||||
@@ -703,7 +733,7 @@ case $basic_machine in
|
||||
pentiumii | pentium2)
|
||||
basic_machine=i686-pc
|
||||
;;
|
||||
pentium-* | p5-* | k5-* | k6-* | nexgen-*)
|
||||
pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*)
|
||||
basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||
;;
|
||||
pentiumpro-* | p6-* | 6x86-* | athlon-*)
|
||||
@@ -727,6 +757,16 @@ case $basic_machine in
|
||||
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/^[^-]*-//'`
|
||||
;;
|
||||
ps2)
|
||||
basic_machine=i386-ibm
|
||||
;;
|
||||
@@ -744,6 +784,12 @@ 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
|
||||
@@ -755,7 +801,7 @@ case $basic_machine in
|
||||
basic_machine=sh-hitachi
|
||||
os=-hms
|
||||
;;
|
||||
sparclite-wrs)
|
||||
sparclite-wrs | simso-wrs)
|
||||
basic_machine=sparclite-wrs
|
||||
os=-vxworks
|
||||
;;
|
||||
@@ -881,6 +927,10 @@ case $basic_machine in
|
||||
basic_machine=hppa1.1-winbond
|
||||
os=-proelf
|
||||
;;
|
||||
windows32)
|
||||
basic_machine=i386-pc
|
||||
os=-windows32-msvcrt
|
||||
;;
|
||||
xmp)
|
||||
basic_machine=xmp-cray
|
||||
os=-unicos
|
||||
@@ -934,7 +984,7 @@ case $basic_machine in
|
||||
we32k)
|
||||
basic_machine=we32k-att
|
||||
;;
|
||||
sh3 | sh4)
|
||||
sh3 | sh4 | sh3eb | sh4eb)
|
||||
basic_machine=sh-unknown
|
||||
;;
|
||||
sparc | sparcv9 | sparcv9b)
|
||||
@@ -1018,11 +1068,13 @@ case $os in
|
||||
| -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
|
||||
| -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
|
||||
| -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
|
||||
| -chorusos* | -chorusrdb* \
|
||||
| -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
|
||||
| -mingw32* | -linux-gnu* | -uxpv* | -beos* | -mpeix* | -udk* \
|
||||
| -interix* | -uwin* | -rhapsody* | -darwin* | -opened* \
|
||||
| -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
|
||||
| -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* | -os2*)
|
||||
| -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
|
||||
| -os2* | -vos* | -palmos* | -uclinux*)
|
||||
# Remember, each alternative MUST END IN *, to match a version number.
|
||||
;;
|
||||
-qnx*)
|
||||
@@ -1346,6 +1398,9 @@ case $basic_machine in
|
||||
-*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
|
||||
vendor=atari
|
||||
;;
|
||||
-vos*)
|
||||
vendor=stratus
|
||||
;;
|
||||
esac
|
||||
basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
|
||||
;;
|
||||
|
||||
+8
-1
@@ -51,7 +51,7 @@ dnl ## All of these are normally in the extension directories.
|
||||
dnl ## Diversion 5 is the last one. Here we generate files and clean up.
|
||||
|
||||
dnl ## This is where the version number is changed from now on!
|
||||
AM_INIT_AUTOMAKE(php, 4.1.0RC1, nodefine)
|
||||
AM_INIT_AUTOMAKE(php, 4.1.2, nodefine)
|
||||
|
||||
PHP_VERSION=$VERSION
|
||||
echo "/* automatically generated by configure */" > php_version.h.new
|
||||
@@ -394,6 +394,7 @@ mkstemp \
|
||||
mmap \
|
||||
nl_langinfo \
|
||||
putenv \
|
||||
realpath \
|
||||
random \
|
||||
rand_r \
|
||||
regcomp \
|
||||
@@ -822,6 +823,12 @@ PHP_OS=`uname`
|
||||
AC_DEFINE_UNQUOTED(PHP_OS,"$PHP_OS",[uname output])
|
||||
|
||||
|
||||
PHP_SUBST(EXT_SUBDIRS)
|
||||
PHP_SUBST(EXT_STATIC)
|
||||
PHP_SUBST(EXT_SHARED)
|
||||
PHP_SUBST(EXT_LIBS)
|
||||
PHP_SUBST(EXT_LTLIBS)
|
||||
|
||||
PHP_SUBST_OLD(abs_builddir)
|
||||
PHP_SUBST_OLD(abs_srcdir)
|
||||
PHP_SUBST(bindir)
|
||||
|
||||
+9
-1
@@ -59,7 +59,15 @@ static PHP_MINFO_FUNCTION(VARIANT)
|
||||
|
||||
|
||||
zend_module_entry VARIANT_module_entry = {
|
||||
"variant", VARIANT_functions, PHP_MINIT(VARIANT), PHP_MSHUTDOWN(VARIANT), NULL, NULL, PHP_MINFO(VARIANT), STANDARD_MODULE_PROPERTIES
|
||||
STANDARD_MODULE_HEADER,
|
||||
"variant",
|
||||
VARIANT_functions,
|
||||
PHP_MINIT(VARIANT),
|
||||
PHP_MSHUTDOWN(VARIANT),
|
||||
NULL, NULL,
|
||||
PHP_MINFO(VARIANT),
|
||||
NO_VERSION_YET,
|
||||
STANDARD_MODULE_PROPERTIES
|
||||
};
|
||||
|
||||
|
||||
|
||||
+3
-3
@@ -5,11 +5,11 @@ PHP_ARG_WITH(crack, whether to include crack support,
|
||||
|
||||
if test "$PHP_CRACK" != "no"; then
|
||||
|
||||
for i in /usr/local/lib /usr/lib $PHP_CRACK $PHP_CRACK/cracklib; do
|
||||
test -f $i/lib/libcrack.$SHLIB_SUFFIX_NAME -o -f $i/lib/libcrack.a && CRACK_LIBDIR=$i
|
||||
for i in /usr/local/lib /usr/lib $PHP_CRACK/lib $PHP_CRACK/cracklib; do
|
||||
test -f $i/lib/libcrack.$SHLIB_SUFFIX_NAME -o -f $i/libcrack.a && CRACK_LIBDIR=$i
|
||||
done
|
||||
|
||||
for i in /usr/local/include /usr/include $PHP_CRACK $PHP_CRACK/cracklib; do
|
||||
for i in /usr/local/include /usr/include $PHP_CRACK/include $PHP_CRACK/cracklib; do
|
||||
test -f $i/packer.h && CRACK_INCLUDEDIR=$i
|
||||
done
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ ctype on integers
|
||||
--GET--
|
||||
--FILE--
|
||||
<?php
|
||||
setlocale("LC_ALL","C");
|
||||
setlocale(LC_ALL,"C");
|
||||
|
||||
function ctype_test_001($function) {
|
||||
$n=0;
|
||||
|
||||
@@ -6,7 +6,7 @@ ctype on strings
|
||||
--GET--
|
||||
--FILE--
|
||||
<?php
|
||||
setlocale("LC_ALL","C");
|
||||
setlocale(LC_ALL,"C");
|
||||
|
||||
function ctype_test_002($function) {
|
||||
$n=0; $m=0;
|
||||
|
||||
+3
-3
@@ -24,7 +24,7 @@ if test "$PHP_CURL" != "no"; then
|
||||
fi
|
||||
|
||||
CURL_CONFIG="curl-config"
|
||||
AC_MSG_CHECKING(for cURL greater than 7.7.3)
|
||||
AC_MSG_CHECKING(for cURL greater than 7.8.1)
|
||||
|
||||
if ${CURL_DIR}/bin/curl-config --libs print > /dev/null 2>&1; then
|
||||
CURL_CONFIG=${CURL_DIR}/bin/curl-config
|
||||
@@ -32,11 +32,11 @@ if test "$PHP_CURL" != "no"; then
|
||||
|
||||
curl_version_full=`$CURL_CONFIG --version`
|
||||
curl_version=`echo ${curl_version_full} | sed -e 's/libcurl //' | awk 'BEGIN { FS = "."; } { printf "%d", ($1 * 1000 + $2) * 1000 + $3;}'`
|
||||
if test "$curl_version" -ge 7007003; then
|
||||
if test "$curl_version" -ge 7008001; then
|
||||
AC_MSG_RESULT($curl_version_full)
|
||||
CURL_LIBS=`$CURL_CONFIG --libs`
|
||||
else
|
||||
AC_MSG_ERROR(cURL version 7.7.3 or later is required to compile php with cURL support)
|
||||
AC_MSG_ERROR(cURL version 7.8.1 or later is required to compile php with cURL support)
|
||||
fi
|
||||
|
||||
PHP_ADD_INCLUDE($CURL_DIR/include)
|
||||
|
||||
+240
-174
@@ -73,7 +73,7 @@ zend_module_entry curl_module_entry = {
|
||||
"curl",
|
||||
curl_functions,
|
||||
PHP_MINIT(curl),
|
||||
NULL,
|
||||
PHP_MSHUTDOWN(curl),
|
||||
NULL,
|
||||
NULL,
|
||||
PHP_MINFO(curl),
|
||||
@@ -97,152 +97,184 @@ PHP_MINFO_FUNCTION(curl)
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
#define REGISTER_CURL_CONSTANT(name, value) REGISTER_LONG_CONSTANT(name, value, CONST_CS | CONST_PERSISTENT)
|
||||
#define REGISTER_CURL_CONSTANT(__c) REGISTER_LONG_CONSTANT(#__c, __c, CONST_CS | CONST_PERSISTENT)
|
||||
|
||||
/* {{{ PHP_MINIT_FUNCTION
|
||||
*/
|
||||
PHP_MINIT_FUNCTION(curl)
|
||||
{
|
||||
int startup_options;
|
||||
|
||||
le_curl = zend_register_list_destructors_ex(_php_curl_close, NULL, "curl", module_number);
|
||||
|
||||
/* Constants for curl_setopt() */
|
||||
REGISTER_CURL_CONSTANT("CURLOPT_PORT", CURLOPT_PORT);
|
||||
REGISTER_CURL_CONSTANT("CURLOPT_FILE", CURLOPT_FILE);
|
||||
REGISTER_CURL_CONSTANT("CURLOPT_INFILE", CURLOPT_INFILE);
|
||||
REGISTER_CURL_CONSTANT("CURLOPT_INFILESIZE", CURLOPT_INFILESIZE);
|
||||
REGISTER_CURL_CONSTANT("CURLOPT_URL", CURLOPT_URL);
|
||||
REGISTER_CURL_CONSTANT("CURLOPT_PROXY", CURLOPT_PROXY);
|
||||
REGISTER_CURL_CONSTANT("CURLOPT_VERBOSE", CURLOPT_VERBOSE);
|
||||
REGISTER_CURL_CONSTANT("CURLOPT_HEADER", CURLOPT_HEADER);
|
||||
REGISTER_CURL_CONSTANT("CURLOPT_HTTPHEADER", CURLOPT_HTTPHEADER);
|
||||
REGISTER_CURL_CONSTANT("CURLOPT_NOPROGRESS", CURLOPT_NOPROGRESS);
|
||||
REGISTER_CURL_CONSTANT("CURLOPT_NOBODY", CURLOPT_NOBODY);
|
||||
REGISTER_CURL_CONSTANT("CURLOPT_FAILONERROR", CURLOPT_FAILONERROR);
|
||||
REGISTER_CURL_CONSTANT("CURLOPT_UPLOAD", CURLOPT_UPLOAD);
|
||||
REGISTER_CURL_CONSTANT("CURLOPT_POST", CURLOPT_POST);
|
||||
REGISTER_CURL_CONSTANT("CURLOPT_FTPLISTONLY", CURLOPT_FTPLISTONLY);
|
||||
REGISTER_CURL_CONSTANT("CURLOPT_FTPAPPEND", CURLOPT_FTPAPPEND);
|
||||
REGISTER_CURL_CONSTANT("CURLOPT_NETRC", CURLOPT_NETRC);
|
||||
REGISTER_CURL_CONSTANT("CURLOPT_FOLLOWLOCATION", CURLOPT_FOLLOWLOCATION);
|
||||
REGISTER_CURL_CONSTANT("CURLOPT_FTPASCII", CURLOPT_FTPASCII);
|
||||
REGISTER_CURL_CONSTANT("CURLOPT_PUT", CURLOPT_PUT);
|
||||
REGISTER_CURL_CONSTANT("CURLOPT_MUTE", CURLOPT_MUTE);
|
||||
REGISTER_CURL_CONSTANT("CURLOPT_USERPWD", CURLOPT_USERPWD);
|
||||
REGISTER_CURL_CONSTANT("CURLOPT_PROXYUSERPWD", CURLOPT_PROXYUSERPWD);
|
||||
REGISTER_CURL_CONSTANT("CURLOPT_RANGE", CURLOPT_RANGE);
|
||||
REGISTER_CURL_CONSTANT("CURLOPT_TIMEOUT", CURLOPT_TIMEOUT);
|
||||
REGISTER_CURL_CONSTANT("CURLOPT_POSTFIELDS", CURLOPT_POSTFIELDS);
|
||||
REGISTER_CURL_CONSTANT("CURLOPT_REFERER", CURLOPT_REFERER);
|
||||
REGISTER_CURL_CONSTANT("CURLOPT_USERAGENT", CURLOPT_USERAGENT);
|
||||
REGISTER_CURL_CONSTANT("CURLOPT_FTPPORT", CURLOPT_FTPPORT);
|
||||
REGISTER_CURL_CONSTANT("CURLOPT_LOW_SPEED_LIMIT", CURLOPT_LOW_SPEED_LIMIT);
|
||||
REGISTER_CURL_CONSTANT("CURLOPT_LOW_SPEED_TIME", CURLOPT_LOW_SPEED_TIME);
|
||||
REGISTER_CURL_CONSTANT("CURLOPT_RESUME_FROM", CURLOPT_RESUME_FROM);
|
||||
REGISTER_CURL_CONSTANT("CURLOPT_COOKIE", CURLOPT_COOKIE);
|
||||
REGISTER_CURL_CONSTANT("CURLOPT_SSLCERT", CURLOPT_SSLCERT);
|
||||
REGISTER_CURL_CONSTANT("CURLOPT_SSLCERTPASSWD", CURLOPT_SSLCERTPASSWD);
|
||||
REGISTER_CURL_CONSTANT("CURLOPT_WRITEHEADER", CURLOPT_WRITEHEADER);
|
||||
REGISTER_CURL_CONSTANT("CURLOPT_COOKIEFILE", CURLOPT_COOKIEFILE);
|
||||
REGISTER_CURL_CONSTANT("CURLOPT_SSLVERSION", CURLOPT_SSLVERSION);
|
||||
REGISTER_CURL_CONSTANT("CURLOPT_TIMECONDITION", CURLOPT_TIMECONDITION);
|
||||
REGISTER_CURL_CONSTANT("CURLOPT_TIMEVALUE", CURLOPT_TIMEVALUE);
|
||||
REGISTER_CURL_CONSTANT("CURLOPT_CUSTOMREQUEST", CURLOPT_CUSTOMREQUEST);
|
||||
REGISTER_CURL_CONSTANT("CURLOPT_STDERR", CURLOPT_STDERR);
|
||||
REGISTER_CURL_CONSTANT("CURLOPT_TRANSFERTEXT", CURLOPT_TRANSFERTEXT);
|
||||
REGISTER_CURL_CONSTANT("CURLOPT_RETURNTRANSFER", CURLOPT_RETURNTRANSFER);
|
||||
REGISTER_CURL_CONSTANT("CURLOPT_QUOTE", CURLOPT_QUOTE);
|
||||
REGISTER_CURL_CONSTANT("CURLOPT_POSTQUOTE", CURLOPT_POSTQUOTE);
|
||||
REGISTER_CURL_CONSTANT("CURLOPT_INTERFACE", CURLOPT_INTERFACE);
|
||||
REGISTER_CURL_CONSTANT("CURLOPT_KRB4LEVEL", CURLOPT_KRB4LEVEL);
|
||||
REGISTER_CURL_CONSTANT("CURLOPT_HTTPPROXYTUNNEL", CURLOPT_HTTPPROXYTUNNEL);
|
||||
REGISTER_CURL_CONSTANT("CURLOPT_FILETIME", CURLOPT_FILETIME);
|
||||
REGISTER_CURL_CONSTANT("CURLOPT_WRITEFUNCTION", CURLOPT_WRITEFUNCTION);
|
||||
REGISTER_CURL_CONSTANT("CURLOPT_READFUNCTION", CURLOPT_READFUNCTION);
|
||||
REGISTER_CURL_CONSTANT("CURLOPT_PASSWDFUNCTION", CURLOPT_PASSWDFUNCTION);
|
||||
REGISTER_CURL_CONSTANT("CURLOPT_HEADERFUNCTION", CURLOPT_HEADERFUNCTION);
|
||||
REGISTER_CURL_CONSTANT("CURLOPT_MAXREDIRS", CURLOPT_MAXREDIRS);
|
||||
REGISTER_CURL_CONSTANT("CURLOPT_MAXCONNECTS", CURLOPT_MAXCONNECTS);
|
||||
REGISTER_CURL_CONSTANT("CURLOPT_CLOSEPOLICY", CURLOPT_CLOSEPOLICY);
|
||||
REGISTER_CURL_CONSTANT("CURLOPT_FRESH_CONNECT", CURLOPT_FRESH_CONNECT);
|
||||
REGISTER_CURL_CONSTANT("CURLOPT_FORBID_REUSE", CURLOPT_FORBID_REUSE);
|
||||
REGISTER_CURL_CONSTANT("CURLOPT_RANDOM_FILE", CURLOPT_RANDOM_FILE);
|
||||
REGISTER_CURL_CONSTANT("CURLOPT_EGDSOCKET", CURLOPT_EGDSOCKET);
|
||||
REGISTER_CURL_CONSTANT("CURLOPT_CONNECTTIMEOUT", CURLOPT_CONNECTTIMEOUT);
|
||||
REGISTER_CURL_CONSTANT("CURLOPT_SSL_VERIFYPEER", CURLOPT_SSL_VERIFYPEER);
|
||||
REGISTER_CURL_CONSTANT("CURLOPT_CAINFO", CURLOPT_CAINFO);
|
||||
REGISTER_CURL_CONSTANT("CURLOPT_BINARYTRANSFER", CURLOPT_BINARYTRANSFER);
|
||||
REGISTER_CURL_CONSTANT(CURLOPT_PORT);
|
||||
REGISTER_CURL_CONSTANT(CURLOPT_FILE);
|
||||
REGISTER_CURL_CONSTANT(CURLOPT_INFILE);
|
||||
REGISTER_CURL_CONSTANT(CURLOPT_INFILESIZE);
|
||||
REGISTER_CURL_CONSTANT(CURLOPT_URL);
|
||||
REGISTER_CURL_CONSTANT(CURLOPT_PROXY);
|
||||
REGISTER_CURL_CONSTANT(CURLOPT_VERBOSE);
|
||||
REGISTER_CURL_CONSTANT(CURLOPT_HEADER);
|
||||
REGISTER_CURL_CONSTANT(CURLOPT_HTTPHEADER);
|
||||
REGISTER_CURL_CONSTANT(CURLOPT_NOPROGRESS);
|
||||
REGISTER_CURL_CONSTANT(CURLOPT_NOBODY);
|
||||
REGISTER_CURL_CONSTANT(CURLOPT_FAILONERROR);
|
||||
REGISTER_CURL_CONSTANT(CURLOPT_UPLOAD);
|
||||
REGISTER_CURL_CONSTANT(CURLOPT_POST);
|
||||
REGISTER_CURL_CONSTANT(CURLOPT_FTPLISTONLY);
|
||||
REGISTER_CURL_CONSTANT(CURLOPT_FTPAPPEND);
|
||||
REGISTER_CURL_CONSTANT(CURLOPT_NETRC);
|
||||
REGISTER_CURL_CONSTANT(CURLOPT_FOLLOWLOCATION);
|
||||
REGISTER_CURL_CONSTANT(CURLOPT_FTPASCII);
|
||||
REGISTER_CURL_CONSTANT(CURLOPT_PUT);
|
||||
REGISTER_CURL_CONSTANT(CURLOPT_MUTE);
|
||||
REGISTER_CURL_CONSTANT(CURLOPT_USERPWD);
|
||||
REGISTER_CURL_CONSTANT(CURLOPT_PROXYUSERPWD);
|
||||
REGISTER_CURL_CONSTANT(CURLOPT_RANGE);
|
||||
REGISTER_CURL_CONSTANT(CURLOPT_TIMEOUT);
|
||||
REGISTER_CURL_CONSTANT(CURLOPT_POSTFIELDS);
|
||||
REGISTER_CURL_CONSTANT(CURLOPT_REFERER);
|
||||
REGISTER_CURL_CONSTANT(CURLOPT_USERAGENT);
|
||||
REGISTER_CURL_CONSTANT(CURLOPT_FTPPORT);
|
||||
REGISTER_CURL_CONSTANT(CURLOPT_LOW_SPEED_LIMIT);
|
||||
REGISTER_CURL_CONSTANT(CURLOPT_LOW_SPEED_TIME);
|
||||
REGISTER_CURL_CONSTANT(CURLOPT_RESUME_FROM);
|
||||
REGISTER_CURL_CONSTANT(CURLOPT_COOKIE);
|
||||
REGISTER_CURL_CONSTANT(CURLOPT_SSLCERT);
|
||||
REGISTER_CURL_CONSTANT(CURLOPT_SSLCERTPASSWD);
|
||||
REGISTER_CURL_CONSTANT(CURLOPT_WRITEHEADER);
|
||||
REGISTER_CURL_CONSTANT(CURLOPT_SSL_VERIFYHOST);
|
||||
REGISTER_CURL_CONSTANT(CURLOPT_COOKIEFILE);
|
||||
REGISTER_CURL_CONSTANT(CURLOPT_SSLVERSION);
|
||||
REGISTER_CURL_CONSTANT(CURLOPT_TIMECONDITION);
|
||||
REGISTER_CURL_CONSTANT(CURLOPT_TIMEVALUE);
|
||||
REGISTER_CURL_CONSTANT(CURLOPT_CUSTOMREQUEST);
|
||||
REGISTER_CURL_CONSTANT(CURLOPT_STDERR);
|
||||
REGISTER_CURL_CONSTANT(CURLOPT_TRANSFERTEXT);
|
||||
REGISTER_CURL_CONSTANT(CURLOPT_RETURNTRANSFER);
|
||||
REGISTER_CURL_CONSTANT(CURLOPT_QUOTE);
|
||||
REGISTER_CURL_CONSTANT(CURLOPT_POSTQUOTE);
|
||||
REGISTER_CURL_CONSTANT(CURLOPT_INTERFACE);
|
||||
REGISTER_CURL_CONSTANT(CURLOPT_KRB4LEVEL);
|
||||
REGISTER_CURL_CONSTANT(CURLOPT_HTTPPROXYTUNNEL);
|
||||
REGISTER_CURL_CONSTANT(CURLOPT_FILETIME);
|
||||
REGISTER_CURL_CONSTANT(CURLOPT_WRITEFUNCTION);
|
||||
REGISTER_CURL_CONSTANT(CURLOPT_READFUNCTION);
|
||||
REGISTER_CURL_CONSTANT(CURLOPT_PASSWDFUNCTION);
|
||||
REGISTER_CURL_CONSTANT(CURLOPT_HEADERFUNCTION);
|
||||
REGISTER_CURL_CONSTANT(CURLOPT_MAXREDIRS);
|
||||
REGISTER_CURL_CONSTANT(CURLOPT_MAXCONNECTS);
|
||||
REGISTER_CURL_CONSTANT(CURLOPT_CLOSEPOLICY);
|
||||
REGISTER_CURL_CONSTANT(CURLOPT_FRESH_CONNECT);
|
||||
REGISTER_CURL_CONSTANT(CURLOPT_FORBID_REUSE);
|
||||
REGISTER_CURL_CONSTANT(CURLOPT_RANDOM_FILE);
|
||||
REGISTER_CURL_CONSTANT(CURLOPT_EGDSOCKET);
|
||||
REGISTER_CURL_CONSTANT(CURLOPT_CONNECTTIMEOUT);
|
||||
REGISTER_CURL_CONSTANT(CURLOPT_SSL_VERIFYPEER);
|
||||
REGISTER_CURL_CONSTANT(CURLOPT_CAINFO);
|
||||
REGISTER_CURL_CONSTANT(CURLOPT_COOKIEJAR);
|
||||
REGISTER_CURL_CONSTANT(CURLOPT_SSL_CIPHER_LIST);
|
||||
REGISTER_CURL_CONSTANT(CURLOPT_BINARYTRANSFER);
|
||||
|
||||
/* Constants effecting the way CURLOPT_CLOSEPOLICY works */
|
||||
REGISTER_CURL_CONSTANT("CURLCLOSEPOLICY_LEAST_RECENTLY_USED", CURLCLOSEPOLICY_LEAST_RECENTLY_USED);
|
||||
REGISTER_CURL_CONSTANT("CURLCLOSEPOLICY_OLDEST", CURLCLOSEPOLICY_OLDEST);
|
||||
REGISTER_CURL_CONSTANT(CURLCLOSEPOLICY_LEAST_RECENTLY_USED);
|
||||
REGISTER_CURL_CONSTANT(CURLCLOSEPOLICY_LEAST_TRAFFIC);
|
||||
REGISTER_CURL_CONSTANT(CURLCLOSEPOLICY_SLOWEST);
|
||||
REGISTER_CURL_CONSTANT(CURLCLOSEPOLICY_CALLBACK);
|
||||
REGISTER_CURL_CONSTANT(CURLCLOSEPOLICY_OLDEST);
|
||||
|
||||
/* Info constants */
|
||||
REGISTER_CURL_CONSTANT("CURLINFO_EFFECTIVE_URL", CURLINFO_EFFECTIVE_URL);
|
||||
REGISTER_CURL_CONSTANT("CURLINFO_HTTP_CODE", CURLINFO_HTTP_CODE);
|
||||
REGISTER_CURL_CONSTANT("CURLINFO_HEADER_SIZE", CURLINFO_HEADER_SIZE);
|
||||
REGISTER_CURL_CONSTANT("CURLINFO_REQUEST_SIZE", CURLINFO_REQUEST_SIZE);
|
||||
REGISTER_CURL_CONSTANT("CURLINFO_TOTAL_TIME", CURLINFO_TOTAL_TIME);
|
||||
REGISTER_CURL_CONSTANT("CURLINFO_NAMELOOKUP_TIME", CURLINFO_NAMELOOKUP_TIME);
|
||||
REGISTER_CURL_CONSTANT("CURLINFO_CONNECT_TIME", CURLINFO_CONNECT_TIME);
|
||||
REGISTER_CURL_CONSTANT("CURLINFO_PRETRANSFER_TIME", CURLINFO_PRETRANSFER_TIME);
|
||||
REGISTER_CURL_CONSTANT("CURLINFO_SIZE_UPLOAD", CURLINFO_SIZE_UPLOAD);
|
||||
REGISTER_CURL_CONSTANT("CURLINFO_SIZE_DOWNLOAD", CURLINFO_SIZE_DOWNLOAD);
|
||||
REGISTER_CURL_CONSTANT("CURLINFO_SPEED_DOWNLOAD", CURLINFO_SPEED_DOWNLOAD);
|
||||
REGISTER_CURL_CONSTANT("CURLINFO_SPEED_UPLOAD", CURLINFO_SPEED_UPLOAD);
|
||||
REGISTER_CURL_CONSTANT("CURLINFO_FILETIME", CURLINFO_FILETIME);
|
||||
REGISTER_CURL_CONSTANT(CURLINFO_EFFECTIVE_URL);
|
||||
REGISTER_CURL_CONSTANT(CURLINFO_HTTP_CODE);
|
||||
REGISTER_CURL_CONSTANT(CURLINFO_HEADER_SIZE);
|
||||
REGISTER_CURL_CONSTANT(CURLINFO_REQUEST_SIZE);
|
||||
REGISTER_CURL_CONSTANT(CURLINFO_TOTAL_TIME);
|
||||
REGISTER_CURL_CONSTANT(CURLINFO_NAMELOOKUP_TIME);
|
||||
REGISTER_CURL_CONSTANT(CURLINFO_CONNECT_TIME);
|
||||
REGISTER_CURL_CONSTANT(CURLINFO_PRETRANSFER_TIME);
|
||||
REGISTER_CURL_CONSTANT(CURLINFO_SIZE_UPLOAD);
|
||||
REGISTER_CURL_CONSTANT(CURLINFO_SIZE_DOWNLOAD);
|
||||
REGISTER_CURL_CONSTANT(CURLINFO_SPEED_DOWNLOAD);
|
||||
REGISTER_CURL_CONSTANT(CURLINFO_SPEED_UPLOAD);
|
||||
REGISTER_CURL_CONSTANT(CURLINFO_FILETIME);
|
||||
REGISTER_CURL_CONSTANT(CURLINFO_SSL_VERIFYRESULT);
|
||||
REGISTER_CURL_CONSTANT(CURLINFO_CONTENT_LENGTH_DOWNLOAD);
|
||||
REGISTER_CURL_CONSTANT(CURLINFO_CONTENT_LENGTH_UPLOAD);
|
||||
|
||||
/* Error Constants */
|
||||
REGISTER_CURL_CONSTANT("CURLE_OK", CURLE_OK);
|
||||
REGISTER_CURL_CONSTANT("CURLE_UNSUPPORTED_PROTOCOL", CURLE_UNSUPPORTED_PROTOCOL);
|
||||
REGISTER_CURL_CONSTANT("CURLE_FAILED_INIT", CURLE_FAILED_INIT);
|
||||
REGISTER_CURL_CONSTANT("CURLE_URL_MALFORMAT", CURLE_URL_MALFORMAT);
|
||||
REGISTER_CURL_CONSTANT("CURLE_URL_MALFORMAT_USER", CURLE_URL_MALFORMAT_USER);
|
||||
REGISTER_CURL_CONSTANT("CURLE_COULDNT_RESOLVE_PROXY", CURLE_COULDNT_RESOLVE_PROXY);
|
||||
REGISTER_CURL_CONSTANT("CURLE_COULDNT_RESOLVE_HOST", CURLE_COULDNT_RESOLVE_HOST);
|
||||
REGISTER_CURL_CONSTANT("CURLE_COULDNT_CONNECT", CURLE_COULDNT_CONNECT);
|
||||
REGISTER_CURL_CONSTANT("CURLE_FTP_WEIRD_SERVER_REPLY", CURLE_FTP_WEIRD_SERVER_REPLY);
|
||||
REGISTER_CURL_CONSTANT("CURLE_FTP_ACCESS_DENIED", CURLE_FTP_ACCESS_DENIED);
|
||||
REGISTER_CURL_CONSTANT("CURLE_FTP_USER_PASSWORD_INCORRECT", CURLE_FTP_USER_PASSWORD_INCORRECT);
|
||||
REGISTER_CURL_CONSTANT("CURLE_FTP_WEIRD_PASS_REPLY", CURLE_FTP_WEIRD_PASS_REPLY);
|
||||
REGISTER_CURL_CONSTANT("CURLE_FTP_WEIRD_USER_REPLY", CURLE_FTP_WEIRD_USER_REPLY);
|
||||
REGISTER_CURL_CONSTANT("CURLE_FTP_WEIRD_PASV_REPLY", CURLE_FTP_WEIRD_PASV_REPLY);
|
||||
REGISTER_CURL_CONSTANT("CURLE_FTP_WEIRD_227_FORMAT", CURLE_FTP_WEIRD_227_FORMAT);
|
||||
REGISTER_CURL_CONSTANT("CURLE_FTP_CANT_GET_HOST", CURLE_FTP_CANT_GET_HOST);
|
||||
REGISTER_CURL_CONSTANT("CURLE_FTP_CANT_RECONNECT", CURLE_FTP_CANT_RECONNECT);
|
||||
REGISTER_CURL_CONSTANT("CURLE_FTP_COULDNT_SET_BINARY", CURLE_FTP_COULDNT_SET_BINARY);
|
||||
REGISTER_CURL_CONSTANT("CURLE_PARTIAL_FILE", CURLE_PARTIAL_FILE);
|
||||
REGISTER_CURL_CONSTANT("CURLE_FTP_COULDNT_RETR_FILE", CURLE_FTP_COULDNT_RETR_FILE);
|
||||
REGISTER_CURL_CONSTANT("CURLE_FTP_WRITE_ERROR", CURLE_FTP_WRITE_ERROR);
|
||||
REGISTER_CURL_CONSTANT("CURLE_FTP_QUOTE_ERROR", CURLE_FTP_QUOTE_ERROR);
|
||||
REGISTER_CURL_CONSTANT("CURLE_HTTP_NOT_FOUND", CURLE_HTTP_NOT_FOUND);
|
||||
REGISTER_CURL_CONSTANT("CURLE_WRITE_ERROR", CURLE_WRITE_ERROR);
|
||||
REGISTER_CURL_CONSTANT("CURLE_MALFORMAT_USER", CURLE_MALFORMAT_USER);
|
||||
REGISTER_CURL_CONSTANT("CURLE_FTP_COULDNT_STOR_FILE", CURLE_FTP_COULDNT_STOR_FILE);
|
||||
REGISTER_CURL_CONSTANT("CURLE_READ_ERROR", CURLE_READ_ERROR);
|
||||
REGISTER_CURL_CONSTANT("CURLE_OUT_OF_MEMORY", CURLE_OUT_OF_MEMORY);
|
||||
REGISTER_CURL_CONSTANT("CURLE_OPERATION_TIMEOUTED", CURLE_OPERATION_TIMEOUTED);
|
||||
REGISTER_CURL_CONSTANT("CURLE_FTP_COULDNT_SET_ASCII", CURLE_FTP_COULDNT_SET_ASCII);
|
||||
REGISTER_CURL_CONSTANT("CURLE_FTP_PORT_FAILED", CURLE_FTP_PORT_FAILED);
|
||||
REGISTER_CURL_CONSTANT("CURLE_FTP_COULDNT_USE_REST", CURLE_FTP_COULDNT_USE_REST);
|
||||
REGISTER_CURL_CONSTANT("CURLE_FTP_COULDNT_GET_SIZE", CURLE_FTP_COULDNT_GET_SIZE);
|
||||
REGISTER_CURL_CONSTANT("CURLE_HTTP_RANGE_ERROR", CURLE_HTTP_RANGE_ERROR);
|
||||
REGISTER_CURL_CONSTANT("CURLE_HTTP_POST_ERROR", CURLE_HTTP_POST_ERROR);
|
||||
REGISTER_CURL_CONSTANT("CURLE_SSL_CONNECT_ERROR", CURLE_SSL_CONNECT_ERROR);
|
||||
REGISTER_CURL_CONSTANT("CURLE_FTP_BAD_DOWNLOAD_RESUME", CURLE_FTP_BAD_DOWNLOAD_RESUME);
|
||||
REGISTER_CURL_CONSTANT("CURLE_FILE_COULDNT_READ_FILE", CURLE_FILE_COULDNT_READ_FILE);
|
||||
REGISTER_CURL_CONSTANT("CURLE_LDAP_CANNOT_BIND", CURLE_LDAP_CANNOT_BIND);
|
||||
REGISTER_CURL_CONSTANT("CURLE_LDAP_SEARCH_FAILED", CURLE_LDAP_SEARCH_FAILED);
|
||||
REGISTER_CURL_CONSTANT("CURLE_LIBRARY_NOT_FOUND", CURLE_LIBRARY_NOT_FOUND);
|
||||
REGISTER_CURL_CONSTANT("CURLE_FUNCTION_NOT_FOUND", CURLE_FUNCTION_NOT_FOUND);
|
||||
REGISTER_CURL_CONSTANT("CURLE_ABORTED_BY_CALLBACK", CURLE_ABORTED_BY_CALLBACK);
|
||||
REGISTER_CURL_CONSTANT("CURLE_BAD_FUNCTION_ARGUMENT", CURLE_BAD_FUNCTION_ARGUMENT);
|
||||
REGISTER_CURL_CONSTANT("CURLE_BAD_CALLING_ORDER", CURLE_BAD_CALLING_ORDER);
|
||||
REGISTER_CURL_CONSTANT("CURLE_HTTP_PORT_FAILED", CURLE_HTTP_PORT_FAILED);
|
||||
REGISTER_CURL_CONSTANT("CURLE_BAD_PASSWORD_ENTERED", CURLE_BAD_PASSWORD_ENTERED);
|
||||
REGISTER_CURL_CONSTANT("CURLE_TOO_MANY_REDIRECTS", CURLE_TOO_MANY_REDIRECTS);
|
||||
REGISTER_CURL_CONSTANT("CURLE_UNKOWN_TELNET_OPTION", CURLE_UNKNOWN_TELNET_OPTION);
|
||||
REGISTER_CURL_CONSTANT("CURLE_TELNET_OPTION_SYNTAX", CURLE_TELNET_OPTION_SYNTAX);
|
||||
REGISTER_CURL_CONSTANT("CURLE_ALREADY_COMPLETE", CURLE_ALREADY_COMPLETE);
|
||||
REGISTER_CURL_CONSTANT(CURLE_OK);
|
||||
REGISTER_CURL_CONSTANT(CURLE_UNSUPPORTED_PROTOCOL);
|
||||
REGISTER_CURL_CONSTANT(CURLE_FAILED_INIT);
|
||||
REGISTER_CURL_CONSTANT(CURLE_URL_MALFORMAT);
|
||||
REGISTER_CURL_CONSTANT(CURLE_URL_MALFORMAT_USER);
|
||||
REGISTER_CURL_CONSTANT(CURLE_COULDNT_RESOLVE_PROXY);
|
||||
REGISTER_CURL_CONSTANT(CURLE_COULDNT_RESOLVE_HOST);
|
||||
REGISTER_CURL_CONSTANT(CURLE_COULDNT_CONNECT);
|
||||
REGISTER_CURL_CONSTANT(CURLE_FTP_WEIRD_SERVER_REPLY);
|
||||
REGISTER_CURL_CONSTANT(CURLE_FTP_ACCESS_DENIED);
|
||||
REGISTER_CURL_CONSTANT(CURLE_FTP_USER_PASSWORD_INCORRECT);
|
||||
REGISTER_CURL_CONSTANT(CURLE_FTP_WEIRD_PASS_REPLY);
|
||||
REGISTER_CURL_CONSTANT(CURLE_FTP_WEIRD_USER_REPLY);
|
||||
REGISTER_CURL_CONSTANT(CURLE_FTP_WEIRD_PASV_REPLY);
|
||||
REGISTER_CURL_CONSTANT(CURLE_FTP_WEIRD_227_FORMAT);
|
||||
REGISTER_CURL_CONSTANT(CURLE_FTP_CANT_GET_HOST);
|
||||
REGISTER_CURL_CONSTANT(CURLE_FTP_CANT_RECONNECT);
|
||||
REGISTER_CURL_CONSTANT(CURLE_FTP_COULDNT_SET_BINARY);
|
||||
REGISTER_CURL_CONSTANT(CURLE_PARTIAL_FILE);
|
||||
REGISTER_CURL_CONSTANT(CURLE_FTP_COULDNT_RETR_FILE);
|
||||
REGISTER_CURL_CONSTANT(CURLE_FTP_WRITE_ERROR);
|
||||
REGISTER_CURL_CONSTANT(CURLE_FTP_QUOTE_ERROR);
|
||||
REGISTER_CURL_CONSTANT(CURLE_HTTP_NOT_FOUND);
|
||||
REGISTER_CURL_CONSTANT(CURLE_WRITE_ERROR);
|
||||
REGISTER_CURL_CONSTANT(CURLE_MALFORMAT_USER);
|
||||
REGISTER_CURL_CONSTANT(CURLE_FTP_COULDNT_STOR_FILE);
|
||||
REGISTER_CURL_CONSTANT(CURLE_READ_ERROR);
|
||||
REGISTER_CURL_CONSTANT(CURLE_OUT_OF_MEMORY);
|
||||
REGISTER_CURL_CONSTANT(CURLE_OPERATION_TIMEOUTED);
|
||||
REGISTER_CURL_CONSTANT(CURLE_FTP_COULDNT_SET_ASCII);
|
||||
REGISTER_CURL_CONSTANT(CURLE_FTP_PORT_FAILED);
|
||||
REGISTER_CURL_CONSTANT(CURLE_FTP_COULDNT_USE_REST);
|
||||
REGISTER_CURL_CONSTANT(CURLE_FTP_COULDNT_GET_SIZE);
|
||||
REGISTER_CURL_CONSTANT(CURLE_HTTP_RANGE_ERROR);
|
||||
REGISTER_CURL_CONSTANT(CURLE_HTTP_POST_ERROR);
|
||||
REGISTER_CURL_CONSTANT(CURLE_SSL_CONNECT_ERROR);
|
||||
REGISTER_CURL_CONSTANT(CURLE_FTP_BAD_DOWNLOAD_RESUME);
|
||||
REGISTER_CURL_CONSTANT(CURLE_FILE_COULDNT_READ_FILE);
|
||||
REGISTER_CURL_CONSTANT(CURLE_LDAP_CANNOT_BIND);
|
||||
REGISTER_CURL_CONSTANT(CURLE_LDAP_SEARCH_FAILED);
|
||||
REGISTER_CURL_CONSTANT(CURLE_LIBRARY_NOT_FOUND);
|
||||
REGISTER_CURL_CONSTANT(CURLE_FUNCTION_NOT_FOUND);
|
||||
REGISTER_CURL_CONSTANT(CURLE_ABORTED_BY_CALLBACK);
|
||||
REGISTER_CURL_CONSTANT(CURLE_BAD_FUNCTION_ARGUMENT);
|
||||
REGISTER_CURL_CONSTANT(CURLE_BAD_CALLING_ORDER);
|
||||
REGISTER_CURL_CONSTANT(CURLE_HTTP_PORT_FAILED);
|
||||
REGISTER_CURL_CONSTANT(CURLE_BAD_PASSWORD_ENTERED);
|
||||
REGISTER_CURL_CONSTANT(CURLE_TOO_MANY_REDIRECTS);
|
||||
REGISTER_CURL_CONSTANT(CURLE_UNKNOWN_TELNET_OPTION);
|
||||
REGISTER_CURL_CONSTANT(CURLE_TELNET_OPTION_SYNTAX);
|
||||
REGISTER_CURL_CONSTANT(CURLE_OBSOLETE);
|
||||
REGISTER_CURL_CONSTANT(CURLE_SSL_PEER_CERTIFICATE);
|
||||
|
||||
#if HAVE_OPENSSL_EXT /* OpenSSL already takes care of initialization */
|
||||
startup_options = CURL_GLOBAL_NOTHING;
|
||||
#else
|
||||
startup_options = CURL_GLOBAL_ALL;
|
||||
#endif
|
||||
|
||||
if (curl_global_init(startup_options) != CURLE_OK) {
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ PHP_MSHUTDOWN_FUNCTION
|
||||
*/
|
||||
PHP_MSHUTDOWN_FUNCTION(curl)
|
||||
{
|
||||
curl_global_cleanup();
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
@@ -279,6 +311,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]);
|
||||
@@ -293,7 +326,7 @@ static size_t curl_write(char *data, size_t size, size_t nmemb, void *ctx)
|
||||
t->func,
|
||||
retval, 2, argv TSRMLS_CC);
|
||||
if (error == FAILURE) {
|
||||
php_error(E_WARNING, "Cannot call the CURLOPT_WRITEFUNCTION");
|
||||
php_error(E_WARNING, "Couldn't call the CURLOPT_WRITEFUNCTION");
|
||||
length = -1;
|
||||
}
|
||||
else {
|
||||
@@ -319,7 +352,6 @@ static size_t curl_read(char *data, size_t size, size_t nmemb, void *ctx)
|
||||
php_curl *ch = (php_curl *) ctx;
|
||||
php_curl_read *t = ch->handlers->read;
|
||||
int length = -1;
|
||||
TSRMLS_FETCH();
|
||||
|
||||
switch (t->method) {
|
||||
case PHP_CURL_DIRECT:
|
||||
@@ -330,6 +362,7 @@ static size_t curl_read(char *data, size_t size, size_t nmemb, void *ctx)
|
||||
zval *retval;
|
||||
int length;
|
||||
int error;
|
||||
TSRMLS_FETCH();
|
||||
|
||||
MAKE_STD_ZVAL(argv[0]);
|
||||
MAKE_STD_ZVAL(argv[1]);
|
||||
@@ -395,6 +428,7 @@ static size_t curl_write_header(char *data, size_t size, size_t nmemb, void *ctx
|
||||
case PHP_CURL_USER: {
|
||||
zval *argv[2];
|
||||
zval *retval;
|
||||
TSRMLS_FETCH();
|
||||
|
||||
MAKE_STD_ZVAL(argv[0]);
|
||||
MAKE_STD_ZVAL(argv[1]);
|
||||
@@ -437,7 +471,7 @@ static size_t curl_passwd(void *ctx, char *prompt, char *buf, int buflen)
|
||||
php_curl *ch = (php_curl *) ctx;
|
||||
zval *func = ch->handlers->passwd;
|
||||
zval *argv[3];
|
||||
zval *retval;
|
||||
zval *retval = NULL;
|
||||
int error;
|
||||
int ret = 0;
|
||||
TSRMLS_FETCH();
|
||||
@@ -523,6 +557,7 @@ static void alloc_curl_handle(php_curl **ch)
|
||||
(*ch)->handlers->write = ecalloc(1, sizeof(php_curl_write));
|
||||
(*ch)->handlers->write_header = ecalloc(1, sizeof(php_curl_write));
|
||||
(*ch)->handlers->read = ecalloc(1, sizeof(php_curl_read));
|
||||
(*ch)->performed = 0;
|
||||
memset(&(*ch)->err, 0, sizeof((*ch)->err));
|
||||
|
||||
zend_llist_init(&(*ch)->to_free.str, sizeof(char *),
|
||||
@@ -633,6 +668,7 @@ PHP_FUNCTION(curl_setopt)
|
||||
case CURLOPT_FRESH_CONNECT:
|
||||
case CURLOPT_FORBID_REUSE:
|
||||
case CURLOPT_CONNECTTIMEOUT:
|
||||
case CURLOPT_SSL_VERIFYHOST:
|
||||
case CURLOPT_SSL_VERIFYPEER:
|
||||
convert_to_long_ex(zvalue);
|
||||
error = curl_easy_setopt(ch->cp, option, Z_LVAL_PP(zvalue));
|
||||
@@ -654,7 +690,9 @@ PHP_FUNCTION(curl_setopt)
|
||||
case CURLOPT_KRB4LEVEL:
|
||||
case CURLOPT_RANDOM_FILE:
|
||||
case CURLOPT_EGDSOCKET:
|
||||
case CURLOPT_CAINFO: {
|
||||
case CURLOPT_CAINFO:
|
||||
case CURLOPT_COOKIEJAR:
|
||||
case CURLOPT_SSL_CIPHER_LIST: {
|
||||
char *copystr = NULL;
|
||||
|
||||
convert_to_string_ex(zvalue);
|
||||
@@ -669,9 +707,12 @@ PHP_FUNCTION(curl_setopt)
|
||||
case CURLOPT_INFILE:
|
||||
case CURLOPT_WRITEHEADER:
|
||||
case CURLOPT_STDERR: {
|
||||
FILE *fp;
|
||||
FILE *fp = NULL;
|
||||
ZEND_FETCH_RESOURCE(fp, FILE *, zvalue, -1, "File-Handle", php_file_le_fopen());
|
||||
|
||||
if (!fp) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
error = CURLE_OK;
|
||||
switch (option) {
|
||||
case CURLOPT_FILE:
|
||||
@@ -732,7 +773,11 @@ PHP_FUNCTION(curl_setopt)
|
||||
HashTable *postfields;
|
||||
struct HttpPost *first = NULL;
|
||||
struct HttpPost *last = NULL;
|
||||
|
||||
char *postval;
|
||||
char *string_key = NULL;
|
||||
ulong num_key;
|
||||
uint string_key_len;
|
||||
|
||||
postfields = HASH_OF(*zvalue);
|
||||
if (! postfields) {
|
||||
php_error(E_WARNING, "Couldn't get HashTable in CURLOPT_POSTFIELDS");
|
||||
@@ -742,19 +787,20 @@ PHP_FUNCTION(curl_setopt)
|
||||
for (zend_hash_internal_pointer_reset(postfields);
|
||||
zend_hash_get_current_data(postfields, (void **) ¤t) == SUCCESS;
|
||||
zend_hash_move_forward(postfields)) {
|
||||
char *string_key = NULL;
|
||||
char *postval = NULL;
|
||||
ulong num_key;
|
||||
|
||||
SEPARATE_ZVAL(current);
|
||||
convert_to_string_ex(current);
|
||||
|
||||
zend_hash_get_current_key(postfields, &string_key, &num_key, 0);
|
||||
|
||||
postval = emalloc(strlen(string_key) + Z_STRLEN_PP(current) + 1);
|
||||
sprintf(postval, "%s=%s", string_key, Z_STRVAL_PP(current));
|
||||
|
||||
error = curl_formparse(postval, &first, &last);
|
||||
zend_hash_get_current_key_ex(postfields, &string_key, &string_key_len, &num_key, 0, NULL);
|
||||
postval = Z_STRVAL_PP(current);
|
||||
if (*postval == '@') {
|
||||
error = curl_formadd(&first, &last, CURLFORM_COPYNAME, string_key,
|
||||
CURLFORM_FILE, ++postval, CURLFORM_END);
|
||||
}
|
||||
else {
|
||||
error = curl_formadd(&first, &last, CURLFORM_COPYNAME, string_key,
|
||||
CURLFORM_PTRCONTENTS, postval, CURLFORM_END);
|
||||
}
|
||||
}
|
||||
|
||||
if (error != CURLE_OK) {
|
||||
@@ -781,26 +827,26 @@ PHP_FUNCTION(curl_setopt)
|
||||
case CURLOPT_QUOTE:
|
||||
case CURLOPT_POSTQUOTE: {
|
||||
zval **current;
|
||||
HashTable *hash;
|
||||
HashTable *ph;
|
||||
struct curl_slist *slist = NULL;
|
||||
|
||||
hash = HASH_OF(*zvalue);
|
||||
if (! hash) {
|
||||
ph = HASH_OF(*zvalue);
|
||||
if (! ph) {
|
||||
php_error(E_WARNING,
|
||||
"You must pass either an object or an array with the CURLOPT_HTTPHEADER, CURLOPT_QUOTE and CURLOPT_POSTQUOTE arguments");
|
||||
"You must pass either an object or an array with the CURLOPT_HTTPHEADER,"
|
||||
"CURLOPT_QUOTE and CURLOPT_POSTQUOTE arguments");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
for (zend_hash_internal_pointer_reset(hash);
|
||||
zend_hash_get_current_data(hash, (void **) ¤t) == SUCCESS;
|
||||
zend_hash_move_forward(hash)) {
|
||||
for (zend_hash_internal_pointer_reset(ph);
|
||||
zend_hash_get_current_data(ph, (void **) ¤t) == SUCCESS;
|
||||
zend_hash_move_forward(ph)) {
|
||||
char *indiv = NULL;
|
||||
|
||||
SEPARATE_ZVAL(current);
|
||||
convert_to_string_ex(current);
|
||||
|
||||
indiv = estrndup(Z_STRVAL_PP(current), Z_STRLEN_PP(current) + 1);
|
||||
indiv[Z_STRLEN_PP(current)] = '\0';
|
||||
slist = curl_slist_append(slist, indiv);
|
||||
if (! slist) {
|
||||
efree(indiv);
|
||||
@@ -840,6 +886,11 @@ PHP_FUNCTION(curl_exec)
|
||||
}
|
||||
ZEND_FETCH_RESOURCE(ch, php_curl *, zid, -1, le_curl_name, le_curl);
|
||||
|
||||
if (ch->performed) {
|
||||
php_error(E_WARNING, "Multiple executions on the same handle are not currently supported, please upgrade to the next version of PHP");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
error = curl_easy_perform(ch->cp);
|
||||
if (error != CURLE_OK) {
|
||||
if (ch->handlers->write->buf.c)
|
||||
@@ -848,6 +899,8 @@ PHP_FUNCTION(curl_exec)
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
ch->performed = 1;
|
||||
|
||||
if (ch->handlers->write->method == PHP_CURL_RETURN) {
|
||||
if (ch->handlers->write->type != PHP_CURL_BINARY)
|
||||
smart_str_0(&ch->handlers->write->buf);
|
||||
@@ -858,6 +911,10 @@ PHP_FUNCTION(curl_exec)
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
#define CAAL(s, v) add_assoc_long_ex(return_value, s, sizeof(s), v);
|
||||
#define CAAD(s, v) add_assoc_double_ex(return_value, s, sizeof(s), v);
|
||||
#define CAAS(s, v) add_assoc_string_ex(return_value, s, sizeof(s), v, 1);
|
||||
|
||||
/* {{{ proto string curl_getinfo(int ch, int opt)
|
||||
Get information regarding a specific transfer */
|
||||
PHP_FUNCTION(curl_getinfo)
|
||||
@@ -882,31 +939,37 @@ PHP_FUNCTION(curl_getinfo)
|
||||
array_init(return_value);
|
||||
|
||||
curl_easy_getinfo(ch->cp, CURLINFO_EFFECTIVE_URL, &url);
|
||||
add_assoc_string(return_value, "url", url, 1);
|
||||
CAAS("url", url);
|
||||
curl_easy_getinfo(ch->cp, CURLINFO_HTTP_CODE, &l_code);
|
||||
add_assoc_long(return_value, "http_code", l_code);
|
||||
CAAL("http_code", l_code);
|
||||
curl_easy_getinfo(ch->cp, CURLINFO_HEADER_SIZE, &l_code);
|
||||
add_assoc_long(return_value, "header_size", l_code);
|
||||
CAAL("header_size", l_code);
|
||||
curl_easy_getinfo(ch->cp, CURLINFO_REQUEST_SIZE, &l_code);
|
||||
add_assoc_long(return_value, "request_size", l_code);
|
||||
CAAL("request_size", l_code);
|
||||
curl_easy_getinfo(ch->cp, CURLINFO_FILETIME, &l_code);
|
||||
add_assoc_long(return_value, "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_TOTAL_TIME, &d_code);
|
||||
add_assoc_double(return_value, "total_time", d_code);
|
||||
CAAD("total_time", d_code);
|
||||
curl_easy_getinfo(ch->cp, CURLINFO_NAMELOOKUP_TIME, &d_code);
|
||||
add_assoc_double(return_value, "namelookup_time", d_code);
|
||||
CAAD("namelookup_time", d_code);
|
||||
curl_easy_getinfo(ch->cp, CURLINFO_CONNECT_TIME, &d_code);
|
||||
add_assoc_double(return_value, "connect_time", d_code);
|
||||
CAAD("connect_time", d_code);
|
||||
curl_easy_getinfo(ch->cp, CURLINFO_PRETRANSFER_TIME, &d_code);
|
||||
add_assoc_double(return_value, "pretransfer_time", d_code);
|
||||
CAAD("pretransfer_time", d_code);
|
||||
curl_easy_getinfo(ch->cp, CURLINFO_SIZE_UPLOAD, &d_code);
|
||||
add_assoc_double(return_value, "size_upload", d_code);
|
||||
CAAD("size_upload", d_code);
|
||||
curl_easy_getinfo(ch->cp, CURLINFO_SIZE_DOWNLOAD, &d_code);
|
||||
add_assoc_double(return_value, "size_download", d_code);
|
||||
CAAD("size_download", d_code);
|
||||
curl_easy_getinfo(ch->cp, CURLINFO_SPEED_DOWNLOAD, &d_code);
|
||||
add_assoc_double(return_value, "speed_download", d_code);
|
||||
CAAD("speed_download", d_code);
|
||||
curl_easy_getinfo(ch->cp, CURLINFO_SPEED_UPLOAD, &d_code);
|
||||
add_assoc_double(return_value, "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);
|
||||
} else {
|
||||
option = Z_LVAL_PP(zoption);
|
||||
switch (option) {
|
||||
@@ -921,7 +984,8 @@ PHP_FUNCTION(curl_getinfo)
|
||||
case CURLINFO_HTTP_CODE:
|
||||
case CURLINFO_HEADER_SIZE:
|
||||
case CURLINFO_REQUEST_SIZE:
|
||||
case CURLINFO_FILETIME: {
|
||||
case CURLINFO_FILETIME:
|
||||
case CURLINFO_SSL_VERIFYRESULT: {
|
||||
long code;
|
||||
|
||||
curl_easy_getinfo(ch->cp, option, &code);
|
||||
@@ -936,7 +1000,9 @@ PHP_FUNCTION(curl_getinfo)
|
||||
case CURLINFO_SIZE_UPLOAD:
|
||||
case CURLINFO_SIZE_DOWNLOAD:
|
||||
case CURLINFO_SPEED_DOWNLOAD:
|
||||
case CURLINFO_SPEED_UPLOAD: {
|
||||
case CURLINFO_SPEED_UPLOAD:
|
||||
case CURLINFO_CONTENT_LENGTH_DOWNLOAD:
|
||||
case CURLINFO_CONTENT_LENGTH_UPLOAD: {
|
||||
double code;
|
||||
|
||||
curl_easy_getinfo(ch->cp, option, &code);
|
||||
@@ -1032,6 +1098,6 @@ static void _php_curl_close(zend_rsrc_list_entry *rsrc TSRMLS_DC)
|
||||
* tab-width: 4
|
||||
* c-basic-offset: 4
|
||||
* End:
|
||||
* vim600: sw=4 ts=4 tw=78 fdm=marker
|
||||
* vim<600: sw=4 ts=4 tw=78
|
||||
* vim600: noet sw=4 ts=4 fdm=marker
|
||||
* vim<600: noet sw=4 ts=4
|
||||
*/
|
||||
@@ -41,6 +41,7 @@ extern zend_module_entry curl_module_entry;
|
||||
#define CURLOPT_BINARYTRANSFER 19914
|
||||
|
||||
PHP_MINIT_FUNCTION(curl);
|
||||
PHP_MSHUTDOWN_FUNCTION(curl);
|
||||
PHP_MINFO_FUNCTION(curl);
|
||||
PHP_FUNCTION(curl_version);
|
||||
PHP_FUNCTION(curl_init);
|
||||
@@ -90,6 +91,7 @@ typedef struct {
|
||||
struct _php_curl_error err;
|
||||
struct _php_curl_free to_free;
|
||||
long id;
|
||||
int performed;
|
||||
} php_curl;
|
||||
|
||||
|
||||
|
||||
+24
-2
@@ -431,6 +431,8 @@ PHP_FUNCTION(dbase_get_record)
|
||||
dbfield_t *dbf, *cur_f;
|
||||
char *data, *fnp, *str_value;
|
||||
size_t cursize = 0;
|
||||
long overflow_test;
|
||||
int errno_save;
|
||||
DBase_TLS_VARS;
|
||||
|
||||
if (ZEND_NUM_ARGS() != 2 || getParameters(ht, 2, &dbh_id, &record)==FAILURE) {
|
||||
@@ -475,7 +477,16 @@ PHP_FUNCTION(dbase_get_record)
|
||||
break;
|
||||
case 'N':
|
||||
if (cur_f->db_fdc == 0) {
|
||||
add_next_index_long(return_value, strtol(str_value, NULL, 10));
|
||||
/* Large integers in dbase can be larger than long */
|
||||
errno_save = errno;
|
||||
overflow_test = strtol(str_value, NULL, 10);
|
||||
if (errno == ERANGE) {
|
||||
/* If the integer is too large, keep it as string */
|
||||
add_next_index_string(return_value, str_value, 1);
|
||||
} else {
|
||||
add_next_index_long(return_value, overflow_test);
|
||||
}
|
||||
errno = errno_save;
|
||||
} else {
|
||||
add_next_index_double(return_value, atof(str_value));
|
||||
}
|
||||
@@ -527,6 +538,8 @@ PHP_FUNCTION(dbase_get_record_with_names)
|
||||
int dbh_type;
|
||||
dbfield_t *dbf, *cur_f;
|
||||
char *data, *fnp, *str_value;
|
||||
long overflow_test;
|
||||
int errno_save;
|
||||
DBase_TLS_VARS;
|
||||
|
||||
if (ZEND_NUM_ARGS() != 2 || getParameters(ht, 2, &dbh_id, &record)==FAILURE) {
|
||||
@@ -566,7 +579,16 @@ PHP_FUNCTION(dbase_get_record_with_names)
|
||||
break;
|
||||
case 'N':
|
||||
if (cur_f->db_fdc == 0) {
|
||||
add_assoc_long(return_value, cur_f->db_fname, strtol(str_value, NULL, 10));
|
||||
/* Large integers in dbase can be larger than long */
|
||||
errno_save = errno;
|
||||
overflow_test = strtol(str_value, NULL, 10);
|
||||
if (errno == ERANGE) {
|
||||
/* If the integer is too large, keep it as string */
|
||||
add_assoc_string(return_value, cur_f->db_fname, str_value, 1);
|
||||
} else {
|
||||
add_assoc_long(return_value, cur_f->db_fname, overflow_test);
|
||||
}
|
||||
errno = errno_save;
|
||||
} else {
|
||||
add_assoc_double(return_value, cur_f->db_fname, atof(str_value));
|
||||
}
|
||||
|
||||
+646
-558
File diff suppressed because it is too large.
Load diff
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| PHP version 4.0 |
|
||||
| PHP Version 4 |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1997-2001 The PHP Group |
|
||||
| Copyright (c) 1997-2002 The PHP Group |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.02 of the PHP license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
@@ -52,6 +52,8 @@ PHP_FUNCTION(domxml_doc_create_text_node);
|
||||
PHP_FUNCTION(domxml_doc_create_comment);
|
||||
PHP_FUNCTION(domxml_doc_create_processing_instruction);
|
||||
PHP_FUNCTION(domxml_doc_create_attribute);
|
||||
PHP_FUNCTION(domxml_doc_create_cdata_section);
|
||||
PHP_FUNCTION(domxml_doc_create_entity_reference);
|
||||
PHP_FUNCTION(domxml_doc_imported_node);
|
||||
PHP_FUNCTION(domxml_add_root);
|
||||
PHP_FUNCTION(domxml_intdtd);
|
||||
@@ -85,13 +87,16 @@ PHP_FUNCTION(domxml_node_has_child_nodes);
|
||||
PHP_FUNCTION(domxml_node_parent);
|
||||
PHP_FUNCTION(domxml_node_prefix);
|
||||
PHP_FUNCTION(domxml_node);
|
||||
PHP_FUNCTION(domxml_clone_node);
|
||||
PHP_FUNCTION(domxml_node_unlink_node);
|
||||
PHP_FUNCTION(domxml_node_new_child);
|
||||
PHP_FUNCTION(domxml_node_set_content);
|
||||
PHP_FUNCTION(domxml_node_text_concat);
|
||||
PHP_FUNCTION(domxml_node_set_name);
|
||||
PHP_FUNCTION(domxml_node_name);
|
||||
PHP_FUNCTION(domxml_node_type);
|
||||
PHP_FUNCTION(domxml_node_value);
|
||||
PHP_FUNCTION(domxml_is_blank_node);
|
||||
|
||||
/* Class Attribute methods */
|
||||
PHP_FUNCTION(domxml_attr_name);
|
||||
@@ -135,8 +140,8 @@ PHP_FUNCTION(xpath_eval_expression);
|
||||
PHP_FUNCTION(xptr_new_context);
|
||||
PHP_FUNCTION(xptr_eval);
|
||||
#endif
|
||||
|
||||
PHP_FUNCTION(domxml_test);
|
||||
|
||||
#else
|
||||
#define domxml_module_ptr NULL
|
||||
#endif /* HAVE_DOMXML */
|
||||
|
||||
@@ -2,5 +2,6 @@
|
||||
LTLIBRARY_NAME = libfdf.la
|
||||
LTLIBRARY_SOURCES = fdf.c
|
||||
LTLIBRARY_SHARED_NAME = fdf.la
|
||||
LTLIBRARY_SHARED_LIBADD = $(FDFTK_SHARED_LIBADD)
|
||||
|
||||
include $(top_srcdir)/build/dynlib.mk
|
||||
@@ -169,6 +169,8 @@ AC_DEFUN(PHP_GD_TTSTR,[
|
||||
])
|
||||
|
||||
AC_DEFUN(PHP_GD_CHECK_VERSION,[
|
||||
save_LIBS="$LIBS"
|
||||
LIBS="$GD_SHARED_LIBADD $LIBS"
|
||||
AC_CHECK_LIB(gd, gdImageString16, [AC_DEFINE(HAVE_LIBGD13, 1, [ ])])
|
||||
AC_CHECK_LIB(gd, gdImagePaletteCopy, [AC_DEFINE(HAVE_LIBGD15, 1, [ ])])
|
||||
AC_CHECK_LIB(gd, gdImageCreateFromPng, [AC_DEFINE(HAVE_GD_PNG, 1, [ ])])
|
||||
@@ -187,6 +189,7 @@ AC_DEFUN(PHP_GD_CHECK_VERSION,[
|
||||
AC_CHECK_LIB(gd, gdImageColorClosestHWB, [AC_DEFINE(HAVE_COLORCLOSESTHWB, 1, [ ])])
|
||||
AC_CHECK_LIB(gd, gdImageColorResolve, [AC_DEFINE(HAVE_GDIMAGECOLORRESOLVE, 1, [ ])])
|
||||
AC_CHECK_LIB(gd, gdImageGifCtx, [AC_DEFINE(HAVE_GD_GIF_CTX, 1, [ ])])
|
||||
LIBS=$save_LIBS
|
||||
])
|
||||
|
||||
|
||||
@@ -201,6 +204,7 @@ if test "$PHP_GD" != "no"; then
|
||||
PHP_SUBST(GD_SHARED_LIBADD)
|
||||
|
||||
dnl Various checks for GD features
|
||||
PHP_SHLIB_SUFFIX_NAME
|
||||
PHP_GD_TTSTR
|
||||
PHP_GD_JPEG
|
||||
PHP_GD_PNG
|
||||
|
||||
+41
-22
@@ -1586,24 +1586,32 @@ PHP_FUNCTION(imagecolorat)
|
||||
|
||||
ZEND_FETCH_RESOURCE(im, gdImagePtr, IM, -1, "Image", le_gd);
|
||||
|
||||
#if HAVE_LIBGD20
|
||||
if(im->trueColor) {
|
||||
php_error(E_WARNING, "ImageColorAt does not work on TrueColor images");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
#endif
|
||||
convert_to_long_ex(x);
|
||||
convert_to_long_ex(y);
|
||||
|
||||
if (im->pixels && gdImageBoundsSafe(im, Z_LVAL_PP(x), Z_LVAL_PP(y))) {
|
||||
#if HAVE_LIBGD13
|
||||
RETURN_LONG(im->pixels[Z_LVAL_PP(y)][Z_LVAL_PP(x)]);
|
||||
#else
|
||||
RETURN_LONG(im->pixels[Z_LVAL_PP(x)][Z_LVAL_PP(y)]);
|
||||
#endif
|
||||
#if HAVE_LIBGD20
|
||||
if(gdImageTrueColor(im)) {
|
||||
if (im->tpixels && gdImageBoundsSafe(im, Z_LVAL_PP(x), Z_LVAL_PP(y))) {
|
||||
RETURN_LONG(gdImageTrueColorPixel(im, Z_LVAL_PP(x), Z_LVAL_PP(y)));
|
||||
} else {
|
||||
php_error(E_NOTICE, "%ld,%ld is out of bounds",Z_LVAL_PP(x), Z_LVAL_PP(y));
|
||||
RETURN_FALSE;
|
||||
}
|
||||
} else {
|
||||
RETURN_FALSE;
|
||||
#endif
|
||||
if (im->pixels && gdImageBoundsSafe(im, Z_LVAL_PP(x), Z_LVAL_PP(y))) {
|
||||
#if HAVE_LIBGD13
|
||||
RETURN_LONG(im->pixels[Z_LVAL_PP(y)][Z_LVAL_PP(x)]);
|
||||
#else
|
||||
RETURN_LONG(im->pixels[Z_LVAL_PP(x)][Z_LVAL_PP(y)]);
|
||||
#endif
|
||||
} else {
|
||||
php_error(E_NOTICE, "%ld,%ld is out of bounds",Z_LVAL_PP(x), Z_LVAL_PP(y));
|
||||
RETURN_FALSE;
|
||||
}
|
||||
#if HAVE_LIBGD20
|
||||
}
|
||||
#endif
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -1770,7 +1778,17 @@ PHP_FUNCTION(imagecolorsforindex)
|
||||
|
||||
convert_to_long_ex(index);
|
||||
col = Z_LVAL_PP(index);
|
||||
|
||||
#if HAVE_LIBGD20
|
||||
if ((col >= 0 && gdImageTrueColor(im)) || (!gdImageTrueColor(im) && col >= 0 && col < gdImageColorsTotal(im))) {
|
||||
if (array_init(return_value) == FAILURE) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
add_assoc_long(return_value,"red", gdImageRed(im,col));
|
||||
add_assoc_long(return_value,"green", gdImageGreen(im,col));
|
||||
add_assoc_long(return_value,"blue", gdImageBlue(im,col));
|
||||
add_assoc_long(return_value,"alpha", gdImageAlpha(im,col));
|
||||
}
|
||||
#else
|
||||
if (col >= 0 && col < gdImageColorsTotal(im)) {
|
||||
if (array_init(return_value) == FAILURE) {
|
||||
RETURN_FALSE;
|
||||
@@ -1778,7 +1796,9 @@ PHP_FUNCTION(imagecolorsforindex)
|
||||
add_assoc_long(return_value,"red", im->red[col]);
|
||||
add_assoc_long(return_value,"green", im->green[col]);
|
||||
add_assoc_long(return_value,"blue", im->blue[col]);
|
||||
} else {
|
||||
}
|
||||
#endif
|
||||
else {
|
||||
php_error(E_WARNING, "Color index out of range");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
@@ -2760,11 +2780,10 @@ static void php_imagettftext_common(INTERNAL_FUNCTION_PARAMETERS, int mode, int
|
||||
}
|
||||
else
|
||||
# endif
|
||||
|
||||
# if HAVE_GD_STRINGFT
|
||||
error = gdImageStringFT(im, brect, col, fontname, ptsize, angle, x, y, str);
|
||||
# endif
|
||||
|
||||
# if HAVE_GD_STRINGTTF
|
||||
# elif HAVE_GD_STRINGTTF
|
||||
error = gdImageStringTTF(im, brect, col, fontname, ptsize, angle, x, y, str);
|
||||
# endif
|
||||
|
||||
@@ -3517,8 +3536,8 @@ static void _php_image_convert(INTERNAL_FUNCTION_PARAMETERS, int image_type )
|
||||
else {
|
||||
y_ratio = x_ratio;
|
||||
}
|
||||
dest_width = org_width / x_ratio;
|
||||
dest_height = org_height / y_ratio;
|
||||
dest_width = (int)(org_width / x_ratio);
|
||||
dest_height = (int)(org_height / y_ratio);
|
||||
}
|
||||
else {
|
||||
x_ratio = (float) dest_width / (float) org_width;
|
||||
@@ -3530,8 +3549,8 @@ static void _php_image_convert(INTERNAL_FUNCTION_PARAMETERS, int image_type )
|
||||
else {
|
||||
y_ratio = x_ratio;
|
||||
}
|
||||
dest_width = org_width * x_ratio;
|
||||
dest_height = org_height * y_ratio;
|
||||
dest_width = (int)(org_width * x_ratio);
|
||||
dest_height = (int)(org_height * y_ratio);
|
||||
}
|
||||
|
||||
im_tmp = gdImageCreate (dest_width, dest_height);
|
||||
|
||||
+2
-2
@@ -51,7 +51,7 @@
|
||||
/* {{{ iconv_functions[]
|
||||
*/
|
||||
function_entry iconv_functions[] = {
|
||||
PHP_FE(iconv, NULL)
|
||||
PHP_NAMED_FE(iconv,php_if_iconv, NULL)
|
||||
PHP_FE(ob_iconv_handler, NULL)
|
||||
PHP_FE(iconv_get_encoding, NULL)
|
||||
PHP_FE(iconv_set_encoding, NULL)
|
||||
@@ -164,7 +164,7 @@ int php_iconv_string(char *in_p, char **out, char *in_charset, char *out_charset
|
||||
|
||||
/* {{{ proto string iconv(string in_charset, string out_charset, string str)
|
||||
Returns str converted to the out_charset character set */
|
||||
PHP_FUNCTION(iconv)
|
||||
PHP_NAMED_FUNCTION(php_if_iconv)
|
||||
{
|
||||
zval **in_charset, **out_charset, **in_buffer;
|
||||
char *out_buffer;
|
||||
|
||||
@@ -33,7 +33,7 @@ PHP_MINIT_FUNCTION(miconv);
|
||||
PHP_MSHUTDOWN_FUNCTION(miconv);
|
||||
PHP_MINFO_FUNCTION(miconv);
|
||||
|
||||
PHP_FUNCTION(iconv);
|
||||
PHP_NAMED_FUNCTION(php_if_iconv);
|
||||
PHP_FUNCTION(ob_iconv_handler);
|
||||
PHP_FUNCTION(iconv_get_encoding);
|
||||
PHP_FUNCTION(iconv_set_encoding);
|
||||
|
||||
@@ -2100,6 +2100,7 @@ PHP_FUNCTION(imap_rfc822_parse_adrlist)
|
||||
ZEND_WRONG_PARAM_COUNT();
|
||||
}
|
||||
|
||||
SEPARATE_ZVAL(str);
|
||||
convert_to_string_ex(str);
|
||||
convert_to_string_ex(defaulthost);
|
||||
|
||||
|
||||
+3
-2
@@ -210,6 +210,7 @@ PHP_MINIT_FUNCTION(ldap)
|
||||
le_result = zend_register_list_destructors_ex(_free_ldap_result, NULL, "ldap result", module_number);
|
||||
le_link = zend_register_list_destructors_ex(_close_ldap_link, NULL, "ldap link", module_number);
|
||||
le_result_entry = zend_register_list_destructors_ex(NULL, NULL, "ldap result entry", module_number);
|
||||
le_ber_entry = zend_register_list_destructors_ex(NULL, NULL, "ldap ber entry", module_number);
|
||||
|
||||
ldap_module_entry.type = type;
|
||||
|
||||
@@ -990,7 +991,7 @@ PHP_FUNCTION(ldap_first_attribute)
|
||||
if ((attribute = ldap_first_attribute(ldap, ldap_result_entry, &ber)) == NULL) {
|
||||
RETURN_FALSE;
|
||||
} else {
|
||||
ZEND_REGISTER_RESOURCE(return_value, ber, le_ber_entry);
|
||||
ZEND_REGISTER_RESOURCE(*berp, ber, le_ber_entry);
|
||||
|
||||
RETVAL_STRING(attribute, 1);
|
||||
#if ( LDAP_API_VERSION > 2000 ) || HAVE_NSLDAP || WINDOWS
|
||||
@@ -1021,7 +1022,7 @@ PHP_FUNCTION(ldap_next_attribute)
|
||||
if ((attribute = ldap_next_attribute(ldap, ldap_result_entry, ber)) == NULL) {
|
||||
RETURN_FALSE;
|
||||
} else {
|
||||
ZEND_REGISTER_RESOURCE(return_value, ber, le_ber_entry);
|
||||
ZEND_REGISTER_RESOURCE(*berp, ber, le_ber_entry);
|
||||
|
||||
RETVAL_STRING(attribute, 1);
|
||||
#if ( LDAP_API_VERSION > 2000 ) || HAVE_NSLDAP || WINDOWS
|
||||
|
||||
@@ -388,8 +388,8 @@ php_mbstring_init_globals(zend_mbstring_globals *pglobals)
|
||||
pglobals->current_language = mbfl_no_language_japanese;
|
||||
pglobals->internal_encoding = mbfl_no_encoding_euc_jp;
|
||||
pglobals->current_internal_encoding = mbfl_no_encoding_euc_jp;
|
||||
pglobals->http_output_encoding = mbfl_no_encoding_invalid;
|
||||
pglobals->current_http_output_encoding = mbfl_no_encoding_invalid;
|
||||
pglobals->http_output_encoding = mbfl_no_encoding_pass;
|
||||
pglobals->current_http_output_encoding = mbfl_no_encoding_pass;
|
||||
pglobals->http_input_identify = mbfl_no_encoding_invalid;
|
||||
pglobals->http_input_identify_get = mbfl_no_encoding_invalid;
|
||||
pglobals->http_input_identify_post = mbfl_no_encoding_invalid;
|
||||
@@ -811,11 +811,11 @@ php_mbstr_encoding_handler(zval *arg, char *res, char *separator TSRMLS_DC)
|
||||
string.no_encoding = MBSTRG(current_internal_encoding);
|
||||
|
||||
/* count the variables contained in the query */
|
||||
num = 1;
|
||||
num = 0;
|
||||
var = res;
|
||||
n = strlen(res);
|
||||
while(n > 0) {
|
||||
if (*var == *separator) {
|
||||
if (*var == '=') {
|
||||
num++;
|
||||
}
|
||||
var++;
|
||||
@@ -939,7 +939,7 @@ SAPI_POST_HANDLER_FUNC(php_mbstr_post_handler)
|
||||
/* http input processing */
|
||||
void mbstr_treat_data(int arg, char *str, zval* destArray TSRMLS_DC)
|
||||
{
|
||||
char *res = NULL, *var, *val, *separator=NULL;
|
||||
char *res = NULL, *separator=NULL;
|
||||
const char *c_var;
|
||||
pval *array_ptr;
|
||||
int free_buffer=0;
|
||||
|
||||
+99
-105
@@ -59,6 +59,9 @@ function_entry mcrypt_functions[] = {
|
||||
PHP_FE(mcrypt_generic, NULL)
|
||||
PHP_FE(mdecrypt_generic, NULL)
|
||||
PHP_FE(mcrypt_generic_end, NULL)
|
||||
#if HAVE_MCRYPT_GENERIC_DEINIT
|
||||
PHP_FE(mcrypt_generic_deinit, NULL)
|
||||
#endif
|
||||
PHP_FE(mcrypt_enc_self_test, NULL)
|
||||
PHP_FE(mcrypt_enc_is_block_algorithm_mode, NULL)
|
||||
PHP_FE(mcrypt_enc_is_block_algorithm, NULL)
|
||||
@@ -203,26 +206,14 @@ ZEND_GET_MODULE(mcrypt)
|
||||
ZEND_FETCH_RESOURCE (td, MCRYPT, mcryptind, -1, "MCrypt", le_mcrypt);
|
||||
|
||||
#define MCRYPT_GET_MODE_DIR_ARGS(DIRECTORY) \
|
||||
switch (argc) { \
|
||||
case 2: \
|
||||
lib_dir_s = Z_STRVAL_PP(lib_dir); \
|
||||
if (zend_get_parameters_ex(2, &arg1, &lib_dir) == FAILURE) \
|
||||
{ \
|
||||
WRONG_PARAM_COUNT; \
|
||||
} \
|
||||
convert_to_string_ex (lib_dir); \
|
||||
break; \
|
||||
case 1: \
|
||||
lib_dir_s = MCG(DIRECTORY); \
|
||||
if (zend_get_parameters_ex(1, &arg1) == FAILURE) \
|
||||
{ \
|
||||
WRONG_PARAM_COUNT; \
|
||||
} \
|
||||
break; \
|
||||
default: \
|
||||
WRONG_PARAM_COUNT; \
|
||||
} \
|
||||
convert_to_string_ex(arg1);
|
||||
char *dir = NULL; \
|
||||
int dir_len; \
|
||||
char *module; \
|
||||
int module_len; \
|
||||
if (zend_parse_parameters (ZEND_NUM_ARGS() TSRMLS_CC, \
|
||||
"s|s", &module, &module_len, &dir, &dir_len) == FAILURE) { \
|
||||
return; \
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -248,10 +239,12 @@ PHP_INI_BEGIN()
|
||||
PHP_INI_END()
|
||||
#endif
|
||||
|
||||
static void php_mcrypt_module_dtor(zend_rsrc_list_entry *rsrc)
|
||||
static void php_mcrypt_module_dtor(zend_rsrc_list_entry *rsrc TSRMLS_DC)
|
||||
{
|
||||
#if HAVE_LIBMCRYPT24
|
||||
MCRYPT td = (MCRYPT) rsrc->ptr;
|
||||
mcrypt_module_close (td);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -458,6 +451,7 @@ PHP_FUNCTION(mcrypt_generic_init)
|
||||
int max_key_size, key_size, iv_size;
|
||||
MCRYPT td;
|
||||
int argc;
|
||||
int result = 0;
|
||||
|
||||
argc = ZEND_NUM_ARGS();
|
||||
MCRYPT_CHECK_PARAM_COUNT (3,3)
|
||||
@@ -472,7 +466,6 @@ PHP_FUNCTION(mcrypt_generic_init)
|
||||
|
||||
if (Z_STRLEN_PP(key) == 0) {
|
||||
php_error (E_WARNING, "key size is 0");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
key_s = emalloc (Z_STRLEN_PP(key));
|
||||
@@ -498,7 +491,27 @@ PHP_FUNCTION(mcrypt_generic_init)
|
||||
}
|
||||
memcpy (iv_s, Z_STRVAL_PP(iv), iv_size);
|
||||
|
||||
RETVAL_LONG (mcrypt_generic_init (td, key_s, key_size, iv_s));
|
||||
result = mcrypt_generic_init (td, key_s, key_size, iv_s);
|
||||
|
||||
/* If this function fails, close the mcrypt module to prevent crashes
|
||||
* when further functions want to access this resource */
|
||||
if (result < 0) {
|
||||
zend_list_delete (Z_LVAL_PP(mcryptind));
|
||||
switch (result) {
|
||||
case -3:
|
||||
php_error (E_WARNING, "mcrypt_generic_init: Key length incorrect");
|
||||
break;
|
||||
case -4:
|
||||
php_error (E_WARNING, "mcrypt_generic_init: Memory allocation error");
|
||||
break;
|
||||
case -1:
|
||||
default:
|
||||
php_error (E_WARNING, "mcrypt_generic_init: Unknown error");
|
||||
break;
|
||||
}
|
||||
}
|
||||
RETVAL_LONG (result);
|
||||
|
||||
efree (iv_s);
|
||||
efree (key_s);
|
||||
}
|
||||
@@ -526,18 +539,19 @@ PHP_FUNCTION(mcrypt_generic)
|
||||
if (mcrypt_enc_is_block_mode (td) == 1) { /* It's a block algorithm */
|
||||
block_size = mcrypt_enc_get_block_size (td);
|
||||
data_size = (((Z_STRLEN_PP(data) - 1) / block_size) + 1) * block_size;
|
||||
data_s = emalloc (data_size);
|
||||
data_s = emalloc (data_size + 1);
|
||||
memset (data_s, 0, data_size);
|
||||
memcpy (data_s, Z_STRVAL_PP(data), Z_STRLEN_PP(data));
|
||||
}
|
||||
else { /* It's not a block algorithm */
|
||||
data_size = Z_STRLEN_PP(data);
|
||||
data_s = emalloc (data_size);
|
||||
data_s = emalloc (data_size + 1);
|
||||
memset (data_s, 0, data_size);
|
||||
memcpy (data_s, Z_STRVAL_PP(data), Z_STRLEN_PP(data));
|
||||
}
|
||||
|
||||
mcrypt_generic (td, data_s, data_size);
|
||||
data_s[data_size] = '\0';
|
||||
|
||||
RETVAL_STRINGL (data_s, data_size, 1);
|
||||
efree (data_s);
|
||||
@@ -566,13 +580,13 @@ PHP_FUNCTION(mdecrypt_generic)
|
||||
if (mcrypt_enc_is_block_mode (td) == 1) { /* It's a block algorithm */
|
||||
block_size = mcrypt_enc_get_block_size (td);
|
||||
data_size = (((Z_STRLEN_PP(data) - 1) / block_size) + 1) * block_size;
|
||||
data_s = emalloc (data_size);
|
||||
data_s = emalloc (data_size + 1);
|
||||
memset (data_s, 0, data_size);
|
||||
memcpy (data_s, Z_STRVAL_PP(data), Z_STRLEN_PP(data));
|
||||
}
|
||||
else { /* It's not a block algorithm */
|
||||
data_size = Z_STRLEN_PP(data);
|
||||
data_s = emalloc (data_size);
|
||||
data_s = emalloc (data_size + 1);
|
||||
memset (data_s, 0, data_size);
|
||||
memcpy (data_s, Z_STRVAL_PP(data), Z_STRLEN_PP(data));
|
||||
}
|
||||
@@ -649,7 +663,12 @@ PHP_FUNCTION(mcrypt_generic_end)
|
||||
|
||||
MCRYPT_GET_TD_ARG
|
||||
|
||||
#if HAVE_MCRYPT_GENERIC_DEINIT
|
||||
php_error(E_NOTICE, "mcrypt_generic_end is deprecated, please use mcrypt_generic_deinit");
|
||||
if (mcrypt_generic_deinit (td) < 0) {
|
||||
#else
|
||||
if (mcrypt_generic_end (td) < 0) {
|
||||
#endif
|
||||
php_error (E_WARNING, "could not terminate encryption specifier");
|
||||
RETURN_FALSE
|
||||
}
|
||||
@@ -658,6 +677,28 @@ PHP_FUNCTION(mcrypt_generic_end)
|
||||
/* }}} */
|
||||
|
||||
|
||||
#if HAVE_MCRYPT_GENERIC_DEINIT
|
||||
|
||||
/* {{{ proto bool mcrypt_generic_deinit(resource td)
|
||||
This function terminates encrypt specified by the descriptor td */
|
||||
PHP_FUNCTION(mcrypt_generic_deinit)
|
||||
{
|
||||
zval **mcryptind;
|
||||
MCRYPT td;
|
||||
|
||||
MCRYPT_GET_TD_ARG
|
||||
|
||||
if (mcrypt_generic_deinit (td) < 0) {
|
||||
php_error (E_WARNING, "could not terminate encryption specifier");
|
||||
RETURN_FALSE
|
||||
}
|
||||
RETURN_TRUE
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/* {{{ proto bool mcrypt_enc_is_block_algorithm_mode(resource td)
|
||||
Returns TRUE if the mode is for use with block algorithms */
|
||||
PHP_FUNCTION(mcrypt_enc_is_block_algorithm_mode)
|
||||
@@ -789,18 +830,11 @@ PHP_FUNCTION(mcrypt_enc_get_modes_name)
|
||||
Does a self test of the module "module" */
|
||||
PHP_FUNCTION(mcrypt_module_self_test)
|
||||
{
|
||||
zval **arg1, **lib_dir;
|
||||
char *lib_dir_s;
|
||||
int argc;
|
||||
|
||||
argc = ZEND_NUM_ARGS();
|
||||
|
||||
MCRYPT_GET_MODE_DIR_ARGS(algorithms_dir);
|
||||
|
||||
if (mcrypt_module_self_test ((*arg1)->value.str.val, lib_dir_s) == 0) {
|
||||
if (mcrypt_module_self_test (module, dir) == 0) {
|
||||
RETURN_TRUE;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
}
|
||||
@@ -811,18 +845,11 @@ PHP_FUNCTION(mcrypt_module_self_test)
|
||||
Returns TRUE if the mode is for use with block algorithms */
|
||||
PHP_FUNCTION(mcrypt_module_is_block_algorithm_mode)
|
||||
{
|
||||
zval **arg1, **lib_dir;
|
||||
char *lib_dir_s;
|
||||
int argc;
|
||||
|
||||
argc = ZEND_NUM_ARGS();
|
||||
|
||||
MCRYPT_GET_MODE_DIR_ARGS(modes_dir)
|
||||
|
||||
if (mcrypt_module_is_block_algorithm_mode ((*arg1)->value.str.val, lib_dir_s) == 0) {
|
||||
if (mcrypt_module_is_block_algorithm_mode (module, dir) == 1) {
|
||||
RETURN_TRUE;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
}
|
||||
@@ -833,18 +860,11 @@ PHP_FUNCTION(mcrypt_module_is_block_algorithm_mode)
|
||||
Returns TRUE if the algorithm is a block algorithm */
|
||||
PHP_FUNCTION(mcrypt_module_is_block_algorithm)
|
||||
{
|
||||
zval **arg1, **lib_dir;
|
||||
char *lib_dir_s;
|
||||
int argc;
|
||||
|
||||
argc = ZEND_NUM_ARGS();
|
||||
|
||||
MCRYPT_GET_MODE_DIR_ARGS(algorithms_dir)
|
||||
|
||||
if (mcrypt_module_is_block_algorithm ((*arg1)->value.str.val, lib_dir_s) == 0) {
|
||||
if (mcrypt_module_is_block_algorithm (module, dir) == 1) {
|
||||
RETURN_TRUE;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
}
|
||||
@@ -855,18 +875,11 @@ PHP_FUNCTION(mcrypt_module_is_block_algorithm)
|
||||
Returns TRUE if the mode outputs blocks of bytes */
|
||||
PHP_FUNCTION(mcrypt_module_is_block_mode)
|
||||
{
|
||||
zval **arg1, **lib_dir;
|
||||
char *lib_dir_s;
|
||||
int argc;
|
||||
|
||||
argc = ZEND_NUM_ARGS();
|
||||
|
||||
MCRYPT_GET_MODE_DIR_ARGS(modes_dir)
|
||||
|
||||
if (mcrypt_module_is_block_mode ((*arg1)->value.str.val, lib_dir_s) == 0) {
|
||||
if (mcrypt_module_is_block_mode (module, dir) == 1) {
|
||||
RETURN_TRUE;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
}
|
||||
@@ -877,15 +890,9 @@ PHP_FUNCTION(mcrypt_module_is_block_mode)
|
||||
Returns the block size of the algorithm */
|
||||
PHP_FUNCTION(mcrypt_module_get_algo_block_size)
|
||||
{
|
||||
zval **arg1, **lib_dir;
|
||||
char *lib_dir_s;
|
||||
int argc;
|
||||
|
||||
argc = ZEND_NUM_ARGS();
|
||||
|
||||
MCRYPT_GET_MODE_DIR_ARGS(algorithms_dir)
|
||||
|
||||
RETURN_LONG(mcrypt_module_get_algo_block_size ((*arg1)->value.str.val, lib_dir_s))
|
||||
RETURN_LONG(mcrypt_module_get_algo_block_size (module, dir));
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -894,15 +901,9 @@ PHP_FUNCTION(mcrypt_module_get_algo_block_size)
|
||||
Returns the maximum supported key size of the algorithm */
|
||||
PHP_FUNCTION(mcrypt_module_get_algo_key_size)
|
||||
{
|
||||
zval **arg1, **lib_dir;
|
||||
char *lib_dir_s;
|
||||
int argc;
|
||||
|
||||
argc = ZEND_NUM_ARGS();
|
||||
|
||||
MCRYPT_GET_MODE_DIR_ARGS(algorithms_dir);
|
||||
|
||||
RETURN_LONG(mcrypt_module_get_algo_key_size ((*arg1)->value.str.val, lib_dir_s))
|
||||
RETURN_LONG(mcrypt_module_get_algo_key_size (module, dir));
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -911,16 +912,12 @@ PHP_FUNCTION(mcrypt_module_get_algo_key_size)
|
||||
This function decrypts the crypttext */
|
||||
PHP_FUNCTION(mcrypt_module_get_supported_key_sizes)
|
||||
{
|
||||
zval **arg1, **lib_dir;
|
||||
char *lib_dir_s;
|
||||
int argc, i, count;
|
||||
int i, count;
|
||||
int *key_sizes;
|
||||
|
||||
argc = ZEND_NUM_ARGS();
|
||||
|
||||
MCRYPT_GET_MODE_DIR_ARGS(algorithms_dir)
|
||||
|
||||
key_sizes = mcrypt_module_get_algo_supported_key_sizes ((*arg1)->value.str.val, lib_dir_s, &count);
|
||||
key_sizes = mcrypt_module_get_algo_supported_key_sizes (module, dir, &count);
|
||||
|
||||
if (array_init(return_value) == FAILURE) {
|
||||
php_error(E_ERROR, "Unable to initialize array");
|
||||
@@ -1425,56 +1422,53 @@ PHP_FUNCTION(mcrypt_ofb)
|
||||
#endif
|
||||
|
||||
/* {{{ proto string mcrypt_create_iv(int size, int source)
|
||||
Create an initializing vector (IV) */
|
||||
Create an initialization vector (IV) */
|
||||
PHP_FUNCTION(mcrypt_create_iv)
|
||||
{
|
||||
zval **size, **psource;
|
||||
char *iv;
|
||||
iv_source source;
|
||||
int i;
|
||||
iv_source source = RANDOM;
|
||||
long size;
|
||||
int n = 0;
|
||||
|
||||
if(ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &size, &psource) == FAILURE) {
|
||||
WRONG_PARAM_COUNT;
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l|l", &size, &source) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
convert_to_long_ex(size);
|
||||
convert_to_long_ex(psource);
|
||||
|
||||
source = Z_LVAL_PP(psource);
|
||||
i = Z_LVAL_PP(size);
|
||||
|
||||
if(i <= 0) {
|
||||
if (size <= 0) {
|
||||
php_error(E_WARNING, "can not create an IV with size 0 or smaller");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
iv = ecalloc(i, 1);
|
||||
iv = ecalloc(size + 1, 1);
|
||||
|
||||
if(source == RANDOM || source == URANDOM) {
|
||||
int fd;
|
||||
if (source == RANDOM || source == URANDOM) {
|
||||
int fd;
|
||||
size_t read_bytes = 0;
|
||||
|
||||
fd = open(source == RANDOM ? "/dev/random" : "/dev/urandom",
|
||||
O_RDONLY);
|
||||
if(fd < 0) {
|
||||
if (fd < 0) {
|
||||
efree(iv);
|
||||
php_error(E_WARNING, "cannot open source device");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
while (read_bytes < i) {
|
||||
n = read(fd, iv + read_bytes, i - read_bytes);
|
||||
while (read_bytes < size) {
|
||||
n = read(fd, iv + read_bytes, size - read_bytes);
|
||||
if (n < 0)
|
||||
break;
|
||||
read_bytes += n;
|
||||
}
|
||||
n = read_bytes;
|
||||
close(fd);
|
||||
if (n < size) {
|
||||
php_error(E_WARNING, "could not gather sufficient random data");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
} else {
|
||||
while(i) {
|
||||
iv[--i] = 255.0 * rand() / RAND_MAX;
|
||||
n = size;
|
||||
while (size) {
|
||||
iv[--size] = 255.0 * rand() / RAND_MAX;
|
||||
}
|
||||
n = Z_LVAL_PP(size);
|
||||
}
|
||||
RETURN_STRINGL(iv, n, 0);
|
||||
}
|
||||
|
||||
@@ -1238,7 +1238,7 @@ PHP_FUNCTION(mssql_fetch_object)
|
||||
Returns an associative array of the current row in the result set specified by result_id */
|
||||
PHP_FUNCTION(mssql_fetch_array)
|
||||
{
|
||||
php_mssql_fetch_hash(INTERNAL_FUNCTION_PARAM_PASSTHRU, MSSQL_ASSOC);
|
||||
php_mssql_fetch_hash(INTERNAL_FUNCTION_PARAM_PASSTHRU, MSSQL_BOTH);
|
||||
}
|
||||
|
||||
/* }}} */
|
||||
|
||||
+2
-1
@@ -23,6 +23,7 @@ AC_DEFUN(PHP_MYSQL_SOCK,[
|
||||
/var/tmp/mysql.sock \
|
||||
/var/lib/mysql/mysql.sock \
|
||||
/var/mysql/mysql.sock \
|
||||
/Private/tmp/mysql.sock \
|
||||
; do
|
||||
if test -r $i; then
|
||||
MYSQL_SOCK=$i
|
||||
@@ -80,7 +81,7 @@ elif test "$PHP_MYSQL" != "no"; then
|
||||
|
||||
if test "$PHP_ZLIB_DIR" != "no"; then
|
||||
PHP_ADD_LIBRARY(z,, MYSQL_SHARED_LIBADD)
|
||||
MYSQL_LIBS="-L$PHP_ZLIB_DIR -z"
|
||||
MYSQL_LIBS="-L$PHP_ZLIB_DIR/lib -z"
|
||||
fi
|
||||
|
||||
PHP_ADD_LIBRARY_WITH_PATH(mysqlclient, $MYSQL_LIB_DIR, MYSQL_SHARED_LIBADD)
|
||||
|
||||
+117
-91
@@ -55,14 +55,16 @@ static int le_result, le_link, le_plink;
|
||||
|
||||
#include "php_ini.h"
|
||||
|
||||
# if HAVE_MYSQL_MYSQL_H
|
||||
# include <mysql/mysql.h>
|
||||
# else
|
||||
# include <mysql.h>
|
||||
# endif
|
||||
#if HAVE_MYSQL_MYSQL_H
|
||||
# include <mysql/mysql.h>
|
||||
#else
|
||||
# include <mysql.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_MYSQL_REAL_CONNECT
|
||||
#ifdef HAVE_ERRMSG_H
|
||||
#include <errmsg.h>
|
||||
# ifdef HAVE_ERRMSG_H
|
||||
# include <errmsg.h>
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#define SAFE_STRING(s) ((s)?(s):"")
|
||||
@@ -117,8 +119,10 @@ function_entry mysql_functions[] = {
|
||||
PHP_FE(mysql_pconnect, NULL)
|
||||
PHP_FE(mysql_close, NULL)
|
||||
PHP_FE(mysql_select_db, NULL)
|
||||
#if MYSQL_VERSION_ID < 40000
|
||||
PHP_FE(mysql_create_db, NULL)
|
||||
PHP_FE(mysql_drop_db, NULL)
|
||||
#endif
|
||||
PHP_FE(mysql_query, NULL)
|
||||
PHP_FE(mysql_unbuffered_query, NULL)
|
||||
PHP_FE(mysql_db_query, NULL)
|
||||
@@ -164,8 +168,10 @@ function_entry mysql_functions[] = {
|
||||
PHP_FALIAS(mysql_fieldtype, mysql_field_type, NULL)
|
||||
PHP_FALIAS(mysql_fieldflags, mysql_field_flags, NULL)
|
||||
PHP_FALIAS(mysql_selectdb, mysql_select_db, NULL)
|
||||
#if MYSQL_VERSION_ID < 40000
|
||||
PHP_FALIAS(mysql_createdb, mysql_create_db, NULL)
|
||||
PHP_FALIAS(mysql_dropdb, mysql_drop_db, NULL)
|
||||
#endif
|
||||
PHP_FALIAS(mysql_freeresult, mysql_free_result, NULL)
|
||||
PHP_FALIAS(mysql_numfields, mysql_num_fields, NULL)
|
||||
PHP_FALIAS(mysql_numrows, mysql_num_rows, NULL)
|
||||
@@ -324,7 +330,7 @@ ZEND_MODULE_STARTUP_D(mysql)
|
||||
le_result = zend_register_list_destructors_ex(_free_mysql_result, NULL, "mysql result", module_number);
|
||||
le_link = zend_register_list_destructors_ex(_close_mysql_link, NULL, "mysql link", module_number);
|
||||
le_plink = zend_register_list_destructors_ex(NULL, _close_mysql_plink, "mysql link persistent", module_number);
|
||||
mysql_module_entry.type = type;
|
||||
Z_TYPE(mysql_module_entry) = type;
|
||||
|
||||
REGISTER_LONG_CONSTANT("MYSQL_ASSOC", MYSQL_ASSOC, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("MYSQL_NUM", MYSQL_NUM, CONST_CS | CONST_PERSISTENT);
|
||||
@@ -332,6 +338,12 @@ ZEND_MODULE_STARTUP_D(mysql)
|
||||
REGISTER_LONG_CONSTANT("MYSQL_USE_RESULT", MYSQL_USE_RESULT, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("MYSQL_STORE_RESULT", MYSQL_STORE_RESULT, CONST_CS | CONST_PERSISTENT);
|
||||
|
||||
#ifdef ZTS
|
||||
# if MYSQL_VERSION_ID >= 40000
|
||||
mysql_thread_init();
|
||||
# endif
|
||||
#endif
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
/* }}} */
|
||||
@@ -340,6 +352,12 @@ ZEND_MODULE_STARTUP_D(mysql)
|
||||
*/
|
||||
PHP_MSHUTDOWN_FUNCTION(mysql)
|
||||
{
|
||||
#ifdef ZTS
|
||||
# if MYSQL_VERSION_ID >= 40000
|
||||
mysql_thread_end();
|
||||
# endif
|
||||
#endif
|
||||
|
||||
UNREGISTER_INI_ENTRIES();
|
||||
return SUCCESS;
|
||||
}
|
||||
@@ -446,7 +464,7 @@ static void php_mysql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
|
||||
MYSQL_DO_CONNECT_RETURN_FALSE();
|
||||
}
|
||||
convert_to_string_ex(z_user);
|
||||
user = (*z_user)->value.str.val;
|
||||
user = Z_STRVAL_PP(z_user);
|
||||
}
|
||||
break;
|
||||
case 3: {
|
||||
@@ -455,8 +473,8 @@ static void php_mysql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
|
||||
}
|
||||
convert_to_string_ex(z_user);
|
||||
convert_to_string_ex(z_passwd);
|
||||
user = (*z_user)->value.str.val;
|
||||
passwd = (*z_passwd)->value.str.val;
|
||||
user = Z_STRVAL_PP(z_user);
|
||||
passwd = Z_STRVAL_PP(z_passwd);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
@@ -549,7 +567,7 @@ static void php_mysql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
|
||||
}
|
||||
|
||||
/* hash it up */
|
||||
new_le.type = le_plink;
|
||||
Z_TYPE(new_le) = le_plink;
|
||||
new_le.ptr = mysql;
|
||||
if (zend_hash_update(&EG(persistent_list), hashed_details, hashed_details_length+1, (void *) &new_le, sizeof(list_entry), NULL)==FAILURE) {
|
||||
free(mysql);
|
||||
@@ -559,7 +577,7 @@ static void php_mysql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
|
||||
MySG(num_persistent)++;
|
||||
MySG(num_links)++;
|
||||
} else { /* we do */
|
||||
if (le->type != le_plink) {
|
||||
if (Z_TYPE_P(le) != le_plink) {
|
||||
MYSQL_DO_CONNECT_RETURN_FALSE();
|
||||
}
|
||||
/* ensure that the link did not die */
|
||||
@@ -598,16 +616,16 @@ static void php_mysql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
|
||||
int type, link;
|
||||
void *ptr;
|
||||
|
||||
if (index_ptr->type != le_index_ptr) {
|
||||
if (Z_TYPE_P(index_ptr) != le_index_ptr) {
|
||||
MYSQL_DO_CONNECT_RETURN_FALSE();
|
||||
}
|
||||
link = (int) index_ptr->ptr;
|
||||
ptr = zend_list_find(link,&type); /* check if the link is still there */
|
||||
if (ptr && (type==le_link || type==le_plink)) {
|
||||
zend_list_addref(link);
|
||||
return_value->value.lval = link;
|
||||
Z_LVAL_P(return_value) = link;
|
||||
php_mysql_set_default_link(link TSRMLS_CC);
|
||||
return_value->type = IS_RESOURCE;
|
||||
Z_TYPE_P(return_value) = IS_RESOURCE;
|
||||
efree(hashed_details);
|
||||
MYSQL_DO_CONNECT_CLEANUP();
|
||||
return;
|
||||
@@ -646,8 +664,8 @@ static void php_mysql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
|
||||
ZEND_REGISTER_RESOURCE(return_value, mysql, le_link);
|
||||
|
||||
/* add it to the hash */
|
||||
new_index_ptr.ptr = (void *) return_value->value.lval;
|
||||
new_index_ptr.type = le_index_ptr;
|
||||
new_index_ptr.ptr = (void *) Z_LVAL_P(return_value);
|
||||
Z_TYPE(new_index_ptr) = le_index_ptr;
|
||||
if (zend_hash_update(&EG(regular_list), hashed_details, hashed_details_length+1,(void *) &new_index_ptr, sizeof(list_entry), NULL)==FAILURE) {
|
||||
efree(hashed_details);
|
||||
MYSQL_DO_CONNECT_RETURN_FALSE();
|
||||
@@ -656,7 +674,7 @@ static void php_mysql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
|
||||
}
|
||||
|
||||
efree(hashed_details);
|
||||
php_mysql_set_default_link(return_value->value.lval TSRMLS_CC);
|
||||
php_mysql_set_default_link(Z_LVAL_P(return_value) TSRMLS_CC);
|
||||
MYSQL_DO_CONNECT_CLEANUP();
|
||||
}
|
||||
/* }}} */
|
||||
@@ -760,7 +778,7 @@ PHP_FUNCTION(mysql_select_db)
|
||||
|
||||
convert_to_string_ex(db);
|
||||
|
||||
if (mysql_select_db(&mysql->conn, (*db)->value.str.val)!=0) {
|
||||
if (mysql_select_db(&mysql->conn, Z_STRVAL_PP(db))!=0) {
|
||||
RETURN_FALSE;
|
||||
} else {
|
||||
RETURN_TRUE;
|
||||
@@ -874,6 +892,7 @@ PHP_FUNCTION(mysql_get_server_info)
|
||||
|
||||
#endif
|
||||
|
||||
#if MYSQL_VERSION_ID < 40000
|
||||
/* {{{ proto int mysql_create_db(string database_name [, int link_identifier])
|
||||
Create a MySQL database */
|
||||
PHP_FUNCTION(mysql_create_db)
|
||||
@@ -904,7 +923,7 @@ PHP_FUNCTION(mysql_create_db)
|
||||
ZEND_FETCH_RESOURCE2(mysql, php_mysql_conn *, mysql_link, id, "MySQL-Link", le_link, le_plink);
|
||||
|
||||
convert_to_string_ex(db);
|
||||
if (mysql_create_db(&mysql->conn, (*db)->value.str.val)==0) {
|
||||
if (mysql_create_db(&mysql->conn, Z_STRVAL_PP(db))==0) {
|
||||
RETURN_TRUE;
|
||||
} else {
|
||||
RETURN_FALSE;
|
||||
@@ -943,13 +962,14 @@ PHP_FUNCTION(mysql_drop_db)
|
||||
ZEND_FETCH_RESOURCE2(mysql, php_mysql_conn *, mysql_link, id, "MySQL-Link", le_link, le_plink);
|
||||
|
||||
convert_to_string_ex(db);
|
||||
if (mysql_drop_db(&mysql->conn, (*db)->value.str.val)==0) {
|
||||
if (mysql_drop_db(&mysql->conn, Z_STRVAL_PP(db))==0) {
|
||||
RETURN_TRUE;
|
||||
} else {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
#endif
|
||||
|
||||
/* {{{ php_mysql_do_query_general
|
||||
*/
|
||||
@@ -962,7 +982,7 @@ static void php_mysql_do_query_general(zval **query, zval **mysql_link, int link
|
||||
|
||||
if (db) {
|
||||
convert_to_string_ex(db);
|
||||
if (mysql_select_db(&mysql->conn, (*db)->value.str.val)!=0) {
|
||||
if (mysql_select_db(&mysql->conn, Z_STRVAL_PP(db))!=0) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
}
|
||||
@@ -973,10 +993,12 @@ static void php_mysql_do_query_general(zval **query, zval **mysql_link, int link
|
||||
MYSQL_RES *mysql_result;
|
||||
|
||||
mysql_result = (MYSQL_RES *) zend_list_find(mysql->active_result_id, &type);
|
||||
if (mysql_result && type==le_result && !mysql_eof(mysql_result)) {
|
||||
php_error(E_NOTICE, "Called %s() without first fetching all rows from a previous unbuffered query",
|
||||
get_active_function_name(TSRMLS_C));
|
||||
while (mysql_fetch_row(mysql_result));
|
||||
if (mysql_result && type==le_result) {
|
||||
if (!mysql_eof(mysql_result)) {
|
||||
php_error(E_NOTICE, "Called %s() without first fetching all rows from a previous unbuffered query",
|
||||
get_active_function_name(TSRMLS_C));
|
||||
while (mysql_fetch_row(mysql_result));
|
||||
}
|
||||
zend_list_delete(mysql->active_result_id);
|
||||
mysql->active_result_id = 0;
|
||||
}
|
||||
@@ -985,11 +1007,11 @@ static void php_mysql_do_query_general(zval **query, zval **mysql_link, int link
|
||||
convert_to_string_ex(query);
|
||||
/* mysql_query is binary unsafe, use mysql_real_query */
|
||||
#if MYSQL_VERSION_ID > 32199
|
||||
if (mysql_real_query(&mysql->conn, (*query)->value.str.val, (*query)->value.str.len)!=0) {
|
||||
if (mysql_real_query(&mysql->conn, Z_STRVAL_PP(query), Z_STRLEN_PP(query))!=0) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
#else
|
||||
if (mysql_query(&mysql->conn, (*query)->value.str.val)!=0) {
|
||||
if (mysql_query(&mysql->conn, Z_STRVAL_PP(query))!=0) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
#endif
|
||||
@@ -1160,7 +1182,7 @@ PHP_FUNCTION(mysql_list_tables)
|
||||
ZEND_FETCH_RESOURCE2(mysql, php_mysql_conn *, mysql_link, id, "MySQL-Link", le_link, le_plink);
|
||||
|
||||
convert_to_string_ex(db);
|
||||
if (mysql_select_db(&mysql->conn, (*db)->value.str.val)!=0) {
|
||||
if (mysql_select_db(&mysql->conn, Z_STRVAL_PP(db))!=0) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
if ((mysql_result=mysql_list_tables(&mysql->conn, NULL))==NULL) {
|
||||
@@ -1203,11 +1225,11 @@ PHP_FUNCTION(mysql_list_fields)
|
||||
ZEND_FETCH_RESOURCE2(mysql, php_mysql_conn *, mysql_link, id, "MySQL-Link", le_link, le_plink);
|
||||
|
||||
convert_to_string_ex(db);
|
||||
if (mysql_select_db(&mysql->conn, (*db)->value.str.val)!=0) {
|
||||
if (mysql_select_db(&mysql->conn, Z_STRVAL_PP(db))!=0) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
convert_to_string_ex(table);
|
||||
if ((mysql_result=mysql_list_fields(&mysql->conn, (*table)->value.str.val, NULL))==NULL) {
|
||||
if ((mysql_result=mysql_list_fields(&mysql->conn, Z_STRVAL_PP(table), NULL))==NULL) {
|
||||
php_error(E_WARNING, "Unable to save MySQL query result");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
@@ -1319,13 +1341,13 @@ PHP_FUNCTION(mysql_affected_rows)
|
||||
ZEND_FETCH_RESOURCE2(mysql, php_mysql_conn *, mysql_link, id, "MySQL-Link", le_link, le_plink);
|
||||
|
||||
/* conversion from int64 to long happing here */
|
||||
return_value->value.lval = (long) mysql_affected_rows(&mysql->conn);
|
||||
return_value->type = IS_LONG;
|
||||
Z_LVAL_P(return_value) = (long) mysql_affected_rows(&mysql->conn);
|
||||
Z_TYPE_P(return_value) = IS_LONG;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
||||
/* {{{ proto char mysql_escape_string([char string])
|
||||
/* {{{ proto string mysql_escape_string(string to_be_escaped)
|
||||
Escape string for mysql query */
|
||||
PHP_FUNCTION(mysql_escape_string)
|
||||
{
|
||||
@@ -1341,7 +1363,7 @@ PHP_FUNCTION(mysql_escape_string)
|
||||
*/
|
||||
Z_STRVAL_P(return_value) = (char *) emalloc(Z_STRLEN_PP(str)*2+1);
|
||||
Z_STRLEN_P(return_value) = mysql_escape_string(Z_STRVAL_P(return_value), Z_STRVAL_PP(str), Z_STRLEN_PP(str));
|
||||
return_value->type = IS_STRING;
|
||||
Z_TYPE_P(return_value) = IS_STRING;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -1373,8 +1395,8 @@ PHP_FUNCTION(mysql_insert_id)
|
||||
ZEND_FETCH_RESOURCE2(mysql, php_mysql_conn *, mysql_link, id, "MySQL-Link", le_link, le_plink);
|
||||
|
||||
/* conversion from int64 to long happing here */
|
||||
return_value->value.lval = (long) mysql_insert_id(&mysql->conn);
|
||||
return_value->type = IS_LONG;
|
||||
Z_LVAL_P(return_value) = (long) mysql_insert_id(&mysql->conn);
|
||||
Z_TYPE_P(return_value) = IS_LONG;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -1408,29 +1430,29 @@ PHP_FUNCTION(mysql_result)
|
||||
ZEND_FETCH_RESOURCE(mysql_result, MYSQL_RES *, result, -1, "MySQL result", le_result);
|
||||
|
||||
convert_to_long_ex(row);
|
||||
if ((*row)->value.lval<0 || (*row)->value.lval>=(int)mysql_num_rows(mysql_result)) {
|
||||
php_error(E_WARNING, "Unable to jump to row %d on MySQL result index %d", (*row)->value.lval, (*result)->value.lval);
|
||||
if (Z_LVAL_PP(row)<0 || Z_LVAL_PP(row)>=(int)mysql_num_rows(mysql_result)) {
|
||||
php_error(E_WARNING, "Unable to jump to row %d on MySQL result index %d", Z_LVAL_PP(row), Z_LVAL_PP(result));
|
||||
RETURN_FALSE;
|
||||
}
|
||||
mysql_data_seek(mysql_result, (*row)->value.lval);
|
||||
mysql_data_seek(mysql_result, Z_LVAL_PP(row));
|
||||
if ((sql_row=mysql_fetch_row(mysql_result))==NULL
|
||||
|| (sql_row_lengths=mysql_fetch_lengths(mysql_result))==NULL) { /* shouldn't happen? */
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
if (field) {
|
||||
switch((*field)->type) {
|
||||
switch(Z_TYPE_PP(field)) {
|
||||
case IS_STRING: {
|
||||
int i=0;
|
||||
MYSQL_FIELD *tmp_field;
|
||||
char *table_name, *field_name, *tmp;
|
||||
|
||||
if ((tmp=strchr((*field)->value.str.val, '.'))) {
|
||||
table_name = estrndup((*field)->value.str.val, tmp-(*field)->value.str.val);
|
||||
if ((tmp=strchr(Z_STRVAL_PP(field), '.'))) {
|
||||
table_name = estrndup(Z_STRVAL_PP(field), tmp-Z_STRVAL_PP(field));
|
||||
field_name = estrdup(tmp+1);
|
||||
} else {
|
||||
table_name = NULL;
|
||||
field_name = estrndup((*field)->value.str.val,(*field)->value.str.len);
|
||||
field_name = estrndup(Z_STRVAL_PP(field),Z_STRLEN_PP(field));
|
||||
}
|
||||
mysql_field_seek(mysql_result, 0);
|
||||
while ((tmp_field=mysql_fetch_field(mysql_result))) {
|
||||
@@ -1442,7 +1464,7 @@ PHP_FUNCTION(mysql_result)
|
||||
}
|
||||
if (!tmp_field) { /* no match found */
|
||||
php_error(E_WARNING, "%s%s%s not found in MySQL result index %d",
|
||||
(table_name?table_name:""), (table_name?".":""), field_name, (*result)->value.lval);
|
||||
(table_name?table_name:""), (table_name?".":""), field_name, Z_LVAL_PP(result));
|
||||
efree(field_name);
|
||||
if (table_name) {
|
||||
efree(table_name);
|
||||
@@ -1457,7 +1479,7 @@ PHP_FUNCTION(mysql_result)
|
||||
break;
|
||||
default:
|
||||
convert_to_long_ex(field);
|
||||
field_offset = (*field)->value.lval;
|
||||
field_offset = Z_LVAL_PP(field);
|
||||
if (field_offset<0 || field_offset>=(int)mysql_num_fields(mysql_result)) {
|
||||
php_error(E_WARNING, "Bad column offset specified");
|
||||
RETURN_FALSE;
|
||||
@@ -1467,16 +1489,16 @@ PHP_FUNCTION(mysql_result)
|
||||
}
|
||||
|
||||
if (sql_row[field_offset]) {
|
||||
return_value->type = IS_STRING;
|
||||
Z_TYPE_P(return_value) = IS_STRING;
|
||||
|
||||
if (PG(magic_quotes_runtime)) {
|
||||
return_value->value.str.val = php_addslashes(sql_row[field_offset], sql_row_lengths[field_offset],&return_value->value.str.len, 0 TSRMLS_CC);
|
||||
Z_STRVAL_P(return_value) = php_addslashes(sql_row[field_offset], sql_row_lengths[field_offset],&Z_STRLEN_P(return_value), 0 TSRMLS_CC);
|
||||
} else {
|
||||
return_value->value.str.len = sql_row_lengths[field_offset];
|
||||
return_value->value.str.val = (char *) safe_estrndup(sql_row[field_offset], return_value->value.str.len);
|
||||
Z_STRLEN_P(return_value) = sql_row_lengths[field_offset];
|
||||
Z_STRVAL_P(return_value) = (char *) safe_estrndup(sql_row[field_offset], Z_STRLEN_P(return_value));
|
||||
}
|
||||
} else {
|
||||
return_value->type = IS_NULL;
|
||||
Z_TYPE_P(return_value) = IS_NULL;
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
@@ -1496,8 +1518,8 @@ PHP_FUNCTION(mysql_num_rows)
|
||||
ZEND_FETCH_RESOURCE(mysql_result, MYSQL_RES *, result, -1, "MySQL result", le_result);
|
||||
|
||||
/* conversion from int64 to long happing here */
|
||||
return_value->value.lval = (long)mysql_num_rows(mysql_result);
|
||||
return_value->type = IS_LONG;
|
||||
Z_LVAL_P(return_value) = (long)mysql_num_rows(mysql_result);
|
||||
Z_TYPE_P(return_value) = IS_LONG;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -1514,8 +1536,8 @@ PHP_FUNCTION(mysql_num_fields)
|
||||
|
||||
ZEND_FETCH_RESOURCE(mysql_result, MYSQL_RES *, result, -1, "MySQL result", le_result);
|
||||
|
||||
return_value->value.lval = mysql_num_fields(mysql_result);
|
||||
return_value->type = IS_LONG;
|
||||
Z_LVAL_P(return_value) = mysql_num_fields(mysql_result);
|
||||
Z_TYPE_P(return_value) = IS_LONG;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -1549,7 +1571,7 @@ static void php_mysql_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, int result_type,
|
||||
RETURN_FALSE;
|
||||
}
|
||||
convert_to_long_ex(arg2);
|
||||
result_type = (*arg2)->value.lval;
|
||||
result_type = Z_LVAL_PP(arg2);
|
||||
break;
|
||||
default:
|
||||
WRONG_PARAM_COUNT;
|
||||
@@ -1620,7 +1642,7 @@ PHP_FUNCTION(mysql_fetch_object)
|
||||
php_mysql_fetch_hash(INTERNAL_FUNCTION_PARAM_PASSTHRU, MYSQL_ASSOC, 2);
|
||||
|
||||
if (Z_TYPE_P(return_value) == IS_ARRAY) {
|
||||
object_and_properties_init(return_value, &zend_standard_class_def, return_value->value.ht);
|
||||
object_and_properties_init(return_value, &zend_standard_class_def, Z_ARRVAL_P(return_value));
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
@@ -1657,11 +1679,11 @@ PHP_FUNCTION(mysql_data_seek)
|
||||
ZEND_FETCH_RESOURCE(mysql_result, MYSQL_RES *, result, -1, "MySQL result", le_result);
|
||||
|
||||
convert_to_long_ex(offset);
|
||||
if ((*offset)->value.lval<0 || (*offset)->value.lval>=(int)mysql_num_rows(mysql_result)) {
|
||||
php_error(E_WARNING, "Offset %d is invalid for MySQL result index %d", (*offset)->value.lval, (*result)->value.lval);
|
||||
if (Z_LVAL_PP(offset)<0 || Z_LVAL_PP(offset)>=(int)mysql_num_rows(mysql_result)) {
|
||||
php_error(E_WARNING, "Offset %d is invalid for MySQL result index %d", Z_LVAL_PP(offset), Z_LVAL_PP(result));
|
||||
RETURN_FALSE;
|
||||
}
|
||||
mysql_data_seek(mysql_result, (*offset)->value.lval);
|
||||
mysql_data_seek(mysql_result, Z_LVAL_PP(offset));
|
||||
RETURN_TRUE;
|
||||
}
|
||||
/* }}} */
|
||||
@@ -1781,11 +1803,11 @@ PHP_FUNCTION(mysql_fetch_field)
|
||||
ZEND_FETCH_RESOURCE(mysql_result, MYSQL_RES *, result, -1, "MySQL result", le_result);
|
||||
|
||||
if (field) {
|
||||
if ((*field)->value.lval<0 || (*field)->value.lval>=(int)mysql_num_fields(mysql_result)) {
|
||||
if (Z_LVAL_PP(field)<0 || Z_LVAL_PP(field)>=(int)mysql_num_fields(mysql_result)) {
|
||||
php_error(E_WARNING, "MySQL: Bad field offset");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
mysql_field_seek(mysql_result, (*field)->value.lval);
|
||||
mysql_field_seek(mysql_result, Z_LVAL_PP(field));
|
||||
}
|
||||
if ((mysql_field=mysql_fetch_field(mysql_result))==NULL) {
|
||||
RETURN_FALSE;
|
||||
@@ -1802,9 +1824,9 @@ PHP_FUNCTION(mysql_fetch_field)
|
||||
add_property_long(return_value, "primary_key", IS_PRI_KEY(mysql_field->flags)?1:0);
|
||||
add_property_long(return_value, "multiple_key",(mysql_field->flags&MULTIPLE_KEY_FLAG?1:0));
|
||||
add_property_long(return_value, "unique_key",(mysql_field->flags&UNIQUE_KEY_FLAG?1:0));
|
||||
add_property_long(return_value, "numeric", IS_NUM(mysql_field->type)?1:0);
|
||||
add_property_long(return_value, "numeric", IS_NUM(Z_TYPE_P(mysql_field))?1:0);
|
||||
add_property_long(return_value, "blob", IS_BLOB(mysql_field->flags)?1:0);
|
||||
add_property_string(return_value, "type", php_mysql_get_field_name(mysql_field->type), 1);
|
||||
add_property_string(return_value, "type", php_mysql_get_field_name(Z_TYPE_P(mysql_field)), 1);
|
||||
add_property_long(return_value, "unsigned",(mysql_field->flags&UNSIGNED_FLAG?1:0));
|
||||
add_property_long(return_value, "zerofill",(mysql_field->flags&ZEROFILL_FLAG?1:0));
|
||||
}
|
||||
@@ -1825,11 +1847,11 @@ PHP_FUNCTION(mysql_field_seek)
|
||||
ZEND_FETCH_RESOURCE(mysql_result, MYSQL_RES *, result, -1, "MySQL result", le_result);
|
||||
|
||||
convert_to_long_ex(offset);
|
||||
if ((*offset)->value.lval<0 || (*offset)->value.lval>=(int)mysql_num_fields(mysql_result)) {
|
||||
php_error(E_WARNING, "Field %d is invalid for MySQL result index %d", (*offset)->value.lval, (*result)->value.lval);
|
||||
if (Z_LVAL_PP(offset)<0 || Z_LVAL_PP(offset)>=(int)mysql_num_fields(mysql_result)) {
|
||||
php_error(E_WARNING, "Field %d is invalid for MySQL result index %d", Z_LVAL_PP(offset), Z_LVAL_PP(result));
|
||||
RETURN_FALSE;
|
||||
}
|
||||
mysql_field_seek(mysql_result, (*offset)->value.lval);
|
||||
mysql_field_seek(mysql_result, Z_LVAL_PP(offset));
|
||||
RETURN_TRUE;
|
||||
}
|
||||
/* }}} */
|
||||
@@ -1858,35 +1880,35 @@ static void php_mysql_field_info(INTERNAL_FUNCTION_PARAMETERS, int entry_type)
|
||||
ZEND_FETCH_RESOURCE(mysql_result, MYSQL_RES *, result, -1, "MySQL result", le_result);
|
||||
|
||||
convert_to_long_ex(field);
|
||||
if ((*field)->value.lval<0 || (*field)->value.lval>=(int)mysql_num_fields(mysql_result)) {
|
||||
php_error(E_WARNING, "Field %d is invalid for MySQL result index %d", (*field)->value.lval, (*result)->value.lval);
|
||||
if (Z_LVAL_PP(field)<0 || Z_LVAL_PP(field)>=(int)mysql_num_fields(mysql_result)) {
|
||||
php_error(E_WARNING, "Field %d is invalid for MySQL result index %d", Z_LVAL_PP(field), Z_LVAL_PP(result));
|
||||
RETURN_FALSE;
|
||||
}
|
||||
mysql_field_seek(mysql_result, (*field)->value.lval);
|
||||
mysql_field_seek(mysql_result, Z_LVAL_PP(field));
|
||||
if ((mysql_field=mysql_fetch_field(mysql_result))==NULL) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
switch (entry_type) {
|
||||
case PHP_MYSQL_FIELD_NAME:
|
||||
return_value->value.str.len = strlen(mysql_field->name);
|
||||
return_value->value.str.val = estrndup(mysql_field->name, return_value->value.str.len);
|
||||
return_value->type = IS_STRING;
|
||||
Z_STRLEN_P(return_value) = strlen(mysql_field->name);
|
||||
Z_STRVAL_P(return_value) = estrndup(mysql_field->name, Z_STRLEN_P(return_value));
|
||||
Z_TYPE_P(return_value) = IS_STRING;
|
||||
break;
|
||||
case PHP_MYSQL_FIELD_TABLE:
|
||||
return_value->value.str.len = strlen(mysql_field->table);
|
||||
return_value->value.str.val = estrndup(mysql_field->table, return_value->value.str.len);
|
||||
return_value->type = IS_STRING;
|
||||
Z_STRLEN_P(return_value) = strlen(mysql_field->table);
|
||||
Z_STRVAL_P(return_value) = estrndup(mysql_field->table, Z_STRLEN_P(return_value));
|
||||
Z_TYPE_P(return_value) = IS_STRING;
|
||||
break;
|
||||
case PHP_MYSQL_FIELD_LEN:
|
||||
return_value->value.lval = mysql_field->length;
|
||||
return_value->type = IS_LONG;
|
||||
Z_LVAL_P(return_value) = mysql_field->length;
|
||||
Z_TYPE_P(return_value) = IS_LONG;
|
||||
break;
|
||||
case PHP_MYSQL_FIELD_TYPE:
|
||||
return_value->value.str.val = php_mysql_get_field_name(mysql_field->type);
|
||||
return_value->value.str.len = strlen(return_value->value.str.val);
|
||||
return_value->value.str.val = estrndup(return_value->value.str.val, return_value->value.str.len);
|
||||
return_value->type = IS_STRING;
|
||||
Z_STRVAL_P(return_value) = php_mysql_get_field_name(Z_TYPE_P(mysql_field));
|
||||
Z_STRLEN_P(return_value) = strlen(Z_STRVAL_P(return_value));
|
||||
Z_STRVAL_P(return_value) = estrndup(Z_STRVAL_P(return_value), Z_STRLEN_P(return_value));
|
||||
Z_TYPE_P(return_value) = IS_STRING;
|
||||
break;
|
||||
case PHP_MYSQL_FIELD_FLAGS:
|
||||
strcpy(buf, "");
|
||||
@@ -1935,6 +1957,11 @@ static void php_mysql_field_info(INTERNAL_FUNCTION_PARAMETERS, int entry_type)
|
||||
strcat(buf, "enum ");
|
||||
}
|
||||
#endif
|
||||
#ifdef SET_FLAG
|
||||
if (mysql_field->flags&SET_FLAG) {
|
||||
strcat(buf, "set ");
|
||||
}
|
||||
#endif
|
||||
#ifdef AUTO_INCREMENT_FLAG
|
||||
if (mysql_field->flags&AUTO_INCREMENT_FLAG) {
|
||||
strcat(buf, "auto_increment ");
|
||||
@@ -1952,9 +1979,9 @@ static void php_mysql_field_info(INTERNAL_FUNCTION_PARAMETERS, int entry_type)
|
||||
len--;
|
||||
}
|
||||
|
||||
return_value->value.str.len = len;
|
||||
return_value->value.str.val = estrndup(buf, len);
|
||||
return_value->type = IS_STRING;
|
||||
Z_STRLEN_P(return_value) = len;
|
||||
Z_STRVAL_P(return_value) = estrndup(buf, len);
|
||||
Z_TYPE_P(return_value) = IS_STRING;
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -2019,17 +2046,16 @@ PHP_FUNCTION(mysql_free_result)
|
||||
WRONG_PARAM_COUNT;
|
||||
}
|
||||
|
||||
if ((*result)->type==IS_RESOURCE && (*result)->value.lval==0) {
|
||||
if (Z_TYPE_PP(result)==IS_RESOURCE && Z_LVAL_PP(result)==0) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
ZEND_FETCH_RESOURCE(mysql_result, MYSQL_RES *, result, -1, "MySQL result", le_result);
|
||||
|
||||
zend_list_delete((*result)->value.lval);
|
||||
zend_list_delete(Z_LVAL_PP(result));
|
||||
RETURN_TRUE;
|
||||
}
|
||||
/* }}} */
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
@@ -2037,6 +2063,6 @@ PHP_FUNCTION(mysql_free_result)
|
||||
* tab-width: 4
|
||||
* c-basic-offset: 4
|
||||
* End:
|
||||
* vim600: sw=4 ts=4 tw=78 fdm=marker
|
||||
* vim<600: sw=4 ts=4 tw=78
|
||||
* vim600: sw=4 ts=4 fdm=marker
|
||||
* vim<600: sw=4 ts=4
|
||||
*/
|
||||
@@ -48,8 +48,10 @@ PHP_FUNCTION(mysql_connect);
|
||||
PHP_FUNCTION(mysql_pconnect);
|
||||
PHP_FUNCTION(mysql_close);
|
||||
PHP_FUNCTION(mysql_select_db);
|
||||
#if MYSQL_VERSION_ID < 40000
|
||||
PHP_FUNCTION(mysql_create_db);
|
||||
PHP_FUNCTION(mysql_drop_db);
|
||||
#endif
|
||||
PHP_FUNCTION(mysql_query);
|
||||
PHP_FUNCTION(mysql_unbuffered_query);
|
||||
PHP_FUNCTION(mysql_db_query);
|
||||
|
||||
@@ -32,7 +32,7 @@ if test "$PHP_NCURSES" != "no"; then
|
||||
LIBNAME=ncurses
|
||||
LIBSYMBOL=initscr
|
||||
old_LIBS=$LIBS
|
||||
LIBS="$LIBS -L$NCURSES_DIR/lib -lm -ldl"
|
||||
LIBS="$LIBS -L$NCURSES_DIR/lib -lm"
|
||||
AC_CHECK_LIB($LIBNAME, $LIBSYMBOL, [AC_DEFINE(HAVE_NCURSESLIB,1,[ ])],
|
||||
[AC_MSG_ERROR(wrong ncurses lib version or lib not found)])
|
||||
LIBS=$old_LIBS
|
||||
|
||||
+18
-8
@@ -385,7 +385,8 @@ static void php_pcre_match(INTERNAL_FUNCTION_PARAMETERS, int global)
|
||||
}
|
||||
|
||||
/* Calculate the size of the offsets array, and allocate memory for it. */
|
||||
num_subpats = pcre_info(re, NULL, NULL) + 1;
|
||||
pcre_fullinfo(re, extra, PCRE_INFO_CAPTURECOUNT, &num_subpats);
|
||||
num_subpats++;
|
||||
size_offsets = num_subpats * 3;
|
||||
offsets = (int *)emalloc(size_offsets * sizeof(int));
|
||||
|
||||
@@ -434,29 +435,38 @@ static void php_pcre_match(INTERNAL_FUNCTION_PARAMETERS, int global)
|
||||
|
||||
if (global) { /* global pattern matching */
|
||||
if (subpats_order_val == PREG_PATTERN_ORDER) {
|
||||
/* For each subpattern, insert it into the appropriate array */
|
||||
for (i=0; i<count; i++) {
|
||||
/* For each subpattern, insert it into the appropriate array. */
|
||||
for (i = 0; i < count; i++) {
|
||||
add_next_index_string(match_sets[i], (char *)stringlist[i], 1);
|
||||
}
|
||||
}
|
||||
else {
|
||||
/*
|
||||
* If the number of captured subpatterns on this run is
|
||||
* less than the total possible number, pad the result
|
||||
* arrays with empty strings.
|
||||
*/
|
||||
if (count < num_subpats) {
|
||||
for (; i < num_subpats; i++) {
|
||||
add_next_index_string(match_sets[i], empty_string, 1);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
/* Allocate the result set array */
|
||||
ALLOC_ZVAL(result_set);
|
||||
array_init(result_set);
|
||||
INIT_PZVAL(result_set);
|
||||
|
||||
/* Add all the subpatterns to it */
|
||||
for (i=0; i<count; i++) {
|
||||
for (i = 0; i < count; i++) {
|
||||
add_next_index_string(result_set, (char *)stringlist[i], 1);
|
||||
}
|
||||
/* And add it to the output array */
|
||||
zend_hash_next_index_insert(Z_ARRVAL_PP(subpats), &result_set,
|
||||
sizeof(zval *), NULL);
|
||||
sizeof(zval *), NULL);
|
||||
}
|
||||
}
|
||||
else { /* single pattern matching */
|
||||
/* For each subpattern, insert it into the subpatterns array. */
|
||||
for (i=0; i<count; i++) {
|
||||
for (i = 0; i < count; i++) {
|
||||
add_next_index_string((*subpats), (char *)stringlist[i], 1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,6 +41,9 @@ PHP_FUNCTION(preg_split);
|
||||
PHP_FUNCTION(preg_quote);
|
||||
PHP_FUNCTION(preg_grep);
|
||||
|
||||
char *php_pcre_replace(char *regex, int regex_len, char *subject, int subject_len,
|
||||
zval *replace_val, int is_callable_replace, int *result_len, int limit TSRMLS_DC);
|
||||
|
||||
extern zend_module_entry pcre_module_entry;
|
||||
#define pcre_module_ptr &pcre_module_entry
|
||||
|
||||
|
||||
@@ -65,6 +65,7 @@ function_entry pspell_functions[] = {
|
||||
PHP_FE(pspell_config_personal, NULL)
|
||||
PHP_FE(pspell_config_repl, NULL)
|
||||
PHP_FE(pspell_config_save_repl, NULL)
|
||||
{NULL, NULL, NULL}
|
||||
};
|
||||
/* }}} */
|
||||
|
||||
|
||||
@@ -59,7 +59,15 @@ static PHP_MINFO_FUNCTION(VARIANT)
|
||||
|
||||
|
||||
zend_module_entry VARIANT_module_entry = {
|
||||
"variant", VARIANT_functions, PHP_MINIT(VARIANT), PHP_MSHUTDOWN(VARIANT), NULL, NULL, PHP_MINFO(VARIANT), STANDARD_MODULE_PROPERTIES
|
||||
STANDARD_MODULE_HEADER,
|
||||
"variant",
|
||||
VARIANT_functions,
|
||||
PHP_MINIT(VARIANT),
|
||||
PHP_MSHUTDOWN(VARIANT),
|
||||
NULL, NULL,
|
||||
PHP_MINFO(VARIANT),
|
||||
NO_VERSION_YET,
|
||||
STANDARD_MODULE_PROPERTIES
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -206,12 +206,18 @@ static void xmlrpc_server_destructor(zend_rsrc_list_entry *rsrc) {
|
||||
}
|
||||
}
|
||||
|
||||
static void xmlrpc_init_globals(php_xmlrpc_globals *xmlrpc_globals)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
/* module init */
|
||||
PHP_MINIT_FUNCTION(xmlrpc)
|
||||
{
|
||||
/* Remove comments if you have entries in php.ini
|
||||
REGISTER_INI_ENTRIES();
|
||||
*/
|
||||
ZEND_INIT_MODULE_GLOBALS(xmlrpc, xmlrpc_init_globals, NULL);
|
||||
XMLRPCG(le_xmlrpc_server) = zend_register_list_destructors_ex(xmlrpc_server_destructor, NULL, "xmlrpc server", module_number);
|
||||
|
||||
return SUCCESS;
|
||||
@@ -842,6 +848,7 @@ static XMLRPC_VALUE php_xmlrpc_callback(XMLRPC_SERVER server, XMLRPC_REQUEST xRe
|
||||
xmlrpc_callback_data* pData = (xmlrpc_callback_data*)data;
|
||||
pval* xmlrpc_params;
|
||||
pval* callback_params[3];
|
||||
TSRMLS_FETCH();
|
||||
|
||||
/* convert xmlrpc to native php types */
|
||||
xmlrpc_params = XMLRPC_to_PHP(XMLRPC_RequestGetData(xRequest));
|
||||
@@ -866,7 +873,8 @@ static void php_xmlrpc_introspection_callback(XMLRPC_SERVER server, void* data)
|
||||
pval *retval_ptr, **php_function;
|
||||
pval* callback_params[1];
|
||||
xmlrpc_callback_data* pData = (xmlrpc_callback_data*)data;
|
||||
|
||||
TSRMLS_FETCH();
|
||||
|
||||
MAKE_STD_ZVAL(retval_ptr);
|
||||
Z_TYPE_P(retval_ptr) = IS_NULL;
|
||||
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
Sablotron XSLT
|
||||
Sterling Hughes
|
||||
@@ -1,5 +0,0 @@
|
||||
this extension is experimental,
|
||||
its functions may change their names
|
||||
or move to extension all together
|
||||
so do not rely to much on them
|
||||
you have been warned!
|
||||
@@ -1,8 +0,0 @@
|
||||
# $Id $
|
||||
|
||||
LTLIBRARY_NAME = libsablot.la
|
||||
LTLIBRARY_SOURCES = sablot.c
|
||||
LTLIBRARY_SHARED_NAME = sablot.la
|
||||
LTLIBRARY_SHARED_LIBADD = $(SABLOT_SHARED_LIBADD)
|
||||
|
||||
include $(top_srcdir)/build/dynlib.mk
|
||||
@@ -1,68 +0,0 @@
|
||||
dnl $Id$
|
||||
dnl config.m4 for extension Sablot
|
||||
|
||||
PHP_ARG_WITH(sablot, for Sablotron XSL support,
|
||||
[ --with-sablot[=DIR] Include Sablotron support])
|
||||
|
||||
PHP_ARG_WITH(expat-dir, libexpat dir for Sablotron 0.50,
|
||||
[ --with-expat-dir=DIR Sablotron: libexpat dir for Sablotron 0.50])
|
||||
|
||||
if test "$PHP_SABLOT" != "no"; then
|
||||
|
||||
|
||||
PHP_EXTENSION(sablot, $ext_shared)
|
||||
PHP_SUBST(SABLOT_SHARED_LIBADD)
|
||||
|
||||
if test -r $PHP_SABLOT/include/sablot.h; then
|
||||
SABLOT_DIR=$PHP_SABLOT
|
||||
else
|
||||
AC_MSG_CHECKING(for Sablotron in default path)
|
||||
for i in /usr/local /usr; do
|
||||
if test -r $i/include/sablot.h; then
|
||||
SABLOT_DIR=$i
|
||||
AC_MSG_RESULT(found in $i)
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
if test -z "$SABLOT_DIR"; then
|
||||
AC_MSG_RESULT(not found)
|
||||
AC_MSG_ERROR(Please reinstall the Sablotron distribution)
|
||||
fi
|
||||
|
||||
testval=no
|
||||
for i in $PHP_EXPAT_DIR $SABLOT_DIR; do
|
||||
if test -f $i/lib/libexpat.a" -o -f "$i/lib/libexpat.$SHLIB_SUFFIX_NAME; then
|
||||
AC_DEFINE(HAVE_LIBEXPAT2,1,[ ])
|
||||
PHP_ADD_LIBRARY_WITH_PATH(expat, $i/lib, SABLOT_SHARED_LIBADD)
|
||||
PHP_ADD_INCLUDE($i/include)
|
||||
AC_CHECK_LIB(sablot, SablotSetEncoding, AC_DEFINE(HAVE_SABLOT_SET_ENCODING,1,[ ]))
|
||||
testval=yes
|
||||
fi
|
||||
done
|
||||
|
||||
if test "$testval" = "no"; then
|
||||
PHP_ADD_LIBRARY(xmlparse)
|
||||
PHP_ADD_LIBRARY(xmltok)
|
||||
fi
|
||||
|
||||
PHP_ADD_INCLUDE($SABLOT_DIR/include)
|
||||
PHP_ADD_LIBRARY_WITH_PATH(sablot, $SABLOT_DIR/lib, SABLOT_SHARED_LIBADD)
|
||||
|
||||
found_iconv=no
|
||||
AC_CHECK_LIB(c, iconv_open, found_iconv=yes)
|
||||
if test "$found_iconv" = "no"; then
|
||||
for i in /usr /usr/local $ICONV_DIR; do
|
||||
if test -f $i/lib/libconv.a -o -f $i/lib/libiconv.$SHLIB_SUFFIX_NAME; then
|
||||
PHP_ADD_LIBRARY_WITH_PATH(iconv, $i/lib, SABLOT_SHARED_LIBADD)
|
||||
found_iconv=yes
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
if test "$found_iconv" = "no"; then
|
||||
AC_MSG_ERROR(iconv not found, in order to build sablotron you need the iconv library)
|
||||
fi
|
||||
|
||||
AC_DEFINE(HAVE_SABLOT,1,[ ])
|
||||
fi
|
||||
@@ -1,138 +0,0 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| PHP version 4.0 |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1997-2001 The PHP Group |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.02 of the PHP license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
| available at through the world-wide-web at |
|
||||
| http://www.php.net/license/2_02.txt. |
|
||||
| If you did not receive a copy of the PHP license and are unable to |
|
||||
| obtain it through the world-wide-web, please send a note to |
|
||||
| license@php.net so we can mail you a copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
| Authors: Sterling Hughes <sterling@php.net> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
#ifndef PHP_SABLOT_H
|
||||
#define PHP_SABLOT_H
|
||||
|
||||
#if HAVE_SABLOT
|
||||
|
||||
#include <sablot.h>
|
||||
|
||||
extern zend_module_entry sablot_module_entry;
|
||||
#define phpext_sablot_ptr &sablot_module_entry
|
||||
|
||||
#ifdef PHP_WIN32
|
||||
#define PHP_SABLOT_API __declspec(dllexport)
|
||||
#else
|
||||
#define PHP_SABLOT_API
|
||||
#endif
|
||||
|
||||
/* Module functions */
|
||||
PHP_MINIT_FUNCTION(sablot);
|
||||
PHP_MINFO_FUNCTION(sablot);
|
||||
PHP_MSHUTDOWN_FUNCTION(sablot);
|
||||
|
||||
/* Request functions */
|
||||
PHP_RSHUTDOWN_FUNCTION(sablot);
|
||||
|
||||
/* Output transformation functions */
|
||||
PHP_FUNCTION(xslt_output_begintransform);
|
||||
PHP_FUNCTION(xslt_output_endtransform);
|
||||
|
||||
/* Basic transformation functions */
|
||||
PHP_FUNCTION(xslt_transform);
|
||||
PHP_FUNCTION(xslt_process);
|
||||
|
||||
/* Advanced API transformation functions */
|
||||
PHP_FUNCTION(xslt_create);
|
||||
PHP_FUNCTION(xslt_run);
|
||||
PHP_FUNCTION(xslt_set_sax_handler);
|
||||
PHP_FUNCTION(xslt_set_scheme_handler);
|
||||
PHP_FUNCTION(xslt_set_error_handler);
|
||||
#ifdef HAVE_SABLOT_SET_ENCODING
|
||||
PHP_FUNCTION(xslt_set_encoding);
|
||||
#endif
|
||||
PHP_FUNCTION(xslt_set_base);
|
||||
PHP_FUNCTION(xslt_fetch_result);
|
||||
PHP_FUNCTION(xslt_free);
|
||||
|
||||
/* Error Handling functions */
|
||||
PHP_FUNCTION(xslt_error);
|
||||
PHP_FUNCTION(xslt_errno);
|
||||
PHP_FUNCTION(xslt_openlog);
|
||||
PHP_FUNCTION(xslt_closelog);
|
||||
|
||||
/* Sablotron error structure */
|
||||
struct _php_sablot_error {
|
||||
char *key;
|
||||
char *value;
|
||||
struct _php_sablot_error *next;
|
||||
};
|
||||
|
||||
typedef struct _php_sablot_error php_sablot_error;
|
||||
|
||||
|
||||
/* Sablotron Handle */
|
||||
typedef struct {
|
||||
|
||||
/* Error Handling */
|
||||
zval *errorHandler;
|
||||
php_sablot_error *errors;
|
||||
php_sablot_error errors_start;
|
||||
int last_errno;
|
||||
|
||||
/* SAX Handling */
|
||||
long index;
|
||||
zval *startDocHandler;
|
||||
zval *startElementHandler;
|
||||
zval *endElementHandler;
|
||||
zval *startNamespaceHandler;
|
||||
zval *endNamespaceHandler;
|
||||
zval *commentHandler;
|
||||
zval *PIHandler;
|
||||
zval *charactersHandler;
|
||||
zval *endDocHandler;
|
||||
|
||||
/* Scheme Handling */
|
||||
zval *getAllHandler;
|
||||
|
||||
/* Sablotron Related */
|
||||
SablotHandle p;
|
||||
|
||||
} php_sablot;
|
||||
|
||||
|
||||
/* Sablotron Globals */
|
||||
ZEND_BEGIN_MODULE_GLOBALS(sablot)
|
||||
zval *errorHandler;
|
||||
php_sablot_error *errors;
|
||||
php_sablot_error errors_start;
|
||||
char *output_transform_file; /* For output transformations */
|
||||
int last_errno; /* Global last_errno, if no handle is found */
|
||||
SablotHandle processor;
|
||||
ZEND_END_MODULE_GLOBALS(sablot)
|
||||
|
||||
|
||||
#ifdef ZTS
|
||||
#define SABLOTG(v) TSRMG(sablot_globals_id, php_sablot_globals *, v)
|
||||
#else
|
||||
#define SABLOTG(v) (sablot_globals.v)
|
||||
#endif
|
||||
|
||||
#else
|
||||
#define phpext_sablot_ptr NULL
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Local variables:
|
||||
* tab-width: 4
|
||||
* c-basic-offset: 4
|
||||
* End:
|
||||
*/
|
||||
-1685
File diff suppressed because it is too large.
Load diff
@@ -1,107 +0,0 @@
|
||||
# Microsoft Developer Studio Project File - Name="sablot" - Package Owner=<4>
|
||||
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||
# ** DO NOT EDIT **
|
||||
|
||||
# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
|
||||
|
||||
CFG=sablot - 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 "sablot.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 "sablot.mak" CFG="sablot - Win32 Debug_TS"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "sablot - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
|
||||
!MESSAGE "sablot - Win32 Release_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)" == "sablot - 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 /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "SABLOT_EXPORTS" /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "..\..\\" /I "..\..\main" /I "..\..\TSRM" /I "..\..\ZEND" /D ZEND_WIN32=1 /D PHP_WIN32=1 /D "NDEBUG" /D "PHP_EXPORTS" /D "HAVE_SABLOT" /D COMPILE_DL_SABLOT=1 /D ZEND_DEBUG=0 /D "ZTS" /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 sablot.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_sablot.dll" /pdbtype:sept /libpath:"..\..\Debug_TS"
|
||||
|
||||
!ELSEIF "$(CFG)" == "sablot - 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 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 /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "SABLOT_EXPORTS" /YX /FD /c
|
||||
# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\..\\" /I "..\..\main" /I "..\..\TSRM" /I "..\..\ZEND" /D ZEND_WIN32=1 /D PHP_WIN32=1 /D "NDEBUG" /D "PHP_EXPORTS" /D "HAVE_SABLOT" /D COMPILE_DL_SABLOT=1 /D ZEND_DEBUG=0 /D "ZTS" /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 php4ts.lib sablot.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 /out:"..\..\Release_TS/php_sablot.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline"
|
||||
|
||||
!ENDIF
|
||||
|
||||
# Begin Target
|
||||
|
||||
# Name "sablot - Win32 Debug_TS"
|
||||
# Name "sablot - Win32 Release_TS"
|
||||
# Begin Group "Source Files"
|
||||
|
||||
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\sablot.c
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Header Files"
|
||||
|
||||
# PROP Default_Filter "h;hpp;hxx;hm;inl"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\php_sablot.h
|
||||
# End Source File
|
||||
# End Group
|
||||
# End Target
|
||||
# End Project
|
||||
@@ -3,7 +3,7 @@ Get a value from an object of type Random
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("satellite")) print "skip";
|
||||
// internet connection needed, try to lookup www.php.net
|
||||
exec("host www.php.net 2>/dev/null", $output, &$rv);
|
||||
exec("host www.php.net 2>/dev/null", $output, $rv);
|
||||
if ($rv) print "skip";
|
||||
?>
|
||||
--POST--
|
||||
|
||||
@@ -36,4 +36,5 @@ if test "$PHP_SESSION" != "no"; then
|
||||
PHP_MISSING_PREAD_DECL
|
||||
PHP_EXTENSION(session,$ext_shared)
|
||||
PHP_SUBST(SESSION_SHARED_LIBADD)
|
||||
AC_DEFINE(HAVE_PHP_SESSION,1,[ ])
|
||||
fi
|
||||
+40
-10
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| PHP version 4.0 |
|
||||
| PHP Version 4 |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1997-2001 The PHP Group |
|
||||
| Copyright (c) 1997-2002 The PHP Group |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.02 of the PHP license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
@@ -22,6 +22,7 @@
|
||||
|
||||
#ifdef HAVE_LIBMM
|
||||
|
||||
#include <unistd.h>
|
||||
#include <mm.h>
|
||||
#include <time.h>
|
||||
#include <sys/stat.h>
|
||||
@@ -30,12 +31,13 @@
|
||||
|
||||
#include "php_session.h"
|
||||
#include "mod_mm.h"
|
||||
#include "SAPI.h"
|
||||
|
||||
#ifdef ZTS
|
||||
# error mm is not thread-safe
|
||||
#endif
|
||||
|
||||
#define PS_MM_PATH "/tmp/session_mm"
|
||||
#define PS_MM_FILE "session_mm_"
|
||||
|
||||
/* For php_uint32 */
|
||||
#include "ext/standard/basic_functions.h"
|
||||
@@ -247,8 +249,36 @@ static void ps_mm_destroy(ps_mm *data)
|
||||
|
||||
PHP_MINIT_FUNCTION(ps_mm)
|
||||
{
|
||||
int save_path_len = strlen(PS(save_path));
|
||||
int mod_name_len = strlen(sapi_module.name);
|
||||
char *ps_mm_path, euid[30];
|
||||
int ret;
|
||||
|
||||
ps_mm_instance = calloc(sizeof(*ps_mm_instance), 1);
|
||||
if (ps_mm_initialize(ps_mm_instance, PS_MM_PATH) != SUCCESS) {
|
||||
if (!ps_mm_instance)
|
||||
return FAILURE;
|
||||
|
||||
if (!sprintf(euid,"%d", geteuid()))
|
||||
return FAILURE;
|
||||
|
||||
/* Directory + '/' + File + Module Name + Effective UID + \0 */
|
||||
ps_mm_path = do_alloca(save_path_len+1+sizeof(PS_MM_FILE)+mod_name_len+strlen(euid)+1);
|
||||
|
||||
memcpy(ps_mm_path, PS(save_path), save_path_len + 1);
|
||||
if (save_path_len > 0 && ps_mm_path[save_path_len - 1] != DEFAULT_SLASH) {
|
||||
ps_mm_path[save_path_len] = DEFAULT_SLASH;
|
||||
ps_mm_path[save_path_len+1] = '\0';
|
||||
}
|
||||
strcat(ps_mm_path, PS_MM_FILE);
|
||||
strcat(ps_mm_path, sapi_module.name);
|
||||
strcat(ps_mm_path, euid);
|
||||
|
||||
ret = ps_mm_initialize(ps_mm_instance, ps_mm_path);
|
||||
|
||||
free_alloca(ps_mm_path);
|
||||
|
||||
if (ret != SUCCESS) {
|
||||
free(ps_mm_instance);
|
||||
ps_mm_instance = NULL;
|
||||
return FAILURE;
|
||||
}
|
||||
@@ -289,7 +319,6 @@ PS_READ_FUNC(mm)
|
||||
{
|
||||
PS_MM_DATA;
|
||||
ps_sd *sd;
|
||||
int ret = FAILURE;
|
||||
|
||||
mm_lock(data->mm, MM_LOCK_RD);
|
||||
|
||||
@@ -299,12 +328,13 @@ PS_READ_FUNC(mm)
|
||||
*val = emalloc(sd->datalen + 1);
|
||||
memcpy(*val, sd->data, sd->datalen);
|
||||
(*val)[sd->datalen] = '\0';
|
||||
ret = SUCCESS;
|
||||
}
|
||||
|
||||
else {
|
||||
*val = estrdup("");
|
||||
}
|
||||
mm_unlock(data->mm);
|
||||
|
||||
return ret;
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
PS_WRITE_FUNC(mm)
|
||||
@@ -411,6 +441,6 @@ zend_module_entry php_session_mm_module = {
|
||||
* tab-width: 4
|
||||
* c-basic-offset: 4
|
||||
* End:
|
||||
* vim600: sw=4 ts=4 tw=78 fdm=marker
|
||||
* vim<600: sw=4 ts=4 tw=78
|
||||
* vim600: sw=4 ts=4 fdm=marker
|
||||
* vim<600: sw=4 ts=4
|
||||
*/
|
||||
@@ -167,8 +167,12 @@ int php_session_register_serializer(const char *name,
|
||||
|
||||
#define PS_ADD_VAR(name) PS_ADD_VARL(name, strlen(name))
|
||||
|
||||
#define PS_DEL_VARL(name,namelen) \
|
||||
zend_hash_del(&PS(vars), name, namelen + 1);
|
||||
#define PS_DEL_VARL(name,namelen) \
|
||||
zend_hash_del(&PS(vars), name, namelen+1); \
|
||||
if (PS(http_session_vars)) { \
|
||||
zend_hash_del(Z_ARRVAL_P(PS(http_session_vars)), name, namelen+1); \
|
||||
}
|
||||
|
||||
|
||||
#define PS_DEL_VAR(name) PS_DEL_VARL(name, strlen(name))
|
||||
|
||||
|
||||
+17
-16
@@ -87,7 +87,7 @@ static PHP_INI_MH(OnUpdateSaveHandler)
|
||||
{
|
||||
PS(mod) = _php_find_ps_module(new_value TSRMLS_CC);
|
||||
if(!PS(mod)) {
|
||||
php_error(E_ERROR,"Cannot find save handler %s",new_value);
|
||||
php_error(E_ERROR,"Cannot find save handler %s",new_value);
|
||||
}
|
||||
return SUCCESS;
|
||||
}
|
||||
@@ -265,14 +265,15 @@ void php_set_session_var(char *name, size_t namelen, zval *state_val,HashTable *
|
||||
|
||||
int php_get_session_var(char *name, size_t namelen, zval ***state_var TSRMLS_DC)
|
||||
{
|
||||
HashTable *ht = &EG(symbol_table);
|
||||
|
||||
if (!PG(register_globals))
|
||||
ht = PS(http_session_vars) ? Z_ARRVAL_P(PS(http_session_vars)) : NULL;
|
||||
|
||||
if (!ht) return HASH_KEY_NON_EXISTANT;
|
||||
|
||||
return zend_hash_find(ht, name, namelen + 1, (void **)state_var);
|
||||
if (PS(http_session_vars)) {
|
||||
if (zend_hash_find(Z_ARRVAL_P(PS(http_session_vars)), name, namelen+1, (void **) state_var)==SUCCESS) {
|
||||
return SUCCESS;
|
||||
}
|
||||
} else if (!PG(register_globals)) {
|
||||
/* register_globals is disabled, but we don't have http_session_vars */
|
||||
return HASH_KEY_NON_EXISTANT;
|
||||
}
|
||||
return zend_hash_find(&EG(symbol_table), name, namelen+1, (void **) state_var);
|
||||
}
|
||||
|
||||
#define PS_BIN_NR_OF_BITS 8
|
||||
@@ -534,12 +535,12 @@ static void php_session_save_current_state(TSRMLS_D)
|
||||
uint variable_len;
|
||||
ulong num_key;
|
||||
HashPosition pos;
|
||||
|
||||
if (!PG(register_globals)) {
|
||||
if (!PS(http_session_vars)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (!PG(register_globals) && !PS(http_session_vars)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (PS(http_session_vars)) {
|
||||
for (zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(PS(http_session_vars)), &pos);
|
||||
zend_hash_get_current_key_ex(Z_ARRVAL_P(PS(http_session_vars)), &variable, &variable_len, &num_key, 0, &pos) == HASH_KEY_IS_STRING;
|
||||
zend_hash_move_forward_ex(Z_ARRVAL_P(PS(http_session_vars)),&pos)) {
|
||||
@@ -1005,7 +1006,7 @@ PHP_FUNCTION(session_module_name)
|
||||
int ac = ZEND_NUM_ARGS();
|
||||
char *old;
|
||||
|
||||
old = estrdup(PS(mod)->name);
|
||||
old = safe_estrdup(PS(mod)->name);
|
||||
|
||||
if (ac < 0 || ac > 1 || zend_get_parameters_ex(ac, &p_name) == FAILURE)
|
||||
WRONG_PARAM_COUNT;
|
||||
|
||||
+18
-14
@@ -1,31 +1,35 @@
|
||||
last update sept 3, 2000 (slavapl@mailandnews.com/iliaa@home.com)
|
||||
last update Jan 2, 2002 (hackie@prohost.org/ilia@prohost.org)
|
||||
|
||||
Shared Memory Operations Extension to PHP4
|
||||
|
||||
While developing a search deamon we needed the php based front end
|
||||
to communicate the deamon via SHM. Now, PHP already had a shared memory
|
||||
While developing a search deamon we needed a php based front end
|
||||
to communicate the deamon via SHM. PHP already had a shared memory
|
||||
extention (sysvshm) written by Christian Cartus <cartus@atrior.de>,
|
||||
unfortunatly this extention was designed with PHP only in mind, and
|
||||
unfortunatly this extention was designed with PHP only in mind and
|
||||
offers high level features which are extremly bothersome for basic SHM
|
||||
we had in mind. After spending a day trying to reverse engeener figure
|
||||
we had in mind. After spending a day trying to reverse engineer and figure
|
||||
out the format of sysvshm we decided that it would be much easier to
|
||||
add our own extention to php for simple SHM operations, we were right :)).
|
||||
|
||||
the functions are:
|
||||
|
||||
int shm_open(int key, string flags, int mode, int size)
|
||||
int shmop_open(int key, string flags, int mode, int size)
|
||||
|
||||
key - the key of/for the shared memory block
|
||||
flags - 2 flags are avalible
|
||||
a for access (sets IPC_EXCL)
|
||||
c for create (sets IPC_CREATE)
|
||||
flags - 3 flags are avalible
|
||||
a for read only access (sets SHM_RDONLY)
|
||||
w for read & write access
|
||||
c create or open an existing segment (sets IPC_CREATE)
|
||||
n create a new segment and fail if one already exists under same name (sets IPC_CREATE|IPC_EXCL)
|
||||
(the n flag is mostly useful for security perpouses, so that you don't end up opening a faked segment
|
||||
if someone guesses your key)
|
||||
mode - acsess mode same as for a file (0644) for example
|
||||
size - size of the block in bytes
|
||||
|
||||
returns an indentifier
|
||||
|
||||
|
||||
char shm_read(int shmid, int start, int count)
|
||||
char shmop_read(int shmid, int start, int count)
|
||||
|
||||
shmid - shmid from which to read
|
||||
start - offset from which to start reading
|
||||
@@ -33,7 +37,7 @@ char shm_read(int shmid, int start, int count)
|
||||
|
||||
returns the data read
|
||||
|
||||
int shm_write(int shmid, string data, int offset)
|
||||
int shmop_write(int shmid, string data, int offset)
|
||||
|
||||
shmid - shmid from which to read
|
||||
data - string to put into shared memory
|
||||
@@ -41,14 +45,14 @@ int shm_write(int shmid, string data, int offset)
|
||||
|
||||
returns bytes written
|
||||
|
||||
int shm_size(int shmid)
|
||||
int shmop_size(int shmid)
|
||||
|
||||
shmid - shmid for which to return the size
|
||||
|
||||
returns the size in bytes of the shm segment
|
||||
|
||||
|
||||
int shm_delete(int shmid)
|
||||
int shmop_delete(int shmid)
|
||||
|
||||
marks the segment for deletion, the segment will be deleted when all processes mapping it will detach
|
||||
|
||||
@@ -56,7 +60,7 @@ int shm_delete(int shmid)
|
||||
|
||||
returns 1 if all ok, zero on failure
|
||||
|
||||
int shm_close(int shmid)
|
||||
int shmop_close(int shmid)
|
||||
|
||||
shmid - shmid which to close
|
||||
|
||||
|
||||
@@ -12,8 +12,8 @@
|
||||
| obtain it through the world-wide-web, please send a note to |
|
||||
| license@php.net so we can mail you a copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
| Authors: Slava Poliakov (slavapl@mailandnews.com) |
|
||||
| Ilia Alshanetsky (iliaa@home.com) |
|
||||
| Authors: Slava Poliakov (hackie@prohost.org) |
|
||||
| Ilia Alshanetsky (ilia@prohost.org) |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
#ifndef PHP_SHMOP_H
|
||||
@@ -52,6 +52,7 @@ struct php_shmop
|
||||
int shmid;
|
||||
key_t key;
|
||||
int shmflg;
|
||||
int shmatflg;
|
||||
char *addr;
|
||||
int size;
|
||||
};
|
||||
|
||||
+48
-28
@@ -12,8 +12,8 @@
|
||||
| obtain it through the world-wide-web, please send a note to |
|
||||
| license@php.net so we can mail you a copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
| Authors: Slava Poliakov (slavapl@mailandnews.com) |
|
||||
| Ilia Alshanetsky (iliaa@home.com) |
|
||||
| Authors: Slava Poliakov (hackie@prohost.org) |
|
||||
| Ilia Alshanetsky (ilia@prohost.org) |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
/* $Id$ */
|
||||
@@ -125,7 +125,6 @@ PHP_FUNCTION(shmop_open)
|
||||
struct php_shmop *shmop;
|
||||
struct shmid_ds shm;
|
||||
int rsid;
|
||||
int shmflg=0;
|
||||
|
||||
if (ZEND_NUM_ARGS() != 4 || zend_get_parameters_ex(4, &key, &flags, &mode, &size) == FAILURE) {
|
||||
WRONG_PARAM_COUNT;
|
||||
@@ -142,37 +141,53 @@ PHP_FUNCTION(shmop_open)
|
||||
shmop->key = (*key)->value.lval;
|
||||
shmop->shmflg |= (*mode)->value.lval;
|
||||
|
||||
if (memchr((*flags)->value.str.val, 'a', (*flags)->value.str.len)) {
|
||||
shmflg = SHM_RDONLY;
|
||||
shmop->shmflg |= IPC_EXCL;
|
||||
}
|
||||
else if (memchr((*flags)->value.str.val, 'c', (*flags)->value.str.len)) {
|
||||
shmop->shmflg |= IPC_CREAT;
|
||||
shmop->size = (*size)->value.lval;
|
||||
}
|
||||
else {
|
||||
php_error(E_WARNING, "shmopen: access mode invalid");
|
||||
efree(shmop);
|
||||
if( (*flags)->value.str.len != 1 ) {
|
||||
php_error(E_WARNING, "shmop_open: invalid flag");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
switch( (*flags)->value.str.val[0] )
|
||||
{
|
||||
case 'a':
|
||||
shmop->shmatflg |= SHM_RDONLY;
|
||||
break;
|
||||
case 'c':
|
||||
shmop->shmflg |= IPC_CREAT;
|
||||
shmop->size = (*size)->value.lval;
|
||||
break;
|
||||
case 'n':
|
||||
shmop->shmflg |= (IPC_CREAT|IPC_EXCL);
|
||||
shmop->size = (*size)->value.lval;
|
||||
break;
|
||||
case 'w':
|
||||
/* noop
|
||||
shm segment is being opened for read & write
|
||||
will fail if segment does not exist
|
||||
*/
|
||||
break;
|
||||
default:
|
||||
php_error(E_WARNING, "shmop_open: invalid access mode");
|
||||
efree(shmop);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
shmop->shmid = shmget(shmop->key, shmop->size, shmop->shmflg);
|
||||
if (shmop->shmid == -1) {
|
||||
php_error(E_WARNING, "shmopen: can't get the block");
|
||||
php_error(E_WARNING, "shmop_open: unable to attach or create shm segment");
|
||||
efree(shmop);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
if (shmctl(shmop->shmid, IPC_STAT, &shm)) {
|
||||
efree(shmop);
|
||||
php_error(E_WARNING, "shmopen: can't get information on the block");
|
||||
php_error(E_WARNING, "shmop_open: unable to get shm segment information");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
shmop->addr = shmat(shmop->shmid, 0, shmflg);
|
||||
shmop->addr = shmat(shmop->shmid, 0, shmop->shmatflg);
|
||||
if (shmop->addr == (char*) -1) {
|
||||
efree(shmop);
|
||||
php_error(E_WARNING, "shmopen: can't attach the memory block");
|
||||
php_error(E_WARNING, "shmop_open: unable to attach to shm segment");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
@@ -205,22 +220,22 @@ PHP_FUNCTION(shmop_read)
|
||||
shmop = zend_list_find((*shmid)->value.lval, &type);
|
||||
|
||||
if (!shmop) {
|
||||
php_error(E_WARNING, "shmread: can't find this segment");
|
||||
php_error(E_WARNING, "shmop_read: can't find this segment");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
if ((*start)->value.lval < 0 || (*start)->value.lval > shmop->size) {
|
||||
php_error(E_WARNING, "shmread: start is out of range");
|
||||
php_error(E_WARNING, "shmop_read: start is out of range");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
if (((*start)->value.lval+(*count)->value.lval) > shmop->size) {
|
||||
php_error(E_WARNING, "shmread: count is out of range");
|
||||
php_error(E_WARNING, "shmop_read: count is out of range");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
if ((*count)->value.lval < 0 ){
|
||||
php_error(E_WARNING, "shmread: count is out of range");
|
||||
php_error(E_WARNING, "shmop_read: count is out of range");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
@@ -249,7 +264,7 @@ PHP_FUNCTION(shmop_close)
|
||||
shmop = zend_list_find((*shmid)->value.lval, &type);
|
||||
|
||||
if (!shmop) {
|
||||
php_error(E_WARNING, "shmclose: no such shmid");
|
||||
php_error(E_WARNING, "shmop_close: no such shmid");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
zend_list_delete((*shmid)->value.lval);
|
||||
@@ -273,7 +288,7 @@ PHP_FUNCTION(shmop_size)
|
||||
shmop = zend_list_find((*shmid)->value.lval, &type);
|
||||
|
||||
if (!shmop) {
|
||||
php_error(E_WARNING, "shmsize: no such segment");
|
||||
php_error(E_WARNING, "shmop_size: no such segment");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
@@ -301,12 +316,17 @@ PHP_FUNCTION(shmop_write)
|
||||
shmop = zend_list_find((*shmid)->value.lval, &type);
|
||||
|
||||
if (!shmop) {
|
||||
php_error(E_WARNING, "shmwrite: error no such segment");
|
||||
php_error(E_WARNING, "shmop_write: error no such segment");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
if( (shmop->shmatflg&SHM_RDONLY) == SHM_RDONLY ) {
|
||||
php_error(E_WARNING, "shmop_write: trying to write to a read only segment");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
if ( (*offset)->value.lval > shmop->size ) {
|
||||
php_error(E_WARNING, "shmwrite: offset out of range");
|
||||
php_error(E_WARNING, "shmop_write: offset out of range");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
@@ -334,12 +354,12 @@ PHP_FUNCTION(shmop_delete)
|
||||
shmop = zend_list_find((*shmid)->value.lval, &type);
|
||||
|
||||
if (!shmop) {
|
||||
php_error(E_WARNING, "shmdelete: error no such segment");
|
||||
php_error(E_WARNING, "shmop_delete: error no such segment");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
if (shmctl(shmop->shmid, IPC_RMID, NULL)) {
|
||||
php_error(E_WARNING, "shmdelete: can't mark segment for deletion (are you the owner?)");
|
||||
php_error(E_WARNING, "shmop_delete: can't mark segment for deletion (are you the owner?)");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
|
||||
@@ -31,8 +31,12 @@ extern zend_module_entry sockets_module_entry;
|
||||
|
||||
#ifdef PHP_WIN32
|
||||
#define PHP_SOCKETS_API __declspec(dllexport)
|
||||
#include <winsock.h>
|
||||
#else
|
||||
#define PHP_SOCKETS_API
|
||||
#if HAVE_SYS_SOCKET_H
|
||||
#include <sys/socket.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
PHP_MINIT_FUNCTION(sockets);
|
||||
@@ -76,6 +80,7 @@ PHP_FUNCTION(socket_writev);
|
||||
PHP_FUNCTION(socket_getopt);
|
||||
PHP_FUNCTION(socket_setopt);
|
||||
PHP_FUNCTION(socket_shutdown);
|
||||
PHP_FUNCTION(socket_last_error);
|
||||
|
||||
typedef struct php_iovec {
|
||||
struct iovec *iov_array;
|
||||
@@ -87,8 +92,9 @@ typedef int SOCKET;
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
SOCKET bsd_socket;
|
||||
SOCKET bsd_socket;
|
||||
int type;
|
||||
int error;
|
||||
} php_socket;
|
||||
|
||||
typedef struct {
|
||||
@@ -97,13 +103,18 @@ typedef struct {
|
||||
} php_fd_set;
|
||||
|
||||
typedef struct {
|
||||
unsigned char info[256];
|
||||
long family;
|
||||
char info[256];
|
||||
} php_sockaddr_storage;
|
||||
|
||||
typedef struct {
|
||||
zend_bool use_system_read;
|
||||
} php_sockets_globals;
|
||||
|
||||
/* Prototypes */
|
||||
int open_listen_sock(php_socket **php_sock, int port, int backlog TSRMLS_DC);
|
||||
int accept_connect(php_socket *in_sock, php_socket **new_sock, struct sockaddr *la TSRMLS_DC);
|
||||
int php_read(int bsd_socket, void *buf, int maxlen);
|
||||
|
||||
#ifdef ZTS
|
||||
#define SOCKETSG(v) (sockets_globals->v)
|
||||
|
||||
@@ -52,7 +52,7 @@ ssize_t readv(SOCKET sock, const struct iovec *iov, int iovcnt) {
|
||||
remain = bytes = (size_t) retval;
|
||||
|
||||
for(i=0; i<iovcnt; i++) {
|
||||
len = (iov[i].iov_len < remain) ? iov[i].iov_len : remain;
|
||||
len = ((unsigned int)iov[i].iov_len < remain) ? iov[i].iov_len : remain;
|
||||
memcpy(iov[i].iov_base, buffer+pos, len);
|
||||
pos += len;
|
||||
remain -= len;
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
#define close(a) closesocket(a)
|
||||
#define CMSG_DATA(cmsg) ((cmsg)->cmsg_data)
|
||||
|
||||
typedef long ssize_t;
|
||||
typedef int ssize_t;
|
||||
|
||||
struct sockaddr_un {
|
||||
short sun_family;
|
||||
@@ -77,6 +77,6 @@ ssize_t recvmsg(SOCKET sock, struct msghdr *msg, int flags);
|
||||
ssize_t sendmsg(SOCKET sock, struct msghdr *msg, int flags);
|
||||
int socketpair(int domain, int type, int protocol, SOCKET sock[2]);
|
||||
int inet_aton(const char *cp, struct in_addr *inp);
|
||||
int fcntl(int fd, int cmd, ...);
|
||||
int fcntl(int fd, int cmd, ...);
|
||||
|
||||
#endif
|
||||
+714
-836
File diff suppressed because it is too large.
Load diff
@@ -8,12 +8,12 @@ CFG=sockets - 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 "SOCKETS.MAK".
|
||||
!MESSAGE NMAKE /f "sockets.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 "SOCKETS.MAK" CFG="sockets - Win32 Debug_TS"
|
||||
!MESSAGE NMAKE /f "sockets.mak" CFG="sockets - Win32 Debug_TS"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
@@ -44,6 +44,7 @@ RSC=rc.exe
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "SOCKETS_EXPORTS" /YX /FD /c
|
||||
# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\TSRM" /D "WIN32" /D "PHP_EXPORTS" /D "COMPILE_DL_SOCKETS" /D ZTS=1 /D HAVE_SOCKETS=1 /D ZEND_DEBUG=0 /D "NDEBUG" /D "_WINDOWS" /D "ZEND_WIN32" /D "PHP_WIN32" /YX /FD /c
|
||||
# SUBTRACT CPP /Z<none>
|
||||
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||
# ADD BASE RSC /l 0x407 /d "NDEBUG"
|
||||
@@ -53,7 +54,8 @@ BSC32=bscmake.exe
|
||||
# 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 php4ts.lib Ws2_32.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 /out:"..\..\Release_TS/php_sockets.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline"
|
||||
# ADD LINK32 php4ts.lib wsock32.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 /out:"..\..\Release_TS/php_sockets.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline"
|
||||
# SUBTRACT LINK32 /debug
|
||||
|
||||
!ELSEIF "$(CFG)" == "sockets - Win32 Debug_TS"
|
||||
|
||||
@@ -80,7 +82,7 @@ BSC32=bscmake.exe
|
||||
# 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 Ws2_32.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_sockets.dll" /pdbtype:sept /libpath:"..\..\Debug_TS"
|
||||
# ADD LINK32 php4ts_debug.lib wsock32.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_sockets.dll" /pdbtype:sept /libpath:"..\..\Debug_TS"
|
||||
|
||||
!ENDIF
|
||||
|
||||
|
||||
@@ -3133,9 +3133,9 @@ PHP_FUNCTION(array_map)
|
||||
/* }}} */
|
||||
|
||||
|
||||
/* {{{ proto bool key_exists(mixed key, array search)
|
||||
/* {{{ proto bool array_key_exists(mixed key, array search)
|
||||
Checks if the given key or index exists in the array */
|
||||
PHP_FUNCTION(key_exists)
|
||||
PHP_FUNCTION(array_key_exists)
|
||||
{
|
||||
zval **key, /* key to check for */
|
||||
**array; /* array to check in */
|
||||
|
||||
@@ -467,7 +467,7 @@ function_entry basic_functions[] = {
|
||||
PHP_FALIAS(socket_set_timeout, warn_not_available, NULL)
|
||||
#endif
|
||||
PHP_FE(socket_get_status, NULL)
|
||||
#if (!defined(PHP_WIN32) && !defined(__BEOS__)) || defined(ZTS)
|
||||
#if (!defined(PHP_WIN32) && !defined(__BEOS__) && HAVE_REALPATH) || defined(ZTS)
|
||||
PHP_FE(realpath, NULL)
|
||||
#else
|
||||
PHP_FALIAS(realpath, warn_not_available, NULL)
|
||||
@@ -616,7 +616,7 @@ function_entry basic_functions[] = {
|
||||
PHP_FE(array_sum, NULL)
|
||||
PHP_FE(array_filter, NULL)
|
||||
PHP_FE(array_map, NULL)
|
||||
PHP_FE(key_exists, NULL)
|
||||
PHP_FE(array_key_exists, NULL)
|
||||
|
||||
/* aliases from array.c */
|
||||
PHP_FALIAS(pos, current, first_arg_force_ref)
|
||||
@@ -2495,6 +2495,10 @@ static void php_simple_ini_parser_cb(zval *arg1, zval *arg2, int callback_type,
|
||||
|
||||
switch (callback_type) {
|
||||
case ZEND_INI_PARSER_ENTRY:
|
||||
if(!arg2) {
|
||||
/* bare string - nothing to do */
|
||||
break;
|
||||
}
|
||||
ALLOC_ZVAL(element);
|
||||
*element = *arg2;
|
||||
zval_copy_ctor(element);
|
||||
@@ -2516,6 +2520,10 @@ static void php_ini_parser_cb_with_sections(zval *arg1, zval *arg2, int callback
|
||||
case ZEND_INI_PARSER_ENTRY: {
|
||||
zval *active_arr;
|
||||
|
||||
if(!arg2) {
|
||||
/* bare string - nothing to do */
|
||||
break;
|
||||
}
|
||||
if (BG(active_ini_file_section)) {
|
||||
active_arr = BG(active_ini_file_section);
|
||||
} else {
|
||||
|
||||
@@ -106,7 +106,7 @@ PHP_MINIT_FUNCTION(crypt)
|
||||
PHP_RINIT_FUNCTION(crypt)
|
||||
{
|
||||
if(!php_crypt_rand_seeded) {
|
||||
php_srand(time(0) * getpid() * (php_combined_lcg(TSRMLS_C) * 10000.0));
|
||||
php_srand(time(0) * getpid() * (unsigned long) (php_combined_lcg(TSRMLS_C) * 10000.0));
|
||||
php_crypt_rand_seeded=1;
|
||||
}
|
||||
return SUCCESS;
|
||||
|
||||
+96
-85
@@ -119,16 +119,16 @@ void php_mktime(INTERNAL_FUNCTION_PARAMETERS, int gm)
|
||||
*/
|
||||
switch(arg_count) {
|
||||
case 7:
|
||||
ta->tm_isdst = is_dst = (*arguments[6])->value.lval;
|
||||
ta->tm_isdst = is_dst = Z_LVAL_PP(arguments[6]);
|
||||
/* fall-through */
|
||||
case 6:
|
||||
/* special case:
|
||||
a zero in year, month and day is considered illegal
|
||||
as it would be interpreted as 30.11.1999 otherwise
|
||||
*/
|
||||
if ( ( (*arguments[5])->value.lval==0)
|
||||
&&((*arguments[4])->value.lval==0)
|
||||
&&((*arguments[3])->value.lval==0)
|
||||
if ( ( Z_LVAL_PP(arguments[5])==0)
|
||||
&&(Z_LVAL_PP(arguments[4])==0)
|
||||
&&(Z_LVAL_PP(arguments[3])==0)
|
||||
) {
|
||||
RETURN_LONG(-1);
|
||||
}
|
||||
@@ -143,26 +143,26 @@ void php_mktime(INTERNAL_FUNCTION_PARAMETERS, int gm)
|
||||
** But it cannot represent ancestral dates prior to year 1001.
|
||||
** Additionally, input parameters of 0..70 are mapped to 100..170
|
||||
*/
|
||||
if ((*arguments[5])->value.lval < 70)
|
||||
ta->tm_year = (*arguments[5])->value.lval + 100;
|
||||
if (Z_LVAL_PP(arguments[5]) < 70)
|
||||
ta->tm_year = Z_LVAL_PP(arguments[5]) + 100;
|
||||
else
|
||||
ta->tm_year = (*arguments[5])->value.lval
|
||||
- (((*arguments[5])->value.lval > 1000) ? 1900 : 0);
|
||||
ta->tm_year = Z_LVAL_PP(arguments[5])
|
||||
- ((Z_LVAL_PP(arguments[5]) > 1000) ? 1900 : 0);
|
||||
/* fall-through */
|
||||
case 5:
|
||||
ta->tm_mday = (*arguments[4])->value.lval;
|
||||
ta->tm_mday = Z_LVAL_PP(arguments[4]);
|
||||
/* fall-through */
|
||||
case 4:
|
||||
ta->tm_mon = (*arguments[3])->value.lval - 1;
|
||||
ta->tm_mon = Z_LVAL_PP(arguments[3]) - 1;
|
||||
/* fall-through */
|
||||
case 3:
|
||||
ta->tm_sec = (*arguments[2])->value.lval;
|
||||
ta->tm_sec = Z_LVAL_PP(arguments[2]);
|
||||
/* fall-through */
|
||||
case 2:
|
||||
ta->tm_min = (*arguments[1])->value.lval;
|
||||
ta->tm_min = Z_LVAL_PP(arguments[1]);
|
||||
/* fall-through */
|
||||
case 1:
|
||||
ta->tm_hour = (*arguments[0])->value.lval;
|
||||
ta->tm_hour = Z_LVAL_PP(arguments[0]);
|
||||
/* fall-through */
|
||||
case 0:
|
||||
break;
|
||||
@@ -220,6 +220,10 @@ php_date(INTERNAL_FUNCTION_PARAMETERS, int gm)
|
||||
struct tm *ta, tmbuf;
|
||||
int i, size = 0, length, h, beat, fd, wd, yd, wk;
|
||||
char tmp_buff[32];
|
||||
#if !HAVE_TM_GMTOFF
|
||||
long tzone;
|
||||
char *tname[2]= {"GMT Standard Time", "BST"};
|
||||
#endif
|
||||
|
||||
switch(ZEND_NUM_ARGS()) {
|
||||
case 1:
|
||||
@@ -233,7 +237,7 @@ php_date(INTERNAL_FUNCTION_PARAMETERS, int gm)
|
||||
WRONG_PARAM_COUNT;
|
||||
}
|
||||
convert_to_long_ex(timestamp);
|
||||
the_time = (*timestamp)->value.lval;
|
||||
the_time = Z_LVAL_PP(timestamp);
|
||||
break;
|
||||
default:
|
||||
WRONG_PARAM_COUNT;
|
||||
@@ -242,16 +246,23 @@ php_date(INTERNAL_FUNCTION_PARAMETERS, int gm)
|
||||
|
||||
if (gm) {
|
||||
ta = php_gmtime_r(&the_time, &tmbuf);
|
||||
#if !HAVE_TM_GMTOFF
|
||||
tzone = 0;
|
||||
#endif
|
||||
} else {
|
||||
ta = php_localtime_r(&the_time, &tmbuf);
|
||||
#if !HAVE_TM_GMTOFF
|
||||
tzone = timezone;
|
||||
tname[0] = tzname[0];
|
||||
#endif
|
||||
}
|
||||
|
||||
if (!ta) { /* that really shouldn't happen... */
|
||||
php_error(E_WARNING, "unexpected error in date()");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
for (i = 0; i < (*format)->value.str.len; i++) {
|
||||
switch ((*format)->value.str.val[i]) {
|
||||
for (i = 0; i < Z_STRLEN_PP(format); i++) {
|
||||
switch (Z_STRVAL_PP(format)[i]) {
|
||||
case 'r': /* rfc822 format */
|
||||
size += 31;
|
||||
break;
|
||||
@@ -266,7 +277,7 @@ php_date(INTERNAL_FUNCTION_PARAMETERS, int gm)
|
||||
#if HAVE_TM_ZONE
|
||||
size += strlen(ta->tm_zone);
|
||||
#elif HAVE_TZNAME
|
||||
size += strlen(tzname[0]);
|
||||
size += strlen(tname[0]);
|
||||
#endif
|
||||
break;
|
||||
case 'Z': /* timezone offset in seconds */
|
||||
@@ -303,7 +314,7 @@ php_date(INTERNAL_FUNCTION_PARAMETERS, int gm)
|
||||
size += 2;
|
||||
break;
|
||||
case '\\':
|
||||
if(i < (*format)->value.str.len-1) {
|
||||
if(i < Z_STRLEN_PP(format)-1) {
|
||||
i++;
|
||||
}
|
||||
size ++;
|
||||
@@ -317,149 +328,149 @@ php_date(INTERNAL_FUNCTION_PARAMETERS, int gm)
|
||||
}
|
||||
}
|
||||
|
||||
return_value->value.str.val = (char *) emalloc(size + 1);
|
||||
return_value->value.str.val[0] = '\0';
|
||||
Z_STRVAL_P(return_value) = (char *) emalloc(size + 1);
|
||||
Z_STRVAL_P(return_value)[0] = '\0';
|
||||
|
||||
for (i = 0; i < (*format)->value.str.len; i++) {
|
||||
switch ((*format)->value.str.val[i]) {
|
||||
for (i = 0; i < Z_STRLEN_PP(format); i++) {
|
||||
switch (Z_STRVAL_PP(format)[i]) {
|
||||
case '\\':
|
||||
if(i < (*format)->value.str.len-1) {
|
||||
if(i < Z_STRLEN_PP(format)-1) {
|
||||
char ch[2];
|
||||
ch[0]=(*format)->value.str.val[i+1];
|
||||
ch[0]=Z_STRVAL_PP(format)[i+1];
|
||||
ch[1]='\0';
|
||||
strcat(return_value->value.str.val, ch);
|
||||
strcat(Z_STRVAL_P(return_value), ch);
|
||||
i++;
|
||||
}
|
||||
break;
|
||||
case 'U': /* seconds since the epoch */
|
||||
sprintf(tmp_buff, "%ld", (long)the_time); /* SAFE */
|
||||
strcat(return_value->value.str.val, tmp_buff);
|
||||
strcat(Z_STRVAL_P(return_value), tmp_buff);
|
||||
break;
|
||||
case 'F': /* month, textual, full */
|
||||
strcat(return_value->value.str.val, mon_full_names[ta->tm_mon]);
|
||||
strcat(Z_STRVAL_P(return_value), mon_full_names[ta->tm_mon]);
|
||||
break;
|
||||
case 'l': /* day (of the week), textual, full */
|
||||
strcat(return_value->value.str.val, day_full_names[ta->tm_wday]);
|
||||
strcat(Z_STRVAL_P(return_value), day_full_names[ta->tm_wday]);
|
||||
break;
|
||||
case 'Y': /* year, numeric, 4 digits */
|
||||
sprintf(tmp_buff, "%d", ta->tm_year + 1900); /* SAFE */
|
||||
strcat(return_value->value.str.val, tmp_buff);
|
||||
strcat(Z_STRVAL_P(return_value), tmp_buff);
|
||||
break;
|
||||
case 'M': /* month, textual, 3 letters */
|
||||
strcat(return_value->value.str.val, mon_short_names[ta->tm_mon]);
|
||||
strcat(Z_STRVAL_P(return_value), mon_short_names[ta->tm_mon]);
|
||||
break;
|
||||
case 'D': /* day (of the week), textual, 3 letters */
|
||||
strcat(return_value->value.str.val, day_short_names[ta->tm_wday]);
|
||||
strcat(Z_STRVAL_P(return_value), day_short_names[ta->tm_wday]);
|
||||
break;
|
||||
case 'z': /* day (of the year) */
|
||||
sprintf(tmp_buff, "%d", ta->tm_yday); /* SAFE */
|
||||
strcat(return_value->value.str.val, tmp_buff);
|
||||
strcat(Z_STRVAL_P(return_value), tmp_buff);
|
||||
break;
|
||||
case 'y': /* year, numeric, 2 digits */
|
||||
sprintf(tmp_buff, "%02d", ((ta->tm_year)%100)); /* SAFE */
|
||||
strcat(return_value->value.str.val, tmp_buff);
|
||||
strcat(Z_STRVAL_P(return_value), tmp_buff);
|
||||
break;
|
||||
case 'm': /* month, numeric */
|
||||
sprintf(tmp_buff, "%02d", ta->tm_mon + 1); /* SAFE */
|
||||
strcat(return_value->value.str.val, tmp_buff);
|
||||
strcat(Z_STRVAL_P(return_value), tmp_buff);
|
||||
break;
|
||||
case 'n': /* month, numeric, no leading zeros */
|
||||
sprintf(tmp_buff, "%d", ta->tm_mon + 1); /* SAFE */
|
||||
strcat(return_value->value.str.val, tmp_buff);
|
||||
strcat(Z_STRVAL_P(return_value), tmp_buff);
|
||||
break;
|
||||
case 'd': /* day of the month, numeric */
|
||||
sprintf(tmp_buff, "%02d", ta->tm_mday); /* SAFE */
|
||||
strcat(return_value->value.str.val, tmp_buff);
|
||||
strcat(Z_STRVAL_P(return_value), tmp_buff);
|
||||
break;
|
||||
case 'j':
|
||||
sprintf(tmp_buff, "%d", ta->tm_mday); /* SAFE */
|
||||
strcat(return_value->value.str.val, tmp_buff);
|
||||
strcat(Z_STRVAL_P(return_value), tmp_buff);
|
||||
break;
|
||||
case 'H': /* hour, numeric, 24 hour format */
|
||||
sprintf(tmp_buff, "%02d", ta->tm_hour); /* SAFE */
|
||||
strcat(return_value->value.str.val, tmp_buff);
|
||||
strcat(Z_STRVAL_P(return_value), tmp_buff);
|
||||
break;
|
||||
case 'h': /* hour, numeric, 12 hour format */
|
||||
h = ta->tm_hour % 12; if (h==0) h = 12;
|
||||
sprintf(tmp_buff, "%02d", h); /* SAFE */
|
||||
strcat(return_value->value.str.val, tmp_buff);
|
||||
strcat(Z_STRVAL_P(return_value), tmp_buff);
|
||||
break;
|
||||
case 'G': /* hour, numeric, 24 hour format, no leading zeros */
|
||||
sprintf(tmp_buff, "%d", ta->tm_hour); /* SAFE */
|
||||
strcat(return_value->value.str.val, tmp_buff);
|
||||
strcat(Z_STRVAL_P(return_value), tmp_buff);
|
||||
break;
|
||||
case 'g': /* hour, numeric, 12 hour format, no leading zeros */
|
||||
h = ta->tm_hour % 12; if (h==0) h = 12;
|
||||
sprintf(tmp_buff, "%d", h); /* SAFE */
|
||||
strcat(return_value->value.str.val, tmp_buff);
|
||||
strcat(Z_STRVAL_P(return_value), tmp_buff);
|
||||
break;
|
||||
case 'i': /* minutes, numeric */
|
||||
sprintf(tmp_buff, "%02d", ta->tm_min); /* SAFE */
|
||||
strcat(return_value->value.str.val, tmp_buff);
|
||||
strcat(Z_STRVAL_P(return_value), tmp_buff);
|
||||
break;
|
||||
case 's': /* seconds, numeric */
|
||||
sprintf(tmp_buff, "%02d", ta->tm_sec); /* SAFE */
|
||||
strcat(return_value->value.str.val, tmp_buff);
|
||||
strcat(Z_STRVAL_P(return_value), tmp_buff);
|
||||
break;
|
||||
case 'A': /* AM/PM */
|
||||
strcat(return_value->value.str.val, (ta->tm_hour >= 12 ? "PM" : "AM"));
|
||||
strcat(Z_STRVAL_P(return_value), (ta->tm_hour >= 12 ? "PM" : "AM"));
|
||||
break;
|
||||
case 'a': /* am/pm */
|
||||
strcat(return_value->value.str.val, (ta->tm_hour >= 12 ? "pm" : "am"));
|
||||
strcat(Z_STRVAL_P(return_value), (ta->tm_hour >= 12 ? "pm" : "am"));
|
||||
break;
|
||||
case 'S': /* standard english suffix, e.g. 2nd/3rd for the day of the month */
|
||||
if (ta->tm_mday >= 10 && ta->tm_mday <= 19) {
|
||||
strcat(return_value->value.str.val, "th");
|
||||
strcat(Z_STRVAL_P(return_value), "th");
|
||||
} else {
|
||||
switch (ta->tm_mday % 10) {
|
||||
case 1:
|
||||
strcat(return_value->value.str.val, "st");
|
||||
strcat(Z_STRVAL_P(return_value), "st");
|
||||
break;
|
||||
case 2:
|
||||
strcat(return_value->value.str.val, "nd");
|
||||
strcat(Z_STRVAL_P(return_value), "nd");
|
||||
break;
|
||||
case 3:
|
||||
strcat(return_value->value.str.val, "rd");
|
||||
strcat(Z_STRVAL_P(return_value), "rd");
|
||||
break;
|
||||
default:
|
||||
strcat(return_value->value.str.val, "th");
|
||||
strcat(Z_STRVAL_P(return_value), "th");
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 't': /* days in current month */
|
||||
sprintf(tmp_buff, "%2d", phpday_tab[isleap((ta->tm_year+1900))][ta->tm_mon] );
|
||||
strcat(return_value->value.str.val, tmp_buff);
|
||||
strcat(Z_STRVAL_P(return_value), tmp_buff);
|
||||
break;
|
||||
case 'w': /* day of the week, numeric EXTENSION */
|
||||
sprintf(tmp_buff, "%01d", ta->tm_wday); /* SAFE */
|
||||
strcat(return_value->value.str.val, tmp_buff);
|
||||
strcat(Z_STRVAL_P(return_value), tmp_buff);
|
||||
break;
|
||||
case 'O': /* GMT offset in [+-]HHMM format */
|
||||
#if HAVE_TM_GMTOFF
|
||||
sprintf(tmp_buff, "%c%02d%02d", (ta->tm_gmtoff < 0) ? '-' : '+', abs(ta->tm_gmtoff / 3600), abs( ta->tm_gmtoff % 3600));
|
||||
#else
|
||||
sprintf(tmp_buff, "%c%02d%02d", ((ta->tm_isdst ? timezone - 3600:timezone)>0)?'-':'+', abs((ta->tm_isdst ? timezone - 3600 : timezone) / 3600), abs((ta->tm_isdst ? timezone - 3600 : timezone) % 3600));
|
||||
sprintf(tmp_buff, "%c%02d%02d", ((ta->tm_isdst ? tzone - 3600:tzone)>0)?'-':'+', abs((ta->tm_isdst ? tzone - 3600 : tzone) / 3600), abs((ta->tm_isdst ? tzone - 3600 : tzone) % 3600));
|
||||
#endif
|
||||
strcat(return_value->value.str.val, tmp_buff);
|
||||
strcat(Z_STRVAL_P(return_value), tmp_buff);
|
||||
break;
|
||||
case 'Z': /* timezone offset in seconds */
|
||||
#if HAVE_TM_GMTOFF
|
||||
sprintf(tmp_buff, "%ld", ta->tm_gmtoff);
|
||||
#else
|
||||
sprintf(tmp_buff, "%ld", ta->tm_isdst ? -(timezone - 3600) : -timezone);
|
||||
sprintf(tmp_buff, "%ld", ta->tm_isdst ? -(tzone- 3600) : -tzone);
|
||||
#endif
|
||||
strcat(return_value->value.str.val, tmp_buff);
|
||||
strcat(Z_STRVAL_P(return_value), tmp_buff);
|
||||
break;
|
||||
case 'L': /* boolean for leapyear */
|
||||
sprintf(tmp_buff, "%d", (isleap((ta->tm_year+1900)) ? 1 : 0 ) );
|
||||
strcat(return_value->value.str.val, tmp_buff);
|
||||
strcat(Z_STRVAL_P(return_value), tmp_buff);
|
||||
break;
|
||||
case 'T': /* timezone name */
|
||||
#if HAVE_TM_ZONE
|
||||
strcat(return_value->value.str.val, ta->tm_zone);
|
||||
strcat(Z_STRVAL_P(return_value), ta->tm_zone);
|
||||
#elif HAVE_TZNAME
|
||||
strcat(return_value->value.str.val, tzname[0]);
|
||||
strcat(Z_STRVAL_P(return_value), tname[0]);
|
||||
#endif
|
||||
break;
|
||||
case 'B': /* Swatch Beat a.k.a. Internet Time */
|
||||
@@ -470,11 +481,11 @@ php_date(INTERNAL_FUNCTION_PARAMETERS, int gm)
|
||||
}
|
||||
beat = beat % 1000;
|
||||
sprintf(tmp_buff, "%03d", beat); /* SAFE */
|
||||
strcat(return_value->value.str.val, tmp_buff);
|
||||
strcat(Z_STRVAL_P(return_value), tmp_buff);
|
||||
break;
|
||||
case 'I':
|
||||
sprintf(tmp_buff, "%d", ta->tm_isdst);
|
||||
strcat(return_value->value.str.val, tmp_buff);
|
||||
strcat(Z_STRVAL_P(return_value), tmp_buff);
|
||||
break;
|
||||
case 'r':
|
||||
#if HAVE_TM_GMTOFF
|
||||
@@ -499,12 +510,12 @@ php_date(INTERNAL_FUNCTION_PARAMETERS, int gm)
|
||||
ta->tm_hour,
|
||||
ta->tm_min,
|
||||
ta->tm_sec,
|
||||
((ta->tm_isdst ? timezone - 3600 : timezone) > 0) ? '-' : '+',
|
||||
abs((ta->tm_isdst ? timezone - 3600 : timezone) / 3600),
|
||||
abs((ta->tm_isdst ? timezone - 3600 : timezone) % 3600)
|
||||
((ta->tm_isdst ? tzone - 3600 : tzone) > 0) ? '-' : '+',
|
||||
abs((ta->tm_isdst ? tzone - 3600 : tzone) / 3600),
|
||||
abs((ta->tm_isdst ? tzone - 3600 : tzone) % 3600)
|
||||
);
|
||||
#endif
|
||||
strcat(return_value->value.str.val, tmp_buff);
|
||||
strcat(Z_STRVAL_P(return_value), tmp_buff);
|
||||
break;
|
||||
case 'W': /* ISO-8601 week number of year, weeks starting on Monday */
|
||||
wd = ta->tm_wday==0 ? 7 : ta->tm_wday;
|
||||
@@ -515,18 +526,18 @@ php_date(INTERNAL_FUNCTION_PARAMETERS, int gm)
|
||||
wk--;
|
||||
}
|
||||
sprintf(tmp_buff, "%d", wk); /* SAFE */
|
||||
strcat(return_value->value.str.val, tmp_buff);
|
||||
strcat(Z_STRVAL_P(return_value), tmp_buff);
|
||||
break;
|
||||
|
||||
default:
|
||||
length = strlen(return_value->value.str.val);
|
||||
return_value->value.str.val[length] = (*format)->value.str.val[i];
|
||||
return_value->value.str.val[length + 1] = '\0';
|
||||
length = strlen(Z_STRVAL_P(return_value));
|
||||
Z_STRVAL_P(return_value)[length] = Z_STRVAL_PP(format)[i];
|
||||
Z_STRVAL_P(return_value)[length + 1] = '\0';
|
||||
break;
|
||||
}
|
||||
}
|
||||
return_value->value.str.len = strlen(return_value->value.str.val);
|
||||
return_value->type = IS_STRING;
|
||||
Z_STRLEN_P(return_value) = strlen(Z_STRVAL_P(return_value));
|
||||
Z_TYPE_P(return_value) = IS_STRING;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -567,13 +578,13 @@ PHP_FUNCTION(localtime)
|
||||
break;
|
||||
case 1:
|
||||
convert_to_long_ex(timestamp_arg);
|
||||
timestamp = (*timestamp_arg)->value.lval;
|
||||
timestamp = Z_LVAL_PP(timestamp_arg);
|
||||
break;
|
||||
case 2:
|
||||
convert_to_long_ex(timestamp_arg);
|
||||
convert_to_long_ex(assoc_array_arg);
|
||||
timestamp = (*timestamp_arg)->value.lval;
|
||||
assoc_array = (*assoc_array_arg)->value.lval;
|
||||
timestamp = Z_LVAL_PP(timestamp_arg);
|
||||
assoc_array = Z_LVAL_PP(assoc_array_arg);
|
||||
break;
|
||||
}
|
||||
ta = php_localtime_r(×tamp, &tmbuf);
|
||||
@@ -620,7 +631,7 @@ PHP_FUNCTION(getdate)
|
||||
WRONG_PARAM_COUNT;
|
||||
} else {
|
||||
convert_to_long_ex(timestamp_arg);
|
||||
timestamp = (*timestamp_arg)->value.lval;
|
||||
timestamp = Z_LVAL_PP(timestamp_arg);
|
||||
}
|
||||
|
||||
ta = php_localtime_r(×tamp, &tmbuf);
|
||||
@@ -689,8 +700,8 @@ PHP_FUNCTION(checkdate)
|
||||
WRONG_PARAM_COUNT;
|
||||
}
|
||||
|
||||
if((*year)->type == IS_STRING) {
|
||||
res = is_numeric_string((*year)->value.str.val, (*year)->value.str.len, NULL, NULL, 0);
|
||||
if(Z_TYPE_PP(year) == IS_STRING) {
|
||||
res = is_numeric_string(Z_STRVAL_PP(year), Z_STRLEN_PP(year), NULL, NULL, 0);
|
||||
if(res!=IS_LONG && res !=IS_DOUBLE) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
@@ -698,9 +709,9 @@ PHP_FUNCTION(checkdate)
|
||||
convert_to_long_ex(day);
|
||||
convert_to_long_ex(month);
|
||||
convert_to_long_ex(year);
|
||||
y = (*year)->value.lval;
|
||||
m = (*month)->value.lval;
|
||||
d = (*day)->value.lval;
|
||||
y = Z_LVAL_PP(year);
|
||||
m = Z_LVAL_PP(month);
|
||||
d = Z_LVAL_PP(day);
|
||||
|
||||
if (y < 1 || y > 32767) {
|
||||
RETURN_FALSE;
|
||||
@@ -739,7 +750,7 @@ void _php_strftime(INTERNAL_FUNCTION_PARAMETERS, int gm)
|
||||
RETURN_FALSE;
|
||||
}
|
||||
convert_to_long_ex(timestamp_arg);
|
||||
timestamp = (*timestamp_arg)->value.lval;
|
||||
timestamp = Z_LVAL_PP(timestamp_arg);
|
||||
break;
|
||||
default:
|
||||
WRONG_PARAM_COUNT;
|
||||
@@ -747,13 +758,13 @@ void _php_strftime(INTERNAL_FUNCTION_PARAMETERS, int gm)
|
||||
}
|
||||
|
||||
convert_to_string_ex(format_arg);
|
||||
if ((*format_arg)->value.str.len==0) {
|
||||
if (Z_STRLEN_PP(format_arg)==0) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
if (timestamp < 0) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
format = (*format_arg)->value.str.val;
|
||||
format = Z_STRVAL_PP(format_arg);
|
||||
if (gm) {
|
||||
ta = php_gmtime_r(×tamp, &tmbuf);
|
||||
} else {
|
||||
@@ -827,6 +838,6 @@ PHP_FUNCTION(strtotime)
|
||||
* tab-width: 4
|
||||
* c-basic-offset: 4
|
||||
* End:
|
||||
* vim600: sw=4 ts=4 tw=78 fdm=marker
|
||||
* vim<600: sw=4 ts=4 tw=78
|
||||
* vim600: sw=4 ts=4 fdm=marker
|
||||
* vim<600: sw=4 ts=4
|
||||
*/
|
||||
@@ -76,6 +76,7 @@ PHP_FUNCTION(dl)
|
||||
php_error(E_ERROR, "Dynamically loaded extensions aren't allowed when running in SAFE MODE.");
|
||||
} else {
|
||||
php_dl(*file, MODULE_TEMPORARY, return_value TSRMLS_CC);
|
||||
EG(full_tables_cleanup) = 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -2208,7 +2208,7 @@ PHP_FUNCTION(fgetcsv)
|
||||
/* }}} */
|
||||
|
||||
|
||||
#if (!defined(PHP_WIN32) && !defined(__BEOS__)) || defined(ZTS)
|
||||
#if (!defined(PHP_WIN32) && !defined(__BEOS__) && HAVE_REALPATH) || defined(ZTS)
|
||||
/* {{{ proto string realpath(string path)
|
||||
Return the resolved path */
|
||||
PHP_FUNCTION(realpath)
|
||||
|
||||
@@ -63,7 +63,9 @@ PHP_FUNCTION(flock);
|
||||
PHP_FUNCTION(fd_set);
|
||||
PHP_FUNCTION(fd_isset);
|
||||
PHP_FUNCTION(select);
|
||||
#if (!defined(PHP_WIN32) && !defined(__BEOS__) && HAVE_REALPATH) || defined(ZTS)
|
||||
PHP_FUNCTION(realpath);
|
||||
#endif
|
||||
PHP_NAMED_FUNCTION(php_if_ftruncate);
|
||||
PHP_NAMED_FUNCTION(php_if_fstat);
|
||||
|
||||
|
||||
+51
-49
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| PHP version 4.0 |
|
||||
| PHP Version 4 |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1997-2001 The PHP Group |
|
||||
| Copyright (c) 1997-2002 The PHP Group |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.02 of the PHP license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
@@ -118,14 +118,15 @@ PHP_RINIT_FUNCTION(filestat)
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
PHP_RSHUTDOWN_FUNCTION(filestat) {
|
||||
PHP_RSHUTDOWN_FUNCTION(filestat)
|
||||
{
|
||||
if (BG(CurrentStatFile)) {
|
||||
efree (BG(CurrentStatFile));
|
||||
}
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
/* {{{ proto double disk_total_space(string path)
|
||||
/* {{{ proto float disk_total_space(string path)
|
||||
Get total disk space for filesystem that path is on */
|
||||
PHP_FUNCTION(disk_total_space)
|
||||
{
|
||||
@@ -164,7 +165,7 @@ PHP_FUNCTION(disk_total_space)
|
||||
|
||||
convert_to_string_ex(path);
|
||||
|
||||
if (php_check_open_basedir((*path)->value.str.val TSRMLS_CC)) {
|
||||
if (php_check_open_basedir(Z_STRVAL_PP(path) TSRMLS_CC)) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
@@ -178,7 +179,7 @@ PHP_FUNCTION(disk_total_space)
|
||||
/* It's available, so we can call it. */
|
||||
if (gdfse) {
|
||||
func = (gdfse_func)gdfse;
|
||||
if (func((*path)->value.str.val,
|
||||
if (func(Z_STRVAL_PP(path),
|
||||
&FreeBytesAvailableToCaller,
|
||||
&TotalNumberOfBytes,
|
||||
&TotalNumberOfFreeBytes) == 0) RETURN_FALSE;
|
||||
@@ -190,7 +191,7 @@ PHP_FUNCTION(disk_total_space)
|
||||
}
|
||||
/* If it's not available, we just use GetDiskFreeSpace */
|
||||
else {
|
||||
if (GetDiskFreeSpace((*path)->value.str.val,
|
||||
if (GetDiskFreeSpace(Z_STRVAL_PP(path),
|
||||
&SectorsPerCluster, &BytesPerSector,
|
||||
&NumberOfFreeClusters, &TotalNumberOfClusters) == 0) RETURN_FALSE;
|
||||
bytestotal = (double)TotalNumberOfClusters * (double)SectorsPerCluster * (double)BytesPerSector;
|
||||
@@ -204,14 +205,14 @@ PHP_FUNCTION(disk_total_space)
|
||||
#elif defined(OS2)
|
||||
{
|
||||
FSALLOCATE fsinfo;
|
||||
char drive = (*path)->value.str.val[0] & 95;
|
||||
char drive = Z_STRVAL_PP(path)[0] & 95;
|
||||
|
||||
if (DosQueryFSInfo( drive ? drive - 64 : 0, FSIL_ALLOC, &fsinfo, sizeof( fsinfo ) ) == 0)
|
||||
bytestotal = (double)fsinfo.cbSector * fsinfo.cSectorUnit * fsinfo.cUnit;
|
||||
}
|
||||
#else /* WINDOWS, OS/2 */
|
||||
#if defined(HAVE_SYS_STATVFS_H) && defined(HAVE_STATVFS)
|
||||
if (statvfs((*path)->value.str.val, &buf)) RETURN_FALSE;
|
||||
if (statvfs(Z_STRVAL_PP(path), &buf)) RETURN_FALSE;
|
||||
if (buf.f_frsize) {
|
||||
bytestotal = (((double)buf.f_blocks) * ((double)buf.f_frsize));
|
||||
} else {
|
||||
@@ -219,7 +220,7 @@ PHP_FUNCTION(disk_total_space)
|
||||
}
|
||||
|
||||
#elif (defined(HAVE_SYS_STATFS_H) || defined(HAVE_SYS_MOUNT_H)) && defined(HAVE_STATFS)
|
||||
if (statfs((*path)->value.str.val, &buf)) RETURN_FALSE;
|
||||
if (statfs(Z_STRVAL_PP(path), &buf)) RETURN_FALSE;
|
||||
bytestotal = (((double)buf.f_bsize) * ((double)buf.f_blocks));
|
||||
#endif
|
||||
#endif /* WINDOWS */
|
||||
@@ -228,7 +229,7 @@ PHP_FUNCTION(disk_total_space)
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto double disk_free_space(string path)
|
||||
/* {{{ proto float disk_free_space(string path)
|
||||
Get free disk space for filesystem that path is on */
|
||||
PHP_FUNCTION(disk_free_space)
|
||||
{
|
||||
@@ -267,7 +268,7 @@ PHP_FUNCTION(disk_free_space)
|
||||
|
||||
convert_to_string_ex(path);
|
||||
|
||||
if (php_check_open_basedir((*path)->value.str.val TSRMLS_CC)) {
|
||||
if (php_check_open_basedir(Z_STRVAL_PP(path) TSRMLS_CC)) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
@@ -281,7 +282,7 @@ PHP_FUNCTION(disk_free_space)
|
||||
/* It's available, so we can call it. */
|
||||
if (gdfse) {
|
||||
func = (gdfse_func)gdfse;
|
||||
if (func((*path)->value.str.val,
|
||||
if (func(Z_STRVAL_PP(path),
|
||||
&FreeBytesAvailableToCaller,
|
||||
&TotalNumberOfBytes,
|
||||
&TotalNumberOfFreeBytes) == 0) RETURN_FALSE;
|
||||
@@ -293,7 +294,7 @@ PHP_FUNCTION(disk_free_space)
|
||||
}
|
||||
/* If it's not available, we just use GetDiskFreeSpace */
|
||||
else {
|
||||
if (GetDiskFreeSpace((*path)->value.str.val,
|
||||
if (GetDiskFreeSpace(Z_STRVAL_PP(path),
|
||||
&SectorsPerCluster, &BytesPerSector,
|
||||
&NumberOfFreeClusters, &TotalNumberOfClusters) == 0) RETURN_FALSE;
|
||||
bytesfree = (double)NumberOfFreeClusters * (double)SectorsPerCluster * (double)BytesPerSector;
|
||||
@@ -307,21 +308,21 @@ PHP_FUNCTION(disk_free_space)
|
||||
#elif defined(OS2)
|
||||
{
|
||||
FSALLOCATE fsinfo;
|
||||
char drive = (*path)->value.str.val[0] & 95;
|
||||
char drive = Z_STRVAL_PP(path)[0] & 95;
|
||||
|
||||
if (DosQueryFSInfo( drive ? drive - 64 : 0, FSIL_ALLOC, &fsinfo, sizeof( fsinfo ) ) == 0)
|
||||
bytesfree = (double)fsinfo.cbSector * fsinfo.cSectorUnit * fsinfo.cUnitAvail;
|
||||
}
|
||||
#else /* WINDOWS, OS/2 */
|
||||
#if defined(HAVE_SYS_STATVFS_H) && defined(HAVE_STATVFS)
|
||||
if (statvfs((*path)->value.str.val, &buf)) RETURN_FALSE;
|
||||
if (statvfs(Z_STRVAL_PP(path), &buf)) RETURN_FALSE;
|
||||
if (buf.f_frsize) {
|
||||
bytesfree = (((double)buf.f_bavail) * ((double)buf.f_frsize));
|
||||
} else {
|
||||
bytesfree = (((double)buf.f_bavail) * ((double)buf.f_bsize));
|
||||
}
|
||||
#elif (defined(HAVE_SYS_STATFS_H) || defined(HAVE_SYS_MOUNT_H)) && defined(HAVE_STATFS)
|
||||
if (statfs((*path)->value.str.val, &buf)) RETURN_FALSE;
|
||||
if (statfs(Z_STRVAL_PP(path), &buf)) RETURN_FALSE;
|
||||
bytesfree = (((double)buf.f_bsize) * ((double)buf.f_bavail));
|
||||
#endif
|
||||
#endif /* WINDOWS */
|
||||
@@ -344,29 +345,29 @@ PHP_FUNCTION(chgrp)
|
||||
WRONG_PARAM_COUNT;
|
||||
}
|
||||
convert_to_string_ex(filename);
|
||||
if ((*group)->type == IS_STRING) {
|
||||
gr = getgrnam((*group)->value.str.val);
|
||||
if (Z_TYPE_PP(group) == IS_STRING) {
|
||||
gr = getgrnam(Z_STRVAL_PP(group));
|
||||
if (!gr) {
|
||||
php_error(E_WARNING, "unable to find gid for %s",
|
||||
(*group)->value.str.val);
|
||||
Z_STRVAL_PP(group));
|
||||
RETURN_FALSE;
|
||||
}
|
||||
gid = gr->gr_gid;
|
||||
} else {
|
||||
convert_to_long_ex(group);
|
||||
gid = (*group)->value.lval;
|
||||
gid = Z_LVAL_PP(group);
|
||||
}
|
||||
|
||||
if (PG(safe_mode) &&(!php_checkuid((*filename)->value.str.val, NULL, CHECKUID_ALLOW_FILE_NOT_EXISTS))) {
|
||||
if (PG(safe_mode) &&(!php_checkuid(Z_STRVAL_PP(filename), NULL, CHECKUID_ALLOW_FILE_NOT_EXISTS))) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
/* Check the basedir */
|
||||
if (php_check_open_basedir((*filename)->value.str.val TSRMLS_CC)) {
|
||||
if (php_check_open_basedir(Z_STRVAL_PP(filename) TSRMLS_CC)) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
ret = VCWD_CHOWN((*filename)->value.str.val, -1, gid);
|
||||
ret = VCWD_CHOWN(Z_STRVAL_PP(filename), -1, gid);
|
||||
if (ret == -1) {
|
||||
php_error(E_WARNING, "chgrp failed: %s", strerror(errno));
|
||||
RETURN_FALSE;
|
||||
@@ -392,29 +393,29 @@ PHP_FUNCTION(chown)
|
||||
WRONG_PARAM_COUNT;
|
||||
}
|
||||
convert_to_string_ex(filename);
|
||||
if ((*user)->type == IS_STRING) {
|
||||
pw = getpwnam((*user)->value.str.val);
|
||||
if (Z_TYPE_PP(user) == IS_STRING) {
|
||||
pw = getpwnam(Z_STRVAL_PP(user));
|
||||
if (!pw) {
|
||||
php_error(E_WARNING, "unable to find uid for %s",
|
||||
(*user)->value.str.val);
|
||||
Z_STRVAL_PP(user));
|
||||
RETURN_FALSE;
|
||||
}
|
||||
uid = pw->pw_uid;
|
||||
} else {
|
||||
convert_to_long_ex(user);
|
||||
uid = (*user)->value.lval;
|
||||
uid = Z_LVAL_PP(user);
|
||||
}
|
||||
|
||||
if (PG(safe_mode) &&(!php_checkuid((*filename)->value.str.val, NULL, CHECKUID_ALLOW_FILE_NOT_EXISTS))) {
|
||||
if (PG(safe_mode) &&(!php_checkuid(Z_STRVAL_PP(filename), NULL, CHECKUID_ALLOW_FILE_NOT_EXISTS))) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
/* Check the basedir */
|
||||
if (php_check_open_basedir((*filename)->value.str.val TSRMLS_CC)) {
|
||||
if (php_check_open_basedir(Z_STRVAL_PP(filename) TSRMLS_CC)) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
ret = VCWD_CHOWN((*filename)->value.str.val, uid, -1);
|
||||
ret = VCWD_CHOWN(Z_STRVAL_PP(filename), uid, -1);
|
||||
if (ret == -1) {
|
||||
php_error(E_WARNING, "chown failed: %s", strerror(errno));
|
||||
RETURN_FALSE;
|
||||
@@ -438,16 +439,16 @@ PHP_FUNCTION(chmod)
|
||||
convert_to_string_ex(filename);
|
||||
convert_to_long_ex(mode);
|
||||
|
||||
if (PG(safe_mode) &&(!php_checkuid((*filename)->value.str.val, NULL, CHECKUID_ALLOW_FILE_NOT_EXISTS))) {
|
||||
if (PG(safe_mode) &&(!php_checkuid(Z_STRVAL_PP(filename), NULL, CHECKUID_ALLOW_FILE_NOT_EXISTS))) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
/* Check the basedir */
|
||||
if (php_check_open_basedir((*filename)->value.str.val TSRMLS_CC)) {
|
||||
if (php_check_open_basedir(Z_STRVAL_PP(filename) TSRMLS_CC)) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
imode = (mode_t) (*mode)->value.lval;
|
||||
imode = (mode_t) Z_LVAL_PP(mode);
|
||||
/* in safe mode, do not allow to setuid files.
|
||||
Setuiding files could allow users to gain privileges
|
||||
that safe mode doesn't give them.
|
||||
@@ -455,7 +456,7 @@ PHP_FUNCTION(chmod)
|
||||
if(PG(safe_mode))
|
||||
imode &= 0777;
|
||||
|
||||
ret = VCWD_CHMOD((*filename)->value.str.val, imode);
|
||||
ret = VCWD_CHMOD(Z_STRVAL_PP(filename), imode);
|
||||
if (ret == -1) {
|
||||
php_error(E_WARNING, "chmod failed: %s", strerror(errno));
|
||||
RETURN_FALSE;
|
||||
@@ -493,20 +494,20 @@ PHP_FUNCTION(touch)
|
||||
return;
|
||||
}
|
||||
convert_to_long_ex(filetime);
|
||||
newtime->actime = (*filetime)->value.lval;
|
||||
newtime->modtime = (*filetime)->value.lval;
|
||||
newtime->actime = Z_LVAL_PP(filetime);
|
||||
newtime->modtime = Z_LVAL_PP(filetime);
|
||||
} else {
|
||||
WRONG_PARAM_COUNT;
|
||||
}
|
||||
convert_to_string_ex(filename);
|
||||
|
||||
if (PG(safe_mode) &&(!php_checkuid((*filename)->value.str.val, NULL, CHECKUID_CHECK_FILE_AND_DIR))) {
|
||||
if (PG(safe_mode) &&(!php_checkuid(Z_STRVAL_PP(filename), NULL, CHECKUID_CHECK_FILE_AND_DIR))) {
|
||||
if (newtime) efree(newtime);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
/* Check the basedir */
|
||||
if (php_check_open_basedir((*filename)->value.str.val TSRMLS_CC)) {
|
||||
if (php_check_open_basedir(Z_STRVAL_PP(filename) TSRMLS_CC)) {
|
||||
if (newtime) {
|
||||
efree(newtime);
|
||||
}
|
||||
@@ -514,18 +515,18 @@ PHP_FUNCTION(touch)
|
||||
}
|
||||
|
||||
/* create the file if it doesn't exist already */
|
||||
ret = VCWD_STAT((*filename)->value.str.val, &sb);
|
||||
ret = VCWD_STAT(Z_STRVAL_PP(filename), &sb);
|
||||
if (ret == -1) {
|
||||
file = VCWD_FOPEN((*filename)->value.str.val, "w");
|
||||
file = VCWD_FOPEN(Z_STRVAL_PP(filename), "w");
|
||||
if (file == NULL) {
|
||||
php_error(E_WARNING, "unable to create file %s because %s", (*filename)->value.str.val, strerror(errno));
|
||||
php_error(E_WARNING, "unable to create file %s because %s", Z_STRVAL_PP(filename), strerror(errno));
|
||||
if (newtime) efree(newtime);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
fclose(file);
|
||||
}
|
||||
|
||||
ret = VCWD_UTIME((*filename)->value.str.val, newtime);
|
||||
ret = VCWD_UTIME(Z_STRVAL_PP(filename), newtime);
|
||||
if (newtime) efree(newtime);
|
||||
if (ret == -1) {
|
||||
php_error(E_WARNING, "utime failed: %s", strerror(errno));
|
||||
@@ -549,10 +550,11 @@ PHP_FUNCTION(clearstatcache)
|
||||
/* }}} */
|
||||
|
||||
#define IS_LINK_OPERATION() (type == 8 /* filetype */ || type == 14 /* is_link */ || type == 16 /* lstat */)
|
||||
#define IS_EXISTS_CHECK(__t) ((__t) == FS_EXISTS || (__t) == FS_IS_W || (__t) == FS_IS_R || (__t) == FS_IS_X || (__t) == FS_IS_FILE || (__t) == FS_IS_DIR || (__t) == FS_IS_LINK)
|
||||
|
||||
/* {{{ php_stat
|
||||
*/
|
||||
static void php_stat(const char *filename, php_stat_len filename_length, int type, pval *return_value)
|
||||
static void php_stat(const char *filename, php_stat_len filename_length, int type, pval *return_value TSRMLS_DC)
|
||||
{
|
||||
zval *stat_dev, *stat_ino, *stat_mode, *stat_nlink, *stat_uid, *stat_gid, *stat_rdev,
|
||||
*stat_size, *stat_atime, *stat_mtime, *stat_ctime, *stat_blksize, *stat_blocks;
|
||||
@@ -560,7 +562,6 @@ static void php_stat(const char *filename, php_stat_len filename_length, int typ
|
||||
int rmask=S_IROTH, wmask=S_IWOTH, xmask=S_IXOTH; /* access rights defaults to other */
|
||||
char *stat_sb_names[13]={"dev", "ino", "mode", "nlink", "uid", "gid", "rdev",
|
||||
"size", "atime", "mtime", "ctime", "blksize", "blocks"};
|
||||
TSRMLS_FETCH();
|
||||
|
||||
stat_sb = &BG(sb);
|
||||
|
||||
@@ -578,7 +579,7 @@ static void php_stat(const char *filename, php_stat_len filename_length, int typ
|
||||
BG(lsb).st_mode = 0; /* mark lstat buf invalid */
|
||||
#endif
|
||||
if (VCWD_STAT(BG(CurrentStatFile), &BG(sb)) == -1) {
|
||||
if (!IS_LINK_OPERATION() && (type != FS_EXISTS || errno != ENOENT)) { /* fileexists() test must print no error */
|
||||
if (!IS_LINK_OPERATION() && (!IS_EXISTS_CHECK(type) || errno != ENOENT)) { /* fileexists() test must print no error */
|
||||
php_error(E_WARNING, "stat failed for %s (errno=%d - %s)", BG(CurrentStatFile), errno, strerror(errno));
|
||||
}
|
||||
efree(BG(CurrentStatFile));
|
||||
@@ -734,6 +735,7 @@ static void php_stat(const char *filename, php_stat_len filename_length, int typ
|
||||
zend_hash_next_index_insert(HASH_OF(return_value), (void *)&stat_nlink, sizeof(zval *), NULL);
|
||||
zend_hash_next_index_insert(HASH_OF(return_value), (void *)&stat_uid, sizeof(zval *), NULL);
|
||||
zend_hash_next_index_insert(HASH_OF(return_value), (void *)&stat_gid, sizeof(zval *), NULL);
|
||||
|
||||
zend_hash_next_index_insert(HASH_OF(return_value), (void *)&stat_rdev, sizeof(zval *), NULL);
|
||||
zend_hash_next_index_insert(HASH_OF(return_value), (void *)&stat_size, sizeof(zval *), NULL);
|
||||
zend_hash_next_index_insert(HASH_OF(return_value), (void *)&stat_atime, sizeof(zval *), NULL);
|
||||
@@ -772,7 +774,7 @@ void name(INTERNAL_FUNCTION_PARAMETERS) { \
|
||||
WRONG_PARAM_COUNT; \
|
||||
} \
|
||||
convert_to_string_ex(filename); \
|
||||
php_stat(Z_STRVAL_PP(filename), (php_stat_len) Z_STRLEN_PP(filename), funcnum, return_value); \
|
||||
php_stat(Z_STRVAL_PP(filename), (php_stat_len) Z_STRLEN_PP(filename), funcnum, return_value TSRMLS_CC); \
|
||||
}
|
||||
|
||||
/* {{{ proto int fileperms(string filename)
|
||||
@@ -870,6 +872,6 @@ FileFunction(php_if_stat, FS_STAT)
|
||||
* tab-width: 4
|
||||
* c-basic-offset: 4
|
||||
* End:
|
||||
* vim600: sw=4 ts=4 tw=78 fdm=marker
|
||||
* vim<600: sw=4 ts=4 tw=78
|
||||
* vim600: sw=4 ts=4 fdm=marker
|
||||
* vim<600: sw=4 ts=4
|
||||
*/
|
||||
@@ -278,7 +278,7 @@ FILE *php_fopen_url_wrap_http(const char *path, char *mode, int options, int *is
|
||||
*new_path='\0';
|
||||
if (strlen(location)<8 || strncasecmp(location, "http://", 7)) {
|
||||
strcpy(new_path, "http://");
|
||||
strncat(new_path, resource->host, sizeof(new_path)-strlen(new_path)-1);
|
||||
strlcat(new_path, resource->host, sizeof(new_path));
|
||||
if (resource->port != 80) {
|
||||
snprintf(new_path+strlen(new_path), sizeof(new_path)-strlen(new_path)-1, ":%d", resource->port);
|
||||
}
|
||||
@@ -286,10 +286,10 @@ FILE *php_fopen_url_wrap_http(const char *path, char *mode, int options, int *is
|
||||
php_dirname(resource->path, strlen(resource->path));
|
||||
snprintf (new_path+strlen(new_path), sizeof(new_path)-strlen(new_path)-1, "%s/", resource->path);
|
||||
}
|
||||
strncat(new_path, location, sizeof(new_path)-strlen(new_path)-1);
|
||||
strlcat(new_path, location, sizeof(new_path));
|
||||
}
|
||||
else {
|
||||
strncpy(new_path, location, sizeof(new_path));
|
||||
strlcpy(new_path, location, sizeof(new_path));
|
||||
}
|
||||
php_url_free(resource);
|
||||
fp = php_fopen_url_wrap_http(new_path, mode, options, issock, socketd, opened_path TSRMLS_CC);
|
||||
|
||||
+2
-2
@@ -414,7 +414,7 @@ PHP_FUNCTION(pow)
|
||||
/* pow(?, float), this is the ^^ case */
|
||||
convert_to_double_ex(zbase);
|
||||
|
||||
if ( Z_DVAL_PP(zbase) <= 0.0 ) {
|
||||
if (Z_DVAL_PP(zbase) < 0.0) {
|
||||
/* Note that with the old behaviour, php pow() returned bogus
|
||||
results. Try pow(-1, 2.5) in PHP <= 4.0.6 ... */
|
||||
php_error(E_WARNING, "Trying to raise a nonpositive value to a broken power");
|
||||
@@ -733,7 +733,7 @@ _php_math_basetozval(zval *arg, int base, zval *ret) {
|
||||
if(!f_mode && (!mult || digit > LONG_MAX/mult || num > LONG_MAX-mult*digit)) {
|
||||
f_mode = 1;
|
||||
if(!mult) {
|
||||
fmult = ULONG_MAX + 1;
|
||||
fmult = ((double) ULONG_MAX) + 1;
|
||||
} else {
|
||||
fmult = (unsigned long)mult;
|
||||
}
|
||||
|
||||
@@ -249,14 +249,17 @@ time : tUNUMBER tMERIDIAN {
|
||||
yyMeridian = $6;
|
||||
}
|
||||
| tUNUMBER ':' tUNUMBER ':' tUNUMBER tSNUMBER {
|
||||
/* ISO 8601 format. hh:mm:ss[+-][0-9]{2}([0-9]{2})?. */
|
||||
yyHour = $1;
|
||||
yyMinutes = $3;
|
||||
yySeconds = $5;
|
||||
yyMeridian = MER24;
|
||||
yyHaveZone++;
|
||||
yyTimezone = ($6 < 0
|
||||
? -$6 % 100 + (-$6 / 100) * 60
|
||||
: - ($6 % 100 + ($6 / 100) * 60));
|
||||
if ($6 <= -100 || $6 >= 100) {
|
||||
yyTimezone = -$6 % 100 + (-$6 / 100) * 60;
|
||||
} else {
|
||||
yyTimezone = -$6 * 60;
|
||||
}
|
||||
}
|
||||
;
|
||||
|
||||
|
||||
@@ -77,7 +77,7 @@ PHP_FUNCTION(array_diff);
|
||||
PHP_FUNCTION(array_sum);
|
||||
PHP_FUNCTION(array_filter);
|
||||
PHP_FUNCTION(array_map);
|
||||
PHP_FUNCTION(key_exists);
|
||||
PHP_FUNCTION(array_key_exists);
|
||||
|
||||
HashTable* php_splice(HashTable *, int, int, zval ***, int, HashTable **);
|
||||
PHPAPI void php_array_merge(HashTable *dest, HashTable *src, int recursive);
|
||||
|
||||
+18
-8
@@ -907,6 +907,7 @@ PHP_FUNCTION(strtok)
|
||||
char *token_end;
|
||||
char *p;
|
||||
char *pe;
|
||||
int skipped = 0;
|
||||
|
||||
if (ZEND_NUM_ARGS() < 1 || ZEND_NUM_ARGS() > 2 ||
|
||||
zend_get_parameters_array_ex(ZEND_NUM_ARGS(), args) == FAILURE)
|
||||
@@ -947,12 +948,15 @@ PHP_FUNCTION(strtok)
|
||||
|
||||
/* Skip leading delimiters */
|
||||
while (STRTOK_TABLE(p))
|
||||
{
|
||||
if (++p >= pe) {
|
||||
/* no other chars left */
|
||||
BG(strtok_last) = NULL;
|
||||
RETVAL_FALSE;
|
||||
goto restore;
|
||||
}
|
||||
skipped++;
|
||||
}
|
||||
|
||||
/* We know at this place that *p is no delimiter, so skip it */
|
||||
while (++p < pe)
|
||||
@@ -961,7 +965,7 @@ PHP_FUNCTION(strtok)
|
||||
|
||||
if (p - BG(strtok_last)) {
|
||||
return_token:
|
||||
RETVAL_STRINGL(BG(strtok_last), p - BG(strtok_last), 1);
|
||||
RETVAL_STRINGL(BG(strtok_last) + skipped, (p - BG(strtok_last)) - skipped, 1);
|
||||
BG(strtok_last) = p + 1;
|
||||
} else {
|
||||
RETVAL_FALSE;
|
||||
@@ -2628,6 +2632,7 @@ static void php_str_replace_in_subject(zval *search, zval *replace, zval **subje
|
||||
/* Duplicate subject string for repeated replacement */
|
||||
*result = **subject;
|
||||
zval_copy_ctor(result);
|
||||
INIT_PZVAL(result);
|
||||
|
||||
zend_hash_internal_pointer_reset(Z_ARRVAL_P(search));
|
||||
|
||||
@@ -2676,14 +2681,18 @@ static void php_str_replace_in_subject(zval *search, zval *replace, zval **subje
|
||||
&temp_result);
|
||||
} else if (Z_STRLEN_PP(search_entry) > 1) {
|
||||
Z_STRVAL(temp_result) = str_to_str(Z_STRVAL_P(result), Z_STRLEN_P(result),
|
||||
Z_STRVAL_PP(search_entry), Z_STRLEN_PP(search_entry),
|
||||
replace_value, replace_len, &Z_STRLEN(temp_result));
|
||||
Z_STRVAL_PP(search_entry), Z_STRLEN_PP(search_entry),
|
||||
replace_value, replace_len, &Z_STRLEN(temp_result));
|
||||
}
|
||||
|
||||
efree(Z_STRVAL_P(result));
|
||||
Z_STRVAL_P(result) = Z_STRVAL(temp_result);
|
||||
Z_STRLEN_P(result) = Z_STRLEN(temp_result);
|
||||
|
||||
if (Z_STRLEN_P(result) == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
zend_hash_move_forward(Z_ARRVAL_P(search));
|
||||
}
|
||||
} else {
|
||||
@@ -2696,11 +2705,12 @@ static void php_str_replace_in_subject(zval *search, zval *replace, zval **subje
|
||||
result);
|
||||
} else if (Z_STRLEN_P(search) > 1) {
|
||||
Z_STRVAL_P(result) = str_to_str(Z_STRVAL_PP(subject), Z_STRLEN_PP(subject),
|
||||
Z_STRVAL_P(search), Z_STRLEN_P(search),
|
||||
Z_STRVAL_P(replace), Z_STRLEN_P(replace), &Z_STRLEN_P(result));
|
||||
Z_STRVAL_P(search), Z_STRLEN_P(search),
|
||||
Z_STRVAL_P(replace), Z_STRLEN_P(replace), &Z_STRLEN_P(result));
|
||||
} else {
|
||||
*result = **subject;
|
||||
zval_copy_ctor(result);
|
||||
INIT_PZVAL(result);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2718,9 +2728,9 @@ PHP_FUNCTION(str_replace)
|
||||
int boyer = 0;
|
||||
|
||||
if(ZEND_NUM_ARGS() < 3 ||
|
||||
ZEND_NUM_ARGS() > 4 ||
|
||||
zend_get_parameters_ex(ZEND_NUM_ARGS(), &search,
|
||||
&replace, &subject, &pboyer) == FAILURE) {
|
||||
ZEND_NUM_ARGS() > 4 ||
|
||||
zend_get_parameters_ex(ZEND_NUM_ARGS(), &search,
|
||||
&replace, &subject, &pboyer) == FAILURE) {
|
||||
WRONG_PARAM_COUNT;
|
||||
}
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ if (file_exists('test.file')) {
|
||||
echo "test.file does not exist\n";
|
||||
}
|
||||
fclose (fopen('test.file', 'w'));
|
||||
chmod ('test.file', 0654);
|
||||
chmod ('test.file', 0744);
|
||||
if (file_exists('test.file')) {
|
||||
echo "test.file exists\n";
|
||||
} else {
|
||||
@@ -134,11 +134,11 @@ test.link lstat and stat differ at element 9
|
||||
test.link lstat and stat differ at element 10
|
||||
test.file is file
|
||||
test.link is link
|
||||
test.file permissions are 0654
|
||||
test.file permissions are 0744
|
||||
test.file size is 0
|
||||
test.file is writeable
|
||||
test.file is readable
|
||||
test.file is not executable
|
||||
test.file is executable
|
||||
test.file is not executable
|
||||
test.file is a regular file
|
||||
test.link is a regular file
|
||||
|
||||
@@ -1,45 +0,0 @@
|
||||
--TEST--
|
||||
Simple math tests
|
||||
--POST--
|
||||
--GET--
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
define('LONG_MAX', is_int(5000000000)? 9223372036854775807 : 0x7FFFFFFF);
|
||||
define('LONG_MIN', -LONG_MAX - 1);
|
||||
printf("%d,%d,%d,%d\n",is_int(LONG_MIN ),is_int(LONG_MAX ),
|
||||
is_int(LONG_MIN-1),is_int(LONG_MAX+1));
|
||||
|
||||
$tests = <<<TESTS
|
||||
1 === abs(-1)
|
||||
1.5 === abs(-1.5)
|
||||
1 === abs("-1")
|
||||
1.5 === abs("-1.5")
|
||||
-LONG_MIN+1 === abs(LONG_MIN-1)
|
||||
-LONG_MIN === abs(LONG_MIN)
|
||||
-(LONG_MIN+1) === abs(LONG_MIN+1)
|
||||
-1 === ceil(-1.5)
|
||||
2 === ceil( 1.5)
|
||||
-2 === floor(-1.5)
|
||||
1 === floor(1.5)
|
||||
LONG_MIN === ceil(LONG_MIN - 0.5)
|
||||
LONG_MIN+1 === ceil(LONG_MIN + 0.5)
|
||||
LONG_MIN-1 === round(LONG_MIN - 0.6)
|
||||
LONG_MIN === round(LONG_MIN - 0.4)
|
||||
LONG_MIN === round(LONG_MIN + 0.4)
|
||||
LONG_MIN+1 === round(LONG_MIN + 0.6)
|
||||
LONG_MIN-1 === floor(LONG_MIN - 0.5)
|
||||
LONG_MIN === floor(LONG_MIN + 0.5)
|
||||
LONG_MAX === ceil(LONG_MAX - 0.5)
|
||||
LONG_MAX+1 === ceil(LONG_MAX + 0.5)
|
||||
LONG_MAX-1 === round(LONG_MAX - 0.6)
|
||||
LONG_MAX === round(LONG_MAX - 0.4)
|
||||
LONG_MAX === round(LONG_MAX + 0.4)
|
||||
LONG_MAX+1 === round(LONG_MAX + 0.6)
|
||||
LONG_MAX-1 === floor(LONG_MAX - 0.5)
|
||||
LONG_MAX === floor(LONG_MAX + 0.5)
|
||||
TESTS;
|
||||
|
||||
include('../../../../tests/quicktester.inc');
|
||||
--EXPECT--
|
||||
OK
|
||||
@@ -0,0 +1,26 @@
|
||||
--TEST--
|
||||
Simple math tests
|
||||
--POST--
|
||||
--GET--
|
||||
--FILE--
|
||||
<?php // $Id$
|
||||
|
||||
define('LONG_MAX', is_int(5000000000)? 9223372036854775807 : 0x7FFFFFFF);
|
||||
define('LONG_MIN', -LONG_MAX - 1);
|
||||
printf("%d,%d,%d,%d\n",is_int(LONG_MIN ),is_int(LONG_MAX ),
|
||||
is_int(LONG_MIN-1),is_int(LONG_MAX+1));
|
||||
|
||||
$tests = <<<TESTS
|
||||
1 === abs(-1)
|
||||
1.5 === abs(-1.5)
|
||||
1 === abs("-1")
|
||||
1.5 === abs("-1.5")
|
||||
-LONG_MIN+1 === abs(LONG_MIN-1)
|
||||
-LONG_MIN === abs(LONG_MIN)
|
||||
-(LONG_MIN+1) === abs(LONG_MIN+1)
|
||||
TESTS;
|
||||
|
||||
include('../../../../tests/quicktester.inc');
|
||||
--EXPECT--
|
||||
1,1,0,0
|
||||
OK
|
||||
@@ -3,7 +3,8 @@ Various pow() tests
|
||||
--POST--
|
||||
--GET--
|
||||
--FILE--
|
||||
<?php
|
||||
<?php // $Id$
|
||||
|
||||
define('LONG_MAX', is_int(5000000000)? 9223372036854775807 : 0x7FFFFFFF);
|
||||
define('LONG_MIN', -LONG_MAX - 1);
|
||||
printf("%d,%d,%d,%d\n",is_int(LONG_MIN ),is_int(LONG_MAX ),
|
||||
@@ -60,13 +61,13 @@ FALSE ===@pow( 0, 2.0)
|
||||
1.0 === pow( 2, 0.0)
|
||||
2.0 === pow( 2, 1.0)
|
||||
4.0 === pow( 2, 2.0)
|
||||
2147483648 === pow(2,31)
|
||||
-2147483648 === pow(-2,31)
|
||||
2147483648 ~== pow(2,31)
|
||||
-2147483648 ~== pow(-2,31)
|
||||
1000000000 === pow(10,9)
|
||||
100000000 === pow(-10,8)
|
||||
1 === pow(-1,1443279822)
|
||||
-1 === pow(-1,1443279821)
|
||||
sqrt(2) === pow(2,1/2)
|
||||
sqrt(2) ~== pow(2,1/2)
|
||||
FALSE ===@pow(-2.0,-2.0)
|
||||
FALSE ===@pow(-2.0,-1.0)
|
||||
FALSE ===@pow(-2.0, 0.0)
|
||||
@@ -119,19 +120,19 @@ FALSE ===@pow( 0.0,-1)
|
||||
4.0 === pow( 2.0, 2)
|
||||
LONG_MAX-1 === pow(LONG_MAX-1,1)
|
||||
LONG_MIN+1 === pow(LONG_MIN+1,1)
|
||||
(LONG_MAX-1)*(LONG_MAX-1) === pow(LONG_MAX-1,2)
|
||||
(LONG_MIN+1)*(LONG_MIN+1) === pow(LONG_MIN+1,2)
|
||||
(float)(LONG_MAX-1) === pow(LONG_MAX-1,1.0)
|
||||
(LONG_MAX-1)*(LONG_MAX-1) ~== pow(LONG_MAX-1,2)
|
||||
(LONG_MIN+1)*(LONG_MIN+1) ~== pow(LONG_MIN+1,2)
|
||||
(float)(LONG_MAX-1) ~== pow(LONG_MAX-1,1.0)
|
||||
FALSE ===@pow(LONG_MIN+1,1.0)
|
||||
(LONG_MAX-1)*(LONG_MAX-1) === pow(LONG_MAX-1,2.0)
|
||||
(LONG_MAX-1)*(LONG_MAX-1) ~== pow(LONG_MAX-1,2.0)
|
||||
FALSE ===@pow(LONG_MIN+1,2.0)
|
||||
LONG_MAX === pow(LONG_MAX,1)
|
||||
LONG_MIN === pow(LONG_MIN,1)
|
||||
LONG_MAX*LONG_MAX === pow(LONG_MAX,2)
|
||||
LONG_MIN*LONG_MIN === pow(LONG_MIN,2)
|
||||
(float)LONG_MAX === pow(LONG_MAX,1.0)
|
||||
LONG_MIN ~== pow(LONG_MIN,1)
|
||||
LONG_MAX*LONG_MAX ~== pow(LONG_MAX,2)
|
||||
LONG_MIN*LONG_MIN ~== pow(LONG_MIN,2)
|
||||
(float)LONG_MAX ~== pow(LONG_MAX,1.0)
|
||||
FALSE ===@pow(LONG_MIN,1.0)
|
||||
LONG_MAX*LONG_MAX === pow(LONG_MAX,2.0)
|
||||
LONG_MAX*LONG_MAX ~== pow(LONG_MAX,2.0)
|
||||
FALSE ===@pow(LONG_MIN,2.0)
|
||||
TESTS;
|
||||
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
--TEST--
|
||||
Simple math tests
|
||||
--POST--
|
||||
--GET--
|
||||
--FILE--
|
||||
<?php // $Id$
|
||||
|
||||
define('LONG_MAX', is_int(5000000000)? 9223372036854775807 : 0x7FFFFFFF);
|
||||
define('LONG_MIN', -LONG_MAX - 1);
|
||||
printf("%d,%d,%d,%d\n",is_int(LONG_MIN ),is_int(LONG_MAX ),
|
||||
is_int(LONG_MIN-1),is_int(LONG_MAX+1));
|
||||
|
||||
$tests = <<<TESTS
|
||||
-1 ~== ceil(-1.5)
|
||||
2 ~== ceil( 1.5)
|
||||
-2 ~== floor(-1.5)
|
||||
1 ~== floor(1.5)
|
||||
LONG_MIN ~== ceil(LONG_MIN - 0.5)
|
||||
LONG_MIN+1 ~== ceil(LONG_MIN + 0.5)
|
||||
LONG_MIN-1 ~== round(LONG_MIN - 0.6)
|
||||
LONG_MIN ~== round(LONG_MIN - 0.4)
|
||||
LONG_MIN ~== round(LONG_MIN + 0.4)
|
||||
LONG_MIN+1 ~== round(LONG_MIN + 0.6)
|
||||
LONG_MIN-1 ~== floor(LONG_MIN - 0.5)
|
||||
LONG_MIN ~== floor(LONG_MIN + 0.5)
|
||||
LONG_MAX ~== ceil(LONG_MAX - 0.5)
|
||||
LONG_MAX+1 ~== ceil(LONG_MAX + 0.5)
|
||||
LONG_MAX-1 ~== round(LONG_MAX - 0.6)
|
||||
LONG_MAX ~== round(LONG_MAX - 0.4)
|
||||
LONG_MAX ~== round(LONG_MAX + 0.4)
|
||||
LONG_MAX+1 ~== round(LONG_MAX + 0.6)
|
||||
LONG_MAX-1 ~== floor(LONG_MAX - 0.5)
|
||||
LONG_MAX ~== floor(LONG_MAX + 0.5)
|
||||
TESTS;
|
||||
|
||||
include('../../../../tests/quicktester.inc');
|
||||
--EXPECT--
|
||||
1,1,0,0
|
||||
OK
|
||||
@@ -4,8 +4,12 @@ microtime() function
|
||||
--GET--
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
set_time_limit(180);
|
||||
|
||||
$passed = 0;
|
||||
$failed = 0;
|
||||
$last = 0;
|
||||
for ($i=1;$i<=100000;$i++) {
|
||||
list($micro,$time)=explode(" ",microtime());
|
||||
$add=$micro+$time;
|
||||
|
||||
@@ -4,37 +4,59 @@ strtotime() function
|
||||
--GET--
|
||||
--FILE--
|
||||
<?php
|
||||
echo "1999-10-13\n";
|
||||
echo strtotime ("1999-10-13")."\n";
|
||||
echo strtotime ("Oct 13 1999")."\n\n";
|
||||
$dates = array (
|
||||
"1999-10-13",
|
||||
"Oct 13 1999",
|
||||
"2000-01-19",
|
||||
"Jan 19 2000",
|
||||
"2001-12-21",
|
||||
"Dec 21 2001",
|
||||
"2001-12-21 12:16",
|
||||
"Dec 21 2001 12:16",
|
||||
"Dec 21 12:16",
|
||||
"2001-10-22 21:19:58",
|
||||
"2001-10-22 21:19:58-02",
|
||||
"2001-10-22 21:19:58-0213",
|
||||
"2001-10-22 21:19:58+02",
|
||||
"2001-10-22 21:19:58+0213"
|
||||
);
|
||||
|
||||
echo "2000-01-19\n";
|
||||
echo strtotime ("2000-01-19")."\n";
|
||||
echo strtotime ("Jan 19 2000")."\n\n";
|
||||
putenv ("TZ=GMT");
|
||||
foreach ($dates as $date) {
|
||||
echo date ("Y-m-d H:i:s\n", strtotime ($date));
|
||||
}
|
||||
|
||||
echo "2001-12-21\n";
|
||||
echo strtotime ("2001-12-21")."\n";
|
||||
echo strtotime ("Dec 21 2001")."\n\n";
|
||||
|
||||
echo "2001-12-21 12:16\n";
|
||||
echo strtotime ("2001-12-21 12:16")."\n";
|
||||
echo strtotime ("Dec 21 2001 12:16")."\n";
|
||||
echo strtotime ("Dec 21 12:16")."\n";
|
||||
putenv ("TZ=Europe/Amsterdam");
|
||||
foreach ($dates as $date) {
|
||||
echo date ("Y-m-d H:i:s\n", strtotime ($date));
|
||||
}
|
||||
?>
|
||||
--EXPECT--
|
||||
1999-10-13
|
||||
939765600
|
||||
939765600
|
||||
|
||||
2000-01-19
|
||||
948236400
|
||||
948236400
|
||||
|
||||
2001-12-21
|
||||
1008889200
|
||||
1008889200
|
||||
|
||||
2001-12-21 12:16
|
||||
1008933360
|
||||
1008933360
|
||||
-1
|
||||
1999-10-13 00:00:00
|
||||
1999-10-13 00:00:00
|
||||
2000-01-19 00:00:00
|
||||
2000-01-19 00:00:00
|
||||
2001-12-21 00:00:00
|
||||
2001-12-21 00:00:00
|
||||
2001-12-21 12:16:00
|
||||
2001-12-21 12:16:00
|
||||
1969-12-31 23:59:59
|
||||
2001-10-22 21:19:58
|
||||
2001-10-22 23:19:58
|
||||
2001-10-22 23:32:58
|
||||
2001-10-22 19:19:58
|
||||
2001-10-22 19:06:58
|
||||
1999-10-13 00:00:00
|
||||
1999-10-13 00:00:00
|
||||
2000-01-19 00:00:00
|
||||
2000-01-19 00:00:00
|
||||
2001-12-21 00:00:00
|
||||
2001-12-21 00:00:00
|
||||
2001-12-21 12:16:00
|
||||
2001-12-21 12:16:00
|
||||
1970-01-01 00:59:59
|
||||
2001-10-22 21:19:58
|
||||
2001-10-23 01:19:58
|
||||
2001-10-23 01:32:58
|
||||
2001-10-22 21:19:58
|
||||
2001-10-22 21:06:58
|
||||
+1
-1
@@ -250,7 +250,7 @@ PHPAPI char *php_url_encode(char *s, int len, int *new_length)
|
||||
register int x, y;
|
||||
unsigned char *str;
|
||||
|
||||
str = (unsigned char *) emalloc(3 * strlen(s) + 1);
|
||||
str = (unsigned char *) emalloc(3 * len + 1);
|
||||
for (x = 0, y = 0; len--; x++, y++) {
|
||||
str[y] = (unsigned char) s[x];
|
||||
if (str[y] == ' ') {
|
||||
|
||||
+8
-2
@@ -210,6 +210,10 @@ static void php_var_serialize_class(smart_str *buf, zval **struc, zval *retval_p
|
||||
ulong index;
|
||||
HashPosition pos;
|
||||
int i;
|
||||
zval nval, *nvalp;
|
||||
|
||||
ZVAL_NULL(&nval);
|
||||
nvalp = &nval;
|
||||
|
||||
zend_hash_internal_pointer_reset_ex(HASH_OF(retval_ptr), &pos);
|
||||
|
||||
@@ -230,11 +234,13 @@ static void php_var_serialize_class(smart_str *buf, zval **struc, zval *retval_p
|
||||
continue;
|
||||
}
|
||||
|
||||
php_var_serialize_string(buf, Z_STRVAL_PP(name), Z_STRLEN_PP(name));
|
||||
|
||||
if (zend_hash_find(Z_OBJPROP_PP(struc), Z_STRVAL_PP(name),
|
||||
Z_STRLEN_PP(name) + 1, (void *) &d) == SUCCESS) {
|
||||
php_var_serialize_string(buf, Z_STRVAL_PP(name),
|
||||
Z_STRLEN_PP(name));
|
||||
php_var_serialize_intern(buf, d, var_hash TSRMLS_CC);
|
||||
} else {
|
||||
php_var_serialize_intern(buf, &nvalp, var_hash TSRMLS_CC);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -208,6 +208,12 @@ PHP_FUNCTION(shm_remove)
|
||||
id = (*arg_id)->value.lval;
|
||||
|
||||
shm_list_ptr = (sysvshm_shm *) zend_list_find(id, &type);
|
||||
|
||||
if (!shm_list_ptr) {
|
||||
php_error(E_WARNING, "The parameter is not a valid shm_indentifier");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
if(shmctl(shm_list_ptr->id,IPC_RMID,NULL)<0) {
|
||||
php_error(E_WARNING, "shm_remove() failed for key 0x%x, id %i: %s", shm_list_ptr->key, id,strerror(errno));
|
||||
RETURN_FALSE;
|
||||
|
||||
+18
-7
@@ -80,6 +80,7 @@ typedef struct {
|
||||
typedef struct {
|
||||
int top, max;
|
||||
char *varname;
|
||||
zend_bool done;
|
||||
void **elements;
|
||||
} wddx_stack;
|
||||
|
||||
@@ -129,6 +130,7 @@ static int wddx_stack_init(wddx_stack *stack)
|
||||
} else {
|
||||
stack->max = STACK_BLOCK_SIZE;
|
||||
stack->varname = NULL;
|
||||
stack->done = 0;
|
||||
return SUCCESS;
|
||||
}
|
||||
}
|
||||
@@ -211,6 +213,7 @@ static void release_wddx_packet_rsrc(zend_rsrc_list_entry *rsrc TSRMLS_DC)
|
||||
|
||||
#include "ext/session/php_session.h"
|
||||
|
||||
#if HAVE_PHP_SESSION
|
||||
/* {{{ PS_SERIALIZER_ENCODE_FUNC
|
||||
*/
|
||||
PS_SERIALIZER_ENCODE_FUNC(wddx)
|
||||
@@ -283,16 +286,20 @@ PS_SERIALIZER_DECODE_FUNC(wddx)
|
||||
return ret;
|
||||
}
|
||||
/* }}} */
|
||||
#endif
|
||||
|
||||
/* {{{ PHP_MINIT_FUNCTION
|
||||
*/
|
||||
PHP_MINIT_FUNCTION(wddx)
|
||||
{
|
||||
le_wddx = zend_register_list_destructors_ex(release_wddx_packet_rsrc, NULL, "wddx", module_number);
|
||||
|
||||
#if HAVE_PHP_SESSION
|
||||
php_session_register_serializer("wddx",
|
||||
PS_SERIALIZER_ENCODE_NAME(wddx),
|
||||
PS_SERIALIZER_DECODE_NAME(wddx));
|
||||
|
||||
#endif
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
/* }}} */
|
||||
@@ -302,7 +309,10 @@ PHP_MINIT_FUNCTION(wddx)
|
||||
PHP_MINFO_FUNCTION(wddx)
|
||||
{
|
||||
php_info_print_table_start();
|
||||
php_info_print_table_row(2, "WDDX Support", "enabled" );
|
||||
php_info_print_table_header(2, "WDDX Support", "enabled" );
|
||||
#if HAVE_PHP_SESSION
|
||||
php_info_print_table_row(2, "WDDX Session Serializer", "enabled" );
|
||||
#endif
|
||||
php_info_print_table_end();
|
||||
}
|
||||
/* }}} */
|
||||
@@ -374,7 +384,7 @@ static void php_wddx_serialize_string(wddx_packet *packet, zval *var)
|
||||
break;
|
||||
|
||||
default:
|
||||
if (iscntrl((int)*p)) {
|
||||
if (iscntrl((int)*p) && *p != '\n') {
|
||||
FLUSH_BUF();
|
||||
sprintf(control_buf, WDDX_CHAR, *p);
|
||||
php_wddx_add_chunk(packet, control_buf);
|
||||
@@ -876,7 +886,8 @@ static void php_wddx_pop_element(void *user_data, const char *name)
|
||||
}
|
||||
}
|
||||
efree(ent1);
|
||||
}
|
||||
} else
|
||||
stack->done = 1;
|
||||
} else if (!strcmp(name, EL_VAR) && stack->varname) {
|
||||
efree(stack->varname);
|
||||
}
|
||||
@@ -893,7 +904,7 @@ static void php_wddx_process_data(void *user_data, const char *s, int len)
|
||||
int decoded_len;
|
||||
TSRMLS_FETCH();
|
||||
|
||||
if (!wddx_stack_is_empty(stack)) {
|
||||
if (!wddx_stack_is_empty(stack) && !stack->done) {
|
||||
wddx_stack_top(stack, (void**)&ent);
|
||||
switch (Z_TYPE_P(ent)) {
|
||||
case ST_STRING:
|
||||
@@ -1197,6 +1208,6 @@ PHP_FUNCTION(wddx_deserialize)
|
||||
* tab-width: 4
|
||||
* c-basic-offset: 4
|
||||
* End:
|
||||
* vim600: sw=4 ts=4 tw=78 fdm=marker
|
||||
* vim<600: sw=4 ts=4 tw=78
|
||||
* vim600: sw=4 ts=4 fdm=marker
|
||||
* vim<600: sw=4 ts=4
|
||||
*/
|
||||
@@ -206,12 +206,18 @@ static void xmlrpc_server_destructor(zend_rsrc_list_entry *rsrc) {
|
||||
}
|
||||
}
|
||||
|
||||
static void xmlrpc_init_globals(php_xmlrpc_globals *xmlrpc_globals)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
/* module init */
|
||||
PHP_MINIT_FUNCTION(xmlrpc)
|
||||
{
|
||||
/* Remove comments if you have entries in php.ini
|
||||
REGISTER_INI_ENTRIES();
|
||||
*/
|
||||
ZEND_INIT_MODULE_GLOBALS(xmlrpc, xmlrpc_init_globals, NULL);
|
||||
XMLRPCG(le_xmlrpc_server) = zend_register_list_destructors_ex(xmlrpc_server_destructor, NULL, "xmlrpc server", module_number);
|
||||
|
||||
return SUCCESS;
|
||||
@@ -842,6 +848,7 @@ static XMLRPC_VALUE php_xmlrpc_callback(XMLRPC_SERVER server, XMLRPC_REQUEST xRe
|
||||
xmlrpc_callback_data* pData = (xmlrpc_callback_data*)data;
|
||||
pval* xmlrpc_params;
|
||||
pval* callback_params[3];
|
||||
TSRMLS_FETCH();
|
||||
|
||||
/* convert xmlrpc to native php types */
|
||||
xmlrpc_params = XMLRPC_to_PHP(XMLRPC_RequestGetData(xRequest));
|
||||
@@ -866,7 +873,8 @@ static void php_xmlrpc_introspection_callback(XMLRPC_SERVER server, void* data)
|
||||
pval *retval_ptr, **php_function;
|
||||
pval* callback_params[1];
|
||||
xmlrpc_callback_data* pData = (xmlrpc_callback_data*)data;
|
||||
|
||||
TSRMLS_FETCH();
|
||||
|
||||
MAKE_STD_ZVAL(retval_ptr);
|
||||
Z_TYPE_P(retval_ptr) = IS_NULL;
|
||||
|
||||
|
||||
+28
-22
@@ -38,7 +38,7 @@
|
||||
#include <fcntl.h>
|
||||
|
||||
/* functions relating to handlers */
|
||||
static void register_sax_handler_pair(zval *, zval *, zval **);
|
||||
static void register_sax_handler_pair(zval **, zval **, zval **);
|
||||
|
||||
/* Free processor */
|
||||
static void free_processor(zend_rsrc_list_entry *rsrc TSRMLS_DC);
|
||||
@@ -89,6 +89,7 @@ function_entry xslt_functions[] = {
|
||||
PHP_FE(xslt_error, NULL)
|
||||
PHP_FE(xslt_errno, NULL)
|
||||
PHP_FE(xslt_free, NULL)
|
||||
{NULL, NULL, NULL}
|
||||
};
|
||||
/* }}} */
|
||||
|
||||
@@ -245,20 +246,20 @@ PHP_FUNCTION(xslt_set_sax_handlers)
|
||||
|
||||
/* Document handlers (document start, document end) */
|
||||
if (strcasecmp(string_key, "document") == 0) {
|
||||
register_sax_handler_pair(XSLT_SAX(handle).doc_start,
|
||||
XSLT_SAX(handle).doc_end,
|
||||
register_sax_handler_pair(&XSLT_SAX(handle).doc_start,
|
||||
&XSLT_SAX(handle).doc_end,
|
||||
handler);
|
||||
}
|
||||
/* Element handlers, start of an element, and end of an element */
|
||||
else if (strcasecmp(string_key, "element") == 0) {
|
||||
register_sax_handler_pair(XSLT_SAX(handle).element_start,
|
||||
XSLT_SAX(handle).element_end,
|
||||
register_sax_handler_pair(&XSLT_SAX(handle).element_start,
|
||||
&XSLT_SAX(handle).element_end,
|
||||
handler);
|
||||
}
|
||||
/* Namespace handlers, start of a namespace, end of a namespace */
|
||||
else if (strcasecmp(string_key, "namespace") == 0) {
|
||||
register_sax_handler_pair(XSLT_SAX(handle).namespace_start,
|
||||
XSLT_SAX(handle).namespace_end,
|
||||
register_sax_handler_pair(&XSLT_SAX(handle).namespace_start,
|
||||
&XSLT_SAX(handle).namespace_end,
|
||||
handler);
|
||||
}
|
||||
/* Comment handlers, called when a comment is reached */
|
||||
@@ -292,7 +293,7 @@ PHP_FUNCTION(xslt_set_scheme_handlers)
|
||||
zval **processor_p, /* Resource pointer to the php->sablotron handle */
|
||||
**scheme_handlers_p, /* Pointer to the scheme handler array */
|
||||
**handler; /* Individual scheme handler */
|
||||
zval *assign_handle; /* The handler to assign to */
|
||||
zval **assign_handle; /* The handler to assign to */
|
||||
HashTable *scheme_handlers; /* Scheme handler array */
|
||||
php_xslt *handle; /* php->sablotron handle */
|
||||
char *string_key; /* Hash key (string) */
|
||||
@@ -328,31 +329,32 @@ PHP_FUNCTION(xslt_set_scheme_handlers)
|
||||
|
||||
/* Open the URI and return the whole string */
|
||||
if (strcasecmp(string_key, "get_all") == 0) {
|
||||
assign_handle = XSLT_SCHEME(handle).get_all;
|
||||
assign_handle = &XSLT_SCHEME(handle).get_all;
|
||||
}
|
||||
/* Open the URI and return a handle */
|
||||
else if (strcasecmp(string_key, "open") == 0) {
|
||||
assign_handle = XSLT_SCHEME(handle).open;
|
||||
assign_handle = &XSLT_SCHEME(handle).open;
|
||||
}
|
||||
/* Retrieve data from the URI */
|
||||
else if (strcasecmp(string_key, "get") == 0) {
|
||||
assign_handle = XSLT_SCHEME(handle).get;
|
||||
assign_handle = &XSLT_SCHEME(handle).get;
|
||||
}
|
||||
/* Save data to the URI */
|
||||
else if (strcasecmp(string_key, "put") == 0) {
|
||||
assign_handle = XSLT_SCHEME(handle).put;
|
||||
assign_handle = &XSLT_SCHEME(handle).put;
|
||||
}
|
||||
/* Close the URI */
|
||||
else if (strcasecmp(string_key, "close") == 0) {
|
||||
assign_handle = XSLT_SCHEME(handle).close;
|
||||
assign_handle = &XSLT_SCHEME(handle).close;
|
||||
}
|
||||
/* Invalid handler name */
|
||||
else {
|
||||
php_error(E_WARNING, "Invalid option to xslt_set_scheme_handlers(): %s", string_key);
|
||||
php_error(E_WARNING, "%s() invalid option '%s', skipping", get_active_function_name(TSRMLS_C), string_key);
|
||||
continue;
|
||||
}
|
||||
|
||||
assign_handle = *handler;
|
||||
zval_add_ref(&assign_handle);
|
||||
*assign_handle = *handler;
|
||||
zval_add_ref(assign_handle);
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
@@ -580,7 +582,11 @@ PHP_FUNCTION(xslt_error)
|
||||
}
|
||||
ZEND_FETCH_RESOURCE(handle, php_xslt *, processor_p, -1, le_xslt_name, le_xslt);
|
||||
|
||||
RETURN_STRING(XSLT_ERRSTR(handle), 1);
|
||||
if (XSLT_ERRSTR(handle)) {
|
||||
RETURN_STRING(XSLT_ERRSTR(handle), 1);
|
||||
} else {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -659,14 +665,14 @@ static void free_processor(zend_rsrc_list_entry *rsrc TSRMLS_DC)
|
||||
|
||||
/* {{{ register_sax_handler_pair()
|
||||
Register a pair of sax handlers */
|
||||
static void register_sax_handler_pair(zval *handler1, zval *handler2, zval **handler)
|
||||
static void register_sax_handler_pair(zval **handler1, zval **handler2, zval **handler)
|
||||
{
|
||||
zval **current; /* The current handler we're grabbing */
|
||||
|
||||
/* Grab and assign handler 1 */
|
||||
if (zend_hash_index_find(Z_ARRVAL_PP(handler), 0, (void **) ¤t) == SUCCESS) {
|
||||
handler1 = *current;
|
||||
zval_add_ref(&handler1);
|
||||
*handler1 = *current;
|
||||
zval_add_ref(handler1);
|
||||
}
|
||||
else {
|
||||
php_error(E_WARNING, "Wrong format of arguments to xslt_set_sax_handlers()");
|
||||
@@ -675,8 +681,8 @@ static void register_sax_handler_pair(zval *handler1, zval *handler2, zval **han
|
||||
|
||||
/* Grab and assign handler 2 */
|
||||
if (zend_hash_index_find(Z_ARRVAL_PP(handler), 1, (void **) ¤t) == SUCCESS) {
|
||||
handler2 = *current;
|
||||
zval_add_ref(&handler2);
|
||||
*handler2 = *current;
|
||||
zval_add_ref(handler2);
|
||||
}
|
||||
else {
|
||||
php_error(E_WARNING, "Wrong format of arguments to xslt_set_sax_handlers()");
|
||||
|
||||
+1
-4
@@ -219,9 +219,6 @@ extern void xslt_call_function(char *name,
|
||||
int idx; /* Idx, when looping through and free'ing the arguments */
|
||||
TSRMLS_FETCH(); /* For TS mode, fetch the executor globals */
|
||||
|
||||
/* Allocate and initialize return value from the function */
|
||||
MAKE_STD_ZVAL(*retval);
|
||||
|
||||
argv = emalloc(argc * sizeof(zval **));
|
||||
for (idx = 0; idx < argc; idx++) {
|
||||
argv[idx] = &user_args[idx];
|
||||
@@ -241,10 +238,10 @@ extern void xslt_call_function(char *name,
|
||||
/* Decrease refcount and free if refcount is <= 0 */
|
||||
zval_ptr_dtor(argv[idx]);
|
||||
}
|
||||
|
||||
efree(argv);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
||||
+5
-4
@@ -288,10 +288,11 @@ PHP_FUNCTION(zip_entry_read)
|
||||
|
||||
buf = emalloc(len + 1);
|
||||
ret = zzip_read(entry->fp, buf, len);
|
||||
if (ret == 0)
|
||||
RETURN_FALSE;
|
||||
else
|
||||
RETURN_STRINGL(buf, len, 0);
|
||||
if (ret == 0) {
|
||||
RETURN_FALSE;
|
||||
} else {
|
||||
RETURN_STRINGL(buf, len, 0);
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
||||
+20
-1
@@ -131,8 +131,27 @@ ZEND_DECLARE_MODULE_GLOBALS(zlib)
|
||||
ZEND_GET_MODULE(php_zlib)
|
||||
#endif
|
||||
|
||||
/* {{{ OnUpdate_zlib_output_compression */
|
||||
static PHP_INI_MH(OnUpdate_zlib_output_compression)
|
||||
{
|
||||
char *ini_value;
|
||||
|
||||
ini_value = php_ini_string("output_handler", sizeof("output_handler"), 0);
|
||||
if (ini_value != NULL && strlen(ini_value) != 0 &&
|
||||
new_value != NULL && strlen(new_value) != 0 ) {
|
||||
php_error(E_CORE_ERROR,"Cannot use both zlib.output_compression and output_handler together!!");
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
OnUpdateInt(entry, new_value, new_value_length, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC);
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
||||
PHP_INI_BEGIN()
|
||||
STD_PHP_INI_BOOLEAN("zlib.output_compression", "0", PHP_INI_ALL, OnUpdateInt, output_compression, zend_zlib_globals, zlib_globals)
|
||||
STD_PHP_INI_BOOLEAN("zlib.output_compression", "0", PHP_INI_ALL, OnUpdate_zlib_output_compression, output_compression, zend_zlib_globals, zlib_globals)
|
||||
PHP_INI_END()
|
||||
|
||||
/* {{{ phpi_destructor_gzclose
|
||||
|
||||
+80
-1
@@ -23,6 +23,11 @@
|
||||
|
||||
#include "php.h"
|
||||
#include "SAPI.h"
|
||||
#include "ext/standard/php_string.h"
|
||||
#include "ext/standard/pageinfo.h"
|
||||
#if HAVE_PCRE || HAVE_BUNDLED_PCRE
|
||||
#include "ext/pcre/php_pcre.h"
|
||||
#endif
|
||||
#ifdef ZTS
|
||||
#include "TSRM.h"
|
||||
#endif
|
||||
@@ -371,6 +376,7 @@ SAPI_API int sapi_add_header_ex(char *header_line, uint header_line_len, zend_bo
|
||||
int retval, free_header = 0;
|
||||
sapi_header_struct sapi_header;
|
||||
char *colon_offset;
|
||||
long myuid = 0L;
|
||||
|
||||
if (SG(headers_sent) && !SG(request_info).no_headers) {
|
||||
char *output_start_filename = php_get_output_start_filename(TSRMLS_C);
|
||||
@@ -440,9 +446,82 @@ SAPI_API int sapi_add_header_ex(char *header_line, uint header_line_len, zend_bo
|
||||
SG(sapi_headers).http_response_code = 302;
|
||||
}
|
||||
} else if (!STRCASECMP(header_line, "WWW-Authenticate")) { /* HTTP Authentication */
|
||||
int newlen;
|
||||
char *result, *newheader;
|
||||
#if HAVE_PCRE || HAVE_BUNDLED_PCRE
|
||||
zval *repl_temp;
|
||||
char *ptr = colon_offset+1;
|
||||
int ptr_len=0, result_len = 0;
|
||||
#endif
|
||||
|
||||
SG(sapi_headers).http_response_code = 401; /* authentication-required */
|
||||
#if HAVE_PCRE || HAVE_BUNDLED_PCRE
|
||||
if(PG(safe_mode)) {
|
||||
myuid = php_getuid();
|
||||
|
||||
ptr_len = strlen(ptr);
|
||||
MAKE_STD_ZVAL(repl_temp);
|
||||
Z_TYPE_P(repl_temp) = IS_STRING;
|
||||
Z_STRVAL_P(repl_temp) = emalloc(32);
|
||||
Z_STRLEN_P(repl_temp) = sprintf(Z_STRVAL_P(repl_temp), "realm=\"\\1-%ld\"", myuid);
|
||||
/* Modify quoted realm value */
|
||||
result = php_pcre_replace("/realm=\"(.*?)\"/i", 16,
|
||||
ptr, ptr_len,
|
||||
repl_temp,
|
||||
0, &result_len, -1 TSRMLS_CC);
|
||||
if(result_len==ptr_len) {
|
||||
efree(result);
|
||||
sprintf(Z_STRVAL_P(repl_temp), "realm=\\1-%ld\\2", myuid);
|
||||
/* modify unquoted realm value */
|
||||
result = php_pcre_replace("/realm=([^\\s]+)(.*)/i", 21,
|
||||
ptr, ptr_len,
|
||||
repl_temp,
|
||||
0, &result_len, -1 TSRMLS_CC);
|
||||
if(result_len==ptr_len) {
|
||||
char *lower_temp = estrdup(ptr);
|
||||
char conv_temp[32];
|
||||
int conv_len;
|
||||
|
||||
php_strtolower(lower_temp,strlen(lower_temp));
|
||||
/* If there is no realm string at all, append one */
|
||||
if(!strstr(lower_temp,"realm")) {
|
||||
efree(result);
|
||||
conv_len = sprintf(conv_temp," realm=\"%ld\"",myuid);
|
||||
result = emalloc(ptr_len+conv_len+1);
|
||||
result_len = ptr_len + conv_len;
|
||||
memcpy(result, ptr, ptr_len);
|
||||
memcpy(result+ptr_len, conv_temp, conv_len);
|
||||
*(result+ptr_len+conv_len) = '\0';
|
||||
}
|
||||
efree(lower_temp);
|
||||
}
|
||||
}
|
||||
newlen = sizeof("WWW-Authenticate: ") + result_len;
|
||||
newheader = emalloc(newlen+1);
|
||||
sprintf(newheader,"WWW-Authenticate: %s", result);
|
||||
efree(header_line);
|
||||
sapi_header.header = newheader;
|
||||
sapi_header.header_len = newlen;
|
||||
efree(result);
|
||||
efree(Z_STRVAL_P(repl_temp));
|
||||
efree(repl_temp);
|
||||
}
|
||||
#else
|
||||
if(PG(safe_mode)) {
|
||||
myuid = php_getuid();
|
||||
result = emalloc(32);
|
||||
newlen = sprintf(result, "WWW-Authenticate: %ld", myuid);
|
||||
newheader = estrndup(result,newlen);
|
||||
efree(header_line);
|
||||
sapi_header.header = newheader;
|
||||
sapi_header.header_len = newlen;
|
||||
efree(result);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
if (sapi_header.header==header_line) {
|
||||
*colon_offset = ':';
|
||||
}
|
||||
*colon_offset = ':';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -56,7 +56,7 @@
|
||||
#define CONFIGURATION_FILE_PATH "php.ini"
|
||||
#define USE_CONFIG_FILE 1
|
||||
|
||||
#define PHP_INCLUDE_PATH NULL
|
||||
#define PHP_INCLUDE_PATH "c:\\php4\\pear"
|
||||
|
||||
|
||||
/* Undefine if you want stricter XML/SGML compliance by default */
|
||||
@@ -250,7 +250,7 @@
|
||||
#define HAVE_STRFTIME 1
|
||||
|
||||
/* Default directory for loading extensions. */
|
||||
#define PHP_EXTENSION_DIR NULL
|
||||
#define PHP_EXTENSION_DIR "c:\\php4"
|
||||
|
||||
#define SIZEOF_INT 4
|
||||
|
||||
|
||||
+3
-6
@@ -506,9 +506,8 @@ PHP_FUNCTION(set_time_limit)
|
||||
WRONG_PARAM_COUNT;
|
||||
}
|
||||
|
||||
convert_to_long_ex(new_timeout);
|
||||
zend_unset_timeout(TSRMLS_C);
|
||||
zend_set_timeout(Z_LVAL_PP(new_timeout));
|
||||
convert_to_string_ex(new_timeout);
|
||||
zend_alter_ini_entry("max_execution_time", sizeof("max_execution_time"), Z_STRVAL_PP(new_timeout), Z_STRLEN_PP(new_timeout), PHP_INI_USER, PHP_INI_STAGE_RUNTIME);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -1001,9 +1000,7 @@ void php_module_shutdown(TSRMLS_D)
|
||||
/* close down the ini config */
|
||||
php_shutdown_config();
|
||||
|
||||
#ifdef ZTS
|
||||
ts_free_thread();
|
||||
#else
|
||||
#ifndef ZTS
|
||||
zend_ini_shutdown(TSRMLS_C);
|
||||
shutdown_memory_manager(CG(unclean_shutdown), 1);
|
||||
#endif
|
||||
|
||||
+17
-7
@@ -136,6 +136,8 @@ PHPAPI void php_end_ob_buffer(zend_bool send_buffer, zend_bool just_flush TSRMLS
|
||||
char *to_be_destroyed_buffer;
|
||||
char *to_be_destroyed_handled_output[2] = { 0, 0 };
|
||||
int status;
|
||||
php_ob_buffer *prev_ob_buffer_p=NULL;
|
||||
php_ob_buffer orig_ob_buffer;
|
||||
|
||||
if (OG(ob_nesting_level)==0) {
|
||||
return;
|
||||
@@ -201,7 +203,8 @@ PHPAPI void php_end_ob_buffer(zend_bool send_buffer, zend_bool just_flush TSRMLS
|
||||
|
||||
to_be_destroyed_buffer = OG(active_ob_buffer).buffer;
|
||||
if (OG(active_ob_buffer).internal_output_handler
|
||||
&& (final_buffer != OG(active_ob_buffer).internal_output_handler_buffer)) {
|
||||
&& (final_buffer != OG(active_ob_buffer).internal_output_handler_buffer)
|
||||
&& (final_buffer != OG(active_ob_buffer).buffer)) {
|
||||
to_be_destroyed_handled_output[0] = final_buffer;
|
||||
}
|
||||
|
||||
@@ -209,23 +212,30 @@ PHPAPI void php_end_ob_buffer(zend_bool send_buffer, zend_bool just_flush TSRMLS
|
||||
if (OG(active_ob_buffer).internal_output_handler) {
|
||||
to_be_destroyed_handled_output[1] = OG(active_ob_buffer).internal_output_handler_buffer;
|
||||
}
|
||||
}
|
||||
if (OG(ob_nesting_level)>1) { /* restore previous buffer */
|
||||
php_ob_buffer *ob_buffer_p;
|
||||
|
||||
zend_stack_top(&OG(ob_buffers), (void **) &ob_buffer_p);
|
||||
OG(active_ob_buffer) = *ob_buffer_p;
|
||||
zend_stack_top(&OG(ob_buffers), (void **) &prev_ob_buffer_p);
|
||||
orig_ob_buffer = OG(active_ob_buffer);
|
||||
OG(active_ob_buffer) = *prev_ob_buffer_p;
|
||||
zend_stack_del_top(&OG(ob_buffers));
|
||||
if (OG(ob_nesting_level)==2) { /* destroy the stack */
|
||||
if (!just_flush && OG(ob_nesting_level)==2) { /* destroy the stack */
|
||||
zend_stack_destroy(&OG(ob_buffers));
|
||||
}
|
||||
}
|
||||
OG(ob_nesting_level)--;
|
||||
}
|
||||
|
||||
if (send_buffer) {
|
||||
OG(php_body_write)(final_buffer, final_buffer_length TSRMLS_CC);
|
||||
}
|
||||
|
||||
if (just_flush) { /* we restored the previous ob, return to the current */
|
||||
if (prev_ob_buffer_p) {
|
||||
zend_stack_push(&OG(ob_buffers), &OG(active_ob_buffer), sizeof(php_ob_buffer));
|
||||
OG(active_ob_buffer) = orig_ob_buffer;
|
||||
}
|
||||
OG(ob_nesting_level)++;
|
||||
}
|
||||
|
||||
if (alternate_buffer) {
|
||||
zval_ptr_dtor(&alternate_buffer);
|
||||
}
|
||||
|
||||
+1
-1
@@ -50,7 +50,7 @@ static void php_ini_displayer_cb(zend_ini_entry *ini_entry, int type)
|
||||
uint display_string_length, esc_html=0;
|
||||
|
||||
if (type==ZEND_INI_DISPLAY_ORIG && ini_entry->modified) {
|
||||
if (ini_entry->orig_value) {
|
||||
if (ini_entry->orig_value && ini_entry->orig_value[0]) {
|
||||
display_string = ini_entry->orig_value;
|
||||
display_string_length = ini_entry->orig_value_length;
|
||||
esc_html=1;
|
||||
|
||||
@@ -104,7 +104,7 @@ static FILE *php_do_open_temporary_file(char *path, const char *pfx, char **open
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (*path+strlen(path)-1 == '/') {
|
||||
if (path[strlen(path)-1] == '/') {
|
||||
trailing_slash = "";
|
||||
} else {
|
||||
trailing_slash = "/";
|
||||
@@ -199,6 +199,6 @@ PHPAPI FILE *php_open_temporary_file(const char *dir, const char *pfx, char **op
|
||||
* tab-width: 4
|
||||
* c-basic-offset: 4
|
||||
* End:
|
||||
* vim600: sw=4 ts=4 tw=78 fdm=marker
|
||||
* vim<600: sw=4 ts=4 tw=78
|
||||
* vim600: sw=4 ts=4 fdm=marker
|
||||
* vim<600: sw=4 ts=4
|
||||
*/
|
||||
+1
-1
@@ -1,3 +1,3 @@
|
||||
/* automatically generated by configure */
|
||||
/* edit configure.in to change version number */
|
||||
#define PHP_VERSION "4.1.0RC1"
|
||||
#define PHP_VERSION "4.1.2"
|
||||
@@ -195,7 +195,13 @@ static void php_mime_split(char *buf, int cnt, char *boundary, zval *array_ptr T
|
||||
SAFE_RETURN;
|
||||
}
|
||||
}
|
||||
rem -= loc - ptr;
|
||||
if (rem <= 0) {
|
||||
php_error(E_WARNING, "File Upload Mime headers garbled ptr: [%c%c%c%c%c]", *ptr, *(ptr + 1), *(ptr + 2), *(ptr + 3), *(ptr + 4));
|
||||
SAFE_RETURN;
|
||||
}
|
||||
name = strstr(ptr, " name=");
|
||||
ptr = loc;
|
||||
if (name && name < loc) {
|
||||
name += 6;
|
||||
if ( *name == '\"' ) {
|
||||
|
||||
@@ -5,4 +5,4 @@
|
||||
$Id$
|
||||
|
||||
This document is no longer maintained, see
|
||||
http://php.net/manual/en/pear.standards.php instead.
|
||||
http://pear.php.net/manual/standards.php instead.
|
||||
@@ -75,7 +75,7 @@ class Console_Getopt {
|
||||
sort($long_options);
|
||||
|
||||
reset($args);
|
||||
while (list(, $arg) = each($args)) {
|
||||
while (list($i, $arg) = each($args)) {
|
||||
|
||||
/* The special element '--' means explicit end of options. Treat the
|
||||
rest of the arguments as non-options and end the loop. */
|
||||
@@ -84,9 +84,9 @@ class Console_Getopt {
|
||||
break;
|
||||
}
|
||||
|
||||
if ($arg{0} != '-' || ($arg{1} == '-' && !$long_options)) {
|
||||
if ($arg{0} != '-' || (strlen($arg) > 1 && $arg{1} == '-' && !$long_options)) {
|
||||
$non_opts[] = $arg;
|
||||
} else if ($arg{1} == '-') {
|
||||
} else if (strlen($arg) > 1 && $arg{1} == '-') {
|
||||
$error = Console_Getopt::_parseLongOption(substr($arg, 2), $long_options, $opts, $args);
|
||||
if (PEAR::isError($error))
|
||||
return $error;
|
||||
@@ -147,7 +147,7 @@ class Console_Getopt {
|
||||
*/
|
||||
function _parseLongOption($arg, $long_options, &$opts, &$args)
|
||||
{
|
||||
list($opt, $opt_arg) = explode('=', $arg);
|
||||
@list($opt, $opt_arg) = explode('=', $arg);
|
||||
$opt_len = strlen($opt);
|
||||
|
||||
for ($i = 0; $i < count($long_options); $i++) {
|
||||
|
||||
+93
-25
@@ -57,6 +57,7 @@ define("DB_ERROR_NOT_LOCKED", -21);
|
||||
define("DB_ERROR_VALUE_COUNT_ON_ROW", -22);
|
||||
define("DB_ERROR_INVALID_DSN", -23);
|
||||
define("DB_ERROR_CONNECT_FAILED", -24);
|
||||
define("DB_ERROR_EXTENSION_NOT_FOUND",-25);
|
||||
|
||||
/*
|
||||
* Warnings are not detected as errors by DB::isError(), and are not
|
||||
@@ -375,7 +376,8 @@ class DB
|
||||
DB_OK => 'no error',
|
||||
DB_WARNING => 'unknown warning',
|
||||
DB_WARNING_READ_ONLY => 'read only',
|
||||
DB_ERROR_NEED_MORE_DATA => 'insufficient data supplied'
|
||||
DB_ERROR_NEED_MORE_DATA => 'insufficient data supplied',
|
||||
DB_ERROR_EXTENSION_NOT_FOUND=> 'extension not found'
|
||||
);
|
||||
}
|
||||
|
||||
@@ -512,16 +514,10 @@ class DB
|
||||
function assertExtension($name)
|
||||
{
|
||||
if (!extension_loaded($name)) {
|
||||
$dlext = (substr(PHP_OS, 0, 3) == 'WIN') ? '.dll' : '.so';
|
||||
$dlext = OS_WINDOWS ? '.dll' : '.so';
|
||||
@dl($name . $dlext);
|
||||
}
|
||||
if (!extension_loaded($name)) {
|
||||
trigger_error("The extension '$name' couldn't be loaded. ".
|
||||
'Probably you don\'t have support in your PHP '.
|
||||
'to this Database backend', E_USER_ERROR);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
return extension_loaded($name);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -604,6 +600,7 @@ class DB_result
|
||||
{
|
||||
var $dbh;
|
||||
var $result;
|
||||
var $row_counter = null;
|
||||
|
||||
/**
|
||||
* DB_result constructor.
|
||||
@@ -618,11 +615,11 @@ class DB_result
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch and return a row of data (it uses backend->fetchInto for that)
|
||||
* @param $fetchmode format of fetched row
|
||||
* @param $rownum the row number to fetch
|
||||
* Fetch and return a row of data (it uses driver->fetchInto for that)
|
||||
* @param int $fetchmode format of fetched row
|
||||
* @param int $rownum the row number to fetch
|
||||
*
|
||||
* @return array a row of data, NULL on no more rows or PEAR_Error on error
|
||||
* @return array a row of data, NULL on no more rows or PEAR_Error on error
|
||||
*/
|
||||
function fetchRow($fetchmode = DB_FETCHMODE_DEFAULT, $rownum=null)
|
||||
{
|
||||
@@ -631,15 +628,41 @@ class DB_result
|
||||
}
|
||||
if ($fetchmode === DB_FETCHMODE_OBJECT) {
|
||||
$fetchmode = DB_FETCHMODE_ASSOC;
|
||||
$return_object = true;
|
||||
$object_class = $this->dbh->fetchmode_object_class;
|
||||
}
|
||||
if ($this->dbh->limit_from !== null) {
|
||||
if ($this->row_counter === null) {
|
||||
$this->row_counter = $this->dbh->limit_from;
|
||||
// For Interbase
|
||||
if ($this->dbh->features['limit'] == false) {
|
||||
$i = 0;
|
||||
while ($i++ < $this->dbh->limit_from) {
|
||||
$this->dbh->fetchInto($this->result, $arr, $fetchmode);
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($this->row_counter >= (
|
||||
$this->dbh->limit_from + $this->dbh->limit_count))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
if ($this->dbh->features['limit'] == 'emulate') {
|
||||
$rownum = $this->row_counter;
|
||||
}
|
||||
|
||||
$this->row_counter++;
|
||||
}
|
||||
$res = $this->dbh->fetchInto($this->result, $arr, $fetchmode, $rownum);
|
||||
if ($res !== DB_OK) {
|
||||
return $res;
|
||||
}
|
||||
if (isset($return_object)) {
|
||||
$class = $this->dbh->fetchmode_object_class;
|
||||
$ret =& new $class($arr);
|
||||
if (isset($object_class)) {
|
||||
// default mode specified in DB_common::fetchmode_object_class property
|
||||
if ($object_class == 'stdClass') {
|
||||
$ret = (object) $arr;
|
||||
} else {
|
||||
$ret =& new $object_class($arr);
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
return $arr;
|
||||
@@ -648,12 +671,12 @@ class DB_result
|
||||
/**
|
||||
* Fetch a row of data into an existing variable.
|
||||
*
|
||||
* @param $arr reference to data containing the row
|
||||
* @param $fetchmode format of fetched row
|
||||
* @param $rownum the row number to fetch
|
||||
* @param mixed $arr reference to data containing the row
|
||||
* @param int $fetchmode format of fetched row
|
||||
* @param int $rownum the row number to fetch
|
||||
*
|
||||
* @return mixed DB_OK on success, NULL on no more rows or
|
||||
* a DB_Error object on errors
|
||||
* a DB_Error object on error
|
||||
*/
|
||||
function fetchInto(&$arr, $fetchmode = DB_FETCHMODE_DEFAULT, $rownum=null)
|
||||
{
|
||||
@@ -662,12 +685,38 @@ class DB_result
|
||||
}
|
||||
if ($fetchmode === DB_FETCHMODE_OBJECT) {
|
||||
$fetchmode = DB_FETCHMODE_ASSOC;
|
||||
$return_object = true;
|
||||
$object_class = $this->dbh->fetchmode_object_class;
|
||||
}
|
||||
if ($this->dbh->limit_from !== null) {
|
||||
if ($this->row_counter === null) {
|
||||
$this->row_counter = $this->dbh->limit_from;
|
||||
// For Interbase
|
||||
if ($this->dbh->features['limit'] == false) {
|
||||
$i = 0;
|
||||
while ($i++ < $this->dbh->limit_from) {
|
||||
$this->dbh->fetchInto($this->result, $arr, $fetchmode);
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($this->row_counter >= (
|
||||
$this->dbh->limit_from + $this->dbh->limit_count))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
if ($this->dbh->features['limit'] == 'emulate') {
|
||||
$rownum = $this->row_counter;
|
||||
}
|
||||
|
||||
$this->row_counter++;
|
||||
}
|
||||
$res = $this->dbh->fetchInto($this->result, $arr, $fetchmode, $rownum);
|
||||
if (($res === DB_OK) && isset($return_object)) {
|
||||
$class = $this->dbh->fetchmode_object_class;
|
||||
$arr = new $class($arr);
|
||||
if (($res === DB_OK) && isset($object_class)) {
|
||||
// default mode specified in DB_common::fetchmode_object_class property
|
||||
if ($object_class == 'stdClass') {
|
||||
$arr = (object) $arr;
|
||||
} else {
|
||||
$arr = new $object_class($arr);
|
||||
}
|
||||
}
|
||||
return $res;
|
||||
}
|
||||
@@ -692,6 +741,16 @@ class DB_result
|
||||
return $this->dbh->numRows($this->result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the next result if a batch of queries was executed.
|
||||
*
|
||||
* @return bool true if a new result is available or false if not.
|
||||
*/
|
||||
function nextResult()
|
||||
{
|
||||
return $this->dbh->nextResult($this->result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Frees the resources allocated for this result set.
|
||||
* @return int error code
|
||||
@@ -710,8 +769,17 @@ class DB_result
|
||||
{
|
||||
return $this->dbh->tableInfo($this->result, $mode);
|
||||
}
|
||||
|
||||
function getRowCounter()
|
||||
{
|
||||
return $this->row_counter;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Pear DB Row Object
|
||||
* @see DB_common::setFetchMode()
|
||||
*/
|
||||
class DB_row
|
||||
{
|
||||
function DB_row(&$arr)
|
||||
|
||||
+6
-4
@@ -51,11 +51,13 @@ class Log {
|
||||
* @return The newly created concrete Log instance, or an
|
||||
* false on an error.
|
||||
*/
|
||||
function factory ($log_type, $log_name = '', $ident = '', $conf = array()) {
|
||||
function &factory($log_type, $log_name = '', $ident = '', $conf = array())
|
||||
{
|
||||
$log_type = strtolower($log_type);
|
||||
$classfile = 'Log/' . $log_type . '.php';
|
||||
if (@include_once $classfile) {
|
||||
$class = 'Log_' . $log_type;
|
||||
@include_once $classfile;
|
||||
$class = 'Log_' . $log_type;
|
||||
if (class_exists($class)) {
|
||||
return new $class($log_name, $ident, $conf);
|
||||
} else {
|
||||
return false;
|
||||
@@ -101,7 +103,7 @@ class Log {
|
||||
|
||||
$signature = md5($log_type . '][' . $log_name . '][' . $ident . '][' . implode('][', $conf));
|
||||
if (!isset($instances[$signature])) {
|
||||
$instances[$signature] = Log::factory($log_type, $log_name, $ident, $conf);
|
||||
$instances[$signature] = &Log::factory($log_type, $log_name, $ident, $conf);
|
||||
}
|
||||
return $instances[$signature];
|
||||
}
|
||||
|
||||
+7
-5
@@ -30,8 +30,7 @@ PEAR_SUBDIRS = \
|
||||
Payment \
|
||||
PEAR \
|
||||
Schedule \
|
||||
XML \
|
||||
XML/RPC
|
||||
XML
|
||||
|
||||
PEAR_FILES = \
|
||||
Archive/Tar.php \
|
||||
@@ -57,6 +56,7 @@ PEAR_FILES = \
|
||||
Date/Human.php \
|
||||
DB.php \
|
||||
DB/common.php \
|
||||
DB/fbsql.php \
|
||||
DB/ibase.php \
|
||||
DB/ifx.php \
|
||||
DB/msql.php \
|
||||
@@ -103,14 +103,16 @@ PEAR_FILES = \
|
||||
Numbers/Roman.php \
|
||||
PEAR.php \
|
||||
PEAR/Common.php \
|
||||
PEAR/Config.php \
|
||||
PEAR/Installer.php \
|
||||
PEAR/Packager.php \
|
||||
PEAR/Remote.php \
|
||||
PEAR/Uploader.php \
|
||||
PEAR/Registry.php \
|
||||
Payment/Verisign.php \
|
||||
Schedule/At.php \
|
||||
XML/Parser.php \
|
||||
XML/RPC.php \
|
||||
XML/RPC/Server.php
|
||||
System.php \
|
||||
XML/Parser.php
|
||||
|
||||
install-data-local:
|
||||
@if $(mkinstalldirs) $(INSTALL_ROOT)$(peardir); then \
|
||||
|
||||
+12
-71
@@ -286,7 +286,7 @@ class PEAR
|
||||
*
|
||||
* @return int the new depth of the "expected errors" stack
|
||||
*/
|
||||
function expectError($code)
|
||||
function expectError($code = "*")
|
||||
{
|
||||
if (is_array($code)) {
|
||||
array_push($this->_expected_errors, $code);
|
||||
@@ -366,8 +366,12 @@ class PEAR
|
||||
$message = $message->getMessage();
|
||||
}
|
||||
|
||||
if (isset($this) && isset($this->_expected_errors) && sizeof($this->_expected_errors) > 0 && in_array($code, end($this->_expected_errors))) {
|
||||
$mode = PEAR_ERROR_RETURN;
|
||||
if (isset($this) && isset($this->_expected_errors) && sizeof($this->_expected_errors) > 0 && sizeof($exp = end($this->_expected_errors))) {
|
||||
if ($exp[0] == "*" ||
|
||||
(is_int(reset($exp)) && in_array($code, $exp)) ||
|
||||
(is_string(reset($exp)) && in_array($message, $exp))) {
|
||||
$mode = PEAR_ERROR_RETURN;
|
||||
}
|
||||
}
|
||||
|
||||
if ($mode === null) {
|
||||
@@ -491,63 +495,6 @@ class PEAR
|
||||
}
|
||||
|
||||
// }}}
|
||||
|
||||
/**
|
||||
* Converts a php version string to an array
|
||||
* (supported formats are: X.X.X, X.X.X-dev, X.X.XplX)
|
||||
*
|
||||
* @param string $version A valid php version (ie. 4.0.7)
|
||||
* @return array
|
||||
* @see PEAR::phpVersionIs()
|
||||
*/
|
||||
function _explodePHPVersion($version)
|
||||
{
|
||||
@list($version, ) = explode('-', $version); // 4.0.7-dev
|
||||
@list($version, ) = explode('RC', $version); // 4.0.7RC1
|
||||
list($mayor, $minor, $sub) = explode('.', $version);
|
||||
@list($sub, $patch) = explode('pl', $sub); // 4.0.14pl1
|
||||
if ($patch === null) {
|
||||
$patch = 0;
|
||||
}
|
||||
return array($mayor, $minor, $sub, $patch);
|
||||
}
|
||||
|
||||
/**
|
||||
* Find if a version is minor or greater than a given PHP version
|
||||
* (it should be red as "if my php version is minor|greater|between this one)
|
||||
*
|
||||
* Usage:
|
||||
* PEAR::phpVersionIs('4.0.7') => if the current version
|
||||
* is minor than version 4.0.7
|
||||
* PEAR::phpVersionIs(null, '4.0.12pl3') => if current is greater that 4.0.12pl3
|
||||
* PEAR::phpVersionIs('4.0.9', '4.0.4') => if current is between 4.0.9 and 4.0.4
|
||||
*
|
||||
* @param string $minorthan Version should be minor than this param
|
||||
* @param string $greaterthan Version should be greater than this param
|
||||
* @param string $version Version to compare with (defaults to current)
|
||||
*
|
||||
* @return bool If the comparation was successful or not
|
||||
*/
|
||||
function phpVersionIs($minorthan = null, $greaterthan = null, $version = PHP_VERSION)
|
||||
{
|
||||
$version = PEAR::_explodePHPVersion($version);
|
||||
$ret = false;
|
||||
if ($minorthan) {
|
||||
$minor = PEAR::_explodePHPVersion($minorthan);
|
||||
for ($i=0; $i < count($version)-1 && $minor[$i] == $version[$i]; $i++);
|
||||
if ($version[$i] >= $minor[$i]) {
|
||||
return false;
|
||||
}
|
||||
$ret = true;
|
||||
}
|
||||
if ($greaterthan) {
|
||||
$greater = PEAR::_explodePHPVersion($greaterthan);
|
||||
for ($i=0; $i < count($version)-1 && $greater[$i] == $version[$i]; $i++);
|
||||
$ret = ($version[$i] > $greater[$i]) ? true : false;
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// {{{ _PEAR_call_destructors()
|
||||
@@ -584,13 +531,11 @@ class PEAR_Error
|
||||
// {{{ properties
|
||||
|
||||
var $error_message_prefix = '';
|
||||
var $error_prepend = '';
|
||||
var $error_append = '';
|
||||
var $mode = PEAR_ERROR_RETURN;
|
||||
var $level = E_USER_NOTICE;
|
||||
var $code = -1;
|
||||
var $message = '';
|
||||
var $debuginfo = '';
|
||||
var $userinfo = '';
|
||||
|
||||
// Wait until we have a stack-groping function in PHP.
|
||||
//var $file = '';
|
||||
@@ -713,8 +658,7 @@ class PEAR_Error
|
||||
*/
|
||||
function getMessage ()
|
||||
{
|
||||
return ($this->error_prepend . $this->error_message_prefix .
|
||||
$this->message . $this->error_append);
|
||||
return ($this->error_message_prefix . $this->message);
|
||||
}
|
||||
|
||||
|
||||
@@ -808,11 +752,9 @@ class PEAR_Error
|
||||
$callback = $this->callback;
|
||||
}
|
||||
return sprintf('[%s: message="%s" code=%d mode=callback '.
|
||||
'callback=%s prefix="%s" prepend="%s" append="%s" '.
|
||||
'info="%s"]',
|
||||
'callback=%s prefix="%s" info="%s"]',
|
||||
get_class($this), $this->message, $this->code,
|
||||
$callback, $this->error_message_prefix,
|
||||
$this->error_prepend, $this->error_append,
|
||||
$this->userinfo);
|
||||
}
|
||||
if ($this->mode & PEAR_ERROR_CALLBACK) {
|
||||
@@ -830,12 +772,11 @@ class PEAR_Error
|
||||
if ($this->mode & PEAR_ERROR_RETURN) {
|
||||
$modes[] = 'return';
|
||||
}
|
||||
return sprintf('[%s: message="%s" code=%d mode=%s level=%s prefix="%s" '.
|
||||
'prepend="%s" append="%s" info="%s"]',
|
||||
return sprintf('[%s: message="%s" code=%d mode=%s level=%s '.
|
||||
'prefix="%s" info="%s"]',
|
||||
get_class($this), $this->message, $this->code,
|
||||
implode("|", $modes), $levels[$this->level],
|
||||
$this->error_message_prefix,
|
||||
$this->error_prepend, $this->error_append,
|
||||
$this->userinfo);
|
||||
}
|
||||
|
||||
|
||||
+77
-71
@@ -22,15 +22,15 @@
|
||||
|
||||
require_once 'PEAR.php';
|
||||
require_once 'Archive/Tar.php';
|
||||
require_once 'Experimental/System.php';
|
||||
require_once 'System.php';
|
||||
|
||||
/**
|
||||
* TODO:
|
||||
* - check in inforFromDescFile that the minimal data needed is present
|
||||
* (pack name, version, files, others?)
|
||||
* - perhaps use parser folding to be less restrictive with the format
|
||||
* of the package.xml file
|
||||
*/
|
||||
* TODO:
|
||||
* - check in inforFromDescFile that the minimal data needed is present
|
||||
* (pack name, version, files, others?)
|
||||
* - perhaps use parser folding to be less restrictive with the format
|
||||
* of the package.xml file
|
||||
*/
|
||||
class PEAR_Common extends PEAR
|
||||
{
|
||||
// {{{ properties
|
||||
@@ -51,15 +51,17 @@ class PEAR_Common extends PEAR
|
||||
var $pkginfo = array();
|
||||
|
||||
/**
|
||||
* Permitted maintainer roles
|
||||
* @var array
|
||||
*/
|
||||
* Permitted maintainer roles
|
||||
* @var array
|
||||
*/
|
||||
var $maintainer_roles = array('lead','developer','contributor','helper');
|
||||
|
||||
/**
|
||||
* Permitted release states
|
||||
* @var array
|
||||
*/
|
||||
* Permitted release states
|
||||
* @var array
|
||||
*/
|
||||
var $releases_states = array('alpha','beta','stable','snapshot');
|
||||
|
||||
// }}}
|
||||
|
||||
// {{{ constructor
|
||||
@@ -124,6 +126,7 @@ class PEAR_Common extends PEAR
|
||||
}
|
||||
|
||||
// }}}
|
||||
// {{{ mkTempDir()
|
||||
|
||||
function mkTempDir()
|
||||
{
|
||||
@@ -137,38 +140,40 @@ class PEAR_Common extends PEAR
|
||||
return $tmpdir;
|
||||
}
|
||||
|
||||
// }}}
|
||||
// {{{ _element_start()
|
||||
|
||||
function _element_start($xp, $name, $attribs)
|
||||
{
|
||||
array_push($this->element_stack, $name);
|
||||
$this->current_element = $name;
|
||||
$this->prev_element = $this->element_stack[sizeof($this->element_stack)-2];
|
||||
$spos = sizeof($this->element_stack) - 2;
|
||||
$this->prev_element = ($spos >= 0) ? $this->element_stack[$spos] : '';
|
||||
$this->current_attributes = $attribs;
|
||||
switch ($name) {
|
||||
case 'DIR':
|
||||
case 'dir':
|
||||
if (isset($this->dir_names)) {
|
||||
$this->dir_names[] = $attribs['NAME'];
|
||||
$this->dir_names[] = $attribs['name'];
|
||||
} else {
|
||||
// Don't add the root dir
|
||||
$this->dir_names = array();
|
||||
}
|
||||
if (isset($attribs['BASEINSTALLDIR'])) {
|
||||
$this->dir_install = $attribs['BASEINSTALLDIR'];
|
||||
if (isset($attribs['baseinstalldir'])) {
|
||||
$this->dir_install = $attribs['baseinstalldir'];
|
||||
}
|
||||
if (isset($attribs['ROLE'])) {
|
||||
$this->dir_role = $attribs['ROLE'];
|
||||
if (isset($attribs['role'])) {
|
||||
$this->dir_role = $attribs['role'];
|
||||
}
|
||||
break;
|
||||
case 'LIBFILE':
|
||||
case 'libfile':
|
||||
$this->lib_atts = $attribs;
|
||||
$this->lib_atts['ROLE'] = 'extension';
|
||||
$this->lib_atts['role'] = 'extension';
|
||||
break;
|
||||
case 'MAINTAINERS':
|
||||
case 'maintainers':
|
||||
$this->pkginfo['maintainers'] = array();
|
||||
$this->m_i = 0; // maintainers array index
|
||||
break;
|
||||
case 'MAINTAINER':
|
||||
case 'maintainer':
|
||||
// compatibility check
|
||||
if (!isset($this->pkginfo['maintainers'])) {
|
||||
$this->pkginfo['maintainers'] = array();
|
||||
@@ -177,12 +182,12 @@ class PEAR_Common extends PEAR
|
||||
$this->pkginfo['maintainers'][$this->m_i] = array();
|
||||
$this->current_maintainer =& $this->pkginfo['maintainers'][$this->m_i];
|
||||
break;
|
||||
case 'CHANGELOG':
|
||||
case 'changelog':
|
||||
$this->pkginfo['changelog'] = array();
|
||||
$this->c_i = 0; // changelog array index
|
||||
$this->in_changelog = true;
|
||||
break;
|
||||
case 'RELEASE':
|
||||
case 'release':
|
||||
if ($this->in_changelog) {
|
||||
$this->pkginfo['changelog'][$this->c_i] = array();
|
||||
$this->current_release =& $this->pkginfo['changelog'][$this->c_i];
|
||||
@@ -197,12 +202,10 @@ class PEAR_Common extends PEAR
|
||||
function _element_end($xp, $name)
|
||||
{
|
||||
switch ($name) {
|
||||
case 'DIR':
|
||||
case 'dir':
|
||||
array_pop($this->dir_names);
|
||||
unset($this->dir_install);
|
||||
unset($this->dir_role);
|
||||
break;
|
||||
case 'FILE':
|
||||
case 'file':
|
||||
$path = '';
|
||||
foreach ($this->dir_names as $dir) {
|
||||
$path .= $dir . DIRECTORY_SEPARATOR;
|
||||
@@ -210,17 +213,17 @@ class PEAR_Common extends PEAR
|
||||
$path .= $this->current_file;
|
||||
$this->filelist[$path] = $this->current_attributes;
|
||||
// Set the baseinstalldir only if the file don't have this attrib
|
||||
if (!isset($this->filelist[$path]['BASEINSTALLDIR']) &&
|
||||
if (!isset($this->filelist[$path]['baseinstalldir']) &&
|
||||
isset($this->dir_install))
|
||||
{
|
||||
$this->filelist[$path]['BASEINSTALLDIR'] = $this->dir_install;
|
||||
$this->filelist[$path]['baseinstalldir'] = $this->dir_install;
|
||||
}
|
||||
// Set the Role
|
||||
if (!isset($this->filelist[$path]['ROLE']) && isset($this->dir_role)) {
|
||||
$this->filelist[$path]['ROLE'] = $this->dir_role;
|
||||
if (!isset($this->filelist[$path]['role']) && isset($this->dir_role)) {
|
||||
$this->filelist[$path]['role'] = $this->dir_role;
|
||||
}
|
||||
break;
|
||||
case 'LIBFILE':
|
||||
case 'libfile':
|
||||
$path = '';
|
||||
foreach ($this->dir_names as $dir) {
|
||||
$path .= $dir . DIRECTORY_SEPARATOR;
|
||||
@@ -228,10 +231,10 @@ class PEAR_Common extends PEAR
|
||||
$path .= $this->lib_name;
|
||||
$this->filelist[$path] = $this->lib_atts;
|
||||
// Set the baseinstalldir only if the file don't have this attrib
|
||||
if (!isset($this->filelist[$path]['BASEINSTALLDIR']) &&
|
||||
if (!isset($this->filelist[$path]['baseinstalldir']) &&
|
||||
isset($this->dir_install))
|
||||
{
|
||||
$this->filelist[$path]['BASEINSTALLDIR'] = $this->dir_install;
|
||||
$this->filelist[$path]['baseinstalldir'] = $this->dir_install;
|
||||
}
|
||||
if (isset($this->lib_sources)) {
|
||||
$this->filelist[$path]['sources'] = $this->lib_sources;
|
||||
@@ -239,19 +242,20 @@ class PEAR_Common extends PEAR
|
||||
unset($this->lib_atts);
|
||||
unset($this->lib_sources);
|
||||
break;
|
||||
case 'MAINTAINER':
|
||||
case 'maintainer':
|
||||
$this->m_i++;
|
||||
break;
|
||||
case 'RELEASE':
|
||||
case 'release':
|
||||
if ($this->in_changelog) {
|
||||
$this->c_i++;
|
||||
}
|
||||
break;
|
||||
case 'CHANGELOG':
|
||||
case 'changelog':
|
||||
$this->in_changelog = false;
|
||||
}
|
||||
array_pop($this->element_stack);
|
||||
$this->current_element = $this->element_stack[sizeof($this->element_stack)-1];
|
||||
$spos = sizeof($this->element_stack) - 1;
|
||||
$this->current_element = ($spos > 0) ? $this->element_stack[$spos] : '';
|
||||
}
|
||||
|
||||
// }}}
|
||||
@@ -260,72 +264,71 @@ class PEAR_Common extends PEAR
|
||||
function _pkginfo_cdata($xp, $data)
|
||||
{
|
||||
switch ($this->current_element) {
|
||||
case 'NAME':
|
||||
case 'name':
|
||||
switch ($this->prev_element) {
|
||||
case 'PACKAGE':
|
||||
$this->pkginfo['package'] .= $data;
|
||||
case 'package':
|
||||
$this->pkginfo['package'] = $data;
|
||||
break;
|
||||
case 'MAINTAINER':
|
||||
$this->current_maintainer['name'] .= $data;
|
||||
case 'maintainer':
|
||||
$this->current_maintainer['name'] = $data;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 'SUMMARY':
|
||||
$this->pkginfo['summary'] .= $data;
|
||||
case 'summary':
|
||||
$this->pkginfo['summary'] = $data;
|
||||
break;
|
||||
case 'USER':
|
||||
$this->current_maintainer['handle'] .= $data;
|
||||
case 'user':
|
||||
$this->current_maintainer['handle'] = $data;
|
||||
break;
|
||||
case 'EMAIL':
|
||||
$this->current_maintainer['email'] .= $data;
|
||||
case 'email':
|
||||
$this->current_maintainer['email'] = $data;
|
||||
break;
|
||||
case 'ROLE':
|
||||
case 'role':
|
||||
if (!in_array($data, $this->maintainer_roles)) {
|
||||
trigger_error("The maintainer role: '$data' is not valid", E_USER_WARNING);
|
||||
} else {
|
||||
$this->current_maintainer['role'] .= $data;
|
||||
$this->current_maintainer['role'] = $data;
|
||||
}
|
||||
break;
|
||||
case 'VERSION':
|
||||
case 'version':
|
||||
if ($this->in_changelog) {
|
||||
$this->current_release['version'] .= $data;
|
||||
$this->current_release['version'] = $data;
|
||||
} else {
|
||||
$this->pkginfo['version'] .= $data;
|
||||
$this->pkginfo['version'] = $data;
|
||||
}
|
||||
break;
|
||||
case 'DATE':
|
||||
case 'date':
|
||||
if ($this->in_changelog) {
|
||||
$this->current_release['release_date'] .= $data;
|
||||
$this->current_release['release_date'] = $data;
|
||||
} else {
|
||||
$this->pkginfo['release_date'] .= $data;
|
||||
$this->pkginfo['release_date'] = $data;
|
||||
}
|
||||
break;
|
||||
case 'NOTES':
|
||||
case 'notes':
|
||||
if ($this->in_changelog) {
|
||||
$this->current_release['release_notes'] .= $data;
|
||||
$this->current_release['release_notes'] = $data;
|
||||
} else {
|
||||
$this->pkginfo['release_notes'] .= $data;
|
||||
$this->pkginfo['release_notes'] = $data;
|
||||
}
|
||||
break;
|
||||
case 'STATE':
|
||||
case 'state':
|
||||
if (!in_array($data, $this->releases_states)) {
|
||||
trigger_error("The release state: '$data' is not valid", E_USER_WARNING);
|
||||
} elseif ($this->in_changelog) {
|
||||
$this->current_release['release_state'] = $data;
|
||||
} else {
|
||||
$this->pkginfo['release_state'] .= $data;
|
||||
$this->pkginfo['release_state'] = $data;
|
||||
}
|
||||
break;
|
||||
case 'DIR':
|
||||
case 'dir':
|
||||
break;
|
||||
case 'FILE':
|
||||
$role = strtolower($this->current_attributes['ROLE']);
|
||||
case 'file':
|
||||
$this->current_file = trim($data);
|
||||
break;
|
||||
case 'LIBNAME':
|
||||
case 'libname':
|
||||
$this->lib_name = trim($data);
|
||||
break;
|
||||
case 'SOURCES':
|
||||
case 'sources':
|
||||
$this->lib_sources[] = trim($data);
|
||||
break;
|
||||
}
|
||||
@@ -347,7 +350,7 @@ class PEAR_Common extends PEAR
|
||||
xml_set_object($xp, $this);
|
||||
xml_set_element_handler($xp, '_element_start', '_element_end');
|
||||
xml_set_character_data_handler($xp, '_pkginfo_cdata');
|
||||
xml_parser_set_option($xp, XML_OPTION_CASE_FOLDING, true);
|
||||
xml_parser_set_option($xp, XML_OPTION_CASE_FOLDING, false);
|
||||
|
||||
$this->element_stack = array();
|
||||
$this->pkginfo = array();
|
||||
@@ -378,6 +381,7 @@ class PEAR_Common extends PEAR
|
||||
return $this->pkginfo;
|
||||
}
|
||||
// }}}
|
||||
// {{{ infoFromTgzFile()
|
||||
|
||||
/**
|
||||
* Returns info from a tgz pear package
|
||||
@@ -404,5 +408,7 @@ class PEAR_Common extends PEAR
|
||||
unlink($xml);
|
||||
return $info;
|
||||
}
|
||||
|
||||
// }}}
|
||||
}
|
||||
?>
|
||||
@@ -0,0 +1,222 @@
|
||||
<?php
|
||||
//
|
||||
// +----------------------------------------------------------------------+
|
||||
// | PHP version 4.0 |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | Copyright (c) 1997-2001 The PHP Group |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | This source file is subject to version 2.02 of the PHP license, |
|
||||
// | that is bundled with this package in the file LICENSE, and is |
|
||||
// | available at through the world-wide-web at |
|
||||
// | http://www.php.net/license/2_02.txt. |
|
||||
// | If you did not receive a copy of the PHP license and are unable to |
|
||||
// | obtain it through the world-wide-web, please send a note to |
|
||||
// | license@php.net so we can mail you a copy immediately. |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | Authors: Stig Bakken <ssb@fast.no> |
|
||||
// | |
|
||||
// +----------------------------------------------------------------------+
|
||||
//
|
||||
// $Id$
|
||||
|
||||
require_once 'PEAR.php';
|
||||
|
||||
/**
|
||||
* This is a class for storing simple configuration values keeping
|
||||
* track of which are system-defined (defaulted) and which are
|
||||
* user-defined. By default, only user-defined settings are stored
|
||||
* back to the user's configuration file.
|
||||
*
|
||||
* Configuration member is a simple associative array. Used keys:
|
||||
*
|
||||
* master_server which server to query for mirror lists etc.
|
||||
* server which server/mirror we're currently using
|
||||
* username PEAR username
|
||||
* password PEAR password (stored base64-encoded)
|
||||
* php_dir Where to install .php files
|
||||
* ext_dir Directory to install compiled libs in
|
||||
* doc_dir Directory to install documentation in
|
||||
*
|
||||
*/
|
||||
class PEAR_Config extends PEAR
|
||||
{
|
||||
// {{{ properties
|
||||
|
||||
var $defaults_file = '';
|
||||
|
||||
var $config_file = '';
|
||||
|
||||
var $configuration = array();
|
||||
|
||||
var $defaulted = array();
|
||||
|
||||
// }}}
|
||||
|
||||
// {{{ PEAR_Config([file], [defaults_file])
|
||||
|
||||
function PEAR_Config($file = '', $defaults_file = '')
|
||||
{
|
||||
$this->PEAR();
|
||||
$this->config_file = $file;
|
||||
$this->defaults_file = $defaults_file;
|
||||
if ($file && file_exists($file)) {
|
||||
$this->readConfigFile($file);
|
||||
}
|
||||
if ($defaults_file && file_exists($defaults_file)) {
|
||||
$this->mergeConfigFile($defaults_file, false, true);
|
||||
}
|
||||
}
|
||||
|
||||
// }}}
|
||||
|
||||
// {{{ readConfigFile([file], [defaults])
|
||||
|
||||
function readConfigFile($file = null, $defaults = false)
|
||||
{
|
||||
if ($file === null) {
|
||||
$file = $this->config_file;
|
||||
}
|
||||
$fp = @fopen($file, "r");
|
||||
if (!$fp) {
|
||||
return $this->raiseError($php_errormsg);
|
||||
}
|
||||
$size = filesize($file);
|
||||
$contents = fread($fp, $size);
|
||||
$data = unserialize($contents);
|
||||
if ($data === false && $size > 1) {
|
||||
return $this->raiseError("PEAR_Config::readConfigFile: bad data");
|
||||
}
|
||||
$this->configuration = $data;
|
||||
if ($defaults) {
|
||||
foreach ($data as $key => $value) {
|
||||
$this->defaulted[$key] = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// }}}
|
||||
// {{{ mergeConfigFile(file, [override], [defaults])
|
||||
|
||||
function mergeConfigFile($file, $override = true, $defaults = false)
|
||||
{
|
||||
$fp = @fopen($file, "r");
|
||||
if (!$fp) {
|
||||
return $this->raiseError($php_errormsg);
|
||||
}
|
||||
$contents = fread($fp, filesize($file));
|
||||
$data = unserialize($contents);
|
||||
if ($data === false) {
|
||||
return $this->raiseError("PEAR_Config::mergeConfigFile: bad data");
|
||||
}
|
||||
foreach ($data as $key => $value) {
|
||||
if (isset($this->configuration[$key]) && !$override) {
|
||||
continue;
|
||||
}
|
||||
if ($defaults) {
|
||||
$this->defaulted[$key] = true;
|
||||
}
|
||||
$this->configuration[$key] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
// }}}
|
||||
// {{{ writeConfigFile([file], [what_keys])
|
||||
|
||||
function writeConfigFile($file = null, $what_keys = 'userdefined')
|
||||
{
|
||||
if ($what_keys == 'both') {
|
||||
$this->writeConfigFile($file, 'userdefined');
|
||||
$this->writeConfigFile($file, 'default');
|
||||
return;
|
||||
}
|
||||
if ($file === null) {
|
||||
if ($what_keys == 'default') {
|
||||
$file = $this->defaults_file;
|
||||
} else {
|
||||
$file = $this->config_file;
|
||||
}
|
||||
}
|
||||
if ($what_keys == 'default') {
|
||||
$keys_to_store = array_intersect(array_keys($this->configuration),
|
||||
array_keys($this->defaulted));
|
||||
} elseif ($what_keys == 'all') {
|
||||
$keys_to_store = array_keys($this->configuration);
|
||||
} else { // user-defined keys
|
||||
$keys_to_store = array_diff(array_keys($this->configuration),
|
||||
array_keys($this->defaulted));
|
||||
}
|
||||
$data = array();
|
||||
foreach ($keys_to_store as $key) {
|
||||
$data[$key] = $this->configuration[$key];
|
||||
}
|
||||
$fp = @fopen($file, "w");
|
||||
if (!$fp) {
|
||||
return $this->raiseError("PEAR_Config::writeConfigFile fopen('$file','w') failed");
|
||||
}
|
||||
if (!@fwrite($fp, serialize($data))) {
|
||||
return $this->raiseError("PEAR_Config::writeConfigFile serialize failed");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// }}}
|
||||
// {{{ get(key)
|
||||
|
||||
function get($key)
|
||||
{
|
||||
return @$this->configuration[$key];
|
||||
}
|
||||
|
||||
// }}}
|
||||
// {{{ set(key, value, [default])
|
||||
|
||||
function set($key, $value, $default = false)
|
||||
{
|
||||
$this->configuration[$key] = $value;
|
||||
if ($default) {
|
||||
$this->defaulted[$key] = true;
|
||||
} elseif (isset($this->defaulted[$key])) {
|
||||
unset($this->defaulted[$key]);
|
||||
}
|
||||
}
|
||||
|
||||
// }}}
|
||||
// {{{ getKeys()
|
||||
|
||||
function getKeys()
|
||||
{
|
||||
return array_keys($this->configuration);
|
||||
}
|
||||
|
||||
// }}}
|
||||
// {{{ toDefault(key)
|
||||
|
||||
function toDefault($key)
|
||||
{
|
||||
if (file_exists($this->defaults_file)) {
|
||||
// re-reads the defaults file each time, but hey it works
|
||||
unset($this->configuration[$key]);
|
||||
$this->mergeConfigFile($this->defaults_file, false, true);
|
||||
}
|
||||
}
|
||||
|
||||
// }}}
|
||||
// {{{ isDefaulted(key)
|
||||
|
||||
function isDefaulted($key)
|
||||
{
|
||||
return isset($this->defaulted[$key]);
|
||||
}
|
||||
|
||||
// }}}
|
||||
// {{{ isDefined(key)
|
||||
|
||||
function isDefined($key)
|
||||
{
|
||||
return isset($this->configuration[$key]);
|
||||
}
|
||||
|
||||
// }}}
|
||||
}
|
||||
|
||||
?>
|
||||
Loaded 100 of 138 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user