mirror of
https://github.com/bdnugget/php-src.git
synced 2026-11-09 02:00:49 +00:00
Compare commits
56
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b6aed2e625 | ||
|
|
b6b6b14ae9 | ||
|
|
12f8f00fb8 | ||
|
|
e3c79b33f8 | ||
|
|
e9c5c6ea7a | ||
|
|
0493e78c8d | ||
|
|
432a0a8d18 | ||
|
|
3844c9cfb6 | ||
|
|
f825493be1 | ||
|
|
236b0d0861 | ||
|
|
1b32827801 | ||
|
|
59b1db6bfc | ||
|
|
3efc767433 | ||
|
|
0eea6e7a8f | ||
|
|
43357775fa | ||
|
|
ec94654316 | ||
|
|
03e748888b | ||
|
|
3dca869c7b | ||
|
|
480a2ea1b7 | ||
|
|
bf80795cad | ||
|
|
881e6b69c4 | ||
|
|
888e41a834 | ||
|
|
02e8c41b24 | ||
|
|
bd3b413dc9 | ||
|
|
83a354b69a | ||
|
|
3de6716235 | ||
|
|
288d437b3e | ||
|
|
40cd0d8909 | ||
|
|
ac6d2d4fe9 | ||
|
|
ebc2ff7c07 | ||
|
|
a8b9717374 | ||
|
|
de138d3468 | ||
|
|
a5ce3491ef | ||
|
|
d07f47f59e | ||
|
|
c3670534df | ||
|
|
b583e753b5 | ||
|
|
f81e218f15 | ||
|
|
71fa3102fc | ||
|
|
ded8918b9e | ||
|
|
a574e24080 | ||
|
|
d812632083 | ||
|
|
ad39ef1462 | ||
|
|
c0446845b9 | ||
|
|
326dcb9e79 | ||
|
|
26a0663044 | ||
|
|
9b4e521b9c | ||
|
|
449ddbccb1 | ||
|
|
fa077c7be9 | ||
|
|
786eacfd45 | ||
|
|
46cdd040e2 | ||
|
|
6f164ad7dc | ||
|
|
58f0cbd534 | ||
|
|
594b7989cc | ||
|
|
44294ada47 | ||
|
|
c277e3f98d | ||
|
|
cd14d04924 |
No files matched your search
@@ -389,7 +389,8 @@ USING PHP 3 AND PHP 4 AS CONCURRENT APACHE MODULES
|
||||
- Linux with recent binutils (binutils 2.9.1.0.25 tested)
|
||||
- Solaris 2.5 or better
|
||||
- FreeBSD (3.2, 4.0 tested)
|
||||
|
||||
- IRIX64 6.5
|
||||
|
||||
To enable it, configure PHP 3 and PHP 4 to use APXS (--with-apxs) and the
|
||||
necessary link extensions (--enable-versioning). Otherwise, all standard
|
||||
installations instructions apply. For example:
|
||||
|
||||
@@ -1,7 +1,28 @@
|
||||
PHP 4.0 NEWS
|
||||
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||
|
||||
?? ??? 2000, Version 4.0.4
|
||||
19 Dec 2000, Version 4.0.4
|
||||
- Allow assigning a newly created object by reference. This is needed only if
|
||||
your constructor makes other data structures reference the $this object (for
|
||||
example, $GLOBALS["foobar"] =& $this;)
|
||||
The new syntax is $obj =& new MyClass(); (Andi, Zend Engine)
|
||||
- Allow for three expression types to be sent to functions which are requesting
|
||||
the function argument to be passed by reference (only c. was previously
|
||||
supported):
|
||||
a. func(new myclass());
|
||||
b. func(func2()); where func2() returns a reference, i.e. is defined as
|
||||
function &func2(...)
|
||||
{
|
||||
...
|
||||
}
|
||||
c. func($var); where func() is defined as function func(&$var) {...}
|
||||
You CAN'T count on any other expressions to be passable by reference.
|
||||
(Andi, Zend Engine)
|
||||
- Made ldap_get_entries() return an array even if there are no entries
|
||||
in search result. (Jani)
|
||||
- Fixed bad mod_perl interaction which caused segfaults when using LFS (Sascha)
|
||||
- const CONSTNAME now gets recognized. Before the patch only @const CONSTNAME
|
||||
description was recognized.
|
||||
- Added the is_null() function that will return true if a variable is of
|
||||
type null. (Sterling)
|
||||
- Fixed a bug which made readdir() unusable in some systems. (Jani)
|
||||
@@ -59,6 +80,7 @@ PHP 4.0 NEWS
|
||||
the full path (Jani)
|
||||
- Added ImageCreateFromString() which creates an image stream out of
|
||||
e.g. a MySQL blob. (Mathieu)
|
||||
- Fixed a crash bug in imagewbmp() (Jani)
|
||||
- Changed the sablot configuration file so that if you use any version of
|
||||
Sablotron below 0.44 you must use Sablotron's built-in Expat libraries.
|
||||
(Sterling)
|
||||
|
||||
+5
-16
@@ -1,17 +1,6 @@
|
||||
How to install PHP with the BCMath arbitrary precision math library?
|
||||
--------------------------------------------------------------------
|
||||
As of PHP 4.0.4, the BC math library routines are bundled in the
|
||||
standard PHP distribution. There is no need to install any additional
|
||||
files.
|
||||
|
||||
Due to license restrictions, the BC math library can no longer be distributed
|
||||
along with PHP. The BC math library is distributed under the restrictive
|
||||
GNU Public License, and PHP is no longer distributed under that license, but
|
||||
under a less restrictive license, the PHP License.
|
||||
|
||||
If you want to enable BC math support (recommended), all you have to do is
|
||||
simply download http://www.php.net/extra/number4.tar.gz, and untar it on the
|
||||
top level php4 directory.
|
||||
|
||||
A typical way of doing this would be (assuming that you have lynx):
|
||||
cd ~/php4
|
||||
lynx -dump -source http://www.php.net/extra/number4.tar.gz | gzip -d | tar xvf -
|
||||
|
||||
The PHP Group
|
||||
Thanks goes to Phil Nelson, for releasing the BC math library routines
|
||||
under the LGPL.
|
||||
@@ -14,11 +14,7 @@
|
||||
#define TSRM_H
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# undef PACKAGE
|
||||
# undef VERSION
|
||||
# include "tsrm_config.h"
|
||||
# undef PACKAGE
|
||||
# undef VERSION
|
||||
#endif
|
||||
|
||||
/* Only compile multi-threading functions if we're in ZTS mode */
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@ dnl Minimalistic configure.in for TSRM.
|
||||
dnl
|
||||
|
||||
AC_INIT(TSRM.c)
|
||||
AM_INIT_AUTOMAKE(TSRM, 1.0)
|
||||
AM_INIT_AUTOMAKE(TSRM, 1.0, nodefine)
|
||||
AM_CONFIG_HEADER(tsrm_config.h)
|
||||
|
||||
sinclude(tsrm.m4)
|
||||
|
||||
@@ -3,10 +3,6 @@
|
||||
|
||||
@TOP@
|
||||
|
||||
/* these are defined by automake */
|
||||
#undef PACKAGE
|
||||
#undef VERSION
|
||||
|
||||
#undef uint
|
||||
#undef ulong
|
||||
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@ dnl $Id$
|
||||
dnl Process this file with autoconf to produce a configure script.
|
||||
|
||||
AC_INIT(zend.c)
|
||||
AM_INIT_AUTOMAKE(zend, 0.80A)
|
||||
AM_INIT_AUTOMAKE(zend, 0.80A, nodefine)
|
||||
AM_CONFIG_HEADER(zend_config.h)
|
||||
AM_SANITY_CHECK
|
||||
AM_MAINTAINER_MODE
|
||||
|
||||
+2
-2
@@ -177,8 +177,8 @@ ZEND_API int add_get_assoc_stringl(zval *arg, char *key, char *str, uint length,
|
||||
ZEND_API int add_get_index_string(zval *arg, uint idx, char *str, void **dest, int duplicate);
|
||||
ZEND_API int add_get_index_stringl(zval *arg, uint idx, char *str, uint length, void **dest, int duplicate);
|
||||
|
||||
ZEND_API int call_user_function(HashTable *function_table, zval *object, zval *function_name, zval *retval_ptr, int param_count, zval *params[]);
|
||||
ZEND_API int call_user_function_ex(HashTable *function_table, zval *object, zval *function_name, zval **retval_ptr_ptr, int param_count, zval **params[], int no_separation, HashTable *symbol_table);
|
||||
ZEND_API int call_user_function(HashTable *function_table, zval **object_pp, zval *function_name, zval *retval_ptr, int param_count, zval *params[]);
|
||||
ZEND_API int call_user_function_ex(HashTable *function_table, zval **object_pp, zval *function_name, zval **retval_ptr_ptr, int param_count, zval **params[], int no_separation, HashTable *symbol_table);
|
||||
|
||||
ZEND_API int add_property_long(zval *arg, char *key, long l);
|
||||
ZEND_API int add_property_unset(zval *arg, char *key);
|
||||
|
||||
@@ -29,7 +29,7 @@ static ZEND_FUNCTION(zend_version);
|
||||
static ZEND_FUNCTION(func_num_args);
|
||||
static ZEND_FUNCTION(func_get_arg);
|
||||
static ZEND_FUNCTION(func_get_args);
|
||||
static ZEND_FUNCTION(strlen);
|
||||
static ZEND_NAMED_FUNCTION(zend_if_strlen);
|
||||
static ZEND_FUNCTION(strcmp);
|
||||
static ZEND_FUNCTION(strncmp);
|
||||
static ZEND_FUNCTION(strcasecmp);
|
||||
@@ -74,7 +74,7 @@ static zend_function_entry builtin_functions[] = {
|
||||
ZEND_FE(func_num_args, NULL)
|
||||
ZEND_FE(func_get_arg, NULL)
|
||||
ZEND_FE(func_get_args, NULL)
|
||||
ZEND_FE(strlen, NULL)
|
||||
{ "strlen", zend_if_strlen, NULL },
|
||||
ZEND_FE(strcmp, NULL)
|
||||
ZEND_FE(strncmp, NULL)
|
||||
ZEND_FE(strcasecmp, NULL)
|
||||
@@ -221,7 +221,7 @@ ZEND_FUNCTION(func_get_args)
|
||||
|
||||
/* {{{ proto int strlen(string str)
|
||||
Get string length */
|
||||
ZEND_FUNCTION(strlen)
|
||||
ZEND_NAMED_FUNCTION(zend_if_strlen)
|
||||
{
|
||||
zval **str;
|
||||
|
||||
@@ -592,7 +592,7 @@ ZEND_FUNCTION(get_class_methods)
|
||||
while ((key_type = zend_hash_get_current_key(&ce->function_table, &string_key, &num_key)) != HASH_KEY_NON_EXISTANT) {
|
||||
if (key_type == HASH_KEY_IS_STRING) {
|
||||
MAKE_STD_ZVAL(method_name);
|
||||
ZVAL_STRING(method_name, string_key, 1);
|
||||
ZVAL_STRING(method_name, string_key, 0);
|
||||
zend_hash_next_index_insert(return_value->value.ht, &method_name, sizeof(zval *), NULL);
|
||||
}
|
||||
zend_hash_move_forward(&ce->function_table);
|
||||
|
||||
@@ -1791,6 +1791,7 @@ void zend_do_add_static_array_element(znode *result, znode *offset, znode *expr)
|
||||
*element = expr->u.constant;
|
||||
if (offset) {
|
||||
switch (offset->u.constant.type) {
|
||||
case IS_CONSTANT:
|
||||
case IS_STRING:
|
||||
zend_hash_update(result->u.constant.value.ht, offset->u.constant.value.str.val, offset->u.constant.value.str.len+1, &element, sizeof(zval *), NULL);
|
||||
zval_dtor(&offset->u.constant);
|
||||
|
||||
+2
-2
@@ -139,8 +139,8 @@ ZEND_API char *zend_get_executed_filename(ELS_D);
|
||||
ZEND_API uint zend_get_executed_lineno(ELS_D);
|
||||
ZEND_API zend_bool zend_is_executing(void);
|
||||
|
||||
void zend_set_timeout(long seconds);
|
||||
void zend_unset_timeout(void);
|
||||
ZEND_API void zend_set_timeout(long seconds);
|
||||
ZEND_API void zend_unset_timeout(void);
|
||||
ZEND_API void zend_timeout(int dummy);
|
||||
|
||||
#ifdef ZEND_WIN32
|
||||
|
||||
+13
-14
@@ -312,7 +312,7 @@ ZEND_API int zval_update_constant(zval **pp, void *arg)
|
||||
}
|
||||
|
||||
|
||||
int call_user_function(HashTable *function_table, zval *object, zval *function_name, zval *retval_ptr, int param_count, zval *params[])
|
||||
int call_user_function(HashTable *function_table, zval **object_pp, zval *function_name, zval *retval_ptr, int param_count, zval *params[])
|
||||
{
|
||||
zval ***params_array = (zval ***) emalloc(sizeof(zval **)*param_count);
|
||||
int i;
|
||||
@@ -322,7 +322,7 @@ int call_user_function(HashTable *function_table, zval *object, zval *function_n
|
||||
for (i=0; i<param_count; i++) {
|
||||
params_array[i] = ¶ms[i];
|
||||
}
|
||||
ex_retval = call_user_function_ex(function_table, object, function_name, &local_retval_ptr, param_count, params_array, 1, NULL);
|
||||
ex_retval = call_user_function_ex(function_table, object_pp, function_name, &local_retval_ptr, param_count, params_array, 1, NULL);
|
||||
if (local_retval_ptr) {
|
||||
COPY_PZVAL_TO_ZVAL(*retval_ptr, local_retval_ptr);
|
||||
} else {
|
||||
@@ -333,7 +333,7 @@ int call_user_function(HashTable *function_table, zval *object, zval *function_n
|
||||
}
|
||||
|
||||
|
||||
int call_user_function_ex(HashTable *function_table, zval *object, zval *function_name, zval **retval_ptr_ptr, int param_count, zval **params[], int no_separation, HashTable *symbol_table)
|
||||
int call_user_function_ex(HashTable *function_table, zval **object_pp, zval *function_name, zval **retval_ptr_ptr, int param_count, zval **params[], int no_separation, HashTable *symbol_table)
|
||||
{
|
||||
int i;
|
||||
zval **original_return_value;
|
||||
@@ -357,15 +357,15 @@ int call_user_function_ex(HashTable *function_table, zval *object, zval *functio
|
||||
}
|
||||
function_name = *tmp_real_function_name;
|
||||
SEPARATE_ZVAL_IF_NOT_REF(tmp_object_ptr);
|
||||
object = *tmp_object_ptr;
|
||||
object->is_ref = 1;
|
||||
object_pp = tmp_object_ptr;
|
||||
(*object_pp)->is_ref = 1;
|
||||
}
|
||||
|
||||
if (object) {
|
||||
if (object->type != IS_OBJECT) {
|
||||
if (object_pp) {
|
||||
if (Z_TYPE_PP(object_pp) != IS_OBJECT) {
|
||||
return FAILURE;
|
||||
}
|
||||
function_table = &object->value.obj.ce->function_table;
|
||||
function_table = &(*object_pp)->value.obj.ce->function_table;
|
||||
}
|
||||
|
||||
if (function_name->type!=IS_STRING) {
|
||||
@@ -422,14 +422,13 @@ int call_user_function_ex(HashTable *function_table, zval *object, zval *functio
|
||||
ALLOC_HASHTABLE(EG(active_symbol_table));
|
||||
zend_hash_init(EG(active_symbol_table), 0, NULL, ZVAL_PTR_DTOR, 0);
|
||||
}
|
||||
if (object) {
|
||||
if (object_pp) {
|
||||
zval *dummy, **this_ptr;
|
||||
|
||||
|
||||
ALLOC_ZVAL(dummy);
|
||||
INIT_ZVAL(*dummy);
|
||||
|
||||
INIT_ZVAL(*dummy);
|
||||
zend_hash_update(EG(active_symbol_table), "this", sizeof("this"), &dummy, sizeof(zval *), (void **) &this_ptr);
|
||||
zend_assign_to_variable_reference(NULL, this_ptr, &object, NULL ELS_CC);
|
||||
zend_assign_to_variable_reference(NULL, this_ptr, object_pp, NULL ELS_CC);
|
||||
}
|
||||
original_return_value = EG(return_value_ptr_ptr);
|
||||
original_op_array = EG(active_op_array);
|
||||
@@ -447,7 +446,7 @@ int call_user_function_ex(HashTable *function_table, zval *object, zval *functio
|
||||
EG(opline_ptr) = original_opline_ptr;
|
||||
} else {
|
||||
ALLOC_INIT_ZVAL(*retval_ptr_ptr);
|
||||
((zend_internal_function *) function_state.function)->handler(param_count, *retval_ptr_ptr, object, 1 ELS_CC);
|
||||
((zend_internal_function *) function_state.function)->handler(param_count, *retval_ptr_ptr, *object_pp, 1 ELS_CC);
|
||||
INIT_PZVAL(*retval_ptr_ptr);
|
||||
}
|
||||
zend_ptr_stack_clear_multiple(ELS_C);
|
||||
|
||||
+2
-2
@@ -155,7 +155,7 @@ ZEND_API ulong hashpjw(char *arKey, uint nKeyLength)
|
||||
if (!(p)->pDataPtr) { \
|
||||
pefree((p)->pData, (ht)->persistent); \
|
||||
} \
|
||||
(p)->pDataPtr = *(void **)pData; \
|
||||
memcpy(&(p)->pDataPtr, pData, sizeof(void *)); \
|
||||
(p)->pData = &(p)->pDataPtr; \
|
||||
} else { \
|
||||
if ((p)->pDataPtr) { \
|
||||
@@ -167,7 +167,7 @@ ZEND_API ulong hashpjw(char *arKey, uint nKeyLength)
|
||||
|
||||
#define INIT_DATA(ht, p, pData, nDataSize); \
|
||||
if (nDataSize == sizeof(void*)) { \
|
||||
(p)->pDataPtr = *(void **)pData; \
|
||||
memcpy(&(p)->pDataPtr, pData, sizeof(void *)); \
|
||||
(p)->pData = &(p)->pDataPtr; \
|
||||
} else { \
|
||||
(p)->pData = (void *) pemalloc(nDataSize, (ht)->persistent); \
|
||||
|
||||
@@ -419,6 +419,7 @@ expr_without_variable:
|
||||
| cvar '=' expr { zend_do_end_variable_parse(BP_VAR_W, 0 CLS_CC); zend_do_assign(&$$, &$1, &$3 CLS_CC); }
|
||||
| cvar '=' '&' w_cvar { zend_do_end_variable_parse(BP_VAR_W, 0 CLS_CC); zend_do_assign_ref(&$$, &$1, &$4 CLS_CC); }
|
||||
| cvar '=' '&' function_call { zend_do_end_variable_parse(BP_VAR_W, 0 CLS_CC); zend_do_assign_ref(&$$, &$1, &$4 CLS_CC); }
|
||||
| cvar '=' '&' T_NEW class_name { zend_do_extended_fcall_begin(CLS_C); zend_do_begin_new_object(&$4, &$5 CLS_CC); } ctor_arguments { zend_do_end_new_object(&$3, &$5, &$4, &$7 CLS_CC); zend_do_extended_fcall_end(CLS_C); zend_do_end_variable_parse(BP_VAR_W, 0 CLS_CC); zend_do_assign_ref(&$$, &$1, &$3 CLS_CC); }
|
||||
| T_NEW class_name { zend_do_extended_fcall_begin(CLS_C); zend_do_begin_new_object(&$1, &$2 CLS_CC); } ctor_arguments { zend_do_end_new_object(&$$, &$2, &$1, &$4 CLS_CC); zend_do_extended_fcall_end(CLS_C);}
|
||||
| cvar T_PLUS_EQUAL expr { zend_do_end_variable_parse(BP_VAR_RW, 0 CLS_CC); zend_do_binary_assign_op(ZEND_ASSIGN_ADD, &$$, &$1, &$3 CLS_CC); }
|
||||
| cvar T_MINUS_EQUAL expr { zend_do_end_variable_parse(BP_VAR_RW, 0 CLS_CC); zend_do_binary_assign_op(ZEND_ASSIGN_SUB, &$$, &$1, &$3 CLS_CC); }
|
||||
|
||||
+1
-1
@@ -37,7 +37,7 @@ extern unsigned char second_arg_allow_ref[];
|
||||
|
||||
#include "zend.h"
|
||||
|
||||
#define ZEND_MODULE_API_NO 20000809
|
||||
#define ZEND_MODULE_API_NO 20001214
|
||||
#ifdef ZTS
|
||||
#define USING_ZTS 1
|
||||
#else
|
||||
|
||||
@@ -1563,7 +1563,7 @@ ZEND_API int zend_binary_strncasecmp(char *s1, uint len1, char *s2, uint len2, u
|
||||
}
|
||||
}
|
||||
|
||||
return len1 - len2;
|
||||
return MIN(length, len1) - MIN(length, len2);
|
||||
}
|
||||
|
||||
|
||||
|
||||
+1
-1
@@ -54,7 +54,7 @@ distclean: distclean-recursive clean-x
|
||||
php_config.h stamp-h Makefile build-defs.h php4.spec libphp4.module
|
||||
|
||||
test: $(top_builddir)/php
|
||||
@$(top_builddir)/php -f $(top_srcdir)/run-tests.php `pwd`
|
||||
@$(top_builddir)/php -q $(top_srcdir)/run-tests.php `pwd`
|
||||
|
||||
include $(builddir)/.deps
|
||||
|
||||
|
||||
+22
-3
@@ -51,7 +51,7 @@ dnl ## All of these are normally in the extension directories.
|
||||
dnl ## Diversion 5 is the last one. Here we generate files and clean up.
|
||||
|
||||
dnl ## This is where the version number is changed from now on!
|
||||
AM_INIT_AUTOMAKE(php, 4.0.4-dev)
|
||||
AM_INIT_AUTOMAKE(php, 4.0.4, nodefine)
|
||||
|
||||
PHP_VERSION=$VERSION
|
||||
echo "/* automatically generated by configure */" > php_version.h.new
|
||||
@@ -95,7 +95,11 @@ BSD_MAKEFILE=no
|
||||
|
||||
case "$host_alias" in
|
||||
*solaris*)
|
||||
CPPFLAGS="$CPPFLAGS -D_POSIX_PTHREAD_SEMANTICS";;
|
||||
CPPFLAGS="$CPPFLAGS -D_POSIX_PTHREAD_SEMANTICS"
|
||||
if test "${enable_libgcc+set}" != "set" && test "$GCC" = "yes"; then
|
||||
enable_libgcc=yes
|
||||
fi
|
||||
;;
|
||||
*dgux*)
|
||||
CPPFLAGS="$CPPFLAGS -D_BSD_TIMEOFDAY_FLAVOR";;
|
||||
*darwin*|*rhapsody*)
|
||||
@@ -502,7 +506,7 @@ AC_ARG_WITH(exec-dir,
|
||||
])
|
||||
|
||||
PHP_ARG_WITH(openssl,for OpenSSL support,
|
||||
[ --with-openssl[=DIR] Include OpenSSL support])
|
||||
[ --with-openssl[=DIR] Include OpenSSL support (requires OpenSSL >= 0.9.6) ])
|
||||
if test "$PHP_OPENSSL" = "yes"; then
|
||||
PHP_OPENSSL="/usr/local/ssl /usr/local /usr /usr/local/openssl"
|
||||
fi
|
||||
@@ -523,6 +527,21 @@ AC_DEFUN(PHP_SETUP_OPENSSL,[
|
||||
AC_MSG_ERROR(Cannot find OpenSSL's <evp.h>)
|
||||
fi
|
||||
|
||||
old_CPPFLAGS=$CPPFLAGS
|
||||
CPPFLAGS="-I$OPENSSL_INC"
|
||||
AC_MSG_CHECKING(for OpenSSL version)
|
||||
AC_EGREP_CPP(yes,[
|
||||
#include <openssl/opensslv.h>
|
||||
#if OPENSSL_VERSION_NUMBER >= 0x0090600fL
|
||||
yes
|
||||
#endif
|
||||
],[
|
||||
AC_MSG_RESULT(>= 0.9.6)
|
||||
],[
|
||||
AC_MSG_ERROR(OpenSSL version 0.9.6 or greater required.)
|
||||
])
|
||||
CPPFLAGS=$old_CPPFLAGS
|
||||
|
||||
AC_ADD_LIBPATH($OPENSSL_DIR/lib)
|
||||
AC_ADD_LIBRARY(ssl)
|
||||
AC_ADD_LIBRARY(crypto)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
dnl $Id$
|
||||
|
||||
PHP_ARG_WITH(bcmath, for bc style precision math functions,
|
||||
[ --without-bcmath Compile without bc style precision math functions. ], yes)
|
||||
PHP_ARG_ENABLE(bcmath, for bc style precision math functions,
|
||||
[ --enable-bcmath Enable bc style precision math functions.])
|
||||
|
||||
if test "$PHP_BCMATH" != "no"; then
|
||||
AC_DEFINE(WITH_BCMATH, 1, [Whether you have bcmath])
|
||||
|
||||
+2
-3
@@ -3,9 +3,8 @@ dnl config.m4 for PHP4 CCVS Extension
|
||||
|
||||
AC_MSG_CHECKING(CCVS Support)
|
||||
AC_ARG_WITH(ccvs,
|
||||
[ --with-ccvs[=DIR] Compile CCVS support into PHP4.
|
||||
Please specify your CCVS base install directory as DIR.
|
||||
],
|
||||
[ --with-ccvs[=DIR] Compile CCVS support into PHP4. Please specify your
|
||||
CCVS base install directory as DIR.],
|
||||
[
|
||||
if test "$withval" != "no"; then
|
||||
CCVS_DIR="$withval"
|
||||
|
||||
+2
-1
@@ -14,7 +14,8 @@ dnl [ --with-ctype Include ctype support])
|
||||
|
||||
dnl Otherwise use enable:
|
||||
|
||||
PHP_ARG_ENABLE(ctype, whether to enable ctype support,[ --enable-ctype Enable ctype support])
|
||||
PHP_ARG_ENABLE(ctype, whether to enable ctype support,
|
||||
[ --enable-ctype Enable ctype support])
|
||||
|
||||
if test "$PHP_CTYPE" != "no"; then
|
||||
dnl If you will not be testing anything external, like existence of
|
||||
|
||||
+22
-22
@@ -41,17 +41,17 @@ static int le_ctype;
|
||||
*/
|
||||
function_entry ctype_functions[] = {
|
||||
PHP_FE(confirm_ctype_compiled, NULL) /* For testing, remove later. */
|
||||
PHP_FE(isalnum, NULL)
|
||||
PHP_FE(isalpha, NULL)
|
||||
PHP_FE(iscntrl, NULL)
|
||||
PHP_FE(isdigit, NULL)
|
||||
PHP_FE(islower, NULL)
|
||||
PHP_FE(isgraph, NULL)
|
||||
PHP_FE(isprint, NULL)
|
||||
PHP_FE(ispunct, NULL)
|
||||
PHP_FE(isspace, NULL)
|
||||
PHP_FE(isupper, NULL)
|
||||
PHP_FE(isxdigit, NULL)
|
||||
PHP_FE(ctype_alnum, NULL)
|
||||
PHP_FE(ctype_alpha, NULL)
|
||||
PHP_FE(ctype_cntrl, NULL)
|
||||
PHP_FE(ctype_digit, NULL)
|
||||
PHP_FE(ctype_lower, NULL)
|
||||
PHP_FE(ctype_graph, NULL)
|
||||
PHP_FE(ctype_print, NULL)
|
||||
PHP_FE(ctype_punct, NULL)
|
||||
PHP_FE(ctype_space, NULL)
|
||||
PHP_FE(ctype_upper, NULL)
|
||||
PHP_FE(ctype_xdigit, NULL)
|
||||
{NULL, NULL, NULL} /* Must be the last line in ctype_functions[] */
|
||||
};
|
||||
|
||||
@@ -177,7 +177,7 @@ static int ctype(int (*iswhat)(int),zval **c)
|
||||
|
||||
/* {{{ proto bool isalnum(mixed c)
|
||||
Check for alphanumeric character(s) */
|
||||
PHP_FUNCTION(isalnum)
|
||||
PHP_FUNCTION(ctype_alnum)
|
||||
{
|
||||
PHP_EXPERIMENTAL("4.0.4dev",NULL)
|
||||
zval **c;
|
||||
@@ -195,7 +195,7 @@ PHP_FUNCTION(isalnum)
|
||||
|
||||
/* {{{ proto bool isalpha(mixed c)
|
||||
Check for alphabetic character(s) */
|
||||
PHP_FUNCTION(isalpha)
|
||||
PHP_FUNCTION(ctype_alpha)
|
||||
{
|
||||
PHP_EXPERIMENTAL("4.0.4dev",NULL)
|
||||
zval **c;
|
||||
@@ -213,7 +213,7 @@ PHP_FUNCTION(isalpha)
|
||||
|
||||
/* {{{ proto bool iscntrl(mixed c)
|
||||
Check for control character(s) */
|
||||
PHP_FUNCTION(iscntrl)
|
||||
PHP_FUNCTION(ctype_cntrl)
|
||||
{
|
||||
PHP_EXPERIMENTAL("4.0.4dev",NULL)
|
||||
zval **c;
|
||||
@@ -231,7 +231,7 @@ PHP_FUNCTION(iscntrl)
|
||||
|
||||
/* {{{ proto bool isdigit(mixed c)
|
||||
Check for numeric character(s) */
|
||||
PHP_FUNCTION(isdigit)
|
||||
PHP_FUNCTION(ctype_digit)
|
||||
{
|
||||
PHP_EXPERIMENTAL("4.0.4dev",NULL)
|
||||
zval **c;
|
||||
@@ -249,7 +249,7 @@ PHP_FUNCTION(isdigit)
|
||||
|
||||
/* {{{ proto bool islower(mixed c)
|
||||
Check for lowercase character(s) */
|
||||
PHP_FUNCTION(islower)
|
||||
PHP_FUNCTION(ctype_lower)
|
||||
{
|
||||
PHP_EXPERIMENTAL("4.0.4dev",NULL)
|
||||
zval **c;
|
||||
@@ -267,7 +267,7 @@ PHP_FUNCTION(islower)
|
||||
|
||||
/* {{{ proto bool isgraph(mixed c)
|
||||
Check for any printable character(s) except space */
|
||||
PHP_FUNCTION(isgraph)
|
||||
PHP_FUNCTION(ctype_graph)
|
||||
{
|
||||
PHP_EXPERIMENTAL("4.0.4dev",NULL)
|
||||
zval **c;
|
||||
@@ -285,7 +285,7 @@ PHP_FUNCTION(isgraph)
|
||||
|
||||
/* {{{ proto bool isprint(mixed c)
|
||||
Check for printable character(s) */
|
||||
PHP_FUNCTION(isprint)
|
||||
PHP_FUNCTION(ctype_print)
|
||||
{
|
||||
PHP_EXPERIMENTAL("4.0.4dev",NULL)
|
||||
zval **c;
|
||||
@@ -303,7 +303,7 @@ PHP_FUNCTION(isprint)
|
||||
|
||||
/* {{{ proto bool ispunct(mixed c)
|
||||
Check for any printable character which is not a space or an alphanumeric character */
|
||||
PHP_FUNCTION(ispunct)
|
||||
PHP_FUNCTION(ctype_punct)
|
||||
{
|
||||
PHP_EXPERIMENTAL("4.0.4dev",NULL)
|
||||
zval **c;
|
||||
@@ -321,7 +321,7 @@ PHP_FUNCTION(ispunct)
|
||||
|
||||
/* {{{ proto bool isspace(mixed c)
|
||||
Check for whitespace character(s)*/
|
||||
PHP_FUNCTION(isspace)
|
||||
PHP_FUNCTION(ctype_space)
|
||||
{
|
||||
PHP_EXPERIMENTAL("4.0.4dev",NULL)
|
||||
zval **c;
|
||||
@@ -339,7 +339,7 @@ PHP_FUNCTION(isspace)
|
||||
|
||||
/* {{{ proto bool isupper(mixed c)
|
||||
Check for uppercase character(s) */
|
||||
PHP_FUNCTION(isupper)
|
||||
PHP_FUNCTION(ctype_upper)
|
||||
{
|
||||
PHP_EXPERIMENTAL("4.0.4dev",NULL)
|
||||
zval **c;
|
||||
@@ -357,7 +357,7 @@ PHP_FUNCTION(isupper)
|
||||
|
||||
/* {{{ proto bool isxdigit(mixed c)
|
||||
Check for character(s) representing a hexadecimal digit */
|
||||
PHP_FUNCTION(isxdigit)
|
||||
PHP_FUNCTION(ctype_xdigit)
|
||||
{
|
||||
PHP_EXPERIMENTAL("4.0.4dev",NULL)
|
||||
zval **c;
|
||||
|
||||
+11
-11
@@ -41,17 +41,17 @@ PHP_RSHUTDOWN_FUNCTION(ctype);
|
||||
PHP_MINFO_FUNCTION(ctype);
|
||||
|
||||
PHP_FUNCTION(confirm_ctype_compiled); /* For testing, remove later. */
|
||||
PHP_FUNCTION(isalnum);
|
||||
PHP_FUNCTION(isalpha);
|
||||
PHP_FUNCTION(iscntrl);
|
||||
PHP_FUNCTION(isdigit);
|
||||
PHP_FUNCTION(islower);
|
||||
PHP_FUNCTION(isgraph);
|
||||
PHP_FUNCTION(isprint);
|
||||
PHP_FUNCTION(ispunct);
|
||||
PHP_FUNCTION(isspace);
|
||||
PHP_FUNCTION(isupper);
|
||||
PHP_FUNCTION(isxdigit);
|
||||
PHP_FUNCTION(ctype_alnum);
|
||||
PHP_FUNCTION(ctype_alpha);
|
||||
PHP_FUNCTION(ctype_cntrl);
|
||||
PHP_FUNCTION(ctype_digit);
|
||||
PHP_FUNCTION(ctype_lower);
|
||||
PHP_FUNCTION(ctype_graph);
|
||||
PHP_FUNCTION(ctype_print);
|
||||
PHP_FUNCTION(ctype_punct);
|
||||
PHP_FUNCTION(ctype_space);
|
||||
PHP_FUNCTION(ctype_upper);
|
||||
PHP_FUNCTION(ctype_xdigit);
|
||||
|
||||
/*
|
||||
Declare any global variables you may need between the BEGIN
|
||||
|
||||
+22
-22
@@ -15,27 +15,27 @@ ctype on integers
|
||||
}
|
||||
echo "$function $n\n";
|
||||
}
|
||||
ctype_test_001("islower");
|
||||
ctype_test_001("isupper");
|
||||
ctype_test_001("isalpha");
|
||||
ctype_test_001("isdigit");
|
||||
ctype_test_001("isalnum");
|
||||
ctype_test_001("iscntrl");
|
||||
ctype_test_001("isgraph");
|
||||
ctype_test_001("isprint");
|
||||
ctype_test_001("ispunct");
|
||||
ctype_test_001("isspace");
|
||||
ctype_test_001("isxdigit");
|
||||
ctype_test_001("ctype_lower");
|
||||
ctype_test_001("ctype_upper");
|
||||
ctype_test_001("ctype_alpha");
|
||||
ctype_test_001("ctype_digit");
|
||||
ctype_test_001("ctype_alnum");
|
||||
ctype_test_001("ctype_cntrl");
|
||||
ctype_test_001("ctype_graph");
|
||||
ctype_test_001("ctype_print");
|
||||
ctype_test_001("ctype_punct");
|
||||
ctype_test_001("ctype_space");
|
||||
ctype_test_001("ctype_xdigit");
|
||||
?>
|
||||
--EXPECT--
|
||||
islower 26
|
||||
isupper 26
|
||||
isalpha 52
|
||||
isdigit 10
|
||||
isalnum 62
|
||||
iscntrl 33
|
||||
isgraph 94
|
||||
isprint 95
|
||||
ispunct 32
|
||||
isspace 6
|
||||
isxdigit 22
|
||||
ctype_lower 26
|
||||
ctype_upper 26
|
||||
ctype_alpha 52
|
||||
ctype_digit 10
|
||||
ctype_alnum 62
|
||||
ctype_cntrl 33
|
||||
ctype_graph 94
|
||||
ctype_print 95
|
||||
ctype_punct 32
|
||||
ctype_space 6
|
||||
ctype_xdigit 22
|
||||
+22
-22
@@ -17,27 +17,27 @@ ctype on strings
|
||||
}
|
||||
echo "$function $n $m\n";
|
||||
}
|
||||
ctype_test_002("islower");
|
||||
ctype_test_002("isupper");
|
||||
ctype_test_002("isalpha");
|
||||
ctype_test_002("isdigit");
|
||||
ctype_test_002("isalnum");
|
||||
ctype_test_002("iscntrl");
|
||||
ctype_test_002("isgraph");
|
||||
ctype_test_002("isprint");
|
||||
ctype_test_002("ispunct");
|
||||
ctype_test_002("isspace");
|
||||
ctype_test_002("isxdigit");
|
||||
ctype_test_002("ctype_lower");
|
||||
ctype_test_002("ctype_upper");
|
||||
ctype_test_002("ctype_alpha");
|
||||
ctype_test_002("ctype_digit");
|
||||
ctype_test_002("ctype_alnum");
|
||||
ctype_test_002("ctype_cntrl");
|
||||
ctype_test_002("ctype_graph");
|
||||
ctype_test_002("ctype_print");
|
||||
ctype_test_002("ctype_punct");
|
||||
ctype_test_002("ctype_space");
|
||||
ctype_test_002("ctype_xdigit");
|
||||
?>
|
||||
--EXPECT--
|
||||
islower 26 0
|
||||
isupper 26 0
|
||||
isalpha 52 0
|
||||
isdigit 10 0
|
||||
isalnum 62 0
|
||||
iscntrl 33 0
|
||||
isgraph 94 94
|
||||
isprint 95 95
|
||||
ispunct 32 0
|
||||
isspace 6 0
|
||||
isxdigit 22 0
|
||||
ctype_lower 26 0
|
||||
ctype_upper 26 0
|
||||
ctype_alpha 52 0
|
||||
ctype_digit 10 0
|
||||
ctype_alnum 62 0
|
||||
ctype_cntrl 33 0
|
||||
ctype_graph 94 94
|
||||
ctype_print 95 95
|
||||
ctype_punct 32 0
|
||||
ctype_space 6 0
|
||||
ctype_xdigit 22 0
|
||||
+15
-2
@@ -146,6 +146,7 @@ PHP_MINIT_FUNCTION(curl)
|
||||
REGISTER_LONG_CONSTANT("CURLOPT_PROXY", CURLOPT_PROXY, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("CURLOPT_VERBOSE", CURLOPT_VERBOSE, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("CURLOPT_HEADER", CURLOPT_HEADER, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("CURLOPT_HTTPHEADER", CURLOPT_HEADER, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("CURLOPT_NOPROGRESS", CURLOPT_NOPROGRESS, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("CURLOPT_NOBODY", CURLOPT_NOBODY, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("CURLOPT_FAILONERROR", CURLOPT_FAILONERROR, CONST_CS | CONST_PERSISTENT);
|
||||
@@ -300,7 +301,7 @@ PHP_FUNCTION(curl_init)
|
||||
}
|
||||
memset(curl_handle, 0, sizeof(php_curl));
|
||||
|
||||
zend_llist_init(&curl_handle->to_free,sizeof(char *),curl_free_string,0);
|
||||
zend_llist_init(&curl_handle->to_free, sizeof(char *), (void(*)(void *))curl_free_string, 0);
|
||||
|
||||
curl_handle->cp = curl_easy_init();
|
||||
if (!curl_handle->cp) {
|
||||
@@ -576,7 +577,8 @@ PHP_FUNCTION(curl_exec)
|
||||
CURLcode ret;
|
||||
FILE *fp;
|
||||
char buf[4096];
|
||||
int b;
|
||||
int b,
|
||||
is_temp_file;
|
||||
unsigned long pos = 0;
|
||||
|
||||
if (ZEND_NUM_ARGS() != 1 ||
|
||||
@@ -595,6 +597,8 @@ PHP_FUNCTION(curl_exec)
|
||||
}
|
||||
|
||||
curl_easy_setopt(curl_handle->cp, CURLOPT_FILE, fp);
|
||||
|
||||
is_temp_file = 1;
|
||||
|
||||
} else if (curl_handle->return_transfer &&
|
||||
curl_handle->output_file) {
|
||||
@@ -614,6 +618,9 @@ PHP_FUNCTION(curl_exec)
|
||||
} else {
|
||||
RETURN_TRUE;
|
||||
}
|
||||
|
||||
if (fp && is_temp_file)
|
||||
fclose(fp);
|
||||
|
||||
}
|
||||
|
||||
@@ -625,6 +632,9 @@ PHP_FUNCTION(curl_exec)
|
||||
php_write(buf, b);
|
||||
}
|
||||
|
||||
if (is_temp_file)
|
||||
fclose(fp);
|
||||
|
||||
} else {
|
||||
|
||||
char *ret_data;
|
||||
@@ -642,6 +652,9 @@ PHP_FUNCTION(curl_exec)
|
||||
}
|
||||
ret_data[stat_sb.st_size - 1] = '\0';
|
||||
|
||||
if (is_temp_file)
|
||||
fclose(fp);
|
||||
|
||||
RETURN_STRINGL(ret_data, stat_sb.st_size, 0);
|
||||
|
||||
}
|
||||
|
||||
+1
-1
@@ -52,7 +52,7 @@ typedef struct dbm_info {
|
||||
#endif
|
||||
|
||||
dbm_info *php_find_dbm(pval *id);
|
||||
int php_dbm_close(dbm_info *info);
|
||||
int php_dbm_close(zend_rsrc_list_entry *rsrc);
|
||||
dbm_info *php_dbm_open(char *filename, char *mode);
|
||||
int php_dbm_insert(dbm_info *info, char *key, char *value);
|
||||
char *php_dbm_fetch(dbm_info *info, char *key);
|
||||
|
||||
+7
-2
@@ -220,9 +220,14 @@ static PHP_MINFO_FUNCTION(dba)
|
||||
|
||||
php_info_print_table_start();
|
||||
php_info_print_table_row(2, "DBA support", "enabled");
|
||||
php_info_print_table_row(2, "Supported handlers", handlers.c);
|
||||
if (handlers.c) {
|
||||
smart_str_0(&handlers);
|
||||
php_info_print_table_row(2, "Supported handlers", handlers.c);
|
||||
smart_str_free(&handlers);
|
||||
} else {
|
||||
php_info_print_table_row(2, "Supported handlers", "none");
|
||||
}
|
||||
php_info_print_table_end();
|
||||
smart_str_free(&handlers);
|
||||
}
|
||||
|
||||
|
||||
|
||||
+22
-4
@@ -1,8 +1,25 @@
|
||||
dnl $Id$
|
||||
dnl config.m4 for extension domxml
|
||||
|
||||
AC_DEFUN(PHP_DOM_CHECK_VERSION,[
|
||||
old_CPPFLAGS=$CPPFLAGS
|
||||
CPPFLAGS="-I$DOMXML_DIR/include"
|
||||
AC_MSG_CHECKING(for libxml version)
|
||||
AC_EGREP_CPP(yes,[
|
||||
#include <libxml/xmlversion.h>
|
||||
#if LIBXML_VERSION >= 20207
|
||||
yes
|
||||
#endif
|
||||
],[
|
||||
AC_MSG_RESULT(>= 2.2.7)
|
||||
],[
|
||||
AC_MSG_ERROR(libxml version 2.2.7 or greater required.)
|
||||
])
|
||||
CPPFLAGS=$old_CPPFLAGS
|
||||
])
|
||||
|
||||
PHP_ARG_WITH(dom, for DOM support,
|
||||
[ --with-dom[=DIR] Include DOM support (requires libxml >= 2.0).
|
||||
[ --with-dom[=DIR] Include DOM support (requires libxml >= 2.2.7).
|
||||
DIR is the libxml install directory,
|
||||
defaults to /usr.])
|
||||
|
||||
@@ -22,9 +39,11 @@ if test "$PHP_DOM" != "no"; then
|
||||
|
||||
if test -z "$DOMXML_DIR"; then
|
||||
AC_MSG_RESULT(not found)
|
||||
AC_MSG_ERROR(Please reinstall the libxml >= 2.0 distribution)
|
||||
AC_MSG_ERROR(Please reinstall the libxml >= 2.2.7 distribution)
|
||||
fi
|
||||
|
||||
PHP_DOM_CHECK_VERSION
|
||||
|
||||
AC_ADD_INCLUDE($DOMXML_DIR/include)
|
||||
|
||||
PHP_SUBST(DOMXML_SHARED_LIBADD)
|
||||
@@ -52,8 +71,7 @@ if test "$PHP_DOM" != "no"; then
|
||||
LIBS="$LIBS -L$withval/lib -lz"
|
||||
fi
|
||||
|
||||
AC_CHECK_LIB(xml, xmlFreeURI, [AC_DEFINE(HAVE_DOMXML,1,[ ])],
|
||||
[AC_MSG_ERROR(DOM module requires libxml >= 2.0)])
|
||||
AC_DEFINE(HAVE_DOMXML,1,[ ])
|
||||
AC_ADD_LIBRARY(z)
|
||||
|
||||
PHP_EXTENSION(domxml, $ext_shared)
|
||||
|
||||
+2
-2
@@ -170,7 +170,7 @@ echo '/__function_entries_here__/D' >> sedscript
|
||||
echo '/__function_stubs_here__/D' >> sedscript
|
||||
echo '/__header_here__/D' >> sedscript
|
||||
echo '/__footer_here__/D' >> sedscript
|
||||
if [ ! -z $no_help ]; then
|
||||
if [ ! -z "$no_help" ]; then
|
||||
echo "/confirm_$extname_compiled/D" >> sedscript
|
||||
echo '/Remove the following/,/^\*\//D' >> sedscript
|
||||
echo 's/[[:space:]]\/\*.\+\*\///' >> sedscript
|
||||
@@ -190,7 +190,7 @@ echo '/__footer_here__/r ../../footer' >> sedscript
|
||||
echo '/__function_declarations_here__/D' >> sedscript
|
||||
echo '/__header_here__/D' >> sedscript
|
||||
echo '/__footer_here__/D' >> sedscript
|
||||
if [ ! -z $no_help ]; then
|
||||
if [ ! -z "$no_help" ]; then
|
||||
echo "/confirm_$extname_compiled/D" >> sedscript
|
||||
echo 's/[[:space:]]\/\*.\+\*\///' >> sedscript
|
||||
echo 's/^\/\*.*\*\/$//' >> sedscript
|
||||
|
||||
@@ -5,9 +5,9 @@ dnl don't forget to call PHP_EXTENSION(fribidi)
|
||||
|
||||
|
||||
PHP_ARG_WITH(fribidi, whether to add fribidi support,
|
||||
[ --with-fribidi[=DIR] Include fribidi support (requires FriBidi >=0.1.12).
|
||||
DIR is the fribidi installation directory -
|
||||
default /usr/local/],"no")
|
||||
[ --with-fribidi[=DIR] Include fribidi support (requires FriBidi >=0.1.12).
|
||||
DIR is the fribidi installation directory -
|
||||
default /usr/local/])
|
||||
|
||||
|
||||
|
||||
|
||||
+33
-13
@@ -6,11 +6,16 @@ AC_DEFUN(PHP_GD_JPEG,[
|
||||
if test "$withval" = "yes"; then
|
||||
withval="/usr/local"
|
||||
fi
|
||||
old_LIBS=$LIBS
|
||||
jold_LIBS=$LIBS
|
||||
LIBS="$LIBS -L$withval/lib"
|
||||
AC_CHECK_LIB(jpeg,jpeg_read_header, [LIBS="$LIBS -ljpeg"],[AC_MSG_RESULT(no)],)
|
||||
LIBS=$old_LIBS
|
||||
AC_ADD_LIBRARY_WITH_PATH(jpeg, $withval/lib)
|
||||
LIBS=$jold_LIBS
|
||||
if test "$shared" = "yes"; then
|
||||
GD_LIBS="$GD_LIBS -ljpeg"
|
||||
GD_LFLAGS="$GD_LFLAGS -L$withval/lib"
|
||||
else
|
||||
AC_ADD_LIBRARY_WITH_PATH(jpeg, $withval/lib)
|
||||
fi
|
||||
LIBS="$LIBS -L$withval/lib -ljpeg"
|
||||
],[
|
||||
AC_MSG_RESULT(no)
|
||||
@@ -58,7 +63,7 @@ AC_DEFUN(PHP_GD_CHECK_VERSION,[
|
||||
|
||||
AC_MSG_CHECKING(whether to enable truetype string function in gd)
|
||||
AC_ARG_ENABLE(gd-native-ttf,
|
||||
[ --enable-gd-imgstrttf Enable TrueType string function in gd],[
|
||||
[ --enable-gd-imgstrttf Enable TrueType string function in gd],[
|
||||
if test "$enableval" = "yes" ; then
|
||||
AC_DEFINE(USE_GD_IMGSTRTTF, 1, [ ])
|
||||
AC_MSG_RESULT(yes)
|
||||
@@ -72,8 +77,7 @@ AC_ARG_ENABLE(gd-native-ttf,
|
||||
|
||||
shared=no
|
||||
AC_ARG_WITH(gd,
|
||||
[
|
||||
--with-gd[=DIR] Include GD support (DIR is GD's install dir).
|
||||
[ --with-gd[=DIR] Include GD support (DIR is GD's install dir).
|
||||
Set DIR to "shared" to build as a dl, or
|
||||
"shared,DIR" to build as a dl and still specify DIR.],
|
||||
[
|
||||
@@ -93,7 +97,7 @@ AC_ARG_WITH(gd,
|
||||
AC_DEFINE(HAVE_LIBGD,1,[ ])
|
||||
if test "$shared" = "yes"; then
|
||||
AC_MSG_RESULT(yes (shared))
|
||||
GD_LIBS="-lgd"
|
||||
GD_LIBS="-lgd $GD_LIBS"
|
||||
else
|
||||
AC_MSG_RESULT(yes (static))
|
||||
AC_ADD_LIBRARY(gd)
|
||||
@@ -110,6 +114,9 @@ dnl Check the capabilities of GD lib...
|
||||
if test "$ac_cv_lib_gd_gdImageCreateFromPng" = "yes"; then
|
||||
AC_ADD_LIBRARY(png)
|
||||
AC_ADD_LIBRARY(z)
|
||||
if test "$shared" = "yes"; then
|
||||
GD_LIBS="$GD_LIBS -lpng -lz"
|
||||
fi
|
||||
fi
|
||||
|
||||
ac_cv_lib_gd_gdImageLine=yes
|
||||
@@ -142,8 +149,8 @@ dnl A whole whack of possible places where this might be
|
||||
AC_DEFINE(HAVE_LIBGD,1,[ ])
|
||||
if test "$shared" = "yes"; then
|
||||
AC_MSG_RESULT(yes (shared))
|
||||
GD_LIBS="-lgd"
|
||||
GD_LFLAGS="-L$GD_LIB"
|
||||
GD_LIBS="-lgd $GD_LIBS"
|
||||
GD_LFLAGS="-L$GD_LIB $GD_LFLAGS"
|
||||
else
|
||||
AC_MSG_RESULT(yes (static))
|
||||
AC_ADD_LIBRARY_WITH_PATH(gd, $GD_LIB)
|
||||
@@ -160,6 +167,9 @@ dnl Check the capabilities of GD lib...
|
||||
if test "$ac_cv_lib_gd_gdImageCreateFromPng" = "yes"; then
|
||||
AC_ADD_LIBRARY(z)
|
||||
AC_ADD_LIBRARY(png)
|
||||
if test "$shared" = "yes"; then
|
||||
GD_LIBS="$GD_LIBS -lpng -lz"
|
||||
fi
|
||||
fi
|
||||
|
||||
ac_cv_lib_gd_gdImageLine=yes
|
||||
@@ -222,16 +232,26 @@ if test "$with_gd" != "no" && test "$ac_cv_lib_gd_gdImageLine" = "yes"; then
|
||||
if test "$withval" = "yes"; then
|
||||
for i in /usr/local /usr; do
|
||||
if test -f "$i/include/t1lib.h"; then
|
||||
AC_ADD_LIBRARY_WITH_PATH(t1, "$i/lib")
|
||||
AC_ADD_INCLUDE("$i/include")
|
||||
T1_DIR="$i"
|
||||
fi
|
||||
done
|
||||
else
|
||||
if test -f "$withval/include/t1lib.h"; then
|
||||
AC_ADD_LIBRARY_WITH_PATH(t1, "$withval/lib")
|
||||
AC_ADD_INCLUDE("$withval/include")
|
||||
T1_DIR="$withval"
|
||||
fi
|
||||
fi
|
||||
|
||||
if test "$T1_DIR" != "no"; then
|
||||
AC_ADD_INCLUDE("$T1_DIR/include")
|
||||
if test "$shared" = "yes"; then
|
||||
GD_LIBS="$GD_LIBS -lt1"
|
||||
GD_LFLAGS="$GD_LFLAGS -L$T1_DIR/lib"
|
||||
else
|
||||
AC_ADD_LIBRARY_WITH_PATH(t1, "$T1_DIR/lib")
|
||||
fi
|
||||
LIBS="$LIBS -L$T1_DIR/lib -lt1"
|
||||
fi
|
||||
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_CHECK_LIB(t1, T1_GetExtend, [AC_DEFINE(HAVE_LIBT1,1,[ ])])
|
||||
else
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@ dnl If your extension references something external, use with:
|
||||
|
||||
PHP_ARG_WITH(gmp, for gmp support,
|
||||
dnl Make sure that the comment is aligned:
|
||||
[ --with-gmp Include gmp support])
|
||||
[ --with-gmp Include gmp support])
|
||||
|
||||
if test "$PHP_GMP" != "no"; then
|
||||
|
||||
|
||||
-103
@@ -1,103 +0,0 @@
|
||||
#ifndef _INCLUDED_IMAP_H
|
||||
#define _INCLUDED_IMAP_H
|
||||
|
||||
#if COMPILE_DL
|
||||
#undef HAVE_IMAP
|
||||
#define HAVE_IMAP 1
|
||||
#endif
|
||||
|
||||
#if HAVE_IMAP
|
||||
|
||||
#ifndef PHP_WIN32
|
||||
#include "build-defs.h"
|
||||
#endif
|
||||
|
||||
/* Functions accessable to PHP */
|
||||
extern zend_module_entry imap_module_entry;
|
||||
#define imap_module_ptr &imap_module_entry
|
||||
|
||||
extern PHP_MINIT_FUNCTION(imap);
|
||||
extern PHP_RINIT_FUNCTION(imap);
|
||||
extern PHP_RSHUTDOWN_FUNCTION(imap);
|
||||
PHP_MINFO_FUNCTION(imap);
|
||||
PHP_FUNCTION(imap_open);
|
||||
PHP_FUNCTION(imap_popen);
|
||||
PHP_FUNCTION(imap_reopen);
|
||||
PHP_FUNCTION(imap_num_msg);
|
||||
PHP_FUNCTION(imap_num_recent);
|
||||
PHP_FUNCTION(imap_headers);
|
||||
PHP_FUNCTION(imap_headerinfo);
|
||||
PHP_FUNCTION(imap_rfc822_parse_headers);
|
||||
PHP_FUNCTION(imap_body);
|
||||
PHP_FUNCTION(imap_fetchstructure);
|
||||
PHP_FUNCTION(imap_fetchbody);
|
||||
PHP_FUNCTION(imap_expunge);
|
||||
PHP_FUNCTION(imap_delete);
|
||||
PHP_FUNCTION(imap_undelete);
|
||||
PHP_FUNCTION(imap_check);
|
||||
PHP_FUNCTION(imap_close);
|
||||
PHP_FUNCTION(imap_mail_copy);
|
||||
PHP_FUNCTION(imap_mail_move);
|
||||
PHP_FUNCTION(imap_createmailbox);
|
||||
PHP_FUNCTION(imap_renamemailbox);
|
||||
PHP_FUNCTION(imap_deletemailbox);
|
||||
PHP_FUNCTION(imap_listmailbox);
|
||||
PHP_FUNCTION(imap_scanmailbox);
|
||||
PHP_FUNCTION(imap_subscribe);
|
||||
PHP_FUNCTION(imap_unsubscribe);
|
||||
PHP_FUNCTION(imap_append);
|
||||
PHP_FUNCTION(imap_ping);
|
||||
PHP_FUNCTION(imap_base64);
|
||||
PHP_FUNCTION(imap_qprint);
|
||||
PHP_FUNCTION(imap_8bit);
|
||||
PHP_FUNCTION(imap_binary);
|
||||
PHP_FUNCTION(imap_mailboxmsginfo);
|
||||
PHP_FUNCTION(imap_rfc822_write_address);
|
||||
PHP_FUNCTION(imap_rfc822_parse_adrlist);
|
||||
PHP_FUNCTION(imap_setflag_full);
|
||||
PHP_FUNCTION(imap_clearflag_full);
|
||||
PHP_FUNCTION(imap_sort);
|
||||
PHP_FUNCTION(imap_fetchheader);
|
||||
PHP_FUNCTION(imap_fetchtext);
|
||||
PHP_FUNCTION(imap_uid);
|
||||
PHP_FUNCTION(imap_msgno);
|
||||
PHP_FUNCTION(imap_list);
|
||||
PHP_FUNCTION(imap_list_full);
|
||||
PHP_FUNCTION(imap_listscan);
|
||||
PHP_FUNCTION(imap_lsub);
|
||||
PHP_FUNCTION(imap_lsub_full);
|
||||
PHP_FUNCTION(imap_create);
|
||||
PHP_FUNCTION(imap_rename);
|
||||
PHP_FUNCTION(imap_status);
|
||||
PHP_FUNCTION(imap_bodystruct);
|
||||
PHP_FUNCTION(imap_fetch_overview);
|
||||
PHP_FUNCTION(imap_mail_compose);
|
||||
PHP_FUNCTION(imap_alerts);
|
||||
PHP_FUNCTION(imap_errors);
|
||||
PHP_FUNCTION(imap_last_error);
|
||||
PHP_FUNCTION(imap_mail);
|
||||
PHP_FUNCTION(imap_search);
|
||||
PHP_FUNCTION(imap_utf8);
|
||||
PHP_FUNCTION(imap_utf7_decode);
|
||||
PHP_FUNCTION(imap_utf7_encode);
|
||||
PHP_FUNCTION(imap_mime_header_decode);
|
||||
#else
|
||||
#define imap_module_ptr NULL
|
||||
#endif /* HAVE_IMAP */
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#define phpext_imap_ptr imap_module_ptr
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
+4
-2
@@ -851,11 +851,13 @@ PHP_FUNCTION(ldap_get_entries)
|
||||
if (ldap_result == NULL) RETURN_FALSE;
|
||||
|
||||
num_entries = ldap_count_entries(ldap, ldap_result);
|
||||
if (num_entries == 0) RETURN_FALSE;
|
||||
|
||||
array_init(return_value);
|
||||
|
||||
add_assoc_long(return_value, "count", num_entries);
|
||||
|
||||
if (num_entries == 0) return;
|
||||
num_entries = 0;
|
||||
|
||||
ldap_result_entry = ldap_first_entry(ldap, ldap_result);
|
||||
if (ldap_result_entry == NULL) RETURN_FALSE;
|
||||
|
||||
|
||||
+152
-130
@@ -32,7 +32,7 @@
|
||||
|
||||
#ifdef PHP_WIN32
|
||||
#include <winsock.h>
|
||||
#define signal(a,b) NULL
|
||||
#define signal(a, b) NULL
|
||||
#else
|
||||
#include "build-defs.h"
|
||||
#if HAVE_SIGNAL_H
|
||||
@@ -47,7 +47,7 @@
|
||||
#endif
|
||||
|
||||
/* True globals, no need for thread safety */
|
||||
static int le_result,le_link,le_plink;
|
||||
static int le_result, le_link, le_plink;
|
||||
|
||||
#include "php_ini.h"
|
||||
|
||||
@@ -161,7 +161,7 @@ ZEND_GET_MODULE(mysql)
|
||||
|
||||
void timeout(int sig);
|
||||
|
||||
#define CHECK_LINK(link) { if (link==-1) { php_error(E_WARNING,"MySQL: A link to the server could not be established"); RETURN_FALSE; } }
|
||||
#define CHECK_LINK(link) { if (link==-1) { php_error(E_WARNING, "MySQL: A link to the server could not be established"); RETURN_FALSE; } }
|
||||
|
||||
/*
|
||||
* This wrapper is required since mysql_free_result() returns an integer, and
|
||||
@@ -194,7 +194,7 @@ static void _close_mysql_link(zend_rsrc_list_entry *rsrc)
|
||||
|
||||
handler = signal(SIGPIPE, SIG_IGN);
|
||||
mysql_close(link);
|
||||
signal(SIGPIPE,handler);
|
||||
signal(SIGPIPE, handler);
|
||||
efree(link);
|
||||
MySG(num_links)--;
|
||||
}
|
||||
@@ -207,7 +207,7 @@ static void _close_mysql_plink(zend_rsrc_list_entry *rsrc)
|
||||
|
||||
handler = signal(SIGPIPE, SIG_IGN);
|
||||
mysql_close(link);
|
||||
signal(SIGPIPE,handler);
|
||||
signal(SIGPIPE, handler);
|
||||
|
||||
free(link);
|
||||
MySG(num_persistent)--;
|
||||
@@ -320,13 +320,24 @@ PHP_MINFO_FUNCTION(mysql)
|
||||
}
|
||||
|
||||
|
||||
static void php_mysql_do_connect(INTERNAL_FUNCTION_PARAMETERS,int persistent)
|
||||
#define MYSQL_DO_CONNECT_CLEANUP() \
|
||||
if (free_host) { \
|
||||
efree(host); \
|
||||
}
|
||||
|
||||
#define MYSQL_DO_CONNECT_RETURN_FALSE() \
|
||||
MYSQL_DO_CONNECT_CLEANUP(); \
|
||||
RETURN_FALSE;
|
||||
|
||||
static void php_mysql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
|
||||
{
|
||||
char *user,*passwd,*host,*socket,*tmp;
|
||||
char *user, *passwd, *host_and_port, *socket, *tmp, *host=NULL;
|
||||
char *hashed_details;
|
||||
int hashed_details_length,port = MYSQL_PORT;
|
||||
int hashed_details_length, port = MYSQL_PORT;
|
||||
MYSQL *mysql;
|
||||
void (*handler) (int);
|
||||
zval **z_host=NULL, **z_user=NULL, **z_passwd=NULL;
|
||||
zend_bool free_host=0;
|
||||
MySLS_FETCH();
|
||||
PLS_FETCH();
|
||||
|
||||
@@ -334,76 +345,78 @@ static void php_mysql_do_connect(INTERNAL_FUNCTION_PARAMETERS,int persistent)
|
||||
|
||||
if (PG(sql_safe_mode)) {
|
||||
if (ZEND_NUM_ARGS()>0) {
|
||||
php_error(E_NOTICE,"SQL safe mode in effect - ignoring host/user/password information");
|
||||
php_error(E_NOTICE, "SQL safe mode in effect - ignoring host/user/password information");
|
||||
}
|
||||
host=passwd=NULL;
|
||||
host_and_port=passwd=NULL;
|
||||
user=php_get_current_user();
|
||||
hashed_details_length = strlen(user)+5+3;
|
||||
hashed_details = (char *) emalloc(hashed_details_length+1);
|
||||
sprintf(hashed_details,"mysql__%s_",user);
|
||||
sprintf(hashed_details, "mysql__%s_", user);
|
||||
} else {
|
||||
host = MySG(default_host);
|
||||
host_and_port = MySG(default_host);
|
||||
user = MySG(default_user);
|
||||
passwd = MySG(default_password);
|
||||
|
||||
switch(ZEND_NUM_ARGS()) {
|
||||
case 0: /* defaults */
|
||||
break;
|
||||
case 1: {
|
||||
pval **yyhost;
|
||||
|
||||
if (zend_get_parameters_ex(1, &yyhost)==FAILURE) {
|
||||
RETURN_FALSE;
|
||||
case 1: {
|
||||
if (zend_get_parameters_ex(1, &z_host)==FAILURE) {
|
||||
MYSQL_DO_CONNECT_RETURN_FALSE();
|
||||
}
|
||||
convert_to_string_ex(yyhost);
|
||||
host = (*yyhost)->value.str.val;
|
||||
}
|
||||
break;
|
||||
case 2: {
|
||||
pval **yyhost, **yyuser;
|
||||
|
||||
if (zend_get_parameters_ex(2, &yyhost, &yyuser)==FAILURE) {
|
||||
RETURN_FALSE;
|
||||
if (zend_get_parameters_ex(2, &z_host, &z_user)==FAILURE) {
|
||||
MYSQL_DO_CONNECT_RETURN_FALSE();
|
||||
}
|
||||
convert_to_string_ex(yyhost);
|
||||
convert_to_string_ex(yyuser);
|
||||
host = (*yyhost)->value.str.val;
|
||||
user = (*yyuser)->value.str.val;
|
||||
convert_to_string_ex(z_user);
|
||||
user = (*z_user)->value.str.val;
|
||||
}
|
||||
break;
|
||||
case 3: {
|
||||
pval **yyhost,**yyuser,**yypasswd;
|
||||
|
||||
if (zend_get_parameters_ex(3, &yyhost, &yyuser, &yypasswd) == FAILURE) {
|
||||
RETURN_FALSE;
|
||||
if (zend_get_parameters_ex(3, &z_host, &z_user, &z_passwd) == FAILURE) {
|
||||
MYSQL_DO_CONNECT_RETURN_FALSE();
|
||||
}
|
||||
convert_to_string_ex(yyhost);
|
||||
convert_to_string_ex(yyuser);
|
||||
convert_to_string_ex(yypasswd);
|
||||
host = (*yyhost)->value.str.val;
|
||||
user = (*yyuser)->value.str.val;
|
||||
passwd = (*yypasswd)->value.str.val;
|
||||
convert_to_string_ex(z_user);
|
||||
convert_to_string_ex(z_passwd);
|
||||
user = (*z_user)->value.str.val;
|
||||
passwd = (*z_passwd)->value.str.val;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
WRONG_PARAM_COUNT;
|
||||
break;
|
||||
}
|
||||
hashed_details_length = sizeof("mysql___")-1 + strlen(SAFE_STRING(host))+strlen(SAFE_STRING(user))+strlen(SAFE_STRING(passwd));
|
||||
if (z_host) {
|
||||
SEPARATE_ZVAL(z_host); /* We may modify z_host if it contains a port, separate */
|
||||
convert_to_string_ex(z_host);
|
||||
host_and_port = Z_STRVAL_PP(z_host);
|
||||
if (z_user) {
|
||||
convert_to_string_ex(z_user);
|
||||
user = Z_STRVAL_PP(z_user);
|
||||
if (z_passwd) {
|
||||
convert_to_string_ex(z_passwd);
|
||||
passwd = Z_STRVAL_PP(z_passwd);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
hashed_details_length = sizeof("mysql___")-1 + strlen(SAFE_STRING(host_and_port))+strlen(SAFE_STRING(user))+strlen(SAFE_STRING(passwd));
|
||||
hashed_details = (char *) emalloc(hashed_details_length+1);
|
||||
sprintf(hashed_details,"mysql_%s_%s_%s",SAFE_STRING(host), SAFE_STRING(user), SAFE_STRING(passwd));
|
||||
sprintf(hashed_details, "mysql_%s_%s_%s", SAFE_STRING(host_and_port), SAFE_STRING(user), SAFE_STRING(passwd));
|
||||
}
|
||||
|
||||
/* We cannot use mysql_port anymore in windows, need to use
|
||||
* mysql_real_connect() to set the port.
|
||||
*/
|
||||
if (host && (tmp=strchr(host,':'))) {
|
||||
*tmp=0;
|
||||
if (host_and_port && (tmp=strchr(host_and_port, ':'))) {
|
||||
host = estrndup(host_and_port, tmp-host_and_port);
|
||||
free_host = 1;
|
||||
tmp++;
|
||||
if (tmp[0] != '/') {
|
||||
port = atoi(tmp);
|
||||
if ((tmp=strchr(tmp, ':'))) {
|
||||
*tmp=0;
|
||||
tmp++;
|
||||
socket=tmp;
|
||||
}
|
||||
@@ -411,6 +424,7 @@ static void php_mysql_do_connect(INTERNAL_FUNCTION_PARAMETERS,int persistent)
|
||||
socket = tmp;
|
||||
}
|
||||
} else {
|
||||
host = host_and_port;
|
||||
port = MySG(default_port);
|
||||
}
|
||||
|
||||
@@ -429,27 +443,27 @@ static void php_mysql_do_connect(INTERNAL_FUNCTION_PARAMETERS,int persistent)
|
||||
list_entry new_le;
|
||||
|
||||
if (MySG(max_links)!=-1 && MySG(num_links)>=MySG(max_links)) {
|
||||
php_error(E_WARNING,"MySQL: Too many open links (%d)",MySG(num_links));
|
||||
php_error(E_WARNING, "MySQL: Too many open links (%d)", MySG(num_links));
|
||||
efree(hashed_details);
|
||||
RETURN_FALSE;
|
||||
MYSQL_DO_CONNECT_RETURN_FALSE();
|
||||
}
|
||||
if (MySG(max_persistent)!=-1 && MySG(num_persistent)>=MySG(max_persistent)) {
|
||||
php_error(E_WARNING,"MySQL: Too many open persistent links (%d)",MySG(num_persistent));
|
||||
php_error(E_WARNING, "MySQL: Too many open persistent links (%d)", MySG(num_persistent));
|
||||
efree(hashed_details);
|
||||
RETURN_FALSE;
|
||||
MYSQL_DO_CONNECT_RETURN_FALSE();
|
||||
}
|
||||
/* create the link */
|
||||
mysql = (MYSQL *) malloc(sizeof(MYSQL));
|
||||
#if MYSQL_VERSION_ID > 32199 /* this lets us set the port number */
|
||||
mysql_init(mysql);
|
||||
if (mysql_real_connect(mysql,host,user,passwd,NULL,port,socket,0)==NULL) {
|
||||
if (mysql_real_connect(mysql, host, user, passwd, NULL, port, socket, 0)==NULL) {
|
||||
#else
|
||||
if (mysql_connect(mysql,host,user,passwd)==NULL) {
|
||||
if (mysql_connect(mysql, host, user, passwd)==NULL) {
|
||||
#endif
|
||||
php_error(E_WARNING, "%s", mysql_error(mysql));
|
||||
free(mysql);
|
||||
efree(hashed_details);
|
||||
RETURN_FALSE;
|
||||
MYSQL_DO_CONNECT_RETURN_FALSE();
|
||||
}
|
||||
|
||||
/* hash it up */
|
||||
@@ -458,52 +472,52 @@ static void php_mysql_do_connect(INTERNAL_FUNCTION_PARAMETERS,int persistent)
|
||||
if (zend_hash_update(&EG(persistent_list), hashed_details, hashed_details_length+1, (void *) &new_le, sizeof(list_entry), NULL)==FAILURE) {
|
||||
free(mysql);
|
||||
efree(hashed_details);
|
||||
RETURN_FALSE;
|
||||
MYSQL_DO_CONNECT_RETURN_FALSE();
|
||||
}
|
||||
MySG(num_persistent)++;
|
||||
MySG(num_links)++;
|
||||
} else { /* we do */
|
||||
if (le->type != le_plink) {
|
||||
RETURN_FALSE;
|
||||
MYSQL_DO_CONNECT_RETURN_FALSE();
|
||||
}
|
||||
/* ensure that the link did not die */
|
||||
handler=signal(SIGPIPE,SIG_IGN);
|
||||
handler=signal(SIGPIPE, SIG_IGN);
|
||||
#if defined(HAVE_MYSQL_ERRNO) && defined(CR_SERVER_GONE_ERROR)
|
||||
mysql_stat(le->ptr);
|
||||
if (mysql_errno((MYSQL *)le->ptr) == CR_SERVER_GONE_ERROR) {
|
||||
#else
|
||||
if (!strcasecmp(mysql_stat(le->ptr),"mysql server has gone away")) { /* the link died */
|
||||
if (!strcasecmp(mysql_stat(le->ptr), "mysql server has gone away")) { /* the link died */
|
||||
#endif
|
||||
signal(SIGPIPE,handler);
|
||||
signal(SIGPIPE, handler);
|
||||
#if MYSQL_VERSION_ID > 32199 /* this lets us set the port number */
|
||||
if (mysql_real_connect(le->ptr,host,user,passwd,NULL,port,socket,0)==NULL) {
|
||||
if (mysql_real_connect(le->ptr, host, user, passwd, NULL, port, socket, 0)==NULL) {
|
||||
#else
|
||||
if (mysql_connect(le->ptr,host,user,passwd)==NULL) {
|
||||
if (mysql_connect(le->ptr, host, user, passwd)==NULL) {
|
||||
#endif
|
||||
php_error(E_WARNING,"MySQL: Link to server lost, unable to reconnect");
|
||||
php_error(E_WARNING, "MySQL: Link to server lost, unable to reconnect");
|
||||
zend_hash_del(&EG(persistent_list), hashed_details, hashed_details_length+1);
|
||||
efree(hashed_details);
|
||||
RETURN_FALSE;
|
||||
MYSQL_DO_CONNECT_RETURN_FALSE();
|
||||
}
|
||||
}
|
||||
signal(SIGPIPE,handler);
|
||||
signal(SIGPIPE, handler);
|
||||
mysql = (MYSQL *) le->ptr;
|
||||
}
|
||||
ZEND_REGISTER_RESOURCE(return_value, mysql, le_plink);
|
||||
} else { /* non persistent */
|
||||
list_entry *index_ptr,new_index_ptr;
|
||||
list_entry *index_ptr, new_index_ptr;
|
||||
|
||||
/* first we check the hash for the hashed_details key. if it exists,
|
||||
* it should point us to the right offset where the actual mysql link sits.
|
||||
* if it doesn't, open a new mysql link, add it to the resource list,
|
||||
* and add a pointer to it with hashed_details as the key.
|
||||
*/
|
||||
if (zend_hash_find(&EG(regular_list),hashed_details,hashed_details_length+1,(void **) &index_ptr)==SUCCESS) {
|
||||
int type,link;
|
||||
if (zend_hash_find(&EG(regular_list), hashed_details, hashed_details_length+1,(void **) &index_ptr)==SUCCESS) {
|
||||
int type, link;
|
||||
void *ptr;
|
||||
|
||||
if (index_ptr->type != le_index_ptr) {
|
||||
RETURN_FALSE;
|
||||
MYSQL_DO_CONNECT_RETURN_FALSE();
|
||||
}
|
||||
link = (int) index_ptr->ptr;
|
||||
ptr = zend_list_find(link,&type); /* check if the link is still there */
|
||||
@@ -513,28 +527,29 @@ static void php_mysql_do_connect(INTERNAL_FUNCTION_PARAMETERS,int persistent)
|
||||
php_mysql_set_default_link(link);
|
||||
return_value->type = IS_RESOURCE;
|
||||
efree(hashed_details);
|
||||
MYSQL_DO_CONNECT_CLEANUP();
|
||||
return;
|
||||
} else {
|
||||
zend_hash_del(&EG(regular_list),hashed_details,hashed_details_length+1);
|
||||
zend_hash_del(&EG(regular_list), hashed_details, hashed_details_length+1);
|
||||
}
|
||||
}
|
||||
if (MySG(max_links)!=-1 && MySG(num_links)>=MySG(max_links)) {
|
||||
php_error(E_WARNING,"MySQL: Too many open links (%d)",MySG(num_links));
|
||||
php_error(E_WARNING, "MySQL: Too many open links (%d)", MySG(num_links));
|
||||
efree(hashed_details);
|
||||
RETURN_FALSE;
|
||||
MYSQL_DO_CONNECT_RETURN_FALSE();
|
||||
}
|
||||
|
||||
mysql = (MYSQL *) emalloc(sizeof(MYSQL));
|
||||
#if MYSQL_VERSION_ID > 32199 /* this lets us set the port number */
|
||||
mysql_init(mysql);
|
||||
if (mysql_real_connect(mysql,host,user,passwd,NULL,port,socket,0)==NULL) {
|
||||
if (mysql_real_connect(mysql, host, user, passwd, NULL, port, socket, 0)==NULL) {
|
||||
#else
|
||||
if (mysql_connect(mysql,host,user,passwd)==NULL) {
|
||||
if (mysql_connect(mysql, host, user, passwd)==NULL) {
|
||||
#endif
|
||||
php_error(E_WARNING,"MySQL Connection Failed: %s\n",mysql_error(mysql));
|
||||
php_error(E_WARNING, "MySQL Connection Failed: %s\n", mysql_error(mysql));
|
||||
efree(hashed_details);
|
||||
efree(mysql);
|
||||
RETURN_FALSE;
|
||||
MYSQL_DO_CONNECT_RETURN_FALSE();
|
||||
}
|
||||
|
||||
/* add it to the list */
|
||||
@@ -543,15 +558,16 @@ static void php_mysql_do_connect(INTERNAL_FUNCTION_PARAMETERS,int persistent)
|
||||
/* add it to the hash */
|
||||
new_index_ptr.ptr = (void *) return_value->value.lval;
|
||||
new_index_ptr.type = 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) {
|
||||
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);
|
||||
RETURN_FALSE;
|
||||
MYSQL_DO_CONNECT_RETURN_FALSE();
|
||||
}
|
||||
MySG(num_links)++;
|
||||
}
|
||||
|
||||
efree(hashed_details);
|
||||
php_mysql_set_default_link(return_value->value.lval);
|
||||
MYSQL_DO_CONNECT_CLEANUP();
|
||||
}
|
||||
|
||||
|
||||
@@ -587,7 +603,7 @@ PHP_FUNCTION(mysql_pconnect)
|
||||
Close a MySQL connection */
|
||||
PHP_FUNCTION(mysql_close)
|
||||
{
|
||||
pval **mysql_link=NULL;
|
||||
zval **mysql_link=NULL;
|
||||
int id;
|
||||
MYSQL *mysql;
|
||||
MySLS_FETCH();
|
||||
@@ -628,7 +644,7 @@ PHP_FUNCTION(mysql_close)
|
||||
Select a MySQL database */
|
||||
PHP_FUNCTION(mysql_select_db)
|
||||
{
|
||||
pval **db, **mysql_link;
|
||||
zval **db, **mysql_link;
|
||||
int id;
|
||||
MYSQL *mysql;
|
||||
MySLS_FETCH();
|
||||
@@ -670,7 +686,7 @@ PHP_FUNCTION(mysql_select_db)
|
||||
Create a MySQL database */
|
||||
PHP_FUNCTION(mysql_create_db)
|
||||
{
|
||||
pval **db,**mysql_link;
|
||||
zval **db, **mysql_link;
|
||||
int id;
|
||||
MYSQL *mysql;
|
||||
MySLS_FETCH();
|
||||
@@ -710,7 +726,7 @@ PHP_FUNCTION(mysql_create_db)
|
||||
Drop (delete) a MySQL database */
|
||||
PHP_FUNCTION(mysql_drop_db)
|
||||
{
|
||||
pval **db, **mysql_link;
|
||||
zval **db, **mysql_link;
|
||||
int id;
|
||||
MYSQL *mysql;
|
||||
MySLS_FETCH();
|
||||
@@ -751,8 +767,11 @@ PHP_FUNCTION(mysql_drop_db)
|
||||
Send an SQL query to MySQL */
|
||||
PHP_FUNCTION(mysql_query)
|
||||
{
|
||||
pval **query, **mysql_link, **store_result;
|
||||
int id,use_store=MYSQL_STORE_RESULT;
|
||||
zval **query, **mysql_link;
|
||||
#if 0
|
||||
zval **store_result;
|
||||
#endif
|
||||
int id, use_store=MYSQL_STORE_RESULT;
|
||||
MYSQL *mysql;
|
||||
MYSQL_RES *mysql_result;
|
||||
MySLS_FETCH();
|
||||
@@ -823,8 +842,11 @@ PHP_FUNCTION(mysql_query)
|
||||
Send an SQL query to MySQL */
|
||||
PHP_FUNCTION(mysql_db_query)
|
||||
{
|
||||
pval **db, **query, **mysql_link, **store_result;
|
||||
int id,use_store=MYSQL_STORE_RESULT;
|
||||
zval **db, **query, **mysql_link;
|
||||
#if 0
|
||||
zval **store_result;
|
||||
#endif
|
||||
int id, use_store=MYSQL_STORE_RESULT;
|
||||
MYSQL *mysql;
|
||||
MYSQL_RES *mysql_result;
|
||||
MySLS_FETCH();
|
||||
@@ -900,7 +922,7 @@ PHP_FUNCTION(mysql_db_query)
|
||||
List databases available on a MySQL server */
|
||||
PHP_FUNCTION(mysql_list_dbs)
|
||||
{
|
||||
pval **mysql_link;
|
||||
zval **mysql_link;
|
||||
int id;
|
||||
MYSQL *mysql;
|
||||
MYSQL_RES *mysql_result;
|
||||
@@ -925,7 +947,7 @@ PHP_FUNCTION(mysql_list_dbs)
|
||||
ZEND_FETCH_RESOURCE2(mysql, MYSQL *, mysql_link, id, "MySQL-Link", le_link, le_plink);
|
||||
|
||||
if ((mysql_result=mysql_list_dbs(mysql, NULL))==NULL) {
|
||||
php_error(E_WARNING,"Unable to save MySQL query result");
|
||||
php_error(E_WARNING, "Unable to save MySQL query result");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
ZEND_REGISTER_RESOURCE(return_value, mysql_result, le_result);
|
||||
@@ -937,7 +959,7 @@ PHP_FUNCTION(mysql_list_dbs)
|
||||
List tables in a MySQL database */
|
||||
PHP_FUNCTION(mysql_list_tables)
|
||||
{
|
||||
pval **db, **mysql_link;
|
||||
zval **db, **mysql_link;
|
||||
int id;
|
||||
MYSQL *mysql;
|
||||
MYSQL_RES *mysql_result;
|
||||
@@ -969,7 +991,7 @@ PHP_FUNCTION(mysql_list_tables)
|
||||
RETURN_FALSE;
|
||||
}
|
||||
if ((mysql_result=mysql_list_tables(mysql, NULL))==NULL) {
|
||||
php_error(E_WARNING,"Unable to save MySQL query result");
|
||||
php_error(E_WARNING, "Unable to save MySQL query result");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
ZEND_REGISTER_RESOURCE(return_value, mysql_result, le_result);
|
||||
@@ -981,7 +1003,7 @@ PHP_FUNCTION(mysql_list_tables)
|
||||
List MySQL result fields */
|
||||
PHP_FUNCTION(mysql_list_fields)
|
||||
{
|
||||
pval **db, **table, **mysql_link;
|
||||
zval **db, **table, **mysql_link;
|
||||
int id;
|
||||
MYSQL *mysql;
|
||||
MYSQL_RES *mysql_result;
|
||||
@@ -1013,8 +1035,8 @@ PHP_FUNCTION(mysql_list_fields)
|
||||
RETURN_FALSE;
|
||||
}
|
||||
convert_to_string_ex(table);
|
||||
if ((mysql_result=mysql_list_fields(mysql, (*table)->value.str.val,NULL))==NULL) {
|
||||
php_error(E_WARNING,"Unable to save MySQL query result");
|
||||
if ((mysql_result=mysql_list_fields(mysql, (*table)->value.str.val, NULL))==NULL) {
|
||||
php_error(E_WARNING, "Unable to save MySQL query result");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
ZEND_REGISTER_RESOURCE(return_value, mysql_result, le_result);
|
||||
@@ -1026,7 +1048,7 @@ PHP_FUNCTION(mysql_list_fields)
|
||||
Returns the text of the error message from previous MySQL operation */
|
||||
PHP_FUNCTION(mysql_error)
|
||||
{
|
||||
pval **mysql_link;
|
||||
zval **mysql_link;
|
||||
int id;
|
||||
MYSQL *mysql;
|
||||
MySLS_FETCH();
|
||||
@@ -1051,7 +1073,7 @@ PHP_FUNCTION(mysql_error)
|
||||
|
||||
ZEND_FETCH_RESOURCE2(mysql, MYSQL *, mysql_link, id, "MySQL-Link", le_link, le_plink);
|
||||
|
||||
RETURN_STRING(mysql_error(mysql),1);
|
||||
RETURN_STRING(mysql_error(mysql), 1);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -1061,7 +1083,7 @@ PHP_FUNCTION(mysql_error)
|
||||
#ifdef HAVE_MYSQL_ERRNO
|
||||
PHP_FUNCTION(mysql_errno)
|
||||
{
|
||||
pval **mysql_link;
|
||||
zval **mysql_link;
|
||||
int id;
|
||||
MYSQL *mysql;
|
||||
MySLS_FETCH();
|
||||
@@ -1096,7 +1118,7 @@ PHP_FUNCTION(mysql_errno)
|
||||
Get number of affected rows in previous MySQL operation */
|
||||
PHP_FUNCTION(mysql_affected_rows)
|
||||
{
|
||||
pval **mysql_link;
|
||||
zval **mysql_link;
|
||||
int id;
|
||||
MYSQL *mysql;
|
||||
MySLS_FETCH();
|
||||
@@ -1151,7 +1173,7 @@ PHP_FUNCTION(mysql_escape_string)
|
||||
Get the id generated from the previous INSERT operation */
|
||||
PHP_FUNCTION(mysql_insert_id)
|
||||
{
|
||||
pval **mysql_link;
|
||||
zval **mysql_link;
|
||||
int id;
|
||||
MYSQL *mysql;
|
||||
MySLS_FETCH();
|
||||
@@ -1185,7 +1207,7 @@ PHP_FUNCTION(mysql_insert_id)
|
||||
Get result data */
|
||||
PHP_FUNCTION(mysql_result)
|
||||
{
|
||||
pval **result, **row, **field=NULL;
|
||||
zval **result, **row, **field=NULL;
|
||||
MYSQL_RES *mysql_result;
|
||||
MYSQL_ROW sql_row;
|
||||
mysql_row_length_type *sql_row_lengths;
|
||||
@@ -1212,7 +1234,7 @@ PHP_FUNCTION(mysql_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);
|
||||
php_error(E_WARNING, "Unable to jump to row %d on MySQL result index %d", (*row)->value.lval, (*result)->value.lval);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
mysql_data_seek(mysql_result, (*row)->value.lval);
|
||||
@@ -1228,23 +1250,23 @@ PHP_FUNCTION(mysql_result)
|
||||
MYSQL_FIELD *tmp_field;
|
||||
char *table_name, *field_name, *tmp;
|
||||
|
||||
if ((tmp=strchr((*field)->value.str.val,'.'))) {
|
||||
if ((tmp=strchr((*field)->value.str.val, '.'))) {
|
||||
table_name = estrndup((*field)->value.str.val, tmp-(*field)->value.str.val);
|
||||
field_name = estrdup(tmp+1);
|
||||
} else {
|
||||
table_name = NULL;
|
||||
field_name = estrndup((*field)->value.str.val,(*field)->value.str.len);
|
||||
}
|
||||
mysql_field_seek(mysql_result,0);
|
||||
mysql_field_seek(mysql_result, 0);
|
||||
while ((tmp_field=mysql_fetch_field(mysql_result))) {
|
||||
if ((!table_name || !strcasecmp(tmp_field->table,table_name)) && !strcasecmp(tmp_field->name,field_name)) {
|
||||
if ((!table_name || !strcasecmp(tmp_field->table, table_name)) && !strcasecmp(tmp_field->name, field_name)) {
|
||||
field_offset = i;
|
||||
break;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
if (!tmp_field) { /* no match found */
|
||||
php_error(E_WARNING,"%s%s%s not found in MySQL result index %d",
|
||||
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);
|
||||
efree(field_name);
|
||||
if (table_name) {
|
||||
@@ -1262,7 +1284,7 @@ PHP_FUNCTION(mysql_result)
|
||||
convert_to_long_ex(field);
|
||||
field_offset = (*field)->value.lval;
|
||||
if (field_offset<0 || field_offset>=(int)mysql_num_fields(mysql_result)) {
|
||||
php_error(E_WARNING,"Bad column offset specified");
|
||||
php_error(E_WARNING, "Bad column offset specified");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
break;
|
||||
@@ -1273,10 +1295,10 @@ PHP_FUNCTION(mysql_result)
|
||||
return_value->type = 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);
|
||||
return_value->value.str.val = php_addslashes(sql_row[field_offset], sql_row_lengths[field_offset],&return_value->value.str.len, 0);
|
||||
} 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);
|
||||
return_value->value.str.val = (char *) safe_estrndup(sql_row[field_offset], return_value->value.str.len);
|
||||
}
|
||||
} else {
|
||||
return_value->type = IS_NULL;
|
||||
@@ -1289,7 +1311,7 @@ PHP_FUNCTION(mysql_result)
|
||||
Get number of rows in a result */
|
||||
PHP_FUNCTION(mysql_num_rows)
|
||||
{
|
||||
pval **result;
|
||||
zval **result;
|
||||
MYSQL_RES *mysql_result;
|
||||
|
||||
if (ZEND_NUM_ARGS()!=1 || zend_get_parameters_ex(1, &result)==FAILURE) {
|
||||
@@ -1308,7 +1330,7 @@ PHP_FUNCTION(mysql_num_rows)
|
||||
Get number of fields in a result */
|
||||
PHP_FUNCTION(mysql_num_fields)
|
||||
{
|
||||
pval **result;
|
||||
zval **result;
|
||||
MYSQL_RES *mysql_result;
|
||||
|
||||
if (ZEND_NUM_ARGS()!=1 || zend_get_parameters_ex(1, &result)==FAILURE) {
|
||||
@@ -1325,7 +1347,7 @@ PHP_FUNCTION(mysql_num_fields)
|
||||
|
||||
static void php_mysql_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, int result_type)
|
||||
{
|
||||
pval **result, **arg2;
|
||||
zval **result, **arg2;
|
||||
MYSQL_RES *mysql_result;
|
||||
MYSQL_ROW mysql_row;
|
||||
MYSQL_FIELD *mysql_field;
|
||||
@@ -1368,15 +1390,15 @@ static void php_mysql_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, int result_type)
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
mysql_field_seek(mysql_result,0);
|
||||
for (mysql_field=mysql_fetch_field(mysql_result),i=0; mysql_field; mysql_field=mysql_fetch_field(mysql_result),i++) {
|
||||
mysql_field_seek(mysql_result, 0);
|
||||
for (mysql_field=mysql_fetch_field(mysql_result), i=0; mysql_field; mysql_field=mysql_fetch_field(mysql_result), i++) {
|
||||
if (mysql_row[i]) {
|
||||
char *data;
|
||||
int data_len;
|
||||
int should_copy;
|
||||
|
||||
if (PG(magic_quotes_runtime)) {
|
||||
data = php_addslashes(mysql_row[i],mysql_row_lengths[i],&data_len,0);
|
||||
data = php_addslashes(mysql_row[i], mysql_row_lengths[i],&data_len, 0);
|
||||
should_copy = 0;
|
||||
} else {
|
||||
data = mysql_row[i];
|
||||
@@ -1447,7 +1469,7 @@ PHP_FUNCTION(mysql_fetch_assoc)
|
||||
Move internal result pointer */
|
||||
PHP_FUNCTION(mysql_data_seek)
|
||||
{
|
||||
pval **result, **offset;
|
||||
zval **result, **offset;
|
||||
MYSQL_RES *mysql_result;
|
||||
|
||||
if (ZEND_NUM_ARGS()!=2 || zend_get_parameters_ex(2, &result, &offset)==FAILURE) {
|
||||
@@ -1458,7 +1480,7 @@ PHP_FUNCTION(mysql_data_seek)
|
||||
|
||||
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);
|
||||
php_error(E_WARNING, "Offset %d is invalid for MySQL result index %d", (*offset)->value.lval, (*result)->value.lval);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
mysql_data_seek(mysql_result, (*offset)->value.lval);
|
||||
@@ -1471,7 +1493,7 @@ PHP_FUNCTION(mysql_data_seek)
|
||||
Get max data size of each column in a result */
|
||||
PHP_FUNCTION(mysql_fetch_lengths)
|
||||
{
|
||||
pval **result;
|
||||
zval **result;
|
||||
MYSQL_RES *mysql_result;
|
||||
mysql_row_length_type *lengths;
|
||||
int num_fields;
|
||||
@@ -1552,7 +1574,7 @@ static char *php_mysql_get_field_name(int field_type)
|
||||
Get column information from a result and return as an object */
|
||||
PHP_FUNCTION(mysql_fetch_field)
|
||||
{
|
||||
pval **result, **field=NULL;
|
||||
zval **result, **field=NULL;
|
||||
MYSQL_RES *mysql_result;
|
||||
MYSQL_FIELD *mysql_field;
|
||||
|
||||
@@ -1576,7 +1598,7 @@ PHP_FUNCTION(mysql_fetch_field)
|
||||
|
||||
if (field) {
|
||||
if ((*field)->value.lval<0 || (*field)->value.lval>=(int)mysql_num_fields(mysql_result)) {
|
||||
php_error(E_WARNING,"MySQL: Bad field offset");
|
||||
php_error(E_WARNING, "MySQL: Bad field offset");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
mysql_field_seek(mysql_result, (*field)->value.lval);
|
||||
@@ -1591,14 +1613,14 @@ PHP_FUNCTION(mysql_fetch_field)
|
||||
add_property_string(return_value, "name",(mysql_field->name?mysql_field->name:empty_string), 1);
|
||||
add_property_string(return_value, "table",(mysql_field->table?mysql_field->table:empty_string), 1);
|
||||
add_property_string(return_value, "def",(mysql_field->def?mysql_field->def:empty_string), 1);
|
||||
add_property_long(return_value, "max_length",mysql_field->max_length);
|
||||
add_property_long(return_value, "not_null",IS_NOT_NULL(mysql_field->flags)?1:0);
|
||||
add_property_long(return_value, "primary_key",IS_PRI_KEY(mysql_field->flags)?1:0);
|
||||
add_property_long(return_value, "max_length", mysql_field->max_length);
|
||||
add_property_long(return_value, "not_null", IS_NOT_NULL(mysql_field->flags)?1:0);
|
||||
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, "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_long(return_value, "numeric", IS_NUM(mysql_field->type)?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_long(return_value, "unsigned",(mysql_field->flags&UNSIGNED_FLAG?1:0));
|
||||
add_property_long(return_value, "zerofill",(mysql_field->flags&ZEROFILL_FLAG?1:0));
|
||||
}
|
||||
@@ -1609,7 +1631,7 @@ PHP_FUNCTION(mysql_fetch_field)
|
||||
Set result pointer to a specific field offset */
|
||||
PHP_FUNCTION(mysql_field_seek)
|
||||
{
|
||||
pval **result, **offset;
|
||||
zval **result, **offset;
|
||||
MYSQL_RES *mysql_result;
|
||||
|
||||
if (ZEND_NUM_ARGS()!=2 || zend_get_parameters_ex(2, &result, &offset)==FAILURE) {
|
||||
@@ -1620,7 +1642,7 @@ PHP_FUNCTION(mysql_field_seek)
|
||||
|
||||
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);
|
||||
php_error(E_WARNING, "Field %d is invalid for MySQL result index %d", (*offset)->value.lval, (*result)->value.lval);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
mysql_field_seek(mysql_result, (*offset)->value.lval);
|
||||
@@ -1638,7 +1660,7 @@ PHP_FUNCTION(mysql_field_seek)
|
||||
|
||||
static void php_mysql_field_info(INTERNAL_FUNCTION_PARAMETERS, int entry_type)
|
||||
{
|
||||
pval **result, **field;
|
||||
zval **result, **field;
|
||||
MYSQL_RES *mysql_result;
|
||||
MYSQL_FIELD *mysql_field;
|
||||
char buf[512];
|
||||
@@ -1652,7 +1674,7 @@ static void php_mysql_field_info(INTERNAL_FUNCTION_PARAMETERS, int entry_type)
|
||||
|
||||
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);
|
||||
php_error(E_WARNING, "Field %d is invalid for MySQL result index %d", (*field)->value.lval, (*result)->value.lval);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
mysql_field_seek(mysql_result, (*field)->value.lval);
|
||||
@@ -1663,12 +1685,12 @@ static void php_mysql_field_info(INTERNAL_FUNCTION_PARAMETERS, int entry_type)
|
||||
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->value.str.val = estrndup(mysql_field->name, return_value->value.str.len);
|
||||
return_value->type = 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->value.str.val = estrndup(mysql_field->table, return_value->value.str.len);
|
||||
return_value->type = IS_STRING;
|
||||
break;
|
||||
case PHP_MYSQL_FIELD_LEN:
|
||||
@@ -1760,7 +1782,7 @@ static void php_mysql_field_info(INTERNAL_FUNCTION_PARAMETERS, int entry_type)
|
||||
Get the name of the specified field in a result */
|
||||
PHP_FUNCTION(mysql_field_name)
|
||||
{
|
||||
php_mysql_field_info(INTERNAL_FUNCTION_PARAM_PASSTHRU,PHP_MYSQL_FIELD_NAME);
|
||||
php_mysql_field_info(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_MYSQL_FIELD_NAME);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -1769,7 +1791,7 @@ PHP_FUNCTION(mysql_field_name)
|
||||
Get name of the table the specified field is in */
|
||||
PHP_FUNCTION(mysql_field_table)
|
||||
{
|
||||
php_mysql_field_info(INTERNAL_FUNCTION_PARAM_PASSTHRU,PHP_MYSQL_FIELD_TABLE);
|
||||
php_mysql_field_info(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_MYSQL_FIELD_TABLE);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -1778,7 +1800,7 @@ PHP_FUNCTION(mysql_field_table)
|
||||
Returns the length of the specified field */
|
||||
PHP_FUNCTION(mysql_field_len)
|
||||
{
|
||||
php_mysql_field_info(INTERNAL_FUNCTION_PARAM_PASSTHRU,PHP_MYSQL_FIELD_LEN);
|
||||
php_mysql_field_info(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_MYSQL_FIELD_LEN);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -1787,7 +1809,7 @@ PHP_FUNCTION(mysql_field_len)
|
||||
Get the type of the specified field in a result */
|
||||
PHP_FUNCTION(mysql_field_type)
|
||||
{
|
||||
php_mysql_field_info(INTERNAL_FUNCTION_PARAM_PASSTHRU,PHP_MYSQL_FIELD_TYPE);
|
||||
php_mysql_field_info(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_MYSQL_FIELD_TYPE);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -1796,7 +1818,7 @@ PHP_FUNCTION(mysql_field_type)
|
||||
Get the flags associated with the specified field in a result */
|
||||
PHP_FUNCTION(mysql_field_flags)
|
||||
{
|
||||
php_mysql_field_info(INTERNAL_FUNCTION_PARAM_PASSTHRU,PHP_MYSQL_FIELD_FLAGS);
|
||||
php_mysql_field_info(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_MYSQL_FIELD_FLAGS);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -1805,7 +1827,7 @@ PHP_FUNCTION(mysql_field_flags)
|
||||
Free result memory */
|
||||
PHP_FUNCTION(mysql_free_result)
|
||||
{
|
||||
pval **result;
|
||||
zval **result;
|
||||
MYSQL_RES *mysql_result;
|
||||
|
||||
if (ZEND_NUM_ARGS()!=1 || zend_get_parameters_ex(1, &result)==FAILURE) {
|
||||
|
||||
@@ -1,61 +0,0 @@
|
||||
dnl $Id$
|
||||
dnl config.m4 for extension pcre
|
||||
|
||||
dnl By default we'll compile and link against the bundled PCRE library
|
||||
dnl if DIR is supplied, we'll use that for linking
|
||||
|
||||
PHP_ARG_WITH(pcre-regex,whether to include PCRE support,
|
||||
[ --without-pcre-regex Do not include Perl Compatible Regular Expressions
|
||||
support. Use --with-pcre-regex=DIR to specify DIR
|
||||
where PCRE's include and library files are located,
|
||||
if not using bundled library.],yes)
|
||||
|
||||
if test "$PHP_PCRE_REGEX" != "no"; then
|
||||
PHP_EXTENSION(pcre, $ext_shared)
|
||||
if test "$PHP_PCRE_REGEX" = "yes"; then
|
||||
PCRE_LIBADD=pcrelib/libpcre.la
|
||||
PCRE_SHARED_LIBADD=pcrelib/libpcre.la
|
||||
PCRE_SUBDIRS=pcrelib
|
||||
PHP_SUBST(PCRE_LIBADD)
|
||||
PHP_SUBST(PCRE_SUBDIRS)
|
||||
AC_DEFINE(HAVE_BUNDLED_PCRE, 1, [ ])
|
||||
PHP_FAST_OUTPUT($ext_builddir/pcrelib/Makefile)
|
||||
LIB_BUILD($ext_builddir/pcrelib,$ext_shared,yes)
|
||||
else
|
||||
test -f $PHP_PCRE_REGEX/pcre.h && PCRE_INCDIR=$PHP_PCRE_REGEX
|
||||
test -f $PHP_PCRE_REGEX/include/pcre.h && PCRE_INCDIR=$PHP_PCRE_REGEX/include
|
||||
|
||||
if test -z "$PCRE_INCDIR"; then
|
||||
AC_MSG_RESULT(Could not find pcre.h in $PHP_PCRE_REGEX)
|
||||
fi
|
||||
|
||||
changequote({,})
|
||||
pcre_major=`grep PCRE_MAJOR $PCRE_INCDIR/pcre.h | sed -e 's/[^0-9]//g'`
|
||||
pcre_minor=`grep PCRE_MINOR $PCRE_INCDIR/pcre.h | sed -e 's/[^0-9]//g'`
|
||||
changequote([,])
|
||||
pcre_minor_length=`echo "$pcre_minor" | wc -c | sed -e 's/[^0-9]//g'`
|
||||
if test "$pcre_minor_length" -eq 2 ; then
|
||||
pcre_minor="$pcre_minor"0
|
||||
fi
|
||||
pcre_version=$pcre_major$pcre_minor
|
||||
if test "$pcre_version" -lt 208; then
|
||||
AC_MSG_ERROR(The PCRE extension requires PCRE library version >= 2.08)
|
||||
fi
|
||||
|
||||
test -f $PHP_PCRE_REGEX/libpcre.a && PCRE_LIBDIR="$PHP_PCRE_REGEX"
|
||||
test -f $PHP_PCRE_REGEX/lib/libpcre.a && PCRE_LIBDIR="$PHP_PCRE_REGEX/lib"
|
||||
|
||||
if test -z "$PCRE_LIBDIR" ; then
|
||||
AC_MSG_ERROR(Could not find libpcre.a in $PHP_PCRE_REGEX)
|
||||
fi
|
||||
|
||||
AC_ADD_LIBRARY_WITH_PATH(pcre, $PCRE_LIBDIR, PCRE_SHARED_LIBADD)
|
||||
|
||||
AC_ADD_INCLUDE($PCRE_INCDIR)
|
||||
AC_DEFINE(HAVE_PCRE, 1, [ ])
|
||||
fi
|
||||
fi
|
||||
PHP_SUBST(PCRE_SHARED_LIBADD)
|
||||
|
||||
|
||||
AC_CHECK_FUNC(memmove, [], [AC_DEFINE(USE_BCOPY, 1, [ ])])
|
||||
+4
-2
@@ -117,8 +117,10 @@ static void php_pgsql_set_default_link(int id)
|
||||
if (PGG(default_link)!=-1) {
|
||||
zend_list_delete(PGG(default_link));
|
||||
}
|
||||
PGG(default_link) = id;
|
||||
zend_list_addref(id);
|
||||
if (PGG(default_link) != id) {
|
||||
PGG(default_link) = id;
|
||||
zend_list_addref(id);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@ dnl don't forget to call PHP_EXTENSION(qtdom)
|
||||
|
||||
AC_MSG_CHECKING(whether to include QDOM support)
|
||||
AC_ARG_WITH(qtdom,
|
||||
[ --with-qtdom Include QtDOM support (requires Qt >= 2.2.0).],
|
||||
[ --with-qtdom Include QtDOM support (requires Qt >= 2.2.0).],
|
||||
[
|
||||
case "$withval" in
|
||||
no)
|
||||
|
||||
+1
-1
@@ -1,2 +1,2 @@
|
||||
Sablot
|
||||
Sablotron XSLT
|
||||
Sterling Hughes
|
||||
+15
-3
@@ -34,8 +34,11 @@ extern zend_module_entry sablot_module_entry;
|
||||
|
||||
/* Module functions */
|
||||
PHP_MINIT_FUNCTION(sablot);
|
||||
PHP_MSHUTDOWN_FUNCTION(sablot);
|
||||
PHP_MINFO_FUNCTION(sablot);
|
||||
PHP_MSHUTDOWN_FUNCTION(sablot);
|
||||
|
||||
/* Request functions */
|
||||
PHP_RSHUTDOWN_FUNCTION(sablot);
|
||||
|
||||
/* Output transformation functions */
|
||||
PHP_FUNCTION(xslt_output_begintransform);
|
||||
@@ -65,6 +68,7 @@ struct _php_sablot_error {
|
||||
char *value;
|
||||
struct _php_sablot_error *next;
|
||||
};
|
||||
|
||||
typedef struct _php_sablot_error php_sablot_error;
|
||||
|
||||
|
||||
@@ -98,11 +102,11 @@ typedef struct {
|
||||
/* Sablotron Globals */
|
||||
typedef struct {
|
||||
zval *errorHandler;
|
||||
SablotHandle processor;
|
||||
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;
|
||||
} php_sablot_globals;
|
||||
|
||||
|
||||
@@ -110,10 +114,18 @@ typedef struct {
|
||||
#define SABLOTG(v) (sablot_globals->v)
|
||||
#define SABLOTLS_FETCH() php_sablot_globals *sablot_globals = ts_resource(sablot_globals_id)
|
||||
#define SABLOTG_HANDLE (*sablot_globals)
|
||||
#define SABLOTLS_C sablot_globals
|
||||
#define SABLOTLS_CC , SABLOTLS_C
|
||||
#define SABLOTLS_D php_sablot_globals *sablot_globals
|
||||
#define SABLOTLS_DC , SABLOTLS_D
|
||||
#else
|
||||
#define SABLOTG(v) (sablot_globals.v)
|
||||
#define SABLOTG_HANDLE sablot_globals
|
||||
#define SABLOTLS_FETCH()
|
||||
#define SABLOTLS_C
|
||||
#define SABLOTLS_CC
|
||||
#define SABLOTLS_D
|
||||
#define SABLOTLS_DC
|
||||
#endif
|
||||
|
||||
#else
|
||||
@@ -127,4 +139,4 @@ typedef struct {
|
||||
* tab-width: 4
|
||||
* c-basic-offset: 4
|
||||
* End:
|
||||
*/
|
||||
*/
|
||||
+72
-44
@@ -31,7 +31,7 @@
|
||||
#include "ext/standard/php_output.h"
|
||||
#include "php_sablot.h"
|
||||
|
||||
static int le_sablot;
|
||||
static int le_sablot;
|
||||
|
||||
/* Functions related to PHP's list handling */
|
||||
static void _php_sablot_free_processor(zend_rsrc_list_entry *rsrc);
|
||||
@@ -67,34 +67,34 @@ static zval *_php_sablot_resource_zval(long);
|
||||
|
||||
/* ERROR Macros */
|
||||
|
||||
#define SABLOT_FREE_ERROR_HANDLE(__handle) \
|
||||
if ((__handle).errors) { \
|
||||
#define SABLOT_FREE_ERROR_HANDLE(__handle) \
|
||||
if ((__handle).errors) { \
|
||||
(__handle).errors = (__handle).errors_start.next; \
|
||||
while ((__handle).errors) { \
|
||||
S_FREE((__handle).errors->key); \
|
||||
S_FREE((__handle).errors->value); \
|
||||
(__handle).errors = (__handle).errors->next; \
|
||||
} \
|
||||
S_FREE((__handle).errors); \
|
||||
while ((__handle).errors) { \
|
||||
S_FREE((__handle).errors->key); \
|
||||
S_FREE((__handle).errors->value); \
|
||||
(__handle).errors = (__handle).errors->next; \
|
||||
} \
|
||||
S_FREE((__handle).errors); \
|
||||
}
|
||||
|
||||
|
||||
/* Sablotron Basic Api macro's */
|
||||
#define SABLOT_BASIC_CREATE_PROCESSOR() \
|
||||
if (SABLOTG(processor) == NULL) { \
|
||||
int ret = 0; \
|
||||
\
|
||||
ret = SablotCreateProcessor(&SABLOTG(processor)); \
|
||||
if (ret) { \
|
||||
SABLOTG(last_errno) = ret; \
|
||||
return; \
|
||||
} \
|
||||
\
|
||||
#define SABLOT_BASIC_CREATE_PROCESSOR() \
|
||||
if (SABLOTG(processor) == NULL) { \
|
||||
int ret = 0; \
|
||||
\
|
||||
ret = SablotCreateProcessor(&SABLOTG(processor)); \
|
||||
if (ret) { \
|
||||
SABLOTG(last_errno) = (int) ret; \
|
||||
return; \
|
||||
} \
|
||||
\
|
||||
ret = SablotRegHandler(SABLOTG(processor), HLR_MESSAGE, (void *)&mh, (void *)NULL); \
|
||||
if (ret) { \
|
||||
SABLOTG(last_errno) = ret; \
|
||||
return; \
|
||||
} \
|
||||
if (ret) { \
|
||||
SABLOTG(last_errno) = (int) ret; \
|
||||
return; \
|
||||
} \
|
||||
}
|
||||
|
||||
#define SABLOT_BASIC_HANDLE SABLOTG(processor)
|
||||
@@ -162,7 +162,7 @@ zend_module_entry sablot_module_entry = {
|
||||
PHP_MINIT(sablot),
|
||||
PHP_MSHUTDOWN(sablot),
|
||||
NULL,
|
||||
NULL,
|
||||
PHP_RSHUTDOWN(sablot),
|
||||
PHP_MINFO(sablot),
|
||||
STANDARD_MODULE_PROPERTIES
|
||||
};
|
||||
@@ -171,10 +171,23 @@ zend_module_entry sablot_module_entry = {
|
||||
ZEND_GET_MODULE(sablot)
|
||||
#endif
|
||||
|
||||
static void php_sablot_init_globals(SABLOTLS_D)
|
||||
{
|
||||
SABLOTG(processor) = NULL;
|
||||
SABLOTG(errors) = NULL;
|
||||
SABLOTG(errorHandler) = NULL;
|
||||
}
|
||||
|
||||
|
||||
/* MINIT and MINFO Functions */
|
||||
PHP_MINIT_FUNCTION(sablot)
|
||||
{
|
||||
#ifdef ZTS
|
||||
sablot_globals_id = ts_allocate_id(sizeof(php_sablot_globals), (ts_allocate_ctor)php_sablot_init_globals, NULL);
|
||||
#else
|
||||
php_sablot_init_globals(SABLOTLS_C);
|
||||
#endif
|
||||
|
||||
le_sablot = zend_register_list_destructors_ex(_php_sablot_free_processor, NULL, "Sablotron XSLT", module_number);
|
||||
|
||||
return SUCCESS;
|
||||
@@ -182,16 +195,24 @@ PHP_MINIT_FUNCTION(sablot)
|
||||
|
||||
PHP_MSHUTDOWN_FUNCTION(sablot)
|
||||
{
|
||||
SABLOTLS_FETCH();
|
||||
|
||||
if (SABLOTG(processor)) {
|
||||
SablotUnregHandler(SABLOTG(processor), HLR_MESSAGE, NULL, NULL);
|
||||
SablotDestroyProcessor(SABLOTG(processor));
|
||||
}
|
||||
|
||||
SABLOTLS_FETCH();
|
||||
if (SABLOTG(processor)) {
|
||||
SablotUnregHandler(SABLOTG(processor), HLR_MESSAGE, NULL, NULL);
|
||||
SablotDestroyProcessor(SABLOTG(processor));
|
||||
}
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
PHP_RSHUTDOWN_FUNCTION(sablot)
|
||||
{
|
||||
SABLOTLS_FETCH();
|
||||
|
||||
SABLOT_FREE_ERROR_HANDLE(SABLOTG_HANDLE);
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
PHP_MINFO_FUNCTION(sablot)
|
||||
{
|
||||
php_info_print_table_start();
|
||||
@@ -252,7 +273,7 @@ PHP_FUNCTION(xslt_output_endtransform)
|
||||
buffer = estrndup(OG(active_ob_buffer).buffer, OG(active_ob_buffer).text_length);
|
||||
|
||||
/* Nake sure there is data to send */
|
||||
if (strlen(buffer)) {
|
||||
if (OG(active_ob_buffer).text_length) {
|
||||
char *args[] = {"/_xmlinput", buffer,
|
||||
"/_output", NULL};
|
||||
|
||||
@@ -785,7 +806,6 @@ PHP_FUNCTION(xslt_set_sax_handler)
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
|
||||
if (!strcasecmp("document", string_key)) {
|
||||
_php_sablot_handler_pair(handle,
|
||||
&handle->startDocHandler, &handle->endDocHandler,
|
||||
@@ -1166,24 +1186,24 @@ static MH_ERROR _php_sablot_error(void *userData, SablotHandle p, MH_ERROR code,
|
||||
zval **argv = NULL,
|
||||
*errorHandler;
|
||||
|
||||
php_sablot_error *errors,
|
||||
errors_start;
|
||||
php_sablot_error *errors;
|
||||
php_sablot *handle = NULL;
|
||||
|
||||
char *sep = NULL;
|
||||
|
||||
int isAdvanced = 0,
|
||||
argc = 0,
|
||||
i,
|
||||
idx,
|
||||
len;
|
||||
|
||||
SABLOTLS_FETCH();
|
||||
|
||||
|
||||
if (userData == NULL) {
|
||||
SABLOT_FREE_ERROR_HANDLE(SABLOTG_HANDLE);
|
||||
|
||||
SABLOTG(errors_start).next = NULL;
|
||||
SABLOTG(errors) = &SABLOTG(errors_start);
|
||||
SABLOTG(errors) = &SABLOTG(errors_start);
|
||||
|
||||
errors = SABLOTG(errors);
|
||||
errorHandler = SABLOTG(errorHandler);
|
||||
@@ -1193,7 +1213,7 @@ static MH_ERROR _php_sablot_error(void *userData, SablotHandle p, MH_ERROR code,
|
||||
SABLOT_FREE_ERROR_HANDLE(*handle);
|
||||
|
||||
handle->errors_start.next = NULL;
|
||||
handle->errors = &errors_start;
|
||||
handle->errors = &handle->errors_start;
|
||||
|
||||
errors = handle->errors;
|
||||
errorHandler = handle->errorHandler;
|
||||
@@ -1216,6 +1236,7 @@ static MH_ERROR _php_sablot_error(void *userData, SablotHandle p, MH_ERROR code,
|
||||
|
||||
memcpy(errors->key, fields[0], idx);
|
||||
memcpy(errors->value, fields[0] + idx + 1, len - idx - 1);
|
||||
errors->key[idx] = '\0';
|
||||
errors->value[len - idx - 1] = '\0';
|
||||
|
||||
errors->next = NULL;
|
||||
@@ -1223,9 +1244,9 @@ static MH_ERROR _php_sablot_error(void *userData, SablotHandle p, MH_ERROR code,
|
||||
}
|
||||
|
||||
if (isAdvanced)
|
||||
handle->last_errno = (int)code;
|
||||
handle->last_errno = (int) code;
|
||||
else
|
||||
SABLOTG(last_errno) = (int)code;
|
||||
SABLOTG(last_errno) = (int) code;
|
||||
|
||||
if (errorHandler) {
|
||||
zval *retval;
|
||||
@@ -1249,7 +1270,7 @@ static MH_ERROR _php_sablot_error(void *userData, SablotHandle p, MH_ERROR code,
|
||||
|
||||
array_init(argv[3]);
|
||||
errors = handle->errors_start.next;
|
||||
while (errors->next) {
|
||||
while (errors) {
|
||||
add_assoc_string(argv[3], errors->key, errors->value, 1);
|
||||
errors = errors->next;
|
||||
}
|
||||
@@ -1271,12 +1292,19 @@ static MH_ERROR _php_sablot_error(void *userData, SablotHandle p, MH_ERROR code,
|
||||
|
||||
zval_dtor(retval);
|
||||
efree(retval);
|
||||
|
||||
for (i = 1; i < argc; i++) {
|
||||
zval_del_ref(&argv[i]);
|
||||
}
|
||||
} else {
|
||||
_php_sablot_standard_error(errors, isAdvanced ? handle->errors_start : SABLOTG(errors_start), code, level);
|
||||
if (level == MH_LEVEL_CRITICAL ||
|
||||
level == MH_LEVEL_ERROR ||
|
||||
level == MH_LEVEL_WARN) {
|
||||
_php_sablot_standard_error(errors, isAdvanced ? handle->errors_start : SABLOTG(errors_start), code, level);
|
||||
}
|
||||
}
|
||||
|
||||
return(0);
|
||||
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -1288,7 +1316,6 @@ static void _php_sablot_standard_error(php_sablot_error *errors, php_sablot_erro
|
||||
SABLOTLS_FETCH();
|
||||
|
||||
errors = errors_start.next;
|
||||
|
||||
while (errors) {
|
||||
len = pos + strlen(errors->key) + sizeof(": ") + strlen(errors->value) + sizeof("\n");
|
||||
|
||||
@@ -1344,6 +1371,7 @@ static void _php_sablot_free_processor(zend_rsrc_list_entry *rsrc)
|
||||
FUNCH_FREE(handle->endDocHandler);
|
||||
|
||||
SABLOT_FREE_ERROR_HANDLE(*handle);
|
||||
efree(handle);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
||||
@@ -25,6 +25,8 @@
|
||||
|
||||
#if HAVE_SHMOP
|
||||
|
||||
#include "ext/standard/info.h"
|
||||
|
||||
#ifdef ZTS
|
||||
int shmop_globals_id;
|
||||
#else
|
||||
|
||||
@@ -80,9 +80,7 @@ typedef struct php_iovec {
|
||||
} php_iovec_t;
|
||||
|
||||
typedef struct {
|
||||
int le_destroy;
|
||||
int le_iov;
|
||||
int use_system_read;
|
||||
zend_bool use_system_read;
|
||||
} php_sockets_globals;
|
||||
|
||||
|
||||
|
||||
+61
-90
@@ -77,23 +77,9 @@ typedef struct {
|
||||
unsigned char info[128];
|
||||
} php_sockaddr_storage;
|
||||
|
||||
/* Perform convert_to_long_ex on a list of items */
|
||||
static void v_convert_to_long_ex(int items,...)
|
||||
{
|
||||
va_list ap;
|
||||
zval **arg;
|
||||
int i;
|
||||
|
||||
va_start(ap, items);
|
||||
|
||||
for (i = 0; i < items; i++) {
|
||||
arg = va_arg(ap, zval **);
|
||||
convert_to_long_ex(arg);
|
||||
}
|
||||
va_end(ap);
|
||||
|
||||
}
|
||||
|
||||
static int le_iov;
|
||||
static int le_destroy;
|
||||
|
||||
static unsigned char second_and_third_args_force_ref[] =
|
||||
{3, BYREF_NONE, BYREF_FORCE, BYREF_FORCE};
|
||||
@@ -202,9 +188,8 @@ static void destroy_iovec(zend_rsrc_list_entry *rsrc)
|
||||
|
||||
PHP_MINIT_FUNCTION(sockets)
|
||||
{
|
||||
SOCKETSLS_FETCH();
|
||||
SOCKETSG(le_destroy) = zend_register_list_destructors_ex(destroy_fd_sets, NULL, "sockets file descriptor set", module_number);
|
||||
SOCKETSG(le_iov) = zend_register_list_destructors_ex(destroy_iovec, NULL, "sockets i/o vector", module_number);
|
||||
le_destroy = zend_register_list_destructors_ex(destroy_fd_sets, NULL, "sockets file descriptor set", module_number);
|
||||
le_iov = zend_register_list_destructors_ex(destroy_iovec, NULL, "sockets i/o vector", module_number);
|
||||
|
||||
REGISTER_LONG_CONSTANT("AF_UNIX", AF_UNIX, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("AF_INET", AF_INET, CONST_CS | CONST_PERSISTENT);
|
||||
@@ -265,24 +250,34 @@ PHP_MINFO_FUNCTION(sockets)
|
||||
PHP_FUNCTION(fd_alloc)
|
||||
{
|
||||
fd_set *set;
|
||||
SOCKETSLS_FETCH();
|
||||
|
||||
set = (fd_set *)emalloc(sizeof(fd_set));
|
||||
set = (fd_set *) emalloc(sizeof(fd_set));
|
||||
if (!set) {
|
||||
php_error(E_WARNING, "Can't allocate memory for fd_set");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
ZEND_REGISTER_RESOURCE(return_value, set, SOCKETSG(le_destroy));
|
||||
ZEND_REGISTER_RESOURCE(return_value, set, le_destroy);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto void fd_dealloc(void)
|
||||
/* {{{ proto bool fd_dealloc(void)
|
||||
De-allocates a file descriptor set */
|
||||
/* ** BUG: This is currently a no-op! */
|
||||
PHP_FUNCTION(fd_dealloc)
|
||||
{
|
||||
RETURN_NULL();
|
||||
zval **set;
|
||||
fd_set *the_set;
|
||||
|
||||
if (ZEND_NUM_ARGS() != 1 ||
|
||||
zend_get_parameters_ex(1, &set) == FAILURE) {
|
||||
WRONG_PARAM_COUNT;
|
||||
}
|
||||
|
||||
ZEND_FETCH_RESOURCE(the_set, fd_set *, set, -1, "File descriptor set", le_destroy);
|
||||
|
||||
zend_list_delete(Z_LVAL_PP(set));
|
||||
|
||||
RETURN_TRUE;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -292,7 +287,6 @@ PHP_FUNCTION(fd_set)
|
||||
{
|
||||
zval **set, **fd;
|
||||
fd_set *the_set;
|
||||
SOCKETSLS_FETCH();
|
||||
|
||||
if (ZEND_NUM_ARGS() != 2 ||
|
||||
zend_get_parameters_ex(2, &fd, &set) == FAILURE) {
|
||||
@@ -300,7 +294,7 @@ PHP_FUNCTION(fd_set)
|
||||
}
|
||||
convert_to_long_ex(fd);
|
||||
|
||||
ZEND_FETCH_RESOURCE(the_set, fd_set *, set, -1, "File descriptor set", SOCKETSG(le_destroy));
|
||||
ZEND_FETCH_RESOURCE(the_set, fd_set *, set, -1, "File descriptor set", le_destroy);
|
||||
|
||||
if (Z_LVAL_PP(fd) < 0) {
|
||||
php_error(E_WARNING, "Can't set negative fd falues in a set");
|
||||
@@ -319,7 +313,6 @@ PHP_FUNCTION(fd_clear)
|
||||
{
|
||||
zval **set, **fd;
|
||||
fd_set *the_set;
|
||||
SOCKETSLS_FETCH();
|
||||
|
||||
if (ZEND_NUM_ARGS() != 2 ||
|
||||
zend_get_parameters_ex(2, &fd, &set) == FAILURE) {
|
||||
@@ -327,7 +320,7 @@ PHP_FUNCTION(fd_clear)
|
||||
}
|
||||
convert_to_long_ex(fd);
|
||||
|
||||
ZEND_FETCH_RESOURCE(the_set, fd_set *, set, -1, "File descriptor set", SOCKETSG(le_destroy));
|
||||
ZEND_FETCH_RESOURCE(the_set, fd_set *, set, -1, "File descriptor set", le_destroy);
|
||||
|
||||
if (Z_LVAL_PP(fd) < 0) {
|
||||
php_error(E_WARNING, "Can't clear negative fd values in a set");
|
||||
@@ -346,7 +339,6 @@ PHP_FUNCTION(fd_isset)
|
||||
{
|
||||
zval **set, **fd;
|
||||
fd_set *the_set;
|
||||
SOCKETSLS_FETCH();
|
||||
|
||||
if (ZEND_NUM_ARGS() != 2 ||
|
||||
zend_get_parameters_ex(2, &fd, &set) == FAILURE) {
|
||||
@@ -354,7 +346,7 @@ PHP_FUNCTION(fd_isset)
|
||||
}
|
||||
convert_to_long_ex(fd);
|
||||
|
||||
ZEND_FETCH_RESOURCE(the_set, fd_set *, set, -1, "File descriptor set", SOCKETSG(le_destroy));
|
||||
ZEND_FETCH_RESOURCE(the_set, fd_set *, set, -1, "File descriptor set", le_destroy);
|
||||
|
||||
if (Z_LVAL_PP(fd) < 0) {
|
||||
php_error(E_WARNING, "Can't check for negative fd values in a set");
|
||||
@@ -375,14 +367,13 @@ PHP_FUNCTION(fd_zero)
|
||||
{
|
||||
zval **set;
|
||||
fd_set *the_set;
|
||||
SOCKETSLS_FETCH();
|
||||
|
||||
if (ZEND_NUM_ARGS() != 1 ||
|
||||
zend_get_parameters_ex(1, &set) == FAILURE) {
|
||||
WRONG_PARAM_COUNT;
|
||||
}
|
||||
|
||||
ZEND_FETCH_RESOURCE(the_set, fd_set *, set, -1, "File descriptor set", SOCKETSG(le_destroy));
|
||||
ZEND_FETCH_RESOURCE(the_set, fd_set *, set, -1, "File descriptor set", le_destroy);
|
||||
|
||||
FD_ZERO(the_set);
|
||||
|
||||
@@ -416,31 +407,30 @@ PHP_FUNCTION(select)
|
||||
struct timeval tv;
|
||||
fd_set *rfds, *wfds, *xfds;
|
||||
int ret = 0;
|
||||
SOCKETSLS_FETCH();
|
||||
|
||||
if (ZEND_NUM_ARGS() != 6 ||
|
||||
zend_get_parameters_ex(6, &max_fd, &readfds, &writefds, &exceptfds, &tv_sec, &tv_usec) == FAILURE) {
|
||||
WRONG_PARAM_COUNT;
|
||||
}
|
||||
v_convert_to_long_ex(3, max_fd, tv_sec, tv_usec);
|
||||
multi_convert_to_long_ex(3, max_fd, tv_sec, tv_usec);
|
||||
|
||||
tv.tv_sec = Z_LVAL_PP(tv_sec);
|
||||
tv.tv_usec = Z_LVAL_PP(tv_usec);
|
||||
|
||||
if (Z_LVAL_PP(readfds) != 0) {
|
||||
ZEND_FETCH_RESOURCE(rfds, fd_set *, readfds, -1, "File descriptor set", SOCKETSG(le_destroy));
|
||||
ZEND_FETCH_RESOURCE(rfds, fd_set *, readfds, -1, "File descriptor set", le_destroy);
|
||||
} else {
|
||||
rfds = NULL;
|
||||
}
|
||||
|
||||
if (Z_LVAL_PP(writefds) != 0) {
|
||||
ZEND_FETCH_RESOURCE(wfds, fd_set *, writefds, -1, "File descriptor set", SOCKETSG(le_destroy));
|
||||
ZEND_FETCH_RESOURCE(wfds, fd_set *, writefds, -1, "File descriptor set", le_destroy);
|
||||
} else {
|
||||
wfds = NULL;
|
||||
}
|
||||
|
||||
if (Z_LVAL_PP(exceptfds) != 0) {
|
||||
ZEND_FETCH_RESOURCE(xfds, fd_set *, exceptfds, -1, "File descriptor set", SOCKETSG(le_destroy));
|
||||
ZEND_FETCH_RESOURCE(xfds, fd_set *, exceptfds, -1, "File descriptor set", le_destroy);
|
||||
} else {
|
||||
xfds = NULL;
|
||||
}
|
||||
@@ -554,7 +544,7 @@ PHP_FUNCTION(listen)
|
||||
if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &fd, &backlog) == FAILURE) {
|
||||
WRONG_PARAM_COUNT;
|
||||
}
|
||||
v_convert_to_long_ex(2, fd, backlog);
|
||||
multi_convert_to_long_ex(2, fd, backlog);
|
||||
|
||||
ret = listen(Z_LVAL_PP(fd), Z_LVAL_PP(backlog));
|
||||
|
||||
@@ -596,7 +586,7 @@ PHP_FUNCTION(write)
|
||||
WRONG_PARAM_COUNT;
|
||||
}
|
||||
|
||||
v_convert_to_long_ex(2, fd, length);
|
||||
multi_convert_to_long_ex(2, fd, length);
|
||||
convert_to_string_ex(buf);
|
||||
|
||||
if (Z_STRLEN_PP(buf) < Z_LVAL_PP(length)) {
|
||||
@@ -675,7 +665,7 @@ PHP_FUNCTION(read)
|
||||
WRONG_PARAM_COUNT;
|
||||
}
|
||||
|
||||
v_convert_to_long_ex(ZEND_NUM_ARGS() - 1, fd, length, binary);
|
||||
multi_convert_to_long_ex(ZEND_NUM_ARGS() - 1, fd, length, binary);
|
||||
convert_to_string_ex(buf);
|
||||
|
||||
if (ZEND_NUM_ARGS() == 4) {
|
||||
@@ -693,7 +683,7 @@ PHP_FUNCTION(read)
|
||||
read_function = (int (*)(int, void *, int)) php_read;
|
||||
}
|
||||
|
||||
tmpbuf = emalloc(Z_LVAL_PP(length)*sizeof(char));
|
||||
tmpbuf = emalloc((Z_LVAL_PP(length)+1)*sizeof(char));
|
||||
if (tmpbuf == NULL) {
|
||||
php_error(E_WARNING, "Couldn't allocate memory from %s()", get_active_function_name());
|
||||
RETURN_FALSE;
|
||||
@@ -702,19 +692,13 @@ PHP_FUNCTION(read)
|
||||
ret = (*read_function)(Z_LVAL_PP(fd), tmpbuf, Z_LVAL_PP(length));
|
||||
|
||||
if (ret >= 0) {
|
||||
if (Z_STRLEN_PP(buf) > 0) {
|
||||
if(Z_STRLEN_PP(buf) > 0) {
|
||||
efree(Z_STRVAL_PP(buf));
|
||||
}
|
||||
if (ZEND_NUM_ARGS() == 4 && Z_LVAL_PP(binary) != PHP_NORMAL_READ) {
|
||||
Z_STRVAL_PP(buf) = emalloc(ret);
|
||||
memcpy(Z_STRVAL_PP(buf), tmpbuf, ret);
|
||||
Z_STRLEN_PP(buf) = ret;
|
||||
} else {
|
||||
Z_STRVAL_PP(buf) = estrndup(tmpbuf,strlen(tmpbuf));
|
||||
Z_STRLEN_PP(buf) = strlen(tmpbuf);
|
||||
ret = strlen(tmpbuf);
|
||||
}
|
||||
efree(tmpbuf);
|
||||
|
||||
tmpbuf[ret] = '\0';
|
||||
Z_STRVAL_PP(buf) = erealloc(tmpbuf, ret+1);
|
||||
Z_STRLEN_PP(buf) = ret;
|
||||
|
||||
RETURN_LONG(ret);
|
||||
} else {
|
||||
@@ -745,7 +729,7 @@ PHP_FUNCTION(getsockname)
|
||||
zend_get_parameters_ex(ZEND_NUM_ARGS(), &fd, &addr, &port) == FAILURE) {
|
||||
WRONG_PARAM_COUNT;
|
||||
}
|
||||
v_convert_to_long_ex(ZEND_NUM_ARGS() - 1, fd, port);
|
||||
multi_convert_to_long_ex(ZEND_NUM_ARGS() - 1, fd, port);
|
||||
convert_to_string_ex(addr);
|
||||
|
||||
sa = (struct sockaddr *) &sa_storage;
|
||||
@@ -866,7 +850,7 @@ PHP_FUNCTION(getpeername)
|
||||
zend_get_parameters_ex(ZEND_NUM_ARGS(), &fd, &addr, &port) == FAILURE) {
|
||||
WRONG_PARAM_COUNT;
|
||||
}
|
||||
v_convert_to_long_ex(ZEND_NUM_ARGS() - 1, fd, port);
|
||||
multi_convert_to_long_ex(ZEND_NUM_ARGS() - 1, fd, port);
|
||||
convert_to_string_ex(addr);
|
||||
|
||||
sa = (struct sockaddr *) &sa_storage;
|
||||
@@ -982,7 +966,7 @@ PHP_FUNCTION(socket)
|
||||
zend_get_parameters_ex(3, &domain, &type, &protocol) == FAILURE) {
|
||||
WRONG_PARAM_COUNT;
|
||||
}
|
||||
v_convert_to_long_ex(3, domain, type, protocol);
|
||||
multi_convert_to_long_ex(3, domain, type, protocol);
|
||||
|
||||
if (Z_LVAL_PP(domain) != AF_INET && Z_LVAL_PP(domain) != AF_UNIX) {
|
||||
php_error(E_WARNING, "invalid socket domain specified - assuming AF_INET");
|
||||
@@ -1182,7 +1166,6 @@ PHP_FUNCTION(build_iovec)
|
||||
php_iovec_t *vector;
|
||||
struct iovec *vector_array;
|
||||
int i, j, num_vectors, argcount = ZEND_NUM_ARGS();
|
||||
SOCKETSLS_FETCH();
|
||||
|
||||
args = emalloc(argcount * sizeof(zval *));
|
||||
|
||||
@@ -1209,7 +1192,7 @@ PHP_FUNCTION(build_iovec)
|
||||
vector->iov_array = vector_array;
|
||||
vector->count = num_vectors;
|
||||
|
||||
ZEND_REGISTER_RESOURCE(return_value, vector, SOCKETSG(le_iov));
|
||||
ZEND_REGISTER_RESOURCE(return_value, vector, le_iov);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -1219,14 +1202,13 @@ PHP_FUNCTION(fetch_iovec)
|
||||
{
|
||||
zval **iovec_id, **iovec_position;
|
||||
php_iovec_t *vector;
|
||||
SOCKETSLS_FETCH();
|
||||
|
||||
|
||||
if (ZEND_NUM_ARGS() != 2 ||
|
||||
zend_get_parameters_ex(2, &iovec_id, &iovec_position) == FAILURE) {
|
||||
WRONG_PARAM_COUNT;
|
||||
}
|
||||
|
||||
ZEND_FETCH_RESOURCE(vector, php_iovec_t *, iovec_id, -1, "IO vector table", SOCKETSG(le_iov));
|
||||
ZEND_FETCH_RESOURCE(vector, php_iovec_t *, iovec_id, -1, "IO vector table", le_iov);
|
||||
|
||||
if (Z_LVAL_PP(iovec_position) > vector->count) {
|
||||
php_error(E_WARNING, "Can't access a vector position past the amount of vectors set in the array");
|
||||
@@ -1243,14 +1225,13 @@ PHP_FUNCTION(set_iovec)
|
||||
{
|
||||
zval **iovec_id, **iovec_position, **new_val;
|
||||
php_iovec_t *vector;
|
||||
SOCKETSLS_FETCH();
|
||||
|
||||
|
||||
if (ZEND_NUM_ARGS() != 3 ||
|
||||
zend_get_parameters_ex(3, &iovec_id, &iovec_position, &new_val) == FAILURE) {
|
||||
WRONG_PARAM_COUNT;
|
||||
}
|
||||
|
||||
ZEND_FETCH_RESOURCE(vector, php_iovec_t *, iovec_id, -1, "IO vector table", SOCKETSG(le_iov));
|
||||
ZEND_FETCH_RESOURCE(vector, php_iovec_t *, iovec_id, -1, "IO vector table", le_iov);
|
||||
|
||||
if (Z_LVAL_PP(iovec_position) > vector->count) {
|
||||
php_error(E_WARNING, "Can't access a vector position outside of the vector array bounds");
|
||||
@@ -1275,14 +1256,13 @@ PHP_FUNCTION(add_iovec)
|
||||
zval **iovec_id, **iov_len;
|
||||
php_iovec_t *vector;
|
||||
struct iovec *vector_array;
|
||||
SOCKETSLS_FETCH();
|
||||
|
||||
|
||||
if (ZEND_NUM_ARGS() != 2 ||
|
||||
zend_get_parameters_ex(2, &iovec_id, &iov_len) == FAILURE) {
|
||||
WRONG_PARAM_COUNT;
|
||||
}
|
||||
|
||||
ZEND_FETCH_RESOURCE(vector, php_iovec_t *, iovec_id, -1, "IO vector table", SOCKETSG(le_iov));
|
||||
ZEND_FETCH_RESOURCE(vector, php_iovec_t *, iovec_id, -1, "IO vector table", le_iov);
|
||||
|
||||
vector_array = emalloc(sizeof(struct iovec) * (vector->count + 2));
|
||||
memcpy(vector_array, vector->iov_array, sizeof(struct iovec) * vector->count);
|
||||
@@ -1306,14 +1286,13 @@ PHP_FUNCTION(delete_iovec)
|
||||
php_iovec_t *vector;
|
||||
struct iovec *vector_array;
|
||||
int i;
|
||||
SOCKETSLS_FETCH();
|
||||
|
||||
|
||||
if (ZEND_NUM_ARGS() != 2 ||
|
||||
zend_get_parameters_ex(2, &iovec_id, &iov_pos) == FAILURE) {
|
||||
WRONG_PARAM_COUNT;
|
||||
}
|
||||
|
||||
ZEND_FETCH_RESOURCE(vector, php_iovec_t *, iovec_id, -1, "IO vector table", SOCKETSG(le_iov));
|
||||
ZEND_FETCH_RESOURCE(vector, php_iovec_t *, iovec_id, -1, "IO vector table", le_iov);
|
||||
|
||||
if (Z_LVAL_PP(iov_pos) > vector->count) {
|
||||
php_error(E_WARNING, "Can't delete an IO vector that is out of array bounds");
|
||||
@@ -1344,13 +1323,12 @@ PHP_FUNCTION(free_iovec)
|
||||
zval **iovec_id;
|
||||
php_iovec_t *vector;
|
||||
int pos;
|
||||
SOCKETSLS_FETCH();
|
||||
|
||||
if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &iovec_id) == FAILURE) {
|
||||
WRONG_PARAM_COUNT;
|
||||
}
|
||||
|
||||
ZEND_FETCH_RESOURCE(vector, php_iovec_t *, iovec_id, -1, "IO vector table", SOCKETSG(le_iov));
|
||||
ZEND_FETCH_RESOURCE(vector, php_iovec_t *, iovec_id, -1, "IO vector table", le_iov);
|
||||
|
||||
zend_list_delete(Z_LVAL_PP(iovec_id));
|
||||
|
||||
@@ -1365,14 +1343,13 @@ PHP_FUNCTION(readv)
|
||||
zval **fd, **iovec_id;
|
||||
php_iovec_t *vector;
|
||||
int ret;
|
||||
SOCKETSLS_FETCH();
|
||||
|
||||
if (ZEND_NUM_ARGS() != 2 ||
|
||||
zend_get_parameters_ex(2, &fd, &iovec_id) == FAILURE) {
|
||||
WRONG_PARAM_COUNT;
|
||||
}
|
||||
|
||||
ZEND_FETCH_RESOURCE(vector, php_iovec_t *, iovec_id, -1, "IO vector table", SOCKETSG(le_iov));
|
||||
ZEND_FETCH_RESOURCE(vector, php_iovec_t *, iovec_id, -1, "IO vector table", le_iov);
|
||||
|
||||
ret = readv(Z_LVAL_PP(fd), vector->iov_array, vector->count);
|
||||
|
||||
@@ -1387,14 +1364,13 @@ PHP_FUNCTION(writev)
|
||||
zval **fd, **iovec_id;
|
||||
php_iovec_t *vector;
|
||||
int ret;
|
||||
SOCKETSLS_FETCH();
|
||||
|
||||
if (ZEND_NUM_ARGS() != 2 ||
|
||||
zend_get_parameters_ex(2, &fd, &iovec_id) == FAILURE) {
|
||||
WRONG_PARAM_COUNT;
|
||||
}
|
||||
|
||||
ZEND_FETCH_RESOURCE(vector, php_iovec_t *, iovec_id, -1, "IO vector table", SOCKETSG(le_iov));
|
||||
ZEND_FETCH_RESOURCE(vector, php_iovec_t *, iovec_id, -1, "IO vector table", le_iov);
|
||||
|
||||
ret = writev(Z_LVAL_PP(fd), vector->iov_array, vector->count);
|
||||
|
||||
@@ -1415,7 +1391,7 @@ PHP_FUNCTION(recv)
|
||||
zend_get_parameters_ex(4, &fd, &buf, &len, &flags) == FAILURE) {
|
||||
WRONG_PARAM_COUNT;
|
||||
}
|
||||
v_convert_to_long_ex(3, fd, len, flags);
|
||||
multi_convert_to_long_ex(3, fd, len, flags);
|
||||
convert_to_string_ex(buf);
|
||||
|
||||
recv_buf = emalloc(Z_LVAL_PP(len) + 2);
|
||||
@@ -1452,7 +1428,7 @@ PHP_FUNCTION(send)
|
||||
zend_get_parameters_ex(4, &fd, &buf, &len, &flags) == FAILURE) {
|
||||
WRONG_PARAM_COUNT;
|
||||
}
|
||||
v_convert_to_long_ex(3, fd, len, flags);
|
||||
multi_convert_to_long_ex(3, fd, len, flags);
|
||||
convert_to_string_ex(buf);
|
||||
|
||||
ret = send(Z_LVAL_PP(fd), Z_STRVAL_PP(buf),
|
||||
@@ -1614,7 +1590,7 @@ PHP_FUNCTION(sendto)
|
||||
if (ret == FAILURE) {
|
||||
WRONG_PARAM_COUNT;
|
||||
}
|
||||
v_convert_to_long_ex(3, fd, len, flags);
|
||||
multi_convert_to_long_ex(3, fd, len, flags);
|
||||
convert_to_string_ex(buf);
|
||||
|
||||
if (ZEND_NUM_ARGS() == 6) {
|
||||
@@ -1697,7 +1673,6 @@ PHP_FUNCTION(recvmsg)
|
||||
struct cmsghdr *ctl_buf;
|
||||
socklen_t salen = sizeof(sa_storage);
|
||||
int ret;
|
||||
SOCKETSLS_FETCH();
|
||||
|
||||
switch (ZEND_NUM_ARGS())
|
||||
{
|
||||
@@ -1715,14 +1690,14 @@ PHP_FUNCTION(recvmsg)
|
||||
WRONG_PARAM_COUNT;
|
||||
}
|
||||
|
||||
v_convert_to_long_ex(3, fd, controllen, flags);
|
||||
multi_convert_to_long_ex(3, fd, controllen, flags);
|
||||
convert_to_string_ex(control);
|
||||
convert_to_string_ex(addr);
|
||||
if (ZEND_NUM_ARGS() == 7) {
|
||||
convert_to_long_ex(port);
|
||||
}
|
||||
|
||||
ZEND_FETCH_RESOURCE(iov, php_iovec_t *, iovec, -1, "IO vector table", SOCKETSG(le_iov));
|
||||
ZEND_FETCH_RESOURCE(iov, php_iovec_t *, iovec, -1, "IO vector table", le_iov);
|
||||
|
||||
ret = getsockname(Z_LVAL_PP(fd), sa, &salen);
|
||||
if (ret < 0) {
|
||||
@@ -1860,7 +1835,6 @@ PHP_FUNCTION(sendmsg)
|
||||
int ret, argc = ZEND_NUM_ARGS();
|
||||
struct sockaddr sa;
|
||||
int salen;
|
||||
SOCKETSLS_FETCH();
|
||||
|
||||
if (argc < 4 || argc > 5 ||
|
||||
zend_get_parameters_ex(argc, &fd, &iovec, &flags, &addr, &port) == FAILURE) {
|
||||
@@ -1873,7 +1847,7 @@ PHP_FUNCTION(sendmsg)
|
||||
RETURN_LONG(-errno);
|
||||
}
|
||||
|
||||
ZEND_FETCH_RESOURCE(iov, php_iovec_t *, iovec, -1, "IO vector table", SOCKETSG(le_iov));
|
||||
ZEND_FETCH_RESOURCE(iov, php_iovec_t *, iovec, -1, "IO vector table", le_iov);
|
||||
|
||||
switch(sa.sa_family)
|
||||
{
|
||||
@@ -1947,7 +1921,7 @@ PHP_FUNCTION(getsockopt)
|
||||
WRONG_PARAM_COUNT;
|
||||
}
|
||||
|
||||
v_convert_to_long_ex(3, fd, level, optname);
|
||||
multi_convert_to_long_ex(3, fd, level, optname);
|
||||
/* optname is set on the way out .. */
|
||||
|
||||
if (Z_LVAL_PP(level) == SO_LINGER) {
|
||||
@@ -1992,7 +1966,6 @@ PHP_FUNCTION(setsockopt)
|
||||
struct linger lv;
|
||||
int ov;
|
||||
int optlen;
|
||||
|
||||
errno = 0;
|
||||
|
||||
if (ZEND_NUM_ARGS() != 4 ||
|
||||
@@ -2000,7 +1973,7 @@ PHP_FUNCTION(setsockopt)
|
||||
WRONG_PARAM_COUNT;
|
||||
}
|
||||
|
||||
v_convert_to_long_ex(3, fd, level, optname);
|
||||
multi_convert_to_long_ex(3, fd, level, optname);
|
||||
|
||||
if (Z_LVAL_PP(optname) == SO_LINGER) {
|
||||
HashTable *ht;
|
||||
@@ -2052,8 +2025,7 @@ PHP_FUNCTION(socketpair)
|
||||
zend_get_parameters_ex(4, &domain, &type, &protocol, &fds) == FAILURE) {
|
||||
WRONG_PARAM_COUNT;
|
||||
}
|
||||
|
||||
v_convert_to_long_ex(3, domain, type, protocol);
|
||||
multi_convert_to_long_ex(3, domain, type, protocol);
|
||||
|
||||
if (Z_LVAL_PP(domain) != AF_INET && Z_LVAL_PP(domain) != AF_UNIX) {
|
||||
php_error(E_WARNING, "invalid socket domain specified -- assuming AF_INET");
|
||||
@@ -2089,7 +2061,6 @@ PHP_FUNCTION(socketpair)
|
||||
|
||||
/* {{{ proto int shutdown(int fd, int how)
|
||||
Shuts down a socket for receiving, sending, or both. */
|
||||
|
||||
PHP_FUNCTION(shutdown)
|
||||
{
|
||||
zval **fd, **how;
|
||||
|
||||
@@ -393,10 +393,10 @@ function_entry basic_functions[] = {
|
||||
PHP_FE(fgets, NULL)
|
||||
PHP_FE(fgetss, NULL)
|
||||
PHP_FE(fread, NULL)
|
||||
PHP_FE(fopen, NULL)
|
||||
PHP_STATIC_FE("fopen", php_if_fopen, NULL)
|
||||
PHP_FE(fpassthru, NULL)
|
||||
PHP_FE(ftruncate, NULL)
|
||||
PHP_FE(fstat, NULL)
|
||||
PHP_STATIC_FE("ftruncate", php_if_ftruncate, NULL)
|
||||
PHP_STATIC_FE("fstat", php_if_fstat, NULL)
|
||||
PHP_FE(fseek, NULL)
|
||||
PHP_FE(ftell, NULL)
|
||||
PHP_FE(fflush, NULL)
|
||||
@@ -406,7 +406,7 @@ function_entry basic_functions[] = {
|
||||
PHP_FE(rename, NULL)
|
||||
PHP_FE(copy, NULL)
|
||||
PHP_FE(tempnam, NULL)
|
||||
PHP_FE(tmpfile, NULL)
|
||||
PHP_STATIC_FE("tmpfile", php_if_tmpfile, NULL)
|
||||
PHP_FE(file, NULL)
|
||||
PHP_FE(fgetcsv, NULL)
|
||||
PHP_FE(flock, NULL)
|
||||
@@ -452,7 +452,7 @@ function_entry basic_functions[] = {
|
||||
PHP_FE(chdir, NULL)
|
||||
PHP_FE(getcwd, NULL)
|
||||
PHP_FE(rewinddir, NULL)
|
||||
PHP_FE(readdir, NULL)
|
||||
PHP_STATIC_FE("readdir", php_if_readdir, NULL)
|
||||
PHP_FALIAS(dir, getdir, NULL)
|
||||
|
||||
/* functions from filestat.c */
|
||||
@@ -473,8 +473,8 @@ function_entry basic_functions[] = {
|
||||
PHP_FE(is_file, NULL)
|
||||
PHP_FE(is_dir, NULL)
|
||||
PHP_FE(is_link, NULL)
|
||||
PHP_FE(stat, NULL)
|
||||
PHP_FE(lstat, NULL)
|
||||
PHP_STATIC_FE("stat", php_if_stat, NULL)
|
||||
PHP_STATIC_FE("lstat", php_if_lstat, NULL)
|
||||
PHP_FE(chown, NULL)
|
||||
PHP_FE(chgrp, NULL)
|
||||
PHP_FE(chmod, NULL)
|
||||
@@ -1615,7 +1615,7 @@ PHP_FUNCTION(call_user_method)
|
||||
SEPARATE_ZVAL(params[0]);
|
||||
SEPARATE_ZVAL(params[1]);
|
||||
convert_to_string(*params[0]);
|
||||
if (call_user_function_ex(CG(function_table), *params[1], *params[0], &retval_ptr, arg_count-2, params+2, 1, NULL)==SUCCESS
|
||||
if (call_user_function_ex(CG(function_table), params[1], *params[0], &retval_ptr, arg_count-2, params+2, 1, NULL)==SUCCESS
|
||||
&& retval_ptr) {
|
||||
COPY_PZVAL_TO_ZVAL(*return_value, retval_ptr);
|
||||
} else {
|
||||
|
||||
@@ -779,9 +779,9 @@ PHP_FUNCTION(strtotime)
|
||||
if (argc == 2) {
|
||||
convert_to_long_ex(z_now);
|
||||
now = Z_LVAL_PP(z_now);
|
||||
RETURN_LONG(parse_date(Z_STRVAL_PP(z_time), &now));
|
||||
RETURN_LONG(php_parse_date(Z_STRVAL_PP(z_time), &now));
|
||||
} else {
|
||||
RETURN_LONG(parse_date(Z_STRVAL_PP(z_time), NULL));
|
||||
RETURN_LONG(php_parse_date(Z_STRVAL_PP(z_time), NULL));
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
+2
-2
@@ -92,7 +92,7 @@ static zend_class_entry *dir_class_entry_ptr;
|
||||
static zend_function_entry php_dir_class_functions[] = {
|
||||
PHP_FALIAS(close, closedir, NULL)
|
||||
PHP_FALIAS(rewind, rewinddir, NULL)
|
||||
PHP_FALIAS(read, readdir, NULL)
|
||||
PHP_STATIC_FE("read", php_if_readdir, NULL)
|
||||
{NULL, NULL, NULL}
|
||||
};
|
||||
|
||||
@@ -294,7 +294,7 @@ PHP_FUNCTION(rewinddir)
|
||||
/* {{{ proto string readdir([int dir_handle])
|
||||
Read directory entry from dir_handle */
|
||||
|
||||
PHP_FUNCTION(readdir)
|
||||
PHP_NAMED_FUNCTION(php_if_readdir)
|
||||
{
|
||||
pval **id, **tmp, *myself;
|
||||
php_dir *dirp;
|
||||
|
||||
+9
-9
@@ -500,7 +500,7 @@ PHP_FUNCTION(tempnam)
|
||||
/* }}} */
|
||||
/* {{{ proto int tmpfile(void)
|
||||
Create a temporary file that will be deleted automatically after use */
|
||||
PHP_FUNCTION(tmpfile)
|
||||
PHP_NAMED_FUNCTION(php_if_tmpfile)
|
||||
{
|
||||
FILE *fp;
|
||||
if (ARG_COUNT(ht) != 0) {
|
||||
@@ -518,7 +518,7 @@ PHP_FUNCTION(tmpfile)
|
||||
/* {{{ proto int fopen(string filename, string mode [, int use_include_path])
|
||||
Open a file or a URL and return a file pointer */
|
||||
|
||||
PHP_FUNCTION(fopen)
|
||||
PHP_NAMED_FUNCTION(php_if_fopen)
|
||||
{
|
||||
pval **arg1, **arg2, **arg3;
|
||||
FILE *fp;
|
||||
@@ -1552,7 +1552,7 @@ PHP_FUNCTION(unlink)
|
||||
|
||||
/* {{{ proto int ftruncate (int fp, int size)
|
||||
Truncate file to 'size' length */
|
||||
PHP_FUNCTION(ftruncate)
|
||||
PHP_NAMED_FUNCTION(php_if_ftruncate)
|
||||
{
|
||||
zval **fp , **size;
|
||||
short int ret;
|
||||
@@ -1581,7 +1581,7 @@ PHP_FUNCTION(ftruncate)
|
||||
|
||||
/* {{{ proto int fstat(int fp)
|
||||
Stat() on a filehandle */
|
||||
PHP_FUNCTION(fstat)
|
||||
PHP_NAMED_FUNCTION(php_if_fstat)
|
||||
{
|
||||
zval **fp;
|
||||
int type;
|
||||
@@ -1741,7 +1741,7 @@ PHP_FUNCTION(fread)
|
||||
}
|
||||
|
||||
/* }}} */
|
||||
/* {{{ proto array fgetcsv(int fp, int length)
|
||||
/* {{{ proto array fgetcsv(int fp, int length [, string delimiter])
|
||||
Get line from file pointer and parse for CSV fields */
|
||||
|
||||
PHP_FUNCTION(fgetcsv) {
|
||||
@@ -1813,7 +1813,7 @@ PHP_FUNCTION(fgetcsv) {
|
||||
lineEnd = emalloc(sizeof(char) * (len + 1));
|
||||
bptr = buf;
|
||||
tptr = buf + strlen(buf) -1;
|
||||
while ( isspace((int)*tptr) && (tptr > bptr) ) tptr--;
|
||||
while ( isspace((int)*tptr) && (*tptr!=delimiter) && (tptr > bptr) ) tptr--;
|
||||
tptr++;
|
||||
strcpy(lineEnd, tptr);
|
||||
|
||||
@@ -1839,7 +1839,7 @@ PHP_FUNCTION(fgetcsv) {
|
||||
|
||||
do {
|
||||
/* 1. Strip any leading space */
|
||||
while(isspace((int)*bptr)) bptr++;
|
||||
while(isspace((int)*bptr) && (*bptr!=delimiter)) bptr++;
|
||||
/* 2. Read field, leaving bptr pointing at start of next field */
|
||||
if (*bptr == '"') {
|
||||
/* 2A. handle quote delimited field */
|
||||
@@ -1874,7 +1874,7 @@ PHP_FUNCTION(fgetcsv) {
|
||||
}
|
||||
bptr = buf;
|
||||
tptr = buf + strlen(buf) -1;
|
||||
while ( isspace((int)*tptr) && (tptr > bptr) ) tptr--;
|
||||
while ( isspace((int)*tptr) && (*tptr!=delimiter) && (tptr > bptr) ) tptr--;
|
||||
tptr++; strcpy(lineEnd, tptr);
|
||||
*tptr++ = ' '; *tptr = 0;
|
||||
|
||||
@@ -1889,7 +1889,7 @@ PHP_FUNCTION(fgetcsv) {
|
||||
*tptr=0; /* terminate temporary string */
|
||||
if (strlen(temp)) {
|
||||
tptr--;
|
||||
while (isspace((int)*tptr)) *tptr-- = 0; /* strip any trailing spaces */
|
||||
while (isspace((int)*tptr) && (*tptr!=delimiter)) *tptr-- = 0; /* strip any trailing spaces */
|
||||
}
|
||||
if (*bptr == delimiter) bptr++;
|
||||
}
|
||||
|
||||
+4
-4
@@ -26,8 +26,8 @@
|
||||
extern PHP_MINIT_FUNCTION(file);
|
||||
|
||||
PHP_FUNCTION(tempnam);
|
||||
PHP_FUNCTION(tmpfile);
|
||||
PHP_FUNCTION(fopen);
|
||||
PHP_NAMED_FUNCTION(php_if_tmpfile);
|
||||
PHP_NAMED_FUNCTION(php_if_fopen);
|
||||
PHP_FUNCTION(fclose);
|
||||
PHP_FUNCTION(popen);
|
||||
PHP_FUNCTION(pclose);
|
||||
@@ -63,8 +63,8 @@ PHP_FUNCTION(fd_set);
|
||||
PHP_FUNCTION(fd_isset);
|
||||
PHP_FUNCTION(select);
|
||||
PHP_FUNCTION(realpath);
|
||||
PHP_FUNCTION(ftruncate);
|
||||
PHP_FUNCTION(fstat);
|
||||
PHP_NAMED_FUNCTION(php_if_ftruncate);
|
||||
PHP_NAMED_FUNCTION(php_if_fstat);
|
||||
|
||||
PHPAPI int php_set_sock_blocking(int socketd, int block);
|
||||
PHPAPI int php_file_le_fopen(void);
|
||||
|
||||
@@ -709,12 +709,12 @@ FileFunction(PHP_FN(file_exists),15)
|
||||
|
||||
/* {{{ proto array lstat(string filename)
|
||||
Give information about a file or symbolic link */
|
||||
FileFunction(PHP_FN(lstat),16)
|
||||
FileFunction(php_if_lstat,16)
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto array stat(string filename)
|
||||
Give information about a file */
|
||||
FileFunction(PHP_FN(stat),17)
|
||||
FileFunction(php_if_stat,17)
|
||||
/* }}} */
|
||||
|
||||
/*
|
||||
|
||||
+39
-39
@@ -84,44 +84,44 @@
|
||||
then those parser generators need to be fixed instead of adding those
|
||||
names to this list. */
|
||||
|
||||
#define yymaxdepth gd_maxdepth
|
||||
#define yyparse gd_parse
|
||||
#define yylex gd_lex
|
||||
#define yyerror gd_error
|
||||
#define yylval gd_lval
|
||||
#define yychar gd_char
|
||||
#define yydebug gd_debug
|
||||
#define yypact gd_pact
|
||||
#define yyr1 gd_r1
|
||||
#define yyr2 gd_r2
|
||||
#define yydef gd_def
|
||||
#define yychk gd_chk
|
||||
#define yypgo gd_pgo
|
||||
#define yyact gd_act
|
||||
#define yyexca gd_exca
|
||||
#define yyerrflag gd_errflag
|
||||
#define yynerrs gd_nerrs
|
||||
#define yyps gd_ps
|
||||
#define yypv gd_pv
|
||||
#define yys gd_s
|
||||
#define yy_yys gd_yys
|
||||
#define yystate gd_state
|
||||
#define yytmp gd_tmp
|
||||
#define yyv gd_v
|
||||
#define yy_yyv gd_yyv
|
||||
#define yyval gd_val
|
||||
#define yylloc gd_lloc
|
||||
#define yyreds gd_reds /* With YYDEBUG defined */
|
||||
#define yytoks gd_toks /* With YYDEBUG defined */
|
||||
#define yylhs gd_yylhs
|
||||
#define yylen gd_yylen
|
||||
#define yydefred gd_yydefred
|
||||
#define yydgoto gd_yydgoto
|
||||
#define yysindex gd_yysindex
|
||||
#define yyrindex gd_yyrindex
|
||||
#define yygindex gd_yygindex
|
||||
#define yytable gd_yytable
|
||||
#define yycheck gd_yycheck
|
||||
#define yymaxdepth php_gd_maxdepth
|
||||
#define yyparse php_gd_parse
|
||||
#define yylex php_gd_lex
|
||||
#define yyerror php_gd_error
|
||||
#define yylval php_gd_lval
|
||||
#define yychar php_gd_char
|
||||
#define yydebug php_gd_debug
|
||||
#define yypact php_gd_pact
|
||||
#define yyr1 php_gd_r1
|
||||
#define yyr2 php_gd_r2
|
||||
#define yydef php_gd_def
|
||||
#define yychk php_gd_chk
|
||||
#define yypgo php_gd_pgo
|
||||
#define yyact php_gd_act
|
||||
#define yyexca php_gd_exca
|
||||
#define yyerrflag php_gd_errflag
|
||||
#define yynerrs php_gd_nerrs
|
||||
#define yyps php_gd_ps
|
||||
#define yypv php_gd_pv
|
||||
#define yys php_gd_s
|
||||
#define yy_yys php_gd_yys
|
||||
#define yystate php_gd_state
|
||||
#define yytmp php_gd_tmp
|
||||
#define yyv php_gd_v
|
||||
#define yy_yyv php_gd_yyv
|
||||
#define yyval php_gd_val
|
||||
#define yylloc php_gd_lloc
|
||||
#define yyreds php_gd_reds /* With YYDEBUG defined */
|
||||
#define yytoks php_gd_toks /* With YYDEBUG defined */
|
||||
#define yylhs php_gd_yylhs
|
||||
#define yylen php_gd_yylen
|
||||
#define yydefred php_gd_yydefred
|
||||
#define yydgoto php_gd_yydgoto
|
||||
#define yysindex php_gd_yysindex
|
||||
#define yyrindex php_gd_yyrindex
|
||||
#define yygindex php_gd_yygindex
|
||||
#define yytable php_gd_yytable
|
||||
#define yycheck php_gd_yycheck
|
||||
|
||||
static int yylex ();
|
||||
static int yyerror ();
|
||||
@@ -905,7 +905,7 @@ difftm (struct tm *a, struct tm *b)
|
||||
+ (a->tm_sec - b->tm_sec));
|
||||
}
|
||||
|
||||
time_t parse_date(char *p, time_t *now)
|
||||
time_t php_parse_date(char *p, time_t *now)
|
||||
{
|
||||
struct tm tm, tm0, *tmp;
|
||||
time_t Start;
|
||||
|
||||
@@ -30,7 +30,7 @@ PHP_FUNCTION(closedir);
|
||||
PHP_FUNCTION(chdir);
|
||||
PHP_FUNCTION(getcwd);
|
||||
PHP_FUNCTION(rewinddir);
|
||||
PHP_FUNCTION(readdir);
|
||||
PHP_NAMED_FUNCTION(php_if_readdir);
|
||||
PHP_FUNCTION(getdir);
|
||||
|
||||
#endif /* PHP_DIR_H */
|
||||
@@ -41,8 +41,8 @@ PHP_FUNCTION(is_file);
|
||||
PHP_FUNCTION(is_dir);
|
||||
PHP_FUNCTION(is_link);
|
||||
PHP_FUNCTION(file_exists);
|
||||
PHP_FUNCTION(stat);
|
||||
PHP_FUNCTION(lstat);
|
||||
PHP_NAMED_FUNCTION(php_if_stat);
|
||||
PHP_NAMED_FUNCTION(php_if_lstat);
|
||||
PHP_FUNCTION(diskfreespace);
|
||||
PHP_FUNCTION(chown);
|
||||
PHP_FUNCTION(chgrp);
|
||||
|
||||
@@ -21,6 +21,6 @@
|
||||
|
||||
#include <time.h>
|
||||
|
||||
time_t parse_date(char *p, time_t *now);
|
||||
time_t php_parse_date(char *p, time_t *now);
|
||||
|
||||
#endif
|
||||
@@ -1560,6 +1560,11 @@ PHP_FUNCTION(strtr)
|
||||
|
||||
convert_to_string_ex(str);
|
||||
|
||||
/* shortcut for empty string */
|
||||
if(Z_STRLEN_PP(str) == 0) {
|
||||
RETURN_EMPTY_STRING();
|
||||
}
|
||||
|
||||
if (ac == 2) {
|
||||
php_strtr_array(return_value,(*str)->value.str.val,(*str)->value.str.len,HASH_OF(*from));
|
||||
} else {
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
name value comment
|
||||
true 1 boolean true
|
||||
false 0 boolean false
|
||||
empty nothing
|
||||
@@ -0,0 +1,17 @@
|
||||
--TEST--
|
||||
fgetcsv() with tab delimited fields (BUG #8258)
|
||||
--POST--
|
||||
--GET--
|
||||
--FILE--
|
||||
<?php
|
||||
$fp=fopen("004.data","r");
|
||||
while($a=fgetcsv($fp,100,"\t")) {
|
||||
echo join(",",$a)."\n";
|
||||
}
|
||||
fclose($fp);
|
||||
?>
|
||||
--EXPECT--
|
||||
name,value,comment
|
||||
true,1,boolean true
|
||||
false,0,boolean false
|
||||
empty,,nothing
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Generated by re2c 0.5 on Fri Nov 17 17:26:38 2000 */
|
||||
/* Generated by re2c 0.5 on Tue Dec 5 11:55:45 2000 */
|
||||
#line 1 "/home/sas/src/php4/ext/standard/url_scanner_ex.re"
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
@@ -163,18 +163,23 @@ enum {
|
||||
#define YYMARKER q
|
||||
#define STATE ctx->state
|
||||
|
||||
#define PASSTHRU() {\
|
||||
smart_str_appendl(&ctx->result, start, YYCURSOR - start); \
|
||||
#define STD_PARA url_adapt_state_ex_t *ctx, char *start, char *YYCURSOR PLS_DC
|
||||
#define STD_ARGS ctx, start, xp PLS_CC
|
||||
|
||||
static inline void passthru(STD_PARA)
|
||||
{
|
||||
smart_str_appendl(&ctx->result, start, YYCURSOR - start);
|
||||
}
|
||||
|
||||
#define HANDLE_FORM() {\
|
||||
if (ctx->tag.len == 4 && strncasecmp(ctx->tag.c, "form", 4) == 0) {\
|
||||
smart_str_appends(&ctx->result, "<INPUT TYPE=\"HIDDEN\" NAME=\""); \
|
||||
smart_str_append(&ctx->result, &ctx->q_name); \
|
||||
smart_str_appends(&ctx->result, "\" VALUE=\""); \
|
||||
smart_str_append(&ctx->result, &ctx->q_value); \
|
||||
smart_str_appends(&ctx->result, "\">"); \
|
||||
} \
|
||||
static inline void handle_form(STD_PARA)
|
||||
{
|
||||
if (ctx->tag.len == 4 && strncasecmp(ctx->tag.c, "form", 4) == 0) {
|
||||
smart_str_appends(&ctx->result, "<INPUT TYPE=\"HIDDEN\" NAME=\"");
|
||||
smart_str_append(&ctx->result, &ctx->q_name);
|
||||
smart_str_appends(&ctx->result, "\" VALUE=\"");
|
||||
smart_str_append(&ctx->result, &ctx->q_value);
|
||||
smart_str_appends(&ctx->result, "\">");
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -184,25 +189,30 @@ enum {
|
||||
* HTML stuff to the result buffer.
|
||||
*/
|
||||
|
||||
#define HANDLE_TAG() {\
|
||||
int ok = 0; \
|
||||
int i; \
|
||||
ctx->tag.len = 0; \
|
||||
smart_str_appendl(&ctx->tag, start, YYCURSOR - start); \
|
||||
for (i = 0; i < ctx->tag.len; i++) \
|
||||
ctx->tag.c[i] = tolower(ctx->tag.c[i]); \
|
||||
if (zend_hash_find(ctx->tags, ctx->tag.c, ctx->tag.len, (void **) &ctx->lookup_data) == SUCCESS) \
|
||||
ok = 1; \
|
||||
STATE = ok ? STATE_NEXT_ARG : STATE_PLAIN; \
|
||||
static inline void handle_tag(STD_PARA)
|
||||
{
|
||||
int ok = 0;
|
||||
int i;
|
||||
|
||||
ctx->tag.len = 0;
|
||||
smart_str_appendl(&ctx->tag, start, YYCURSOR - start);
|
||||
for (i = 0; i < ctx->tag.len; i++)
|
||||
ctx->tag.c[i] = tolower(ctx->tag.c[i]);
|
||||
if (zend_hash_find(ctx->tags, ctx->tag.c, ctx->tag.len, (void **) &ctx->lookup_data) == SUCCESS)
|
||||
ok = 1;
|
||||
STATE = ok ? STATE_NEXT_ARG : STATE_PLAIN;
|
||||
}
|
||||
|
||||
#define HANDLE_ARG() {\
|
||||
ctx->arg.len = 0; \
|
||||
smart_str_appendl(&ctx->arg, start, YYCURSOR - start); \
|
||||
static inline void handle_arg(STD_PARA)
|
||||
{
|
||||
ctx->arg.len = 0;
|
||||
smart_str_appendl(&ctx->arg, start, YYCURSOR - start);
|
||||
}
|
||||
#define HANDLE_VAL(quotes, type) {\
|
||||
smart_str_setl(&ctx->val, start + quotes, YYCURSOR - start - quotes * 2); \
|
||||
tag_arg(ctx, type PLS_CC); \
|
||||
|
||||
static inline void handle_val(STD_PARA, char quotes, char type)
|
||||
{
|
||||
smart_str_setl(&ctx->val, start + quotes, YYCURSOR - start - quotes * 2);
|
||||
tag_arg(ctx, type PLS_CC);
|
||||
}
|
||||
|
||||
#ifdef SCANNER_DEBUG
|
||||
@@ -224,7 +234,7 @@ static inline void mainloop(url_adapt_state_ex_t *ctx, const char *newdata, size
|
||||
YYCURSOR = ctx->buf.c;
|
||||
YYLIMIT = ctx->buf.c + ctx->buf.len;
|
||||
|
||||
#line 228
|
||||
#line 238
|
||||
|
||||
|
||||
while(1) {
|
||||
@@ -244,14 +254,14 @@ yy0:
|
||||
if(yych != '<') goto yy4;
|
||||
yy2: yych = *++YYCURSOR;
|
||||
yy3:
|
||||
#line 237
|
||||
{ PASSTHRU(); STATE = STATE_TAG; continue; }
|
||||
#line 247
|
||||
{ passthru(STD_ARGS); STATE = STATE_TAG; continue; }
|
||||
yy4: yych = *++YYCURSOR;
|
||||
yy5:
|
||||
#line 238
|
||||
{ PASSTHRU(); continue; }
|
||||
#line 248
|
||||
{ passthru(STD_ARGS); continue; }
|
||||
}
|
||||
#line 239
|
||||
#line 249
|
||||
|
||||
break;
|
||||
|
||||
@@ -305,19 +315,19 @@ yy6:
|
||||
yy8: yych = *++YYCURSOR;
|
||||
goto yy13;
|
||||
yy9:
|
||||
#line 244
|
||||
{ HANDLE_TAG() /* Sets STATE */; PASSTHRU(); continue; }
|
||||
#line 254
|
||||
{ handle_tag(STD_ARGS); /* Sets STATE */; passthru(STD_ARGS); continue; }
|
||||
yy10: yych = *++YYCURSOR;
|
||||
yy11:
|
||||
#line 245
|
||||
{ PASSTHRU(); STATE = STATE_PLAIN; continue; }
|
||||
#line 255
|
||||
{ passthru(STD_ARGS); STATE = STATE_PLAIN; continue; }
|
||||
yy12: ++YYCURSOR;
|
||||
if(YYLIMIT == YYCURSOR) YYFILL(1);
|
||||
yych = *YYCURSOR;
|
||||
yy13: if(yybm[0+yych] & 128) goto yy12;
|
||||
goto yy9;
|
||||
}
|
||||
#line 246
|
||||
#line 256
|
||||
|
||||
break;
|
||||
|
||||
@@ -351,22 +361,22 @@ yy14:
|
||||
}
|
||||
yy16: yych = *++YYCURSOR;
|
||||
yy17:
|
||||
#line 251
|
||||
{ PASSTHRU(); HANDLE_FORM(); STATE = STATE_PLAIN; continue; }
|
||||
#line 261
|
||||
{ passthru(STD_ARGS); handle_form(STD_ARGS); STATE = STATE_PLAIN; continue; }
|
||||
yy18: yych = *++YYCURSOR;
|
||||
yy19:
|
||||
#line 252
|
||||
{ PASSTHRU(); continue; }
|
||||
#line 262
|
||||
{ passthru(STD_ARGS); continue; }
|
||||
yy20: yych = *++YYCURSOR;
|
||||
yy21:
|
||||
#line 253
|
||||
#line 263
|
||||
{ YYCURSOR--; STATE = STATE_ARG; continue; }
|
||||
yy22: yych = *++YYCURSOR;
|
||||
yy23:
|
||||
#line 254
|
||||
{ PASSTHRU(); STATE = STATE_PLAIN; continue; }
|
||||
#line 264
|
||||
{ passthru(STD_ARGS); STATE = STATE_PLAIN; continue; }
|
||||
}
|
||||
#line 255
|
||||
#line 265
|
||||
|
||||
break;
|
||||
|
||||
@@ -420,19 +430,19 @@ yy24:
|
||||
yy26: yych = *++YYCURSOR;
|
||||
goto yy31;
|
||||
yy27:
|
||||
#line 260
|
||||
{ PASSTHRU(); HANDLE_ARG(); STATE = STATE_BEFORE_VAL; continue; }
|
||||
#line 270
|
||||
{ passthru(STD_ARGS); handle_arg(STD_ARGS); STATE = STATE_BEFORE_VAL; continue; }
|
||||
yy28: yych = *++YYCURSOR;
|
||||
yy29:
|
||||
#line 261
|
||||
{ PASSTHRU(); STATE = STATE_NEXT_ARG; continue; }
|
||||
#line 271
|
||||
{ passthru(STD_ARGS); STATE = STATE_NEXT_ARG; continue; }
|
||||
yy30: ++YYCURSOR;
|
||||
if(YYLIMIT == YYCURSOR) YYFILL(1);
|
||||
yych = *YYCURSOR;
|
||||
yy31: if(yybm[0+yych] & 128) goto yy30;
|
||||
goto yy27;
|
||||
}
|
||||
#line 262
|
||||
#line 272
|
||||
|
||||
|
||||
case STATE_BEFORE_VAL:
|
||||
@@ -486,13 +496,13 @@ yy34: yyaccept = 0;
|
||||
if(yych == ' ') goto yy41;
|
||||
if(yych == '=') goto yy39;
|
||||
yy35:
|
||||
#line 267
|
||||
#line 277
|
||||
{ YYCURSOR--; STATE = STATE_NEXT_ARG; continue; }
|
||||
yy36: yych = *++YYCURSOR;
|
||||
goto yy40;
|
||||
yy37:
|
||||
#line 266
|
||||
{ PASSTHRU(); STATE = STATE_VAL; continue; }
|
||||
#line 276
|
||||
{ passthru(STD_ARGS); STATE = STATE_VAL; continue; }
|
||||
yy38: yych = *++YYCURSOR;
|
||||
goto yy35;
|
||||
yy39: ++YYCURSOR;
|
||||
@@ -510,7 +520,7 @@ yy43: YYCURSOR = YYMARKER;
|
||||
case 0: goto yy35;
|
||||
}
|
||||
}
|
||||
#line 268
|
||||
#line 278
|
||||
|
||||
break;
|
||||
|
||||
@@ -579,14 +589,14 @@ yy46: yyaccept = 0;
|
||||
yych = *(YYMARKER = ++YYCURSOR);
|
||||
if(yych != '>') goto yy63;
|
||||
yy47:
|
||||
#line 276
|
||||
{ PASSTHRU(); STATE = STATE_NEXT_ARG; continue; }
|
||||
#line 286
|
||||
{ passthru(STD_ARGS); STATE = STATE_NEXT_ARG; continue; }
|
||||
yy48: yyaccept = 1;
|
||||
yych = *(YYMARKER = ++YYCURSOR);
|
||||
goto yy55;
|
||||
yy49:
|
||||
#line 275
|
||||
{ HANDLE_VAL(0, '"'); STATE = STATE_NEXT_ARG; continue; }
|
||||
#line 285
|
||||
{ handle_val(STD_ARGS, 0, '"'); STATE = STATE_NEXT_ARG; continue; }
|
||||
yy50: yych = *++YYCURSOR;
|
||||
goto yy53;
|
||||
yy51: yych = *++YYCURSOR;
|
||||
@@ -606,8 +616,8 @@ yy55: if(yybm[0+yych] & 32) goto yy54;
|
||||
yy56: yych = *++YYCURSOR;
|
||||
if(yybm[0+yych] & 16) goto yy52;
|
||||
yy57:
|
||||
#line 274
|
||||
{ HANDLE_VAL(1, '\''); STATE = STATE_NEXT_ARG; continue; }
|
||||
#line 284
|
||||
{ handle_val(STD_ARGS, 1, '\''); STATE = STATE_NEXT_ARG; continue; }
|
||||
yy58: ++YYCURSOR;
|
||||
if(YYLIMIT == YYCURSOR) YYFILL(1);
|
||||
yych = *YYCURSOR;
|
||||
@@ -627,10 +637,10 @@ yy63: if(yybm[0+yych] & 128) goto yy62;
|
||||
if(yych >= '>') goto yy60;
|
||||
yy64: yych = *++YYCURSOR;
|
||||
yy65:
|
||||
#line 273
|
||||
{ HANDLE_VAL(1, '"'); STATE = STATE_NEXT_ARG; continue; }
|
||||
#line 283
|
||||
{ handle_val(STD_ARGS, 1, '"'); STATE = STATE_NEXT_ARG; continue; }
|
||||
}
|
||||
#line 277
|
||||
#line 287
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -161,18 +161,23 @@ enum {
|
||||
#define YYMARKER q
|
||||
#define STATE ctx->state
|
||||
|
||||
#define PASSTHRU() {\
|
||||
smart_str_appendl(&ctx->result, start, YYCURSOR - start); \
|
||||
#define STD_PARA url_adapt_state_ex_t *ctx, char *start, char *YYCURSOR PLS_DC
|
||||
#define STD_ARGS ctx, start, xp PLS_CC
|
||||
|
||||
static inline void passthru(STD_PARA)
|
||||
{
|
||||
smart_str_appendl(&ctx->result, start, YYCURSOR - start);
|
||||
}
|
||||
|
||||
#define HANDLE_FORM() {\
|
||||
if (ctx->tag.len == 4 && strncasecmp(ctx->tag.c, "form", 4) == 0) {\
|
||||
smart_str_appends(&ctx->result, "<INPUT TYPE=\"HIDDEN\" NAME=\""); \
|
||||
smart_str_append(&ctx->result, &ctx->q_name); \
|
||||
smart_str_appends(&ctx->result, "\" VALUE=\""); \
|
||||
smart_str_append(&ctx->result, &ctx->q_value); \
|
||||
smart_str_appends(&ctx->result, "\">"); \
|
||||
} \
|
||||
static inline void handle_form(STD_PARA)
|
||||
{
|
||||
if (ctx->tag.len == 4 && strncasecmp(ctx->tag.c, "form", 4) == 0) {
|
||||
smart_str_appends(&ctx->result, "<INPUT TYPE=\"HIDDEN\" NAME=\"");
|
||||
smart_str_append(&ctx->result, &ctx->q_name);
|
||||
smart_str_appends(&ctx->result, "\" VALUE=\"");
|
||||
smart_str_append(&ctx->result, &ctx->q_value);
|
||||
smart_str_appends(&ctx->result, "\">");
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -182,25 +187,30 @@ enum {
|
||||
* HTML stuff to the result buffer.
|
||||
*/
|
||||
|
||||
#define HANDLE_TAG() {\
|
||||
int ok = 0; \
|
||||
int i; \
|
||||
ctx->tag.len = 0; \
|
||||
smart_str_appendl(&ctx->tag, start, YYCURSOR - start); \
|
||||
for (i = 0; i < ctx->tag.len; i++) \
|
||||
ctx->tag.c[i] = tolower(ctx->tag.c[i]); \
|
||||
if (zend_hash_find(ctx->tags, ctx->tag.c, ctx->tag.len, (void **) &ctx->lookup_data) == SUCCESS) \
|
||||
ok = 1; \
|
||||
STATE = ok ? STATE_NEXT_ARG : STATE_PLAIN; \
|
||||
static inline void handle_tag(STD_PARA)
|
||||
{
|
||||
int ok = 0;
|
||||
int i;
|
||||
|
||||
ctx->tag.len = 0;
|
||||
smart_str_appendl(&ctx->tag, start, YYCURSOR - start);
|
||||
for (i = 0; i < ctx->tag.len; i++)
|
||||
ctx->tag.c[i] = tolower(ctx->tag.c[i]);
|
||||
if (zend_hash_find(ctx->tags, ctx->tag.c, ctx->tag.len, (void **) &ctx->lookup_data) == SUCCESS)
|
||||
ok = 1;
|
||||
STATE = ok ? STATE_NEXT_ARG : STATE_PLAIN;
|
||||
}
|
||||
|
||||
#define HANDLE_ARG() {\
|
||||
ctx->arg.len = 0; \
|
||||
smart_str_appendl(&ctx->arg, start, YYCURSOR - start); \
|
||||
static inline void handle_arg(STD_PARA)
|
||||
{
|
||||
ctx->arg.len = 0;
|
||||
smart_str_appendl(&ctx->arg, start, YYCURSOR - start);
|
||||
}
|
||||
#define HANDLE_VAL(quotes, type) {\
|
||||
smart_str_setl(&ctx->val, start + quotes, YYCURSOR - start - quotes * 2); \
|
||||
tag_arg(ctx, type PLS_CC); \
|
||||
|
||||
static inline void handle_val(STD_PARA, char quotes, char type)
|
||||
{
|
||||
smart_str_setl(&ctx->val, start + quotes, YYCURSOR - start - quotes * 2);
|
||||
tag_arg(ctx, type PLS_CC);
|
||||
}
|
||||
|
||||
#ifdef SCANNER_DEBUG
|
||||
@@ -234,46 +244,46 @@ alpha = [a-zA-Z];
|
||||
|
||||
case STATE_PLAIN:
|
||||
/*!re2c
|
||||
[<] { PASSTHRU(); STATE = STATE_TAG; continue; }
|
||||
(any\[<]) { PASSTHRU(); continue; }
|
||||
[<] { passthru(STD_ARGS); STATE = STATE_TAG; continue; }
|
||||
(any\[<]) { passthru(STD_ARGS); continue; }
|
||||
*/
|
||||
break;
|
||||
|
||||
case STATE_TAG:
|
||||
/*!re2c
|
||||
alpha+ { HANDLE_TAG() /* Sets STATE */; PASSTHRU(); continue; }
|
||||
any { PASSTHRU(); STATE = STATE_PLAIN; continue; }
|
||||
alpha+ { handle_tag(STD_ARGS); /* Sets STATE */; passthru(STD_ARGS); continue; }
|
||||
any { passthru(STD_ARGS); STATE = STATE_PLAIN; continue; }
|
||||
*/
|
||||
break;
|
||||
|
||||
case STATE_NEXT_ARG:
|
||||
/*!re2c
|
||||
">" { PASSTHRU(); HANDLE_FORM(); STATE = STATE_PLAIN; continue; }
|
||||
[ \n] { PASSTHRU(); continue; }
|
||||
">" { passthru(STD_ARGS); handle_form(STD_ARGS); STATE = STATE_PLAIN; continue; }
|
||||
[ \n] { passthru(STD_ARGS); continue; }
|
||||
alpha { YYCURSOR--; STATE = STATE_ARG; continue; }
|
||||
any { PASSTHRU(); STATE = STATE_PLAIN; continue; }
|
||||
any { passthru(STD_ARGS); STATE = STATE_PLAIN; continue; }
|
||||
*/
|
||||
break;
|
||||
|
||||
case STATE_ARG:
|
||||
/*!re2c
|
||||
alpha+ { PASSTHRU(); HANDLE_ARG(); STATE = STATE_BEFORE_VAL; continue; }
|
||||
any { PASSTHRU(); STATE = STATE_NEXT_ARG; continue; }
|
||||
alpha+ { passthru(STD_ARGS); handle_arg(STD_ARGS); STATE = STATE_BEFORE_VAL; continue; }
|
||||
any { passthru(STD_ARGS); STATE = STATE_NEXT_ARG; continue; }
|
||||
*/
|
||||
|
||||
case STATE_BEFORE_VAL:
|
||||
/*!re2c
|
||||
[ ]* "=" [ ]* { PASSTHRU(); STATE = STATE_VAL; continue; }
|
||||
[ ]* "=" [ ]* { passthru(STD_ARGS); STATE = STATE_VAL; continue; }
|
||||
any { YYCURSOR--; STATE = STATE_NEXT_ARG; continue; }
|
||||
*/
|
||||
break;
|
||||
|
||||
case STATE_VAL:
|
||||
/*!re2c
|
||||
["] (any\[">])* ["] { HANDLE_VAL(1, '"'); STATE = STATE_NEXT_ARG; continue; }
|
||||
['] (any\['>])* ['] { HANDLE_VAL(1, '\''); STATE = STATE_NEXT_ARG; continue; }
|
||||
(any\[ \n>"])+ { HANDLE_VAL(0, '"'); STATE = STATE_NEXT_ARG; continue; }
|
||||
any { PASSTHRU(); STATE = STATE_NEXT_ARG; continue; }
|
||||
["] (any\[">])* ["] { handle_val(STD_ARGS, 1, '"'); STATE = STATE_NEXT_ARG; continue; }
|
||||
['] (any\['>])* ['] { handle_val(STD_ARGS, 1, '\''); STATE = STATE_NEXT_ARG; continue; }
|
||||
(any\[ \n>"])+ { handle_val(STD_ARGS, 0, '"'); STATE = STATE_NEXT_ARG; continue; }
|
||||
any { passthru(STD_ARGS); STATE = STATE_NEXT_ARG; continue; }
|
||||
*/
|
||||
break;
|
||||
}
|
||||
|
||||
+14
-8
@@ -16,7 +16,7 @@
|
||||
| Thies C. Arntzen <thies@thieso.net> |
|
||||
| Sascha Schumann <sascha@schumann.cx> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
*/
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
@@ -158,14 +158,21 @@ inline int php_add_var_hash(HashTable *var_hash, zval *var, void *var_old) {
|
||||
ulong var_no;
|
||||
char id[sizeof(void *)*2+3];
|
||||
|
||||
snprintf(id,sizeof(id)-1,"%p",var);
|
||||
snprintf(id,sizeof(id)-1, "%p", var);
|
||||
id[sizeof(id)-1]='\0';
|
||||
if(var_old && zend_hash_find(var_hash,id,sizeof(void *)*2,var_old) == SUCCESS) {
|
||||
|
||||
if(var_old && zend_hash_find(var_hash, id, sizeof(id), var_old) == SUCCESS) {
|
||||
if(!var->is_ref) {
|
||||
/* we still need to bump up the counter, since non-refs will
|
||||
be counted separately by unserializer */
|
||||
var_no = -1;
|
||||
zend_hash_next_index_insert(var_hash, &var_no, sizeof(var_no), NULL);
|
||||
}
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
var_no = zend_hash_num_elements(var_hash)+1; /* +1 because otherwise hash will think we are trying to store NULL pointer */
|
||||
zend_hash_add(var_hash,id,sizeof(void *)*2,&var_no,sizeof(var_no),NULL);
|
||||
zend_hash_add(var_hash, id, sizeof(id), &var_no, sizeof(var_no), NULL);
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
@@ -233,7 +240,7 @@ void php_var_serialize(pval *buf, pval **struc, HashTable *var_hash)
|
||||
MAKE_STD_ZVAL(fname);
|
||||
ZVAL_STRING(fname,"__sleep",1);
|
||||
|
||||
res = call_user_function_ex(CG(function_table), *struc, fname, &retval_ptr, 0, 0, 1, NULL);
|
||||
res = call_user_function_ex(CG(function_table), struc, fname, &retval_ptr, 0, 0, 1, NULL);
|
||||
|
||||
if (res == SUCCESS) {
|
||||
if (retval_ptr && HASH_OF(retval_ptr)) {
|
||||
@@ -263,9 +270,8 @@ void php_var_serialize(pval *buf, pval **struc, HashTable *var_hash)
|
||||
continue;
|
||||
}
|
||||
|
||||
php_var_serialize(buf, name, NULL);
|
||||
|
||||
if (zend_hash_find((*struc)->value.obj.properties,(*name)->value.str.val,(*name)->value.str.len+1,(void*)&d) == SUCCESS) {
|
||||
php_var_serialize(buf, name, NULL);
|
||||
php_var_serialize(buf,d,var_hash);
|
||||
}
|
||||
}
|
||||
@@ -591,7 +597,7 @@ int php_var_unserialize(pval **rval, const char **p, const char *max, HashTable
|
||||
MAKE_STD_ZVAL(fname);
|
||||
ZVAL_STRING(fname,"__wakeup",1);
|
||||
|
||||
call_user_function_ex(CG(function_table), *rval, fname, &retval_ptr, 0, 0, 1, NULL);
|
||||
call_user_function_ex(CG(function_table), rval, fname, &retval_ptr, 0, 0, 1, NULL);
|
||||
|
||||
zval_dtor(fname);
|
||||
FREE_ZVAL(fname);
|
||||
|
||||
@@ -151,6 +151,7 @@ PHP_MINIT_FUNCTION(swf)
|
||||
|
||||
PHP_RINIT_FUNCTION(swf)
|
||||
{
|
||||
SWFLS_FETCH();
|
||||
SWFG(use_file) = 0;
|
||||
|
||||
return SUCCESS;
|
||||
|
||||
+2
-2
@@ -424,7 +424,7 @@ static void php_wddx_serialize_object(wddx_packet *packet, zval *obj)
|
||||
* We try to call __sleep() method on object. It's supposed to return an
|
||||
* array of property names to be serialized.
|
||||
*/
|
||||
if (call_user_function_ex(CG(function_table), obj, fname, &retval, 0, 0, 1, NULL) == SUCCESS) {
|
||||
if (call_user_function_ex(CG(function_table), &obj, fname, &retval, 0, 0, 1, NULL) == SUCCESS) {
|
||||
if (retval && HASH_OF(retval)) {
|
||||
PHP_CLASS_ATTRIBUTES;
|
||||
|
||||
@@ -781,7 +781,7 @@ static void php_wddx_pop_element(void *user_data, const char *name)
|
||||
MAKE_STD_ZVAL(fname);
|
||||
ZVAL_STRING(fname, "__wakeup", 1);
|
||||
|
||||
call_user_function_ex(NULL, ent1->data, fname, &retval, 0, 0, 0, NULL);
|
||||
call_user_function_ex(NULL, &ent1->data, fname, &retval, 0, 0, 0, NULL);
|
||||
|
||||
zval_dtor(fname);
|
||||
FREE_ZVAL(fname);
|
||||
|
||||
+1
-1
@@ -358,7 +358,7 @@ xml_call_handler(xml_parser *parser, zval *handler, int argc, zval **argv)
|
||||
retval->type = IS_BOOL;
|
||||
retval->value.lval = 0;
|
||||
|
||||
result = call_user_function(EG(function_table), parser->object, handler, retval, argc, argv);
|
||||
result = call_user_function(EG(function_table), &parser->object, handler, retval, argc, argv);
|
||||
|
||||
if (result == FAILURE) {
|
||||
zval **method;
|
||||
|
||||
@@ -1105,6 +1105,9 @@ cygwin* | mingw*)
|
||||
with_gnu_ld=no
|
||||
fi
|
||||
;;
|
||||
openbsd*)
|
||||
with_gnu_ld=no
|
||||
;;
|
||||
|
||||
esac
|
||||
|
||||
@@ -1402,10 +1405,18 @@ else
|
||||
;;
|
||||
|
||||
openbsd*)
|
||||
archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linkopts'
|
||||
hardcode_libdir_flag_spec='-R$libdir'
|
||||
hardcode_direct=yes
|
||||
hardcode_shlibpath_var=no
|
||||
case "$host_os" in
|
||||
openbsd2.[01234567])
|
||||
archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linkopts'
|
||||
hardcode_libdir_flag_spec='-R$libdir'
|
||||
;;
|
||||
*)
|
||||
archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $linkopts'
|
||||
hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
|
||||
os2*)
|
||||
@@ -1936,8 +1947,7 @@ hpux9* | hpux10* | hpux11*)
|
||||
# HP-UX runs *really* slowly unless shared libraries are mode 555.
|
||||
postinstall_cmds='chmod 555 $lib'
|
||||
case "$host_os" in
|
||||
hpux10.20*)
|
||||
# TODO: Does this work for hpux-11 too?
|
||||
hpux10.20*|hpux11*)
|
||||
deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9].[0-9]) shared library'
|
||||
file_magic_cmd=/usr/bin/file
|
||||
file_magic_test_file=/usr/lib/libc.sl
|
||||
@@ -2019,13 +2029,10 @@ netbsd*)
|
||||
|
||||
openbsd*)
|
||||
version_type=sunos
|
||||
if test "$with_gnu_ld" = yes; then
|
||||
need_lib_prefix=no
|
||||
need_version=no
|
||||
fi
|
||||
library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix'
|
||||
finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
|
||||
shlibpath_var=LD_LIBRARY_PATH
|
||||
deplibs_check_method='pass_all'
|
||||
;;
|
||||
|
||||
os2*)
|
||||
|
||||
+1
-4
@@ -34,10 +34,6 @@
|
||||
#include "zend.h"
|
||||
#include "php_compat.h"
|
||||
|
||||
/* automake defines PACKAGE and VERSION for Zend too */
|
||||
#undef PACKAGE
|
||||
#undef VERSION
|
||||
|
||||
#include "zend_API.h"
|
||||
|
||||
#if PHP_BROKEN_SPRINTF
|
||||
@@ -219,6 +215,7 @@ char *strerror(int);
|
||||
#define PHP_NAMED_FE(php_name, name, arg_types) { #php_name, name, arg_types },
|
||||
#define PHP_FE(name, arg_types) PHP_NAMED_FE(name, PHP_FN(name), arg_types)
|
||||
#define PHP_FALIAS(name, alias, arg_types) PHP_NAMED_FE(name, PHP_FN(alias), arg_types)
|
||||
#define PHP_STATIC_FE(php_name, func_name, arg_types) { php_name, func_name, arg_types },
|
||||
|
||||
#define PHP_MINIT(module) php_minit_##module
|
||||
#define PHP_MSHUTDOWN(module) php_mshutdown_##module
|
||||
|
||||
+6
-7
@@ -33,15 +33,14 @@ HashTable phpinfo_logo_hash;
|
||||
|
||||
PHPAPI int php_register_info_logo(char *logo_string, char *mimetype, unsigned char *data, int size)
|
||||
{
|
||||
php_info_logo *info_logo = (php_info_logo *)malloc(sizeof(php_info_logo));
|
||||
php_info_logo info_logo;
|
||||
|
||||
if(!info_logo) return FAILURE;
|
||||
info_logo->mimetype = mimetype;
|
||||
info_logo->mimelen = strlen(mimetype);
|
||||
info_logo->data = data;
|
||||
info_logo->size = size;
|
||||
info_logo.mimetype = mimetype;
|
||||
info_logo.mimelen = strlen(mimetype);
|
||||
info_logo.data = data;
|
||||
info_logo.size = size;
|
||||
|
||||
return zend_hash_add(&phpinfo_logo_hash, logo_string, strlen(logo_string), info_logo, sizeof(php_info_logo), NULL);
|
||||
return zend_hash_add(&phpinfo_logo_hash, logo_string, strlen(logo_string), &info_logo, sizeof(php_info_logo), NULL);
|
||||
}
|
||||
|
||||
PHPAPI int php_unregister_info_logos(char *logo_string)
|
||||
|
||||
@@ -1,283 +0,0 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| PHP version 4.0 |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1997, 1998, 1999, 2000 The PHP Group |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.02 of the PHP license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
| available at through the world-wide-web at |
|
||||
| http://www.php.net/license/2_02.txt. |
|
||||
| If you did not receive a copy of the PHP license and are unable to |
|
||||
| obtain it through the world-wide-web, please send a note to |
|
||||
| license@php.net so we can mail you a copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
| Author: Sander Steffann (sander@steffann.nl) |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
#include "php.h"
|
||||
|
||||
#if HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#include <sys/stat.h>
|
||||
|
||||
#ifndef MAXSYMLINKS
|
||||
#define MAXSYMLINKS 32
|
||||
#endif
|
||||
|
||||
#ifndef S_ISDIR
|
||||
#define S_ISDIR(mode) (((mode)&S_IFMT) == S_IFDIR)
|
||||
#endif
|
||||
|
||||
char *php_realpath(char *path, char resolved_path[]);
|
||||
|
||||
#ifdef PHP_WIN32
|
||||
#define IS_SLASH(p) ((p) == '/' || (p) == '\\')
|
||||
#else
|
||||
#define IS_SLASH(p) ((p) == '/')
|
||||
#endif
|
||||
|
||||
char *php_realpath(char *path, char resolved_path []) {
|
||||
char path_construction[MAXPATHLEN]; /* We build the result in here */
|
||||
char *writepos; /* Position to write next char */
|
||||
|
||||
char path_copy[MAXPATHLEN]; /* A work-copy of the path */
|
||||
char *workpos; /* working position in *path */
|
||||
|
||||
#if !defined(PHP_WIN32)
|
||||
char buf[MAXPATHLEN]; /* Buffer for readlink */
|
||||
int linklength; /* The result from readlink */
|
||||
#endif
|
||||
int linkcount = 0; /* Count symlinks to avoid loops */
|
||||
|
||||
struct stat filestat; /* result from stat */
|
||||
|
||||
#ifdef PHP_WIN32
|
||||
char *temppos; /* position while counting '.' */
|
||||
int dotcount; /* number of '.' */
|
||||
int t; /* counter */
|
||||
#endif
|
||||
|
||||
/* Set the work-position to the beginning of the given path */
|
||||
strcpy(path_copy, path);
|
||||
workpos = path_copy;
|
||||
|
||||
#ifdef PHP_WIN32
|
||||
/* Find out where we start - Windows version */
|
||||
if (IS_SLASH(*workpos)) {
|
||||
/* We start at the root of the current drive */
|
||||
/* Get the current directory */
|
||||
if (V_GETCWD(path_construction, MAXPATHLEN-1) == NULL) {
|
||||
/* Unable to get cwd */
|
||||
resolved_path[0] = 0;
|
||||
return NULL;
|
||||
}
|
||||
/* We only need the first three chars (for example "C:\") */
|
||||
path_construction[3] = 0;
|
||||
workpos++;
|
||||
} else if (workpos[1] == ':') {
|
||||
/* A drive-letter is specified, copy it */
|
||||
strncpy(path_construction, path, 2);
|
||||
strcat(path_construction, "\\");
|
||||
workpos++;
|
||||
workpos++;
|
||||
} else {
|
||||
/* Use the current directory */
|
||||
if (V_GETCWD(path_construction, MAXPATHLEN-1) == NULL) {
|
||||
/* Unable to get cwd */
|
||||
resolved_path[0] = 0;
|
||||
return NULL;
|
||||
}
|
||||
strcat(path_construction, "\\");
|
||||
}
|
||||
#else
|
||||
/* Find out where we start - Unix version */
|
||||
if (*workpos == '/') {
|
||||
/* We start at the root */
|
||||
strcpy(path_construction, "/");
|
||||
workpos++;
|
||||
} else {
|
||||
/* Use the current directory */
|
||||
if (V_GETCWD(path_construction, MAXPATHLEN-1) == NULL) {
|
||||
/* Unable to get cwd */
|
||||
resolved_path[0] = 0;
|
||||
return NULL;
|
||||
}
|
||||
strcat(path_construction, "/");
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Set the next-char-position */
|
||||
writepos = &path_construction[strlen(path_construction)];
|
||||
|
||||
/* Go to the end, then stop */
|
||||
while(*workpos != 0) {
|
||||
/* Strip (back)slashes */
|
||||
while(IS_SLASH(*workpos)) workpos++;
|
||||
|
||||
#ifdef PHP_WIN32
|
||||
/* reset dotcount */
|
||||
dotcount = 0;
|
||||
|
||||
/* Look for .. */
|
||||
if ((workpos[0] == '.') && (workpos[1] != 0)) {
|
||||
/* Windows accepts \...\ as \..\..\, \....\ as \..\..\..\, etc */
|
||||
/* At least Win98 does */
|
||||
|
||||
temppos = workpos;
|
||||
while(*temppos++ == '.') {
|
||||
dotcount++;
|
||||
if (!IS_SLASH(*temppos) && (*temppos != 0) && (*temppos != '.')) {
|
||||
/* This is not a /../ component, but a filename that starts with '.' */
|
||||
dotcount = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* Go back dotcount-1 times */
|
||||
for (t=0 ; t<(dotcount-1) ; t++) {
|
||||
workpos++; /* move to next '.' */
|
||||
|
||||
/* Can we still go back? */
|
||||
if ((writepos-3) <= path_construction) return NULL;
|
||||
|
||||
/* Go back */
|
||||
writepos--; /* move to '\' */
|
||||
writepos--;
|
||||
while(!IS_SLASH(*writepos)) writepos--; /* skip until previous '\\' */
|
||||
}
|
||||
workpos++;
|
||||
}
|
||||
|
||||
/* No special case */
|
||||
if (dotcount == 0) {
|
||||
/* Append */
|
||||
while(!IS_SLASH(*workpos) && (*workpos != 0)) {
|
||||
*writepos++ = *workpos++;
|
||||
}
|
||||
}
|
||||
|
||||
/* Just one '.', go to next element */
|
||||
if (dotcount == 1) {
|
||||
while(!IS_SLASH(*workpos) && (*workpos != 0)) {
|
||||
*workpos++;
|
||||
}
|
||||
|
||||
/* Avoid double \ in the result */
|
||||
writepos--;
|
||||
}
|
||||
|
||||
/* If it was a directory, append a slash */
|
||||
if (IS_SLASH(*workpos)) {
|
||||
*writepos++ = *workpos++;
|
||||
}
|
||||
*writepos = 0;
|
||||
#else /* defined(PHP_WIN32) */
|
||||
/* Look for .. */
|
||||
if ((workpos[0] == '.') && (workpos[1] != 0)) {
|
||||
if ((workpos[1] == '.') && ((workpos[2] == '/') || (workpos[2] == 0))) {
|
||||
/* One directory back */
|
||||
/* Set pointers to right position */
|
||||
workpos++; /* move to second '.' */
|
||||
workpos++; /* move to '/' */
|
||||
|
||||
/* Only apply .. if not in root */
|
||||
if ((writepos-1) > path_construction) {
|
||||
writepos--; /* move to '/' */
|
||||
while(*--writepos != '/') ; /* skip until previous '/' */
|
||||
}
|
||||
} else {
|
||||
if (workpos[1] == '/') {
|
||||
/* Found a /./ skip it */
|
||||
workpos++; /* move to '/' */
|
||||
|
||||
/* Avoid double / in the result */
|
||||
writepos--;
|
||||
} else {
|
||||
/* No special case, the name just started with a . */
|
||||
/* Append */
|
||||
while((*workpos != '/') && (*workpos != 0)) {
|
||||
*writepos++ = *workpos++;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
/* No special case */
|
||||
/* Append */
|
||||
while((*workpos != '/') && (*workpos != 0)) {
|
||||
*writepos++ = *workpos++;
|
||||
}
|
||||
}
|
||||
|
||||
#if HAVE_SYMLINK
|
||||
/* We are going to use path_construction, so close it */
|
||||
*writepos = 0;
|
||||
|
||||
/* Check the current location to see if it is a symlink */
|
||||
if((linklength = readlink(path_construction, buf, MAXPATHLEN)) != -1) {
|
||||
/* Check linkcount */
|
||||
if (linkcount > MAXSYMLINKS) return NULL;
|
||||
|
||||
/* Count this symlink */
|
||||
linkcount++;
|
||||
|
||||
/* Set end of buf */
|
||||
buf[linklength] = 0;
|
||||
|
||||
/* Check for overflow */
|
||||
if ((strlen(workpos) + strlen(buf) + 1) >= MAXPATHLEN) return NULL;
|
||||
|
||||
/* Remove the symlink-component wrom path_construction */
|
||||
writepos--; /* move to '/' */
|
||||
while(*--writepos != '/') ; /* skip until previous '/' */
|
||||
*++writepos = 0; /* end of string after '/' */
|
||||
|
||||
/* If the symlink starts with a '/', empty path_construction */
|
||||
if (*buf == '/') {
|
||||
*path_construction = 0;
|
||||
writepos = path_construction;
|
||||
}
|
||||
|
||||
/* Insert symlink into path_copy */
|
||||
strcat(buf, workpos);
|
||||
strcpy(path_copy, buf);
|
||||
workpos = path_copy;
|
||||
}
|
||||
#endif /* HAVE_SYMLINK */
|
||||
|
||||
/* If it was a directory, append a slash */
|
||||
if (*workpos == '/') {
|
||||
*writepos++ = *workpos++;
|
||||
}
|
||||
*writepos = 0;
|
||||
#endif /* defined(PHP_WIN32) */
|
||||
}
|
||||
|
||||
/* Check if the resolved path is a directory */
|
||||
if (V_STAT(path_construction, &filestat) != 0) {
|
||||
if (errno != ENOENT) return NULL;
|
||||
} else {
|
||||
if (S_ISDIR(filestat.st_mode)) {
|
||||
/* It's a directory, append a / if needed */
|
||||
if (*(writepos-1) != '/') {
|
||||
/* Check for overflow */
|
||||
if ((strlen(workpos) + 2) >= MAXPATHLEN) {
|
||||
return NULL;
|
||||
}
|
||||
*writepos++ = '/';
|
||||
*writepos = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
strcpy(resolved_path, path_construction);
|
||||
return resolved_path;
|
||||
}
|
||||
|
||||
/*
|
||||
* Local variables:
|
||||
* tab-width: 4
|
||||
* c-basic-offset: 4
|
||||
* End:
|
||||
*/
|
||||
+15
-8
@@ -29,12 +29,17 @@
|
||||
#include "zend_globals.h"
|
||||
|
||||
|
||||
PHPAPI void php_register_variable(char *var, char *strval, zval *track_vars_array ELS_DC PLS_DC)
|
||||
PHPAPI void php_register_variable(char *var, char *strval, zval *track_vars_array ELS_DC PLS_DC) {
|
||||
php_register_variable_safe(var, strval, strlen(strval), track_vars_array ELS_CC PLS_CC);
|
||||
}
|
||||
|
||||
/* binary-safe version */
|
||||
PHPAPI void php_register_variable_safe(char *var, char *strval, int str_len, zval *track_vars_array ELS_DC PLS_DC)
|
||||
{
|
||||
zval new_entry;
|
||||
|
||||
/* Prepare value */
|
||||
new_entry.value.str.len = strlen(strval);
|
||||
new_entry.value.str.len = str_len;
|
||||
if (PG(magic_quotes_gpc)) {
|
||||
new_entry.value.str.val = php_addslashes(strval, new_entry.value.str.len, &new_entry.value.str.len, 0);
|
||||
} else {
|
||||
@@ -198,11 +203,12 @@ SAPI_POST_HANDLER_FUNC(php_std_post_handler)
|
||||
while (var) {
|
||||
val = strchr(var, '=');
|
||||
if (val) { /* have a value */
|
||||
int val_len;
|
||||
|
||||
*val++ = '\0';
|
||||
/* FIXME: XXX: not binary safe, discards returned length */
|
||||
php_url_decode(var, strlen(var));
|
||||
php_url_decode(val, strlen(val));
|
||||
php_register_variable(var, val, array_ptr ELS_CC PLS_CC);
|
||||
val_len = php_url_decode(val, strlen(val));
|
||||
php_register_variable_safe(var, val, val_len, array_ptr ELS_CC PLS_CC);
|
||||
}
|
||||
var = php_strtok_r(NULL, "&", &strtok_buf);
|
||||
}
|
||||
@@ -282,11 +288,12 @@ void php_treat_data(int arg, char *str, zval* destArray ELS_DC PLS_DC SLS_DC)
|
||||
while (var) {
|
||||
val = strchr(var, '=');
|
||||
if (val) { /* have a value */
|
||||
int val_len;
|
||||
|
||||
*val++ = '\0';
|
||||
/* FIXME: XXX: not binary safe, discards returned length */
|
||||
php_url_decode(var, strlen(var));
|
||||
php_url_decode(val, strlen(val));
|
||||
php_register_variable(var, val, array_ptr ELS_CC PLS_CC);
|
||||
val_len = php_url_decode(val, strlen(val));
|
||||
php_register_variable_safe(var, val, val_len, array_ptr ELS_CC PLS_CC);
|
||||
}
|
||||
if (arg == PARSE_COOKIE) {
|
||||
var = php_strtok_r(NULL, ";", &strtok_buf);
|
||||
|
||||
@@ -33,6 +33,8 @@
|
||||
void php_treat_data(int arg, char *str, zval* destArray ELS_DC PLS_DC SLS_DC);
|
||||
PHPAPI void php_import_environment_variables(zval *array_ptr ELS_DC PLS_DC);
|
||||
PHPAPI void php_register_variable(char *var, char *val, pval *track_vars_array ELS_DC PLS_DC);
|
||||
/* binary-safe version */
|
||||
PHPAPI void php_register_variable_safe(char *var, char *val, int val_len, pval *track_vars_array ELS_DC PLS_DC);
|
||||
PHPAPI void php_register_variable_ex(char *var, zval *val, pval *track_vars_array ELS_DC PLS_DC);
|
||||
|
||||
|
||||
|
||||
+1
-1
@@ -1,3 +1,3 @@
|
||||
/* automatically generated by configure */
|
||||
/* edit configure.in to change version number */
|
||||
#define PHP_VERSION "4.0.4-dev"
|
||||
#define PHP_VERSION "4.0.4"
|
||||
+1
-1
@@ -182,7 +182,7 @@ static void php_mime_split(char *buf, int cnt, char *boundary, zval *array_ptr S
|
||||
if (lbuf) {
|
||||
efree(lbuf);
|
||||
}
|
||||
lbuf = emalloc(s-name + MAX_SIZE_OF_INDEX);
|
||||
lbuf = emalloc(s-name + MAX_SIZE_OF_INDEX + 1);
|
||||
state = 2;
|
||||
loc2 = memchr(loc + 1, '\n', rem);
|
||||
rem -= (loc2 - ptr) + 1;
|
||||
|
||||
+4
-4
@@ -124,11 +124,11 @@ function do_testing($argc, &$argv) {
|
||||
global $term, $windows_p, $php, $skip, $testdirs, $tmpfile, $opts,
|
||||
$skipped, $failed, $passed, $total, $term_bold, $term_norm;
|
||||
|
||||
if ($argc > 0) {
|
||||
if (is_dir($argv[0])) {
|
||||
$dir = $argv[0];
|
||||
if ($argc > 1) {
|
||||
if (is_dir($argv[1])) {
|
||||
$dir = $argv[1];
|
||||
} else {
|
||||
for ($i = 0; $i < $argc; $i++) {
|
||||
for ($i = 1; $i < $argc; $i++) {
|
||||
switch (run_test($argv[$i])) {
|
||||
case TEST_SKIPPED:
|
||||
case TEST_INTERNAL_ERROR:
|
||||
|
||||
@@ -42,13 +42,12 @@ AC_ARG_WITH(apxs,
|
||||
APXS_LDFLAGS="@SYBASE_LFLAGS@ @SYBASE_LIBS@ @SYBASE_CT_LFLAGS@ @SYBASE_CT_LIBS@"
|
||||
APXS_INCLUDEDIR=`$APXS -q INCLUDEDIR`
|
||||
APXS_CFLAGS=`$APXS -q CFLAGS`
|
||||
for flag in $APXS_CFLAGS; do
|
||||
case $flag in
|
||||
-D*) CPPFLAGS="$CPPFLAGS $flag";;
|
||||
esac
|
||||
done
|
||||
AC_ADD_INCLUDE($APXS_INCLUDEDIR)
|
||||
if `echo $APXS_CFLAGS|grep USE_HSREGEX>/dev/null`; then
|
||||
APACHE_HAS_REGEX=yes
|
||||
fi
|
||||
if `echo $APXS_CFLAGS|grep EAPI>/dev/null`; then
|
||||
CPPFLAGS="$CPPFLAGS -DEAPI"
|
||||
fi
|
||||
PHP_SAPI=apache
|
||||
APACHE_INSTALL="$APXS -i -a -n php4 $SAPI_SHARED"
|
||||
PHP_BUILD_SHARED
|
||||
|
||||
+23
-30
@@ -372,12 +372,12 @@ int main(int argc, char *argv[])
|
||||
zend_file_handle file_handle;
|
||||
char *s;
|
||||
/* temporary locals */
|
||||
int cgi_started=0;
|
||||
int behavior=PHP_MODE_STANDARD;
|
||||
int no_headers=0;
|
||||
int orig_optind=ap_php_optind;
|
||||
char *orig_optarg=ap_php_optarg;
|
||||
char *argv0=NULL;
|
||||
char *script_file=NULL;
|
||||
zend_llist global_vars;
|
||||
#if SUPPORT_INTERACTIVE
|
||||
int interactive=0;
|
||||
@@ -541,18 +541,7 @@ any .htaccess restrictions anywhere on your site you can leave doc_root undefine
|
||||
break;
|
||||
|
||||
case 'f': /* parse file */
|
||||
if (!cgi_started){
|
||||
if (php_request_startup(CLS_C ELS_CC PLS_CC SLS_CC)==FAILURE) {
|
||||
php_module_shutdown();
|
||||
return FAILURE;
|
||||
}
|
||||
}
|
||||
if (no_headers) {
|
||||
SG(request_info).no_headers = 1;
|
||||
SG(headers_sent) = 1;
|
||||
}
|
||||
cgi_started=1;
|
||||
SG(request_info).path_translated = estrdup(ap_php_optarg);
|
||||
script_file = estrdup(ap_php_optarg);
|
||||
no_headers = 1;
|
||||
break;
|
||||
|
||||
@@ -575,17 +564,14 @@ any .htaccess restrictions anywhere on your site you can leave doc_root undefine
|
||||
break;
|
||||
|
||||
case 'i': /* php info & quit */
|
||||
if (!cgi_started) {
|
||||
if (php_request_startup(CLS_C ELS_CC PLS_CC SLS_CC)==FAILURE) {
|
||||
php_module_shutdown();
|
||||
return FAILURE;
|
||||
}
|
||||
if (php_request_startup(CLS_C ELS_CC PLS_CC SLS_CC)==FAILURE) {
|
||||
php_module_shutdown();
|
||||
return FAILURE;
|
||||
}
|
||||
if (no_headers) {
|
||||
SG(headers_sent) = 1;
|
||||
SG(request_info).no_headers = 1;
|
||||
}
|
||||
cgi_started=1;
|
||||
php_print_info(0xFFFFFFFF);
|
||||
exit(1);
|
||||
break;
|
||||
@@ -624,11 +610,9 @@ any .htaccess restrictions anywhere on your site you can leave doc_root undefine
|
||||
|
||||
case 'v': /* show php version & quit */
|
||||
no_headers = 1;
|
||||
if (!cgi_started) {
|
||||
if (php_request_startup(CLS_C ELS_CC PLS_CC SLS_CC)==FAILURE) {
|
||||
php_module_shutdown();
|
||||
return FAILURE;
|
||||
}
|
||||
if (php_request_startup(CLS_C ELS_CC PLS_CC SLS_CC)==FAILURE) {
|
||||
php_module_shutdown();
|
||||
return FAILURE;
|
||||
}
|
||||
if (no_headers) {
|
||||
SG(headers_sent) = 1;
|
||||
@@ -655,12 +639,20 @@ any .htaccess restrictions anywhere on your site you can leave doc_root undefine
|
||||
|
||||
if (!cgi) {
|
||||
if (!SG(request_info).query_string) {
|
||||
for (i = ap_php_optind, len = 0; i < argc; i++) {
|
||||
len = 0;
|
||||
if (script_file) {
|
||||
len += strlen(script_file) + 1;
|
||||
}
|
||||
for (i = ap_php_optind; i < argc; i++) {
|
||||
len += strlen(argv[i]) + 1;
|
||||
}
|
||||
|
||||
s = malloc(len + 1); /* leak - but only for command line version, so ok */
|
||||
*s = '\0'; /* we are pretending it came from the environment */
|
||||
if (script_file) {
|
||||
strcpy(s, script_file);
|
||||
strcat(s, "+");
|
||||
}
|
||||
for (i = ap_php_optind, len = 0; i < argc; i++) {
|
||||
strcat(s, argv[i]);
|
||||
if (i < (argc - 1)) {
|
||||
@@ -671,12 +663,13 @@ any .htaccess restrictions anywhere on your site you can leave doc_root undefine
|
||||
}
|
||||
}
|
||||
|
||||
if (script_file) {
|
||||
SG(request_info).path_translated = script_file;
|
||||
}
|
||||
|
||||
if (!cgi_started) {
|
||||
if (php_request_startup(CLS_C ELS_CC PLS_CC SLS_CC)==FAILURE) {
|
||||
php_module_shutdown();
|
||||
return FAILURE;
|
||||
}
|
||||
if (php_request_startup(CLS_C ELS_CC PLS_CC SLS_CC)==FAILURE) {
|
||||
php_module_shutdown();
|
||||
return FAILURE;
|
||||
}
|
||||
if (no_headers) {
|
||||
SG(headers_sent) = 1;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
AC_ARG_WITH(thttpd,
|
||||
[ --with-thttpd=SRCDIR],[
|
||||
[ --with-thttpd=SRCDIR Build PHP as thttpd module],[
|
||||
test -d $withval || AC_MSG_RESULT(thttpd directory does not exist ($withval))
|
||||
AC_EXPAND_PATH($withval, THTTPD)
|
||||
INSTALL_IT="\
|
||||
|
||||
-113
@@ -1,113 +0,0 @@
|
||||
#include "php.h"
|
||||
|
||||
#ifndef HAVE_STRTOK_R
|
||||
|
||||
/*
|
||||
* Copyright (c) 1998 Softweyr LLC. All rights reserved.
|
||||
*
|
||||
* strtok_r, from Berkeley strtok
|
||||
* Oct 13, 1998 by Wes Peters <wes@softweyr.com>
|
||||
*
|
||||
* Copyright (c) 1988, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notices, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notices, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
*
|
||||
* This product includes software developed by Softweyr LLC, the
|
||||
* University of California, Berkeley, and its contributors.
|
||||
*
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY SOFTWEYR LLC, THE REGENTS AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SOFTWEYR LLC, THE
|
||||
* REGENTS, OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
|
||||
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <stddef.h>
|
||||
#include <string.h>
|
||||
|
||||
char *
|
||||
strtok_r(char *s, const char *delim, char **last)
|
||||
{
|
||||
char *spanp;
|
||||
int c, sc;
|
||||
char *tok;
|
||||
|
||||
if (s == NULL && (s = *last) == NULL)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* Skip (span) leading delimiters (s += strspn(s, delim), sort of).
|
||||
*/
|
||||
cont:
|
||||
c = *s++;
|
||||
for (spanp = (char *)delim; (sc = *spanp++) != 0; )
|
||||
{
|
||||
if (c == sc)
|
||||
{
|
||||
goto cont;
|
||||
}
|
||||
}
|
||||
|
||||
if (c == 0) /* no non-delimiter characters */
|
||||
{
|
||||
*last = NULL;
|
||||
return NULL;
|
||||
}
|
||||
tok = s - 1;
|
||||
|
||||
/*
|
||||
* Scan token (scan for delimiters: s += strcspn(s, delim), sort of).
|
||||
* Note that delim must have one NUL; we stop if we see that, too.
|
||||
*/
|
||||
for (;;)
|
||||
{
|
||||
c = *s++;
|
||||
spanp = (char *)delim;
|
||||
do
|
||||
{
|
||||
if ((sc = *spanp++) == c)
|
||||
{
|
||||
if (c == 0)
|
||||
{
|
||||
s = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
char *w = s - 1;
|
||||
*w = '\0';
|
||||
}
|
||||
*last = s;
|
||||
return tok;
|
||||
}
|
||||
}
|
||||
while (sc != 0);
|
||||
}
|
||||
/* NOTREACHED */
|
||||
}
|
||||
|
||||
#endif
|
||||
+3
-3
@@ -2,17 +2,17 @@ PHP Regression Tests
|
||||
====================
|
||||
|
||||
To run the tests, go to the top-level directory and
|
||||
run "./php -f run-tests.php".
|
||||
run "./php -q run-tests.php".
|
||||
|
||||
Without parameters, "run-tests.php" will recursively scan through the
|
||||
file tree looking for directories called "tests", and run all the
|
||||
tests (.phpt files) within (recursively).
|
||||
|
||||
To run tests in a single directory, pass the directory as a parameter:
|
||||
"./php -f run-tests.php tests/lang".
|
||||
"./php -q run-tests.php tests/lang".
|
||||
|
||||
To run one or more single tests, pass them as parameters:
|
||||
"./php -f run-tests.php tests/lang/015.phpt".
|
||||
"./php -q run-tests.php tests/lang/015.phpt".
|
||||
|
||||
The format of the .phpt files is quite simple. There are 6 possible
|
||||
sections. Test, Skipif, Post, Get, File and Expect. The Test section
|
||||
|
||||
Reference in new issue
Block a user