mirror of
https://github.com/bdnugget/php-src.git
synced 2026-11-10 02:30:50 +00:00
Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e94c67742f |
No files matched your search
+202
@@ -1,3 +1,205 @@
|
||||
2002-09-05 Stanislav Malyshev <stas@zend.com>
|
||||
|
||||
* zend_compile.c: quick-n-dirty inheritance support for __handlers
|
||||
|
||||
2002-09-04 Sebastian Bergmann <sb@sebastian-bergmann.de>
|
||||
|
||||
* ZEND_CHANGES: Whitespace fixes.
|
||||
|
||||
2002-09-04 Stanislav Malyshev <stas@zend.com>
|
||||
|
||||
* zend_object_handlers.c: remove dead code
|
||||
|
||||
* ZEND_CHANGES
|
||||
zend_object_handlers.c: Fix __call and add some docs
|
||||
|
||||
2002-09-04 Sebastian Bergmann <sb@sebastian-bergmann.de>
|
||||
|
||||
* zend_object_handlers.c: Fix ZTS build.
|
||||
|
||||
* ZEND_CHANGES: TBD: __call(), __get(), __set().
|
||||
|
||||
2002-09-04 Stanislav Malyshev <stas@zend.com>
|
||||
|
||||
* zend.h
|
||||
zend_compile.c
|
||||
zend_compile.h
|
||||
zend_execute.c
|
||||
zend_extensions.h
|
||||
zend_object_handlers.c
|
||||
zend_objects.c: Support for __get, __set and __call in classes.
|
||||
This should work as follows: if class hasn't member with given name,
|
||||
__get/__set is called. If class has no method with given name, __call is called.
|
||||
__get/__set are not recursive, __call can be.
|
||||
|
||||
2002-09-04 Sebastian Bergmann <sb@sebastian-bergmann.de>
|
||||
|
||||
* ZEND_CHANGES: Workaround for superfluous comma in var_export() result.
|
||||
|
||||
* ZEND_CHANGES:
|
||||
Let debug_backtrace() example print out the class name, if applicable, and the function/method arguments.
|
||||
|
||||
2002-09-03 Thies C. Arntzen <thies@thieso.net>
|
||||
|
||||
* zend_builtin_functions.c: nuke warning
|
||||
|
||||
* zend_builtin_functions.c: nuke unneeded stuff
|
||||
|
||||
2002-09-03 Zeev Suraski <zeev@zend.com>
|
||||
|
||||
* zend.c
|
||||
zend.h
|
||||
zend_ini.c: MFZE1
|
||||
|
||||
2002-09-03 Derick Rethans <d.rethans@jdimedia.nl>
|
||||
|
||||
* zend_ini.c: - Revert
|
||||
|
||||
* zend_ini.c:
|
||||
- MFH for: Apply rest of html errors fix (Patch by Jan Lehnardt <jan@php.net>)
|
||||
|
||||
2002-09-03 Sebastian Bergmann <sb@sebastian-bergmann.de>
|
||||
|
||||
* zend.h:
|
||||
Add html_errors to zend_utility_values. Patch by Jan Lehnardt <jan@php.net>.
|
||||
|
||||
2002-09-03 Andi Gutmans <andi@zend.com>
|
||||
|
||||
* zend_builtin_functions.c: - Fix typo
|
||||
|
||||
2002-09-02 Thies C. Arntzen <thies@thieso.net>
|
||||
|
||||
* zend_builtin_functions.c:
|
||||
refine last patch. if the argument-stack is not consistent don't try to show
|
||||
arguments. no call to zend_error is made as we might end up in an infinite
|
||||
recursion if called from an error_handler.
|
||||
so: if the arguments to functions aren't shown in debug_backtrace this is 'cause
|
||||
the arument stack was not consistent when debug_backtrace was called.
|
||||
|
||||
* zend_builtin_functions.c:
|
||||
debug_backtrace() now checks the complete argument-stack for consistency.
|
||||
|
||||
2002-09-02 Stanislav Malyshev <stas@zend.com>
|
||||
|
||||
* zend_execute.c: MFZE1
|
||||
|
||||
2002-09-01 Andi Gutmans <andi@zend.com>
|
||||
|
||||
* zend_llist.c: - Fix leak reported by "l0t3k" <cshmoove@hotmail.com>
|
||||
|
||||
2002-09-01 Stanislav Malyshev <stas@zend.com>
|
||||
|
||||
* zend_operators.c: MFZE1
|
||||
|
||||
2002-08-28 Thies Arntzen <thies@pb1.pair.com>
|
||||
|
||||
* zend_builtin_functions.c
|
||||
zend_execute_API.c: debug_backtrace()
|
||||
- make args passed to functions called vy call_user_function available again.
|
||||
|
||||
* zend_builtin_functions.c: debug_backtrace():
|
||||
- make args work if called from the error_handler
|
||||
- fix refcount for args
|
||||
|
||||
* zend.c:
|
||||
clear current_execute_data on bailout as it would point into some freed area
|
||||
on the stack.
|
||||
|
||||
2002-08-28 derick <derick@pb1.pair.com>
|
||||
|
||||
* zend.c: - MFZE1
|
||||
|
||||
2002-08-26 Thies Arntzen <thies@pb1.pair.com>
|
||||
|
||||
* zend_builtin_functions.c:
|
||||
debug_backtrace(): show name of included file for include and require calls
|
||||
plus some small fixes suggested by andi.
|
||||
|
||||
2002-08-24 Andi Gutmans <andi@pb1.pair.com>
|
||||
|
||||
* zend_builtin_functions.c: - Whitespace
|
||||
|
||||
* zend_builtin_functions.c: - Whitespace and better variable name
|
||||
|
||||
2002-08-24 Thies Arntzen <thies@pb1.pair.com>
|
||||
|
||||
* zend_builtin_functions.c: fix warning
|
||||
|
||||
2002-08-23 Andi Gutmans <andi@pb1.pair.com>
|
||||
|
||||
* Zend.m4: - Add \n to configure fprintf
|
||||
|
||||
* zend_extensions.c: - dlerror -> DL_ERROR
|
||||
|
||||
2002-08-23 Thies Arntzen <thies@pb1.pair.com>
|
||||
|
||||
* zend_builtin_functions.c:
|
||||
debug_backtrace: show include/require/eval as normal functions on the stack
|
||||
|
||||
2002-08-23 derick <derick@pb1.pair.com>
|
||||
|
||||
* zend_builtin_functions.c: - No spaces :)
|
||||
|
||||
2002-08-23 Thies Arntzen <thies@pb1.pair.com>
|
||||
|
||||
* zend_builtin_functions.c:
|
||||
- debug_backtrace now also returns an array containing the arguments of the
|
||||
called function.
|
||||
|
||||
zeev, andi - is knowing the structure of the stack considered a bad thing in
|
||||
zend_builtin_function? if yes i would have to create a new function in
|
||||
zend_ptr_stack.c (but i think we are save this way)
|
||||
|
||||
* zend_builtin_functions.c
|
||||
zend_execute_API.c: - debug_backtrace:
|
||||
added "type" ('->' or '::') for object calls.
|
||||
made calls done thru call_user_func show-up correct in backtraces.
|
||||
|
||||
andi,
|
||||
does this look correct to you?
|
||||
|
||||
* zend_execute.c: those are set by RETURN_FROM_EXECUTE
|
||||
|
||||
2002-08-21 Thies Arntzen <thies@pb1.pair.com>
|
||||
|
||||
* zend_execute.c:
|
||||
zend_execute: make sure that current_execute_data points to the right thing
|
||||
after coming back from recursion.
|
||||
|
||||
2002-08-19 Zeev Suraski <zeev@pb1.pair.com>
|
||||
|
||||
* zend_operators.c: MFZE1
|
||||
|
||||
2002-08-17 Andi Gutmans <andi@pb1.pair.com>
|
||||
|
||||
* zend_execute.c: MFZE1
|
||||
|
||||
2002-08-17 Zeev Suraski <zeev@pb1.pair.com>
|
||||
|
||||
* zend_execute.c
|
||||
zend_hash.c: MFZE1
|
||||
|
||||
2002-08-16 Stig Bakken <ssb@pb1.pair.com>
|
||||
|
||||
* zend.c: * append emacs footer
|
||||
|
||||
* zend.c: * remove builtin exception class
|
||||
|
||||
2002-08-16 Andi Gutmans <andi@pb1.pair.com>
|
||||
|
||||
* zend.c: - Fix whitespace
|
||||
|
||||
2002-08-16 Stig Bakken <ssb@pb1.pair.com>
|
||||
|
||||
* zend_execute_API.c
|
||||
zend_globals.h
|
||||
zend.c
|
||||
zend_builtin_functions.c:
|
||||
- Added set_exception_handler() function for registering a global,
|
||||
catch-all exception handling function
|
||||
- Added set_exception_handler() function for registering a global,
|
||||
catch-all exception handling function (Stig)
|
||||
|
||||
2002-08-15 Zeev Suraski <zeev@pb1.pair.com>
|
||||
|
||||
* flex.skl
|
||||
|
||||
+75
-3
@@ -483,7 +483,7 @@ Changes in the Zend Engine 2.0
|
||||
|
||||
<?php
|
||||
class foo {
|
||||
static $my_static = 5;
|
||||
static $my_static = 5;
|
||||
}
|
||||
|
||||
print foo::$my_static;
|
||||
@@ -510,11 +510,22 @@ Changes in the Zend Engine 2.0
|
||||
$backtrace = debug_backtrace();
|
||||
|
||||
foreach ($backtrace as $step) {
|
||||
$class = isset($step['class']) ? $step['class'] . '::' : '';
|
||||
if (!empty($step['args'])) {
|
||||
foreach ($step['args'] as $arg) {
|
||||
$args = isset($args) ? $args . ', ' : '';
|
||||
$args .= var_export($arg, true);
|
||||
}
|
||||
} else {
|
||||
$args = '';
|
||||
}
|
||||
|
||||
$args = str_replace(array("\n", ',)'), array('', ')'), $args);
|
||||
|
||||
printf(
|
||||
"%s [%s:%s]\n",
|
||||
"%s%s(%s) [%s:%s]\n",
|
||||
isset($step['class']) ? $step['class'] . '::' : '',
|
||||
$step['function'],
|
||||
$args,
|
||||
$step['file'],
|
||||
$step['line']
|
||||
);
|
||||
@@ -523,6 +534,67 @@ Changes in the Zend Engine 2.0
|
||||
|
||||
* __autoload(). TBD.
|
||||
|
||||
* Method calls and property accesses can be overloaded
|
||||
by class methods __call(), __get() and __set().
|
||||
|
||||
__get() and __set() Example:
|
||||
|
||||
<?php
|
||||
class Setter {
|
||||
public $n;
|
||||
public $x = array('a' => 1, 'b' => 2, 'c' => 3);
|
||||
|
||||
function __get($nm) {
|
||||
print "Getting [$nm]\n";
|
||||
|
||||
if(isset($this->x[$nm])) {
|
||||
$r = $this->x[$nm];
|
||||
print "Returning: $r\n";
|
||||
return $r;
|
||||
} else {
|
||||
print "Nothing!\n";
|
||||
}
|
||||
}
|
||||
|
||||
function __set($nm, $val) {
|
||||
print "Setting [$nm] to $val\n";
|
||||
|
||||
if(isset($this->x[$nm])) {
|
||||
$this->x[$nm] = $val;
|
||||
print "OK!\n";
|
||||
} else {
|
||||
print "Not OK!\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$foo = new Setter();
|
||||
$foo->n = 1;
|
||||
$foo->a = 100;
|
||||
$foo->a++;
|
||||
$foo->z++;
|
||||
var_dump($foo);
|
||||
?>
|
||||
|
||||
__call() Example:
|
||||
|
||||
<?php
|
||||
class Caller {
|
||||
var $x = array(1, 2, 3);
|
||||
|
||||
function __call($m, $a) {
|
||||
print "Method $m called:\n";
|
||||
var_dump($a);
|
||||
return $this->x;
|
||||
}
|
||||
}
|
||||
|
||||
$foo = new Caller();
|
||||
$a = $foo->test(1, '2', 3.4, true);
|
||||
var_dump($a);
|
||||
?>
|
||||
|
||||
|
||||
Changes in the Zend Engine 1.0
|
||||
|
||||
The Zend Engine was designed from the ground up for increased speed,
|
||||
|
||||
+1
-1
@@ -209,7 +209,7 @@ int main()
|
||||
}
|
||||
|
||||
fp = fopen("conftest.zend", "w");
|
||||
fprintf(fp, "%d %d", ZEND_MM_ALIGNMENT, zeros);
|
||||
fprintf(fp, "%d %d\n", ZEND_MM_ALIGNMENT, zeros);
|
||||
fclose(fp);
|
||||
|
||||
exit(0);
|
||||
|
||||
+4
-3
@@ -65,7 +65,7 @@ zend_class_entry global_main_class;
|
||||
HashTable *global_auto_globals_table;
|
||||
#endif
|
||||
|
||||
zend_utility_values zend_uv;
|
||||
ZEND_API zend_utility_values zend_uv;
|
||||
|
||||
ZEND_API zval zval_used_for_init; /* True global variable */
|
||||
|
||||
@@ -208,7 +208,7 @@ ZEND_API void zend_print_zval_r_ex(zend_write_func_t write_func, zval *expr, int
|
||||
ZEND_PUTS("Array\n");
|
||||
if (++expr->value.ht->nApplyCount>1) {
|
||||
ZEND_PUTS(" *RECURSION*");
|
||||
expr->value.ht->nApplyCount=0;
|
||||
expr->value.ht->nApplyCount--;
|
||||
return;
|
||||
}
|
||||
print_hash(expr->value.ht, indent);
|
||||
@@ -220,7 +220,7 @@ ZEND_API void zend_print_zval_r_ex(zend_write_func_t write_func, zval *expr, int
|
||||
|
||||
if (++object->properties->nApplyCount>1) {
|
||||
ZEND_PUTS(" *RECURSION*");
|
||||
object->properties->nApplyCount=0;
|
||||
object->properties->nApplyCount--;
|
||||
return;
|
||||
}
|
||||
zend_printf("%s Object\n", object->ce->name);
|
||||
@@ -549,6 +549,7 @@ ZEND_API void _zend_bailout(char *filename, uint lineno)
|
||||
}
|
||||
CG(unclean_shutdown) = 1;
|
||||
CG(in_compilation) = EG(in_execution) = 0;
|
||||
EG(current_execute_data) = NULL;
|
||||
longjmp(EG(bailout), FAILURE);
|
||||
}
|
||||
END_EXTERN_C()
|
||||
|
||||
+10
-2
@@ -22,7 +22,7 @@
|
||||
#ifndef ZEND_H
|
||||
#define ZEND_H
|
||||
|
||||
#define ZEND_VERSION "2.0.0-alpha2"
|
||||
#define ZEND_VERSION "2.0.0-alpha3"
|
||||
|
||||
#define ZEND_ENGINE_2
|
||||
|
||||
@@ -226,6 +226,8 @@ typedef struct _zend_class_entry zend_class_entry;
|
||||
typedef struct _zend_object {
|
||||
zend_class_entry *ce;
|
||||
HashTable *properties;
|
||||
int in_get:1;
|
||||
int in_set:1;
|
||||
} zend_object;
|
||||
|
||||
typedef unsigned int zend_object_handle;
|
||||
@@ -311,9 +313,14 @@ struct _zend_class_entry {
|
||||
union _zend_function *constructor;
|
||||
union _zend_function *destructor;
|
||||
union _zend_function *clone;
|
||||
union _zend_function *__get;
|
||||
union _zend_function *__set;
|
||||
union _zend_function *__call;
|
||||
|
||||
/* handlers */
|
||||
zend_object_value (*create_object)(zend_class_entry *class_type TSRMLS_DC);
|
||||
|
||||
/* old handlers */
|
||||
void (*handle_function_call)(INTERNAL_FUNCTION_PARAMETERS, zend_property_reference *property_reference);
|
||||
zval (*handle_property_get)(zend_property_reference *property_reference);
|
||||
int (*handle_property_set)(zend_property_reference *property_reference, zval *value);
|
||||
@@ -336,6 +343,7 @@ typedef struct _zend_utility_functions {
|
||||
typedef struct _zend_utility_values {
|
||||
char *import_use_extension;
|
||||
uint import_use_extension_length;
|
||||
zend_bool html_errors;
|
||||
} zend_utility_values;
|
||||
|
||||
|
||||
@@ -462,7 +470,7 @@ void zenderror(char *error);
|
||||
/* The following #define is used for code duality in PHP for Engine 1 & 2 */
|
||||
#define ZEND_STANDARD_CLASS_DEF_PTR zend_standard_class_def
|
||||
extern ZEND_API zend_class_entry *zend_standard_class_def;
|
||||
extern zend_utility_values zend_uv;
|
||||
extern ZEND_API zend_utility_values zend_uv;
|
||||
extern ZEND_API zval zval_used_for_init;
|
||||
|
||||
END_EXTERN_C()
|
||||
|
||||
+124
-17
@@ -1247,6 +1247,26 @@ ZEND_FUNCTION(get_defined_constants)
|
||||
/* }}} */
|
||||
|
||||
|
||||
static zval *debug_backtrace_get_args(void ***curpos TSRMLS_DC) {
|
||||
void **p = *curpos - 2;
|
||||
zval *arg_array, **arg;
|
||||
int arg_count = (ulong) *p;
|
||||
|
||||
*curpos -= (arg_count+2);
|
||||
|
||||
MAKE_STD_ZVAL(arg_array);
|
||||
array_init(arg_array);
|
||||
p -= arg_count;
|
||||
|
||||
while (--arg_count >= 0) {
|
||||
arg = (zval **) p++;
|
||||
SEPARATE_ZVAL_TO_MAKE_IS_REF(arg);
|
||||
(*arg)->refcount++;
|
||||
add_next_index_zval(arg_array, *arg);
|
||||
}
|
||||
return arg_array;
|
||||
}
|
||||
|
||||
/* {{{ proto void debug_backtrace(void)
|
||||
Prints out a backtrace */
|
||||
ZEND_FUNCTION(debug_backtrace)
|
||||
@@ -1256,43 +1276,130 @@ ZEND_FUNCTION(debug_backtrace)
|
||||
char *function_name;
|
||||
char *filename;
|
||||
char *class_name;
|
||||
char *call_type;
|
||||
char *include_filename = NULL;
|
||||
zval *stack_frame;
|
||||
void **cur_arg_pos = EG(argument_stack).top_element;
|
||||
void **args = cur_arg_pos;
|
||||
int arg_stack_consistent = 0;
|
||||
|
||||
if (ZEND_NUM_ARGS()) {
|
||||
WRONG_PARAM_COUNT;
|
||||
}
|
||||
|
||||
while (--args >= EG(argument_stack).elements) {
|
||||
if (*args--) {
|
||||
break;
|
||||
}
|
||||
args -= *(ulong*)args;
|
||||
|
||||
if (args == EG(argument_stack).elements) {
|
||||
arg_stack_consistent = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
ptr = EG(current_execute_data);
|
||||
|
||||
/* Skip debug_backtrace() itself */
|
||||
/* skip debug_backtrace() */
|
||||
ptr = ptr->prev_execute_data;
|
||||
|
||||
cur_arg_pos -= 2;
|
||||
|
||||
array_init(return_value);
|
||||
|
||||
while (ptr) {
|
||||
MAKE_STD_ZVAL(stack_frame);
|
||||
array_init(stack_frame);
|
||||
|
||||
class_name = NULL;
|
||||
if (ptr->op_array) {
|
||||
filename = ptr->op_array->filename;
|
||||
lineno = ptr->opline->lineno;
|
||||
add_assoc_string_ex(stack_frame, "file", sizeof("file"), filename, 1);
|
||||
add_assoc_long_ex(stack_frame, "line", sizeof("line"), lineno);
|
||||
|
||||
if (ptr->object) {
|
||||
class_name = Z_OBJCE(*ptr->object)->name;
|
||||
}
|
||||
if (ptr->function_state.function->common.scope) {
|
||||
class_name = ptr->function_state.function->common.scope->name;
|
||||
/* try to fetch args only if an FCALL was just made - elsewise we're in the middle of a function
|
||||
* and debug_baktrace() might have been called by the error_handler. in this case we don't
|
||||
* want to pop anything of the argument-stack */
|
||||
} else {
|
||||
filename = NULL;
|
||||
}
|
||||
|
||||
function_name = ptr->function_state.function->common.function_name;
|
||||
|
||||
filename = ptr->op_array->filename;
|
||||
lineno = ptr->opline->lineno;
|
||||
|
||||
if (function_name) {
|
||||
add_assoc_string_ex(stack_frame, "function", sizeof("function"), function_name, 1);
|
||||
|
||||
if (ptr->object) {
|
||||
class_name = Z_OBJCE(*ptr->object)->name;
|
||||
call_type = "->";
|
||||
} else if (ptr->function_state.function->common.scope) {
|
||||
class_name = ptr->function_state.function->common.scope->name;
|
||||
call_type = "::";
|
||||
} else {
|
||||
class_name = NULL;
|
||||
call_type = NULL;
|
||||
}
|
||||
|
||||
if (class_name) {
|
||||
add_assoc_string_ex(stack_frame, "class", sizeof("class"), class_name, 1);
|
||||
add_assoc_string_ex(stack_frame, "type", sizeof("type"), call_type, 1);
|
||||
}
|
||||
|
||||
if ((! ptr->opline) || ((ptr->opline->opcode == ZEND_DO_FCALL_BY_NAME) || (ptr->opline->opcode == ZEND_DO_FCALL))) {
|
||||
if (arg_stack_consistent) {
|
||||
add_assoc_zval_ex(stack_frame, "args", sizeof("args"), debug_backtrace_get_args(&cur_arg_pos TSRMLS_CC));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
/* i know this is kinda ugly, but i'm trying to avoid extra cycles in the main execution loop */
|
||||
zend_bool build_filename_arg = 1;
|
||||
|
||||
switch (ptr->opline->op2.u.constant.value.lval) {
|
||||
case ZEND_EVAL:
|
||||
function_name = "eval";
|
||||
build_filename_arg = 0;
|
||||
break;
|
||||
case ZEND_INCLUDE:
|
||||
function_name = "include";
|
||||
break;
|
||||
case ZEND_REQUIRE:
|
||||
function_name = "require";
|
||||
break;
|
||||
case ZEND_INCLUDE_ONCE:
|
||||
function_name = "include_once";
|
||||
break;
|
||||
case ZEND_REQUIRE_ONCE:
|
||||
function_name = "require_once";
|
||||
break;
|
||||
default:
|
||||
/* this can actually happen if you use debug_backtrace() in your error_handler and
|
||||
* you're in the top-scope */
|
||||
function_name = "unknown";
|
||||
build_filename_arg = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
if (build_filename_arg && include_filename) {
|
||||
zval *arg_array;
|
||||
|
||||
MAKE_STD_ZVAL(arg_array);
|
||||
array_init(arg_array);
|
||||
|
||||
/* include_filename always points to the last filename of the last last called-fuction.
|
||||
if we have called include in the frame above - this is the file we have included.
|
||||
*/
|
||||
|
||||
add_next_index_string(arg_array, include_filename, 1);
|
||||
add_assoc_zval_ex(stack_frame, "args", sizeof("args"), arg_array);
|
||||
}
|
||||
|
||||
add_assoc_string_ex(stack_frame, "function", sizeof("function"), function_name, 1);
|
||||
}
|
||||
if (class_name) {
|
||||
add_assoc_string_ex(stack_frame, "class", sizeof("class"), class_name, 1);
|
||||
}
|
||||
add_assoc_string_ex(stack_frame, "file", sizeof("file"), filename, 1);
|
||||
add_assoc_long_ex(stack_frame, "line", sizeof("line"), lineno);
|
||||
/* add_assoc_stringl_ex(stack_frame, "class", sizeof("class")-1, class_name, class_name_length, 1); */
|
||||
|
||||
add_next_index_zval(return_value, stack_frame);
|
||||
|
||||
include_filename = filename;
|
||||
|
||||
ptr = ptr->prev_execute_data;
|
||||
}
|
||||
}
|
||||
|
||||
+15
-4
@@ -895,10 +895,6 @@ void zend_do_free(znode *op1 TSRMLS_DC)
|
||||
}
|
||||
}
|
||||
|
||||
#define ZEND_CLONE_FUNC_NAME "__clone"
|
||||
#define ZEND_CONSTRUCTOR_FUNC_NAME "__construct"
|
||||
#define ZEND_DESTRUCTOR_FUNC_NAME "__destruct"
|
||||
|
||||
void zend_do_begin_function_declaration(znode *function_token, znode *function_name, int is_method, int return_reference TSRMLS_DC)
|
||||
{
|
||||
zend_op_array op_array;
|
||||
@@ -938,6 +934,12 @@ void zend_do_begin_function_declaration(znode *function_token, znode *function_n
|
||||
CG(active_class_entry)->destructor = (zend_function *) CG(active_op_array);
|
||||
} else if ((function_name->u.constant.value.str.len == sizeof(ZEND_CLONE_FUNC_NAME)-1) && (!memcmp(function_name->u.constant.value.str.val, ZEND_CLONE_FUNC_NAME, sizeof(ZEND_CLONE_FUNC_NAME)))) {
|
||||
CG(active_class_entry)->clone = (zend_function *) CG(active_op_array);
|
||||
} else if ((function_name->u.constant.value.str.len == sizeof(ZEND_CALL_FUNC_NAME)-1) && (!memcmp(function_name->u.constant.value.str.val, ZEND_CALL_FUNC_NAME, sizeof(ZEND_CALL_FUNC_NAME)))) {
|
||||
CG(active_class_entry)->__call = (zend_function *) CG(active_op_array);
|
||||
} else if ((function_name->u.constant.value.str.len == sizeof(ZEND_GET_FUNC_NAME)-1) && (!memcmp(function_name->u.constant.value.str.val, ZEND_GET_FUNC_NAME, sizeof(ZEND_GET_FUNC_NAME)))) {
|
||||
CG(active_class_entry)->__get = (zend_function *) CG(active_op_array);
|
||||
} else if ((function_name->u.constant.value.str.len == sizeof(ZEND_SET_FUNC_NAME)-1) && (!memcmp(function_name->u.constant.value.str.val, ZEND_SET_FUNC_NAME, sizeof(ZEND_SET_FUNC_NAME)))) {
|
||||
CG(active_class_entry)->__set = (zend_function *) CG(active_op_array);
|
||||
}
|
||||
} else {
|
||||
zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
|
||||
@@ -1501,6 +1503,9 @@ static void do_inherit_parent_constructor(zend_class_entry *ce)
|
||||
function_add_ref(function);
|
||||
}
|
||||
ce->constructor = ce->parent->constructor;
|
||||
ce->__get = ce->parent->__get;
|
||||
ce->__set = ce->parent->__set;
|
||||
ce->__call = ce->parent->__call;
|
||||
}
|
||||
|
||||
void zend_do_inheritance(zend_class_entry *ce, zend_class_entry *parent_ce)
|
||||
@@ -1551,6 +1556,9 @@ static void create_class(HashTable *class_table, char *name, int name_length, ze
|
||||
new_class_entry->constructor = NULL;
|
||||
new_class_entry->destructor = NULL;
|
||||
new_class_entry->clone = NULL;
|
||||
new_class_entry->__get = NULL;
|
||||
new_class_entry->__set = NULL;
|
||||
new_class_entry->__call = NULL;
|
||||
|
||||
new_class_entry->create_object = NULL;
|
||||
new_class_entry->handle_function_call = NULL;
|
||||
@@ -2050,6 +2058,9 @@ void zend_do_begin_class_declaration(znode *class_token, znode *class_name, znod
|
||||
new_class_entry->constructor = NULL;
|
||||
new_class_entry->destructor = NULL;
|
||||
new_class_entry->clone = NULL;
|
||||
new_class_entry->__get = NULL;
|
||||
new_class_entry->__set = NULL;
|
||||
new_class_entry->__call = NULL;
|
||||
|
||||
new_class_entry->create_object = NULL;
|
||||
new_class_entry->handle_function_call = NULL;
|
||||
|
||||
@@ -710,4 +710,11 @@ int zendlex(znode *zendlval TSRMLS_DC);
|
||||
|
||||
END_EXTERN_C()
|
||||
|
||||
#define ZEND_CLONE_FUNC_NAME "__clone"
|
||||
#define ZEND_CONSTRUCTOR_FUNC_NAME "__construct"
|
||||
#define ZEND_DESTRUCTOR_FUNC_NAME "__destruct"
|
||||
#define ZEND_GET_FUNC_NAME "__get"
|
||||
#define ZEND_SET_FUNC_NAME "__set"
|
||||
#define ZEND_CALL_FUNC_NAME "__call"
|
||||
|
||||
#endif /* ZEND_COMPILE_H */
|
||||
+46
-18
@@ -140,7 +140,7 @@ static inline zval **_get_zval_ptr_ptr(znode *node, temp_variable *Ts TSRMLS_DC)
|
||||
static inline zval **zend_fetch_property_address_inner(zval *object, znode *op2, temp_variable *Ts, int type TSRMLS_DC)
|
||||
{
|
||||
zval *prop_ptr = get_zval_ptr(op2, Ts, &EG(free_op2), BP_VAR_R);
|
||||
zval **retval;
|
||||
zval **retval = NULL;
|
||||
zval tmp;
|
||||
|
||||
|
||||
@@ -161,7 +161,9 @@ static inline zval **zend_fetch_property_address_inner(zval *object, znode *op2,
|
||||
|
||||
if(Z_OBJ_HT_P(object)->get_property_ptr != NULL) {
|
||||
retval = Z_OBJ_HT_P(object)->get_property_ptr(object, prop_ptr TSRMLS_CC);
|
||||
} else {
|
||||
}
|
||||
|
||||
if(retval == NULL) {
|
||||
zend_error(E_WARNING, "This object doesn't support property references");
|
||||
retval = &EG(error_zval_ptr);
|
||||
}
|
||||
@@ -321,6 +323,7 @@ static inline void zend_assign_to_object_op(znode *result, znode *op1, znode *op
|
||||
zval *property = get_zval_ptr(op2, Ts, &EG(free_op2), BP_VAR_R);
|
||||
zval tmp;
|
||||
zval **retval = &Ts[result->u.var].var.ptr;
|
||||
int have_get_ptr = 0;
|
||||
|
||||
Ts[result->u.var].var.ptr_ptr = NULL;
|
||||
make_real_object(object_ptr TSRMLS_CC);
|
||||
@@ -356,12 +359,17 @@ static inline void zend_assign_to_object_op(znode *result, znode *op1, znode *op
|
||||
|
||||
if(Z_OBJ_HT_P(object)->get_property_zval_ptr) {
|
||||
zval **zptr = Z_OBJ_HT_P(object)->get_property_zval_ptr(object, property TSRMLS_CC);
|
||||
SEPARATE_ZVAL_IF_NOT_REF(zptr);
|
||||
if(zptr != NULL) { /* NULL means no success in getting PTR */
|
||||
SEPARATE_ZVAL_IF_NOT_REF(zptr);
|
||||
|
||||
binary_op(*zptr, *zptr, value TSRMLS_CC);
|
||||
*retval = *zptr;
|
||||
SELECTIVE_PZVAL_LOCK(*retval, result);
|
||||
} else {
|
||||
have_get_ptr = 1;
|
||||
binary_op(*zptr, *zptr, value TSRMLS_CC);
|
||||
*retval = *zptr;
|
||||
SELECTIVE_PZVAL_LOCK(*retval, result);
|
||||
}
|
||||
}
|
||||
|
||||
if(!have_get_ptr) {
|
||||
zval *z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_RW TSRMLS_CC);
|
||||
SEPARATE_ZVAL_IF_NOT_REF(&z);
|
||||
binary_op(z, z, value TSRMLS_CC);
|
||||
@@ -989,6 +997,7 @@ static void zend_pre_incdec_property(znode *result, znode *op1, znode *op2, temp
|
||||
zval *object;
|
||||
zval *property = get_zval_ptr(op2, Ts, &EG(free_op2), BP_VAR_R);
|
||||
zval **retval = &Ts[result->u.var].var.ptr;
|
||||
int have_get_ptr = 0;
|
||||
|
||||
make_real_object(object_ptr TSRMLS_CC);
|
||||
object = *object_ptr;
|
||||
@@ -1006,12 +1015,17 @@ static void zend_pre_incdec_property(znode *result, znode *op1, znode *op2, temp
|
||||
|
||||
if(Z_OBJ_HT_P(object)->get_property_zval_ptr) {
|
||||
zval **zptr = Z_OBJ_HT_P(object)->get_property_zval_ptr(object, property TSRMLS_CC);
|
||||
SEPARATE_ZVAL_IF_NOT_REF(zptr);
|
||||
if(zptr != NULL) { /* NULL means no success in getting PTR */
|
||||
SEPARATE_ZVAL_IF_NOT_REF(zptr);
|
||||
|
||||
incdec_op(*zptr);
|
||||
*retval = *zptr;
|
||||
SELECTIVE_PZVAL_LOCK(*retval, result);
|
||||
} else {
|
||||
have_get_ptr = 1;
|
||||
incdec_op(*zptr);
|
||||
*retval = *zptr;
|
||||
SELECTIVE_PZVAL_LOCK(*retval, result);
|
||||
}
|
||||
}
|
||||
|
||||
if(!have_get_ptr) {
|
||||
zval *z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_RW TSRMLS_CC);
|
||||
SEPARATE_ZVAL_IF_NOT_REF(&z);
|
||||
incdec_op(z);
|
||||
@@ -1030,6 +1044,7 @@ static void zend_post_incdec_property(znode *result, znode *op1, znode *op2, tem
|
||||
zval *object;
|
||||
zval *property = get_zval_ptr(op2, Ts, &EG(free_op2), BP_VAR_R);
|
||||
zval *retval = &Ts[result->u.var].tmp_var;
|
||||
int have_get_ptr = 0;
|
||||
|
||||
make_real_object(object_ptr TSRMLS_CC);
|
||||
object = *object_ptr;
|
||||
@@ -1045,13 +1060,19 @@ static void zend_post_incdec_property(znode *result, znode *op1, znode *op2, tem
|
||||
|
||||
if(Z_OBJ_HT_P(object)->get_property_zval_ptr) {
|
||||
zval **zptr = Z_OBJ_HT_P(object)->get_property_zval_ptr(object, property TSRMLS_CC);
|
||||
SEPARATE_ZVAL_IF_NOT_REF(zptr);
|
||||
if(zptr != NULL) { /* NULL means no success in getting PTR */
|
||||
have_get_ptr = 1;
|
||||
SEPARATE_ZVAL_IF_NOT_REF(zptr);
|
||||
|
||||
*retval = **zptr;
|
||||
zendi_zval_copy_ctor(*retval);
|
||||
|
||||
incdec_op(*zptr);
|
||||
|
||||
*retval = **zptr;
|
||||
zendi_zval_copy_ctor(*retval);
|
||||
}
|
||||
}
|
||||
|
||||
incdec_op(*zptr);
|
||||
} else {
|
||||
if(!have_get_ptr) {
|
||||
zval *z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_RW TSRMLS_CC);
|
||||
SEPARATE_ZVAL_IF_NOT_REF(&z);
|
||||
*retval = *z;
|
||||
@@ -1627,6 +1648,8 @@ binary_assign_op_addr_obj:
|
||||
EX(Ts)[EX(opline)->result.u.var].tmp_var.value.str.val[0] = 0;
|
||||
EX(Ts)[EX(opline)->result.u.var].tmp_var.value.str.len = 0;
|
||||
EX(Ts)[EX(opline)->result.u.var].tmp_var.refcount = 1;
|
||||
EX(Ts)[EX(opline)->result.u.var].tmp_var.type = IS_STRING;
|
||||
EX(Ts)[EX(opline)->result.u.var].tmp_var.is_ref = 0;
|
||||
NEXT_OPCODE();
|
||||
case ZEND_ADD_CHAR:
|
||||
add_char_to_string( &EX(Ts)[EX(opline)->result.u.var].tmp_var,
|
||||
@@ -2077,6 +2100,7 @@ do_fcall_common:
|
||||
ALLOC_ZVAL(EX(Ts)[EX(opline)->result.u.var].var.ptr);
|
||||
INIT_ZVAL(*(EX(Ts)[EX(opline)->result.u.var].var.ptr));
|
||||
((zend_internal_function *) EX(function_state).function)->handler(EX(opline)->extended_value, EX(Ts)[EX(opline)->result.u.var].var.ptr, EX(object), return_value_used TSRMLS_CC);
|
||||
EG(current_execute_data) = &execute_data;
|
||||
EX(Ts)[EX(opline)->result.u.var].var.ptr->is_ref = 0;
|
||||
EX(Ts)[EX(opline)->result.u.var].var.ptr->refcount = 1;
|
||||
if (!return_value_used) {
|
||||
@@ -2673,7 +2697,11 @@ send_by_ref:
|
||||
file_handle.free_filename = 0;
|
||||
|
||||
if (file_handle.handle.fp) {
|
||||
if (!opened_path || zend_hash_add(&EG(included_files), opened_path, strlen(opened_path)+1, (void *)&dummy, sizeof(int), NULL)==SUCCESS) {
|
||||
if( !opened_path ) {
|
||||
opened_path = file_handle.opened_path = estrndup(inc_filename->value.str.val, inc_filename->value.str.len);
|
||||
}
|
||||
|
||||
if (zend_hash_add(&EG(included_files), opened_path, strlen(opened_path)+1, (void *)&dummy, sizeof(int), NULL)==SUCCESS) {
|
||||
new_op_array = zend_compile_file(&file_handle, (EX(opline)->op2.u.constant.value.lval==ZEND_INCLUDE_ONCE?ZEND_INCLUDE:ZEND_REQUIRE) TSRMLS_CC);
|
||||
zend_destroy_file_handle(&file_handle TSRMLS_CC);
|
||||
opened_path = NULL; /* zend_destroy_file_handle() already frees it */
|
||||
|
||||
+21
-10
@@ -459,7 +459,6 @@ int call_user_function_ex(HashTable *function_table, zval **object_pp, zval *fun
|
||||
int i;
|
||||
zval **original_return_value;
|
||||
HashTable *calling_symbol_table;
|
||||
zend_function_state function_state;
|
||||
zend_function_state *original_function_state_ptr;
|
||||
zend_op_array *original_op_array;
|
||||
zend_op **original_opline_ptr;
|
||||
@@ -471,6 +470,14 @@ int call_user_function_ex(HashTable *function_table, zval **object_pp, zval *fun
|
||||
zend_class_entry *calling_scope = NULL;
|
||||
zval *current_this;
|
||||
|
||||
zend_execute_data execute_data;
|
||||
|
||||
/* Initialize execute_data */
|
||||
EX(fbc) = NULL;
|
||||
EX(object) = NULL;
|
||||
EX(Ts) = NULL;
|
||||
EX(op_array) = NULL;
|
||||
EX(opline) = NULL;
|
||||
*retval_ptr_ptr = NULL;
|
||||
|
||||
if (function_name->type==IS_ARRAY) { /* assume array($obj, $name) couple */
|
||||
@@ -501,6 +508,7 @@ int call_user_function_ex(HashTable *function_table, zval **object_pp, zval *fun
|
||||
}
|
||||
|
||||
function_table = &Z_OBJCE_PP(object_pp)->function_table;
|
||||
EX(object) = *object_pp;
|
||||
calling_scope = Z_OBJCE_PP(object_pp);
|
||||
} else if (Z_TYPE_PP(object_pp) == IS_STRING) {
|
||||
zend_class_entry **ce;
|
||||
@@ -530,7 +538,7 @@ int call_user_function_ex(HashTable *function_table, zval **object_pp, zval *fun
|
||||
zend_str_tolower(function_name_copy.value.str.val, function_name_copy.value.str.len);
|
||||
|
||||
original_function_state_ptr = EG(function_state_ptr);
|
||||
if (zend_hash_find(function_table, function_name_copy.value.str.val, function_name_copy.value.str.len+1, (void **) &function_state.function)==FAILURE) {
|
||||
if (zend_hash_find(function_table, function_name_copy.value.str.val, function_name_copy.value.str.len+1, (void **) &EX(function_state).function)==FAILURE) {
|
||||
zval_dtor(&function_name_copy);
|
||||
return FAILURE;
|
||||
}
|
||||
@@ -539,9 +547,9 @@ int call_user_function_ex(HashTable *function_table, zval **object_pp, zval *fun
|
||||
for (i=0; i<param_count; i++) {
|
||||
zval *param;
|
||||
|
||||
if (function_state.function->common.arg_types
|
||||
&& i<function_state.function->common.arg_types[0]
|
||||
&& function_state.function->common.arg_types[i+1]==BYREF_FORCE
|
||||
if (EX(function_state).function->common.arg_types
|
||||
&& i<EX(function_state).function->common.arg_types[0]
|
||||
&& EX(function_state).function->common.arg_types[i+1]==BYREF_FORCE
|
||||
&& !PZVAL_IS_REF(*params[i])) {
|
||||
if ((*params[i])->refcount>1) {
|
||||
zval *new_zval;
|
||||
@@ -572,7 +580,7 @@ int call_user_function_ex(HashTable *function_table, zval **object_pp, zval *fun
|
||||
|
||||
zend_ptr_stack_n_push(&EG(argument_stack), 2, (void *) (long) param_count, NULL);
|
||||
|
||||
EG(function_state_ptr) = &function_state;
|
||||
EG(function_state_ptr) = &EX(function_state);
|
||||
|
||||
current_scope = EG(scope);
|
||||
EG(scope) = calling_scope;
|
||||
@@ -597,8 +605,10 @@ int call_user_function_ex(HashTable *function_table, zval **object_pp, zval *fun
|
||||
EG(This) = NULL;
|
||||
}
|
||||
|
||||
EX(prev_execute_data) = EG(current_execute_data);
|
||||
EG(current_execute_data) = &execute_data;
|
||||
|
||||
if (function_state.function->type == ZEND_USER_FUNCTION) {
|
||||
if (EX(function_state).function->type == ZEND_USER_FUNCTION) {
|
||||
calling_symbol_table = EG(active_symbol_table);
|
||||
if (symbol_table) {
|
||||
EG(active_symbol_table) = symbol_table;
|
||||
@@ -610,7 +620,7 @@ int call_user_function_ex(HashTable *function_table, zval **object_pp, zval *fun
|
||||
original_return_value = EG(return_value_ptr_ptr);
|
||||
original_op_array = EG(active_op_array);
|
||||
EG(return_value_ptr_ptr) = retval_ptr_ptr;
|
||||
EG(active_op_array) = (zend_op_array *) function_state.function;
|
||||
EG(active_op_array) = (zend_op_array *) EX(function_state).function;
|
||||
original_opline_ptr = EG(opline_ptr);
|
||||
orig_free_op1 = EG(free_op1);
|
||||
orig_free_op2 = EG(free_op2);
|
||||
@@ -631,7 +641,7 @@ int call_user_function_ex(HashTable *function_table, zval **object_pp, zval *fun
|
||||
EG(binary_op) = orig_binary_op;
|
||||
} else {
|
||||
ALLOC_INIT_ZVAL(*retval_ptr_ptr);
|
||||
((zend_internal_function *) function_state.function)->handler(param_count, *retval_ptr_ptr, (object_pp?*object_pp:NULL), 1 TSRMLS_CC);
|
||||
((zend_internal_function *) EX(function_state).function)->handler(param_count, *retval_ptr_ptr, (object_pp?*object_pp:NULL), 1 TSRMLS_CC);
|
||||
INIT_PZVAL(*retval_ptr_ptr);
|
||||
}
|
||||
zend_ptr_stack_clear_multiple(TSRMLS_C);
|
||||
@@ -642,7 +652,8 @@ int call_user_function_ex(HashTable *function_table, zval **object_pp, zval *fun
|
||||
}
|
||||
EG(scope) = current_scope;
|
||||
EG(This) = current_this;
|
||||
|
||||
EG(current_execute_data) = EX(prev_execute_data); \
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ int zend_load_extension(char *path)
|
||||
handle = DL_LOAD(path);
|
||||
if (!handle) {
|
||||
#ifndef ZEND_WIN32
|
||||
fprintf(stderr, "Failed loading %s: %s\n", path, dlerror());
|
||||
fprintf(stderr, "Failed loading %s: %s\n", path, DL_ERROR());
|
||||
#else
|
||||
fprintf(stderr, "Failed loading %s\n", path);
|
||||
#endif
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
|
||||
#include "zend_compile.h"
|
||||
|
||||
#define ZEND_EXTENSION_API_NO 20010710
|
||||
#define ZEND_EXTENSION_API_NO 220020901
|
||||
|
||||
typedef struct _zend_extension_version_info {
|
||||
int zend_extension_api_no;
|
||||
|
||||
+1
-1
@@ -1109,7 +1109,7 @@ ZEND_API int zend_hash_sort(HashTable *ht, sort_func_t sort_func,
|
||||
|
||||
IS_CONSISTENT(ht);
|
||||
|
||||
if (ht->nNumOfElements <= 1) { /* Doesn't require sorting */
|
||||
if (!(ht->nNumOfElements>1) && !(renumber && ht->nNumOfElements>0)) { /* Doesn't require sorting */
|
||||
return SUCCESS;
|
||||
}
|
||||
arTmp = (Bucket **) pemalloc(ht->nNumOfElements * sizeof(Bucket *), ht->persistent);
|
||||
|
||||
+26
-6
@@ -25,6 +25,8 @@
|
||||
|
||||
static HashTable *registered_zend_ini_directives;
|
||||
|
||||
#define NO_VALUE_PLAINTEXT "no value"
|
||||
#define NO_VALUE_HTML "<i>no value</i>"
|
||||
|
||||
/*
|
||||
* hash_apply functions
|
||||
@@ -305,15 +307,25 @@ static void zend_ini_displayer_cb(zend_ini_entry *ini_entry, int type)
|
||||
display_string = ini_entry->orig_value;
|
||||
display_string_length = ini_entry->orig_value_length;
|
||||
} else {
|
||||
display_string = "<i>no value</i>";
|
||||
display_string_length = sizeof("<i>no value</i>")-1;
|
||||
if(zend_uv.html_errors) {
|
||||
display_string = NO_VALUE_HTML;
|
||||
display_string_length = sizeof(NO_VALUE_HTML)-1;
|
||||
} else {
|
||||
display_string = NO_VALUE_PLAINTEXT;
|
||||
display_string_length = sizeof(NO_VALUE_PLAINTEXT)-1;
|
||||
}
|
||||
}
|
||||
} else if (ini_entry->value && ini_entry->value[0]) {
|
||||
display_string = ini_entry->value;
|
||||
display_string_length = ini_entry->value_length;
|
||||
} else {
|
||||
display_string = "<i>no value</i>";
|
||||
display_string_length = sizeof("<i>no value</i>")-1;
|
||||
if(zend_uv.html_errors) {
|
||||
display_string = NO_VALUE_HTML;
|
||||
display_string_length = sizeof(NO_VALUE_HTML)-1;
|
||||
} else {
|
||||
display_string = NO_VALUE_PLAINTEXT;
|
||||
display_string_length = sizeof(NO_VALUE_PLAINTEXT)-1;
|
||||
}
|
||||
}
|
||||
ZEND_WRITE(display_string, display_string_length);
|
||||
}
|
||||
@@ -351,9 +363,17 @@ ZEND_INI_DISP(zend_ini_color_displayer_cb)
|
||||
value = NULL;
|
||||
}
|
||||
if (value) {
|
||||
zend_printf("<font color=\"%s\">%s</font>", value, value);
|
||||
if (zend_uv.html_errors) {
|
||||
zend_printf("<font color=\"%s\">%s</font>", value, value);
|
||||
} else {
|
||||
ZEND_PUTS(value);
|
||||
}
|
||||
} else {
|
||||
ZEND_PUTS("<i>no value</i>;");
|
||||
if (zend_uv.html_errors) {
|
||||
ZEND_PUTS(NO_VALUE_HTML);
|
||||
} else {
|
||||
ZEND_PUTS(NO_VALUE_PLAINTEXT);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -82,8 +82,8 @@ ZEND_API void zend_llist_prepend_element(zend_llist *l, void *element)
|
||||
}\
|
||||
if ((l)->dtor) {\
|
||||
(l)->dtor((current)->data);\
|
||||
pefree((current), (l)->persistent);\
|
||||
}\
|
||||
pefree((current), (l)->persistent);\
|
||||
--l->count;
|
||||
|
||||
|
||||
|
||||
+254
-21
@@ -8,6 +8,23 @@
|
||||
|
||||
#define DEBUG_OBJECT_HANDLERS 0
|
||||
|
||||
/*
|
||||
__X accessors explanation:
|
||||
|
||||
if we have __get and property that is not part of the properties array is
|
||||
requested, we call __get handler. If it fails, we return uninitialized.
|
||||
|
||||
if we have __set and property that is not part of the properties array is
|
||||
set, we call __set handler. If it fails, we do not change the array.
|
||||
|
||||
for both handlers above, when we are inside __get/__set, no further calls for
|
||||
__get/__set for these objects will be made, to prevent endless recursion and
|
||||
enable accessors to change properties array.
|
||||
|
||||
if we have __call and method which is not part of the class function table is
|
||||
called, we cal __call handler.
|
||||
*/
|
||||
|
||||
static HashTable *zend_std_get_properties(zval *object TSRMLS_DC)
|
||||
{
|
||||
zend_object *zobj;
|
||||
@@ -15,11 +32,109 @@ static HashTable *zend_std_get_properties(zval *object TSRMLS_DC)
|
||||
return zobj->properties;
|
||||
}
|
||||
|
||||
static zval *zend_std_call_getter(zval *object, zval *member TSRMLS_DC)
|
||||
{
|
||||
zval **call_args[1];
|
||||
zval *retval = NULL;
|
||||
zval __get_name;
|
||||
int call_result;
|
||||
|
||||
/* __get handler is called with two arguments:
|
||||
property name
|
||||
return value for the object (by reference)
|
||||
|
||||
it should return whether the call was successfull or not
|
||||
*/
|
||||
INIT_PZVAL(&__get_name);
|
||||
ZVAL_STRINGL(&__get_name, ZEND_GET_FUNC_NAME, sizeof(ZEND_GET_FUNC_NAME)-1, 0);
|
||||
|
||||
call_args[0] = &member;
|
||||
|
||||
/* go call the __get handler */
|
||||
call_result = call_user_function_ex(NULL,
|
||||
&object,
|
||||
&__get_name,
|
||||
&retval,
|
||||
1, call_args,
|
||||
0, NULL TSRMLS_CC);
|
||||
|
||||
/*
|
||||
call_result is if call_user_function gone OK.
|
||||
retval returns the value that is received
|
||||
*/
|
||||
|
||||
|
||||
if(call_result == FAILURE) {
|
||||
zend_error(E_ERROR, "Could not call __get handler for class %s", Z_OBJCE_P(object)->name);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
retval->refcount--;
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
static int zend_std_call_setter(zval *object, zval *member, zval *value TSRMLS_DC)
|
||||
{
|
||||
zval **call_args[2];
|
||||
zval *retval = NULL;
|
||||
zval __set_name;
|
||||
int call_result;
|
||||
int ret;
|
||||
|
||||
/* __set handler is called with two arguments:
|
||||
property name
|
||||
value to be set
|
||||
|
||||
it should return whether the call was successfull or not
|
||||
*/
|
||||
INIT_PZVAL(&__set_name);
|
||||
ZVAL_STRINGL(&__set_name, ZEND_SET_FUNC_NAME, sizeof(ZEND_SET_FUNC_NAME)-1, 0);
|
||||
|
||||
call_args[0] = &member;
|
||||
value->refcount++;
|
||||
call_args[1] = &value;
|
||||
|
||||
/* go call the __set handler */
|
||||
call_result = call_user_function_ex(NULL,
|
||||
&object,
|
||||
&__set_name,
|
||||
&retval,
|
||||
2, call_args,
|
||||
0, NULL TSRMLS_CC);
|
||||
|
||||
/*
|
||||
call_result is if call_user_function gone OK.
|
||||
retval shows if __get method went OK.
|
||||
*/
|
||||
|
||||
|
||||
if(call_result == FAILURE) {
|
||||
zend_error(E_ERROR, "Could not call __set handler for class %s", Z_OBJCE_P(object)->name);
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
zval_ptr_dtor(&value);
|
||||
|
||||
if (retval && zval_is_true(retval)) {
|
||||
ret = SUCCESS;
|
||||
} else {
|
||||
ret = FAILURE;
|
||||
}
|
||||
|
||||
if(retval) {
|
||||
zval_ptr_dtor(&retval);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
zval *zend_std_read_property(zval *object, zval *member, int type TSRMLS_DC)
|
||||
{
|
||||
zend_object *zobj;
|
||||
zval tmp_member;
|
||||
zval **retval;
|
||||
zval *rv = NULL;
|
||||
|
||||
zobj = Z_OBJ_P(object);
|
||||
|
||||
@@ -35,25 +150,38 @@ zval *zend_std_read_property(zval *object, zval *member, int type TSRMLS_DC)
|
||||
#endif
|
||||
|
||||
if (zend_hash_find(zobj->properties, Z_STRVAL_P(member), Z_STRLEN_P(member)+1, (void **) &retval) == FAILURE) {
|
||||
switch (type) {
|
||||
case BP_VAR_R:
|
||||
zend_error(E_NOTICE,"Undefined property: %s", Z_STRVAL_P(member));
|
||||
/* break missing intentionally */
|
||||
case BP_VAR_IS:
|
||||
retval = &EG(uninitialized_zval_ptr);
|
||||
break;
|
||||
case BP_VAR_RW:
|
||||
zend_error(E_NOTICE,"Undefined property: %s", Z_STRVAL_P(member));
|
||||
/* break missing intentionally */
|
||||
case BP_VAR_W: {
|
||||
if(zobj->ce->__get && !zobj->in_get) {
|
||||
/* have getter - try with it! */
|
||||
zobj->in_get = 1; /* prevent circular getting */
|
||||
rv = zend_std_call_getter(object, member TSRMLS_CC);
|
||||
zobj->in_get = 0;
|
||||
|
||||
if(rv) {
|
||||
retval = &rv;
|
||||
} else {
|
||||
retval = &EG(uninitialized_zval_ptr);
|
||||
}
|
||||
} else {
|
||||
switch (type) {
|
||||
case BP_VAR_R:
|
||||
zend_error(E_NOTICE,"Undefined property: %s", Z_STRVAL_P(member));
|
||||
/* break missing intentionally */
|
||||
case BP_VAR_IS:
|
||||
retval = &EG(uninitialized_zval_ptr);
|
||||
break;
|
||||
case BP_VAR_RW:
|
||||
zend_error(E_NOTICE,"Undefined property: %s", Z_STRVAL_P(member));
|
||||
/* break missing intentionally */
|
||||
case BP_VAR_W: {
|
||||
zval *new_zval = &EG(uninitialized_zval);
|
||||
|
||||
|
||||
new_zval->refcount++;
|
||||
zend_hash_update(zobj->properties, Z_STRVAL_P(member), Z_STRLEN_P(member)+1, &new_zval, sizeof(zval *), (void **) &retval);
|
||||
}
|
||||
}
|
||||
break;
|
||||
EMPTY_SWITCH_DEFAULT_CASE()
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
if (member == &tmp_member) {
|
||||
@@ -67,6 +195,7 @@ static void zend_std_write_property(zval *object, zval *member, zval *value TSRM
|
||||
zend_object *zobj;
|
||||
zval tmp_member;
|
||||
zval **variable_ptr;
|
||||
int setter_done = 0;
|
||||
|
||||
zobj = Z_OBJ_P(object);
|
||||
|
||||
@@ -88,10 +217,21 @@ static void zend_std_write_property(zval *object, zval *member, zval *value TSRM
|
||||
FREE_ZVAL(*variable_ptr);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if(zobj->ce->__set && !zobj->in_set) {
|
||||
zobj->in_set = 1; /* prevent circular setting */
|
||||
if(zend_std_call_setter(object, member, value TSRMLS_CC) != SUCCESS) {
|
||||
// zend_error(E_NOTICE,"Cannot set undefined property: %s", Z_STRVAL_P(member));
|
||||
}
|
||||
setter_done = 1;
|
||||
zobj->in_set = 0;
|
||||
}
|
||||
}
|
||||
|
||||
value->refcount++;
|
||||
zend_hash_update(zobj->properties, Z_STRVAL_P(member), Z_STRLEN_P(member)+1, &value, sizeof(zval *), NULL);
|
||||
if(!setter_done) {
|
||||
value->refcount++;
|
||||
zend_hash_update(zobj->properties, Z_STRVAL_P(member), Z_STRLEN_P(member)+1, &value, sizeof(zval *), NULL);
|
||||
}
|
||||
if (member == &tmp_member) {
|
||||
zval_dtor(member);
|
||||
}
|
||||
@@ -117,11 +257,19 @@ static zval **zend_std_get_property_ptr(zval *object, zval *member TSRMLS_DC)
|
||||
#endif
|
||||
|
||||
if (zend_hash_find(zobj->properties, Z_STRVAL_P(member), Z_STRLEN_P(member)+1, (void **) &retval) == FAILURE) {
|
||||
zval *new_zval = &EG(uninitialized_zval);
|
||||
zval *new_zval;
|
||||
|
||||
zend_error(E_NOTICE, "Undefined property: %s", Z_STRVAL_P(member));
|
||||
new_zval->refcount++;
|
||||
zend_hash_update(zobj->properties, Z_STRVAL_P(member), Z_STRLEN_P(member)+1, &new_zval, sizeof(zval *), (void **) &retval);
|
||||
if(!zobj->ce->__get) {
|
||||
/* we don't have getter - will just add it */
|
||||
new_zval = &EG(uninitialized_zval);
|
||||
|
||||
zend_error(E_NOTICE, "Undefined property: %s", Z_STRVAL_P(member));
|
||||
new_zval->refcount++;
|
||||
zend_hash_update(zobj->properties, Z_STRVAL_P(member), Z_STRLEN_P(member)+1, &new_zval, sizeof(zval *), (void **) &retval);
|
||||
} else {
|
||||
/* we do have getter - fail and let it try again with usual get/set */
|
||||
retval = NULL;
|
||||
}
|
||||
}
|
||||
if (member == &tmp_member) {
|
||||
zval_dtor(member);
|
||||
@@ -148,12 +296,86 @@ static void zend_std_unset_property(zval *object, zval *member TSRMLS_DC)
|
||||
}
|
||||
}
|
||||
|
||||
static void zend_std_call_user_call(INTERNAL_FUNCTION_PARAMETERS)
|
||||
{
|
||||
zval ***args;
|
||||
zend_internal_function *func = (zend_internal_function *)EG(function_state_ptr)->function;
|
||||
zval method_name, method_args, __call_name;
|
||||
zval *method_name_ptr, *method_args_ptr;
|
||||
zval **call_args[2];
|
||||
zval *method_result_ptr = NULL;
|
||||
int i, call_result;
|
||||
|
||||
args = (zval ***)emalloc(ZEND_NUM_ARGS() * sizeof(zval **));
|
||||
|
||||
if (zend_get_parameters_array_ex(ZEND_NUM_ARGS(), args) == FAILURE) {
|
||||
efree(args);
|
||||
zend_error(E_ERROR, "Cannot get arguments for __call");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
method_name_ptr = &method_name;
|
||||
INIT_PZVAL(method_name_ptr);
|
||||
ZVAL_STRING(method_name_ptr, func->function_name, 0); /* no dup - it's a copy */
|
||||
|
||||
method_args_ptr = &method_args;
|
||||
INIT_PZVAL(method_args_ptr);
|
||||
array_init(method_args_ptr);
|
||||
|
||||
for(i=0; i<ZEND_NUM_ARGS(); i++) {
|
||||
zval_add_ref(args[i]);
|
||||
add_next_index_zval(method_args_ptr, *args[i]);
|
||||
}
|
||||
|
||||
efree(args);
|
||||
|
||||
INIT_PZVAL(&__call_name);
|
||||
ZVAL_STRINGL(&__call_name, ZEND_CALL_FUNC_NAME, sizeof(ZEND_CALL_FUNC_NAME)-1, 0);
|
||||
|
||||
/* __call handler is called with two arguments:
|
||||
method name
|
||||
array of method parameters
|
||||
|
||||
*/
|
||||
call_args[0] = &method_name_ptr;
|
||||
call_args[1] = &method_args_ptr;
|
||||
|
||||
/* go call the __call handler */
|
||||
call_result = call_user_function_ex(NULL,
|
||||
&this_ptr,
|
||||
&__call_name,
|
||||
&method_result_ptr,
|
||||
2, call_args,
|
||||
0, NULL TSRMLS_CC);
|
||||
|
||||
/* call_result is if call_user_function gone OK.
|
||||
method_result_ptr is the true result of the called method
|
||||
*/
|
||||
|
||||
if(method_result_ptr) {
|
||||
*return_value = *method_result_ptr;
|
||||
zval_copy_ctor(return_value);
|
||||
zval_ptr_dtor(&method_result_ptr);
|
||||
}
|
||||
|
||||
if(call_result == FAILURE) {
|
||||
zend_error(E_ERROR, "Could not call __call handler for class %s", Z_OBJCE_P(this_ptr)->name);
|
||||
}
|
||||
|
||||
/* now destruct all auxiliaries */
|
||||
zval_dtor(method_args_ptr);
|
||||
zval_dtor(method_name_ptr);
|
||||
|
||||
/* destruct the function also, then - we have allocated it in get_method */
|
||||
efree(func);
|
||||
}
|
||||
|
||||
static union _zend_function *zend_std_get_method(zval *object, char *method_name, int method_len TSRMLS_DC)
|
||||
{
|
||||
zend_object *zobj;
|
||||
zend_function *func_method;
|
||||
char *lc_method_name;
|
||||
|
||||
|
||||
lc_method_name = do_alloca(method_len+1);
|
||||
/* Create a zend_copy_str_tolower(dest, src, src_length); */
|
||||
memcpy(lc_method_name, method_name, method_len+1);
|
||||
@@ -161,6 +383,17 @@ static union _zend_function *zend_std_get_method(zval *object, char *method_name
|
||||
|
||||
zobj = Z_OBJ_P(object);
|
||||
if(zend_hash_find(&zobj->ce->function_table, lc_method_name, method_len+1, (void **)&func_method) == FAILURE) {
|
||||
if(zobj->ce->__call != NULL) {
|
||||
zend_internal_function *call_user_call = emalloc(sizeof(zend_internal_function));
|
||||
call_user_call->type = ZEND_INTERNAL_FUNCTION;
|
||||
call_user_call->handler = zend_std_call_user_call;
|
||||
call_user_call->arg_types = NULL;
|
||||
call_user_call->scope = NULL;
|
||||
call_user_call->function_name = estrndup(method_name, method_len);
|
||||
|
||||
free_alloca(lc_method_name);
|
||||
return (union _zend_function *)call_user_call;
|
||||
}
|
||||
zend_error(E_ERROR, "Call to undefined function %s()", method_name);
|
||||
}
|
||||
|
||||
|
||||
@@ -57,6 +57,8 @@ ZEND_API zend_object_value zend_objects_new(zend_object **object, zend_class_ent
|
||||
(*object)->ce = class_type;
|
||||
retval.handle = zend_objects_store_put(*object, (zend_objects_store_dtor_t) zend_objects_destroy_object, NULL TSRMLS_CC);
|
||||
retval.handlers = &std_object_handlers;
|
||||
(*object)->in_get = 0;
|
||||
(*object)->in_set = 0;
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ ZEND_API int zend_atoi(const char *str, int str_len)
|
||||
if (!str_len) {
|
||||
str_len = strlen(str);
|
||||
}
|
||||
retval = atoi(str);
|
||||
retval = strtol(str, NULL, 0);
|
||||
if (str_len>0) {
|
||||
switch (str[str_len-1]) {
|
||||
case 'k':
|
||||
@@ -871,7 +871,7 @@ ZEND_API int bitwise_or_function(zval *result, zval *op1, zval *op2 TSRMLS_DC)
|
||||
result_str[i] |= shorter->value.str.val[i];
|
||||
}
|
||||
if (result==op1) {
|
||||
efree(result->value.str.val);
|
||||
STR_FREE(result->value.str.val);
|
||||
}
|
||||
result->value.str.val = result_str;
|
||||
result->value.str.len = result_len;
|
||||
@@ -910,7 +910,7 @@ ZEND_API int bitwise_and_function(zval *result, zval *op1, zval *op2 TSRMLS_DC)
|
||||
result_str[i] &= longer->value.str.val[i];
|
||||
}
|
||||
if (result==op1) {
|
||||
efree(result->value.str.val);
|
||||
STR_FREE(result->value.str.val);
|
||||
}
|
||||
result->value.str.val = result_str;
|
||||
result->value.str.len = result_len;
|
||||
@@ -951,7 +951,7 @@ ZEND_API int bitwise_xor_function(zval *result, zval *op1, zval *op2 TSRMLS_DC)
|
||||
result_str[i] ^= longer->value.str.val[i];
|
||||
}
|
||||
if (result==op1) {
|
||||
efree(result->value.str.val);
|
||||
STR_FREE(result->value.str.val);
|
||||
}
|
||||
result->value.str.val = result_str;
|
||||
result->value.str.len = result_len;
|
||||
@@ -1489,12 +1489,12 @@ ZEND_API int increment_function(zval *op1)
|
||||
op1->value.lval = lval+1;
|
||||
op1->type = IS_LONG;
|
||||
}
|
||||
efree(strval);
|
||||
efree(strval); /* should never be empty_string */
|
||||
break;
|
||||
case IS_DOUBLE:
|
||||
op1->value.dval = dval+1;
|
||||
op1->type = IS_DOUBLE;
|
||||
efree(strval);
|
||||
efree(strval); /* should never be empty_string */
|
||||
break;
|
||||
#if 0
|
||||
case FLAG_IS_BC:
|
||||
|
||||
-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
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,57 +0,0 @@
|
||||
dnl
|
||||
dnl $Id$
|
||||
dnl
|
||||
|
||||
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,for 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
|
||||
if test "$PHP_PCRE_REGEX" = "yes"; then
|
||||
PHP_NEW_EXTENSION(pcre, pcrelib/maketables.c pcrelib/get.c pcrelib/study.c pcrelib/pcre.c php_pcre.c, $ext_shared,,-DSUPPORT_UTF8 -I@ext_srcdir@/pcrelib)
|
||||
PHP_ADD_BUILD_DIR($ext_builddir/pcrelib)
|
||||
AC_DEFINE(HAVE_BUNDLED_PCRE, 1, [ ])
|
||||
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
|
||||
test -f $PHP_PCRE_REGEX/include/pcre/pcre.h && PCRE_INCDIR=$PHP_PCRE_REGEX/include/pcre
|
||||
|
||||
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
|
||||
|
||||
PHP_ADD_LIBRARY_WITH_PATH(pcre, $PCRE_LIBDIR, PCRE_SHARED_LIBADD)
|
||||
|
||||
AC_DEFINE(HAVE_PCRE, 1, [ ])
|
||||
PHP_ADD_INCLUDE($PCRE_INCDIR)
|
||||
PHP_NEW_EXTENSION(pcre, php_pcre.c, $ext_shared,,-DSUPPORT_UTF8)
|
||||
fi
|
||||
fi
|
||||
PHP_SUBST(PCRE_SHARED_LIBADD)
|
||||
|
||||
AC_CHECK_FUNC(memmove, [], [AC_DEFINE(USE_BCOPY, 1, [ ])])
|
||||
Whitespace-only changes.
@@ -1,13 +0,0 @@
|
||||
top_srcdir = /usr/local/src/php-4.2.0
|
||||
top_builddir = /usr/local/src/php-4.2.0
|
||||
srcdir = /usr/local/src/php-4.2.0/ext/soap
|
||||
builddir = /usr/local/src/php-4.2.0/ext/soap
|
||||
VPATH = /usr/local/src/php-4.2.0/ext/soap
|
||||
# $Id$
|
||||
|
||||
LTLIBRARY_NAME = libsoap.la
|
||||
LTLIBRARY_SOURCES = soap.c php_sdl.c php_schema.c php_xml.c php_encoding.c php_http.c php_packet_soap.c
|
||||
LTLIBRARY_SHARED_NAME = soap.la
|
||||
LTLIBRARY_SHARED_LIBADD = $(SOAP_SHARED_LIBADD)
|
||||
|
||||
include $(top_srcdir)/build/dynlib.mk
|
||||
@@ -1,8 +0,0 @@
|
||||
# $Id$
|
||||
|
||||
LTLIBRARY_NAME = libsoap.la
|
||||
LTLIBRARY_SOURCES = soap.c php_sdl.c php_schema.c php_xml.c php_encoding.c php_http.c php_packet_soap.c
|
||||
LTLIBRARY_SHARED_NAME = soap.la
|
||||
LTLIBRARY_SHARED_LIBADD = $(SOAP_SHARED_LIBADD)
|
||||
|
||||
include $(top_srcdir)/build/dynlib.mk
|
||||
@@ -1,36 +0,0 @@
|
||||
TODO:
|
||||
make sure soap 1.1 and 1.2 is supported fully
|
||||
Better WSDL support Client and server (how much validation is needed here?)
|
||||
UDDI??
|
||||
make internal refrences for soap encoding (use seralization logic)
|
||||
add ini option for always soap_error_handler
|
||||
provide user space overriding of serialization certin objects and types
|
||||
serialization in general needs to be polished/finished... all xsd types
|
||||
make perstistant objects and work with or without register_globals on
|
||||
look to see if php-soap will work with out always_populate_raw_post_data on
|
||||
see if client will work with ssl.. should be eaiser with php_streams
|
||||
work on soap seralizer (php serialization)
|
||||
work on a soap-service 'regiestry' and 'proxy' (apache soap style)
|
||||
convert all string mainpulation to use smart_str
|
||||
make the 'soap' packet abstract.. maybe incorperate xml-rpc
|
||||
make the transport layer abstract.. what other transport layers are needed?... who uses smtp? what about jabber?
|
||||
make $soap_object->data = 'text'; maybe invoke a set_*() and/or get_*() method
|
||||
when using wsdls and function names are similar find the best match
|
||||
void test(int);
|
||||
void test(string);
|
||||
maybe use the same alogrithim as ext/java.
|
||||
investigate further http keep_alive... inital testing proved slower.. maybe php_streams will speed things up..
|
||||
provide schema 1999/2001 support....
|
||||
through memory leak testing
|
||||
possible using shared memory for sdl caching...
|
||||
api for clearing/checking sdl caching...
|
||||
make php-soap work as a standalone server using php_streams and the new socket extension
|
||||
http authication
|
||||
proxy support
|
||||
wsdl generation static and auto (.net style (http://server.com/soapserver.php?WSDL)) using phpdoc parsing engine
|
||||
interpo testing...
|
||||
BENCHMARKING...... lets prove how fast it is.
|
||||
do some more work on website
|
||||
|
||||
does this list stop... what exactly have i done?
|
||||
im sure im forgetting 20 thousand more things....
|
||||
@@ -1,16 +0,0 @@
|
||||
dnl $Id$
|
||||
dnl config.m4 for extension soap
|
||||
|
||||
dnl Comments in this file start with the string 'dnl'.
|
||||
dnl Remove where necessary. This file will not work
|
||||
dnl without editing.
|
||||
|
||||
PHP_ARG_ENABLE(soap, whether to enable soap support,
|
||||
Make sure that the comment is aligned:
|
||||
[ --enable-soap Enable soap support])
|
||||
|
||||
if test "$PHP_SOAP" != "no"; then
|
||||
PHP_ADD_INCLUDE(/usr/local/include/libxml2)
|
||||
PHP_ADD_LIBRARY_WITH_PATH(xml2,/usr/local/lib,SOAP_SHARED_LIBADD)
|
||||
PHP_EXTENSION(soap, $ext_shared)
|
||||
fi
|
||||
@@ -1,25 +0,0 @@
|
||||
<?php
|
||||
//
|
||||
// +----------------------------------------------------------------------+
|
||||
// | PHP Version 4 |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | Copyright (c) 1997-2002 The PHP Group |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | This source file is subject to version 2.02 of the PHP license, |
|
||||
// | that is bundled with this package in the file LICENSE, and is |
|
||||
// | available at through the world-wide-web at |
|
||||
// | http://www.php.net/license/2_02.txt. |
|
||||
// | If you did not receive a copy of the PHP license and are unable to |
|
||||
// | obtain it through the world-wide-web, please send a note to |
|
||||
// | license@php.net so we can mail you a copy immediately. |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | Authors: Shane Caraveo <Shane@Caraveo.com> |
|
||||
// +----------------------------------------------------------------------+
|
||||
//
|
||||
// $Id$
|
||||
//
|
||||
class Interop_Base
|
||||
{
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -1,102 +0,0 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title>Round 2 Interop Client Tests</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<a href="index.php">Back to Interop Index</a><br>
|
||||
<p> </p>
|
||||
<?php
|
||||
require_once 'SOAP/interop/client_round2_interop.php';
|
||||
|
||||
$iop = new Interop_Client();
|
||||
|
||||
function endpointList($test,$sel_endpoint)
|
||||
{
|
||||
global $iop;
|
||||
$iop->getEndpoints($test);
|
||||
echo "<select name='endpoint'>\n";
|
||||
foreach ($iop->endpoints as $epname => $epinfo) {
|
||||
$selected = '';
|
||||
if ($sel_endpoint == $epname) $selected = ' SELECTED';
|
||||
echo "<option value='$epname'$selected>$epname</option>\n";
|
||||
}
|
||||
echo "</select>\n";
|
||||
}
|
||||
function methodList($test,$sel_method)
|
||||
{
|
||||
global $iop;
|
||||
|
||||
$ml = $iop->getMethodList($test);
|
||||
echo "<select name='method'>\n";
|
||||
foreach ($ml as $method) {
|
||||
$selected = '';
|
||||
if ($sel_method == $method) $selected = ' SELECTED';
|
||||
echo "<option value='$method'$selected>$method</option>\n";
|
||||
}
|
||||
echo "<option value='ALL'>Run All Methods</option>\n";
|
||||
echo "</select>\n";
|
||||
}
|
||||
|
||||
function endpointTestForm($test, $endpoint, $method, $paramType, $useWSDL)
|
||||
{
|
||||
global $PHP_SELF;
|
||||
if (!$test) $test = 'base';
|
||||
echo "Round 2 '$test' Selected<br>\n";
|
||||
echo "Select endpoint and method to run:<br>\n";
|
||||
echo "<form action='$PHP_SELF' method='post'>\n";
|
||||
echo "<input type='hidden' name='test' value='$test'>\n";
|
||||
endpointList($test, $endpoint);
|
||||
methodList($test, $method);
|
||||
echo "<select name='paramType'><option value='soapval'>soap value</option>";
|
||||
echo "<option value='php'".($paramType=='php'?' selected':'').">php internal type</option></select>\n";
|
||||
echo "<select name='useWSDL'><option value='0'>go Direct</option><option value='1'".($useWSDL?' selected':'').">use WSDL</option></select>\n";
|
||||
echo "<input type='submit' value='Go'>\n";
|
||||
echo "</form><br>\n";
|
||||
}
|
||||
|
||||
function testSelectForm($selected_test = NULL)
|
||||
{
|
||||
global $iop, $PHP_SELF;
|
||||
echo "Select a Round 2 test case to run:<br>\n";
|
||||
echo "<form action='$PHP_SELF' method='post'>\n";
|
||||
echo "<select name='test'>\n";
|
||||
foreach ($iop->tests as $test) {
|
||||
$selected = '';
|
||||
if ($selected_test == $test) $selected = ' SELECTED';
|
||||
echo "<option value='$test'$selected>$test</option>\n";
|
||||
}
|
||||
echo "</select>\n";
|
||||
echo "<input type='submit' value='Go'>\n";
|
||||
echo "</form><br>\n";
|
||||
}
|
||||
|
||||
testSelectForm($_POST['test']);
|
||||
endpointTestForm($_POST['test'],$_POST['endpoint'],$_POST['method'],$_POST['paramType'],$_POST['useWSDL']);
|
||||
|
||||
if ($_POST['test'] && array_key_exists('endpoint', $_POST) && array_key_exists('method', $_POST)) {
|
||||
// here we execute the orders
|
||||
echo "<h2>Calling {$_POST['method']} at {$_POST['endpoint']}</h2>\n";
|
||||
echo "NOTE: wire's are slightly modified to display better in web browsers.<br>\n";
|
||||
|
||||
$iop->currentTest = $_POST['test']; // see $tests above
|
||||
$iop->paramType = $_POST['paramType']; // 'php' or 'soapval'
|
||||
$iop->useWSDL = $_POST['useWSDL']; // 1= do wsdl tests
|
||||
$iop->numServers = 0; // 0 = all
|
||||
$iop->specificEndpoint = $_POST['endpoint']; // test only this endpoint
|
||||
$iop->testMethod = $_POST['method']=='ALL'?'':$_POST['method']; // test only this method
|
||||
$iop->skipEndpointList = array(); // endpoints to skip
|
||||
$this->nosave = 0; // 1= disable saving results to database
|
||||
// debug output
|
||||
$iop->show = 1;
|
||||
$iop->debug = 1;
|
||||
$iop->showFaults = 0; // used in result table output
|
||||
echo '<pre>';
|
||||
$iop->doTest(); // run a single set of tests using above options
|
||||
echo '</pre>';
|
||||
}
|
||||
?>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,796 +0,0 @@
|
||||
<?php
|
||||
//
|
||||
// +----------------------------------------------------------------------+
|
||||
// | PHP Version 4 |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | Copyright (c) 1997-2002 The PHP Group |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | This source file is subject to version 2.02 of the PHP license, |
|
||||
// | that is bundled with this package in the file LICENSE, and is |
|
||||
// | available at through the world-wide-web at |
|
||||
// | http://www.php.net/license/2_02.txt. |
|
||||
// | If you did not receive a copy of the PHP license and are unable to |
|
||||
// | obtain it through the world-wide-web, please send a note to |
|
||||
// | license@php.net so we can mail you a copy immediately. |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | Authors: Shane Caraveo <Shane@Caraveo.com> |
|
||||
// +----------------------------------------------------------------------+
|
||||
//
|
||||
// $Id$
|
||||
//
|
||||
require_once 'DB.php'; // PEAR/DB
|
||||
require_once 'base.php';
|
||||
require_once 'client_round2_params.php';
|
||||
require_once 'test.utility.php';
|
||||
|
||||
error_reporting(E_ALL ^ E_NOTICE);
|
||||
|
||||
class Interop_Client extends Interop_Base
|
||||
{
|
||||
// database DNS
|
||||
var $DSN = 'mysql://user@localhost/interop2';
|
||||
|
||||
// our central interop server, where we can get the list of endpoints
|
||||
var $interopServer = "http://www.whitemesa.net/interopInfo";
|
||||
|
||||
// our local endpoint, will always get added to the database for all tests
|
||||
var $localEndpoint;
|
||||
|
||||
// specify testing
|
||||
var $currentTest = 'base'; // see $tests above
|
||||
var $paramType = 'php'; // 'php' or 'soapval'
|
||||
var $useWSDL = 0; // 1= do wsdl tests
|
||||
var $numServers = 0; // 0 = all
|
||||
var $specificEndpoint = ''; // test only this endpoint
|
||||
var $testMethod = ''; // test only this method
|
||||
var $skipEndpointList = array(); // endpoints to skip
|
||||
var $nosave = 0;
|
||||
var $startAt = ''; // start in list at this endpoint
|
||||
// debug output
|
||||
var $show = 1;
|
||||
var $debug = 0;
|
||||
var $showFaults = 0; // used in result table output
|
||||
|
||||
// PRIVATE VARIABLES
|
||||
var $dbc = NULL;
|
||||
var $totals = array();
|
||||
var $tests = array('base','GroupB', 'GroupC');
|
||||
var $paramTypes = array('php', 'soapval');
|
||||
var $endpoints = array();
|
||||
|
||||
function Interop_Client() {
|
||||
// set up the database connection
|
||||
$this->dbc = DB::connect($this->DSN, true);
|
||||
// if it errors out, just ignore it and rely on regular methods
|
||||
if (DB::isError($this->dbc)) {
|
||||
echo $this->dbc->getMessage();
|
||||
$this->dbc = NULL;
|
||||
}
|
||||
// set up local endpoint
|
||||
$this->localEndpoint['base'] = array(
|
||||
'endpointName'=>'PEAR SOAP',
|
||||
'endpointURL'=>'http://localhost/soap_interop/server_round2.php',
|
||||
'wsdlURL'=>'http://localhost/soap_interop/interop.wsdl'
|
||||
);
|
||||
$this->localEndpoint['GroupB'] = array(
|
||||
'endpointName'=>'PEAR SOAP',
|
||||
'endpointURL'=>'http://localhost/soap_interop/server_round2.php',
|
||||
'wsdlURL'=>'http://localhost/soap_interop/interopB.wsdl'
|
||||
);
|
||||
$this->localEndpoint['GroupC'] = array(
|
||||
'endpointName'=>'PEAR SOAP',
|
||||
'endpointURL'=>'http://localhost/soap_interop/server_round2.php',
|
||||
'wsdlURL'=>'http://localhost/soap_interop/echoheadersvc.wsdl'
|
||||
);
|
||||
}
|
||||
|
||||
function _fetchEndpoints(&$soapclient, $test) {
|
||||
$this->_getEndpoints($test, 1);
|
||||
|
||||
// retreive endpoints from the endpoint server
|
||||
$endpointArray = $soapclient->call("GetEndpointInfo",array("groupName"=>$test),"http://soapinterop.org/info/","http://soapinterop.org/info/");
|
||||
if (PEAR::isError($endpointArray)) {
|
||||
print $soapclient->wire;
|
||||
print_r($endpointArray);
|
||||
return;
|
||||
}
|
||||
|
||||
// add our local endpoint
|
||||
if ($this->localEndpoint[$test]) {
|
||||
array_push($endpointArray, $this->localEndpoint[$test]);
|
||||
}
|
||||
|
||||
if (!$endpointArray) return;
|
||||
|
||||
// reset the status to zero
|
||||
$res = $this->dbc->query("update endpoints set status = 0 where class='$test'");
|
||||
if (DB::isError($res)) {
|
||||
die ($res->getMessage());
|
||||
}
|
||||
if (is_object($res)) $res->free();
|
||||
// save new endpoints into database
|
||||
foreach($endpointArray as $k => $v){
|
||||
if (array_key_exists($v['endpointName'],$this->endpoints)) {
|
||||
$res = $this->dbc->query("update endpoints set endpointURL='{$v['endpointURL']}', wsdlURL='{$v['wsdlURL']}', status=1 where id={$this->endpoints[$v['endpointName']]['id']}");
|
||||
} else {
|
||||
$res = $this->dbc->query("insert into endpoints (endpointName,endpointURL,wsdlURL,class) values('{$v['endpointName']}','{$v['endpointURL']}','{$v['wsdlURL']}','$test')");
|
||||
}
|
||||
if (DB::isError($res)) {
|
||||
die ($res->getMessage());
|
||||
}
|
||||
if (is_object($res)) $res->free();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* fetchEndpoints
|
||||
* retreive endpoints interop server
|
||||
*
|
||||
* @return boolean result
|
||||
* @access private
|
||||
*/
|
||||
function fetchEndpoints($test = NULL) {
|
||||
// fetch from the interop server
|
||||
$soapclient = new SoapObject($this->interopServer);
|
||||
|
||||
if ($test) {
|
||||
$this->_fetchEndpoints($soapclient, $test);
|
||||
} else {
|
||||
foreach ($this->tests as $test) {
|
||||
$this->_fetchEndpoints($soapclient, $test);
|
||||
}
|
||||
$test = 'base';
|
||||
}
|
||||
|
||||
// retreive all endpoints now
|
||||
$this->currentTest = $test;
|
||||
return $this->_getEndpoints($test);
|
||||
}
|
||||
|
||||
/**
|
||||
* getEndpoints
|
||||
* retreive endpoints from either database or interop server
|
||||
*
|
||||
* @param string base (see local var $tests)
|
||||
* @param boolean all (if false, only get valid endpoints, status=1)
|
||||
* @return boolean result
|
||||
* @access private
|
||||
*/
|
||||
function getEndpoints($base = 'base', $all = 0) {
|
||||
if (!$this->_getEndpoints($base, $all)) {
|
||||
return $this->fetchEndpoints($base);
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* _getEndpoints
|
||||
* retreive endpoints from database
|
||||
*
|
||||
* @param string base (see local var $tests)
|
||||
* @param boolean all (if false, only get valid endpoints, status=1)
|
||||
* @return boolean result
|
||||
* @access private
|
||||
*/
|
||||
function _getEndpoints($base = "", $all = 0) {
|
||||
$this->endpoints = array();
|
||||
|
||||
// build sql
|
||||
$sql = "select * from endpoints ";
|
||||
if ($base) {
|
||||
$sql .= "where class='$base' ";
|
||||
if (!$all) $sql .= "and status=1";
|
||||
} else
|
||||
if (!$all) $sql .= "where status=1";
|
||||
|
||||
$db_ep = $this->dbc->getAll($sql,NULL, DB_FETCHMODE_ASSOC );
|
||||
if (DB::isError($db_ep)) {
|
||||
echo $sql."\n";
|
||||
echo $db_ep->getMessage();
|
||||
return FALSE;
|
||||
}
|
||||
// rearange the array
|
||||
foreach ($db_ep as $entry) {
|
||||
$this->endpoints[$entry['endpointName']] = $entry;
|
||||
}
|
||||
if (count($this->endpoints) > 0) {
|
||||
$this->currentTest = $base;
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* getResults
|
||||
* retreive results from the database, stuff them into the endpoint array
|
||||
*
|
||||
* @access private
|
||||
*/
|
||||
function getResults($test = 'base', $type = 'php', $wsdl = 0) {
|
||||
// be sure we have the right endpoints for this test result
|
||||
$this->getEndpoints($test);
|
||||
|
||||
// retreive the results and put them into the endpoint info
|
||||
$sql = "select * from results where class='$test' and type='$type' and wsdl=$wsdl";
|
||||
$results = $this->dbc->getAll($sql,NULL, DB_FETCHMODE_ASSOC );
|
||||
foreach ($results as $result) {
|
||||
// find the endpoint
|
||||
foreach ($this->endpoints as $epn => $epi) {
|
||||
if ($epi['id'] == $result['endpoint']) {
|
||||
// store the info
|
||||
$this->endpoints[$epn]['methods'][$result['function']] = $result;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* saveResults
|
||||
* save the results of a method test into the database
|
||||
*
|
||||
* @access private
|
||||
*/
|
||||
function _saveResults($endpoint_id, &$soap_test) {
|
||||
if ($this->nosave) return;
|
||||
|
||||
$result = $soap_test->result;
|
||||
$wire = $result['wire'];
|
||||
if ($result['success']) {
|
||||
$success = 'OK';
|
||||
$error = '';
|
||||
} else {
|
||||
$success = $result['fault']->faultcode;
|
||||
$error = $result['fault']->faultstring;
|
||||
if (!$wire) $wire= $result['fault']->detail;
|
||||
}
|
||||
|
||||
$test_name = $soap_test->test_name;
|
||||
// add header info to the test name
|
||||
if ($soap_test->headers) {
|
||||
foreach ($soap_test->headers as $h) {
|
||||
$destination = 0;
|
||||
if (get_class($h) == 'soap_header') {
|
||||
if ($h->attributes['SOAP-ENV:actor'] == 'http://schemas.xmlsoap.org/soap/actor/next') $destination = 1;
|
||||
$test_name .= ":{$h->name},$destination,{$h->attributes['SOAP-ENV:mustUnderstand']}";
|
||||
} else {
|
||||
if (!$h[3] || $h[3] == 'http://schemas.xmlsoap.org/soap/actor/next') $destination = 1;
|
||||
if (!$h[2]) $h[2] = 0;
|
||||
$qn = new QName($h[0]);
|
||||
$test_name .= ":{$qn->name},$destination,".(int)$h[2];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$sql = "delete from results where endpoint=$endpoint_id ".
|
||||
"and class='$this->currentTest' and type='$this->paramType' ".
|
||||
"and wsdl=$this->useWSDL and function=".
|
||||
$this->dbc->quote($test_name);
|
||||
#echo "\n".$sql;
|
||||
$res = $this->dbc->query($sql);
|
||||
if (DB::isError($res)) {
|
||||
die ($res->getMessage());
|
||||
}
|
||||
if (is_object($res)) $res->free();
|
||||
|
||||
$sql = "insert into results (endpoint,stamp,class,type,wsdl,function,result,error,wire) ".
|
||||
"values($endpoint_id,".time().",'$this->currentTest',".
|
||||
"'$this->paramType',$this->useWSDL,".
|
||||
$this->dbc->quote($test_name).",".
|
||||
$this->dbc->quote($success).",".
|
||||
$this->dbc->quote($error).",".
|
||||
($wire?$this->dbc->quote($wire):"''").")";
|
||||
#echo "\n".$sql;
|
||||
$res = $this->dbc->query($sql);
|
||||
|
||||
if (DB::isError($res)) {
|
||||
die ($res->getMessage());
|
||||
}
|
||||
if (is_object($res)) $res->free();
|
||||
}
|
||||
|
||||
/**
|
||||
* decodeSoapval
|
||||
* decodes a soap value to php type, used for test result comparisions
|
||||
*
|
||||
* @param SOAP_Value soapval
|
||||
* @return mixed result
|
||||
* @access public
|
||||
*/
|
||||
function decodeSoapval($soapval)
|
||||
{
|
||||
if (gettype($soapval) == "object" &&
|
||||
(strcasecmp(get_class($soapval),"soapparam") == 0 ||
|
||||
strcasecmp(get_class($soapval),"soapvar") == 0)) {
|
||||
if (strcasecmp(get_class($soapval),"soapparam") == 0)
|
||||
$val = $soapval->param_data->enc_value;
|
||||
else
|
||||
$val = $soapval->enc_value;
|
||||
} else {
|
||||
$val = $soapval;
|
||||
}
|
||||
if (is_array($val)) {
|
||||
foreach($val as $k => $v) {
|
||||
if (gettype($v) == "object" &&
|
||||
(strcasecmp(get_class($soapval),"soapparam") == 0 ||
|
||||
strcasecmp(get_class($soapval),"soapvar") == 0)) {
|
||||
$val[$k] = $this->decodeSoapval($v);
|
||||
}
|
||||
}
|
||||
}
|
||||
return $val;
|
||||
}
|
||||
|
||||
/**
|
||||
* compareResult
|
||||
* compare two php types for a match
|
||||
*
|
||||
* @param string expect
|
||||
* @param string test_result
|
||||
* @return boolean result
|
||||
* @access public
|
||||
*/
|
||||
function compareResult($expect, $result, $type = NULL)
|
||||
{
|
||||
$ok = 0;
|
||||
$expect_type = gettype($expect);
|
||||
$result_type = gettype($result);
|
||||
if ($expect_type == "array" && $result_type == "array") {
|
||||
# compare arrays
|
||||
$ok = array_compare($expect, $result);
|
||||
} else {
|
||||
if ($type == 'boolean')
|
||||
$ok = boolean_compare($expect, $result);
|
||||
else
|
||||
$ok = string_compare($expect, $result);
|
||||
}
|
||||
return $ok;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* doEndpointMethod
|
||||
* run a method on an endpoint and store it's results to the database
|
||||
*
|
||||
* @param array endpoint_info
|
||||
* @param SOAP_Test test
|
||||
* @return boolean result
|
||||
* @access public
|
||||
*/
|
||||
function doEndpointMethod(&$endpoint_info, &$soap_test) {
|
||||
$ok = FALSE;
|
||||
|
||||
// prepare a holder for the test results
|
||||
$soap_test->result['class'] = $this->currentTest;
|
||||
$soap_test->result['type'] = $this->paramType;
|
||||
$soap_test->result['wsdl'] = $this->useWSDL;
|
||||
|
||||
if ($this->useWSDL) {
|
||||
if (array_key_exists('wsdlURL',$endpoint_info)) {
|
||||
if (!array_key_exists('client',$endpoint_info)) {
|
||||
$endpoint_info['client'] = new SoapObject($endpoint_info['wsdlURL']);
|
||||
}
|
||||
$soap =& $endpoint_info['client'];
|
||||
|
||||
# XXX how do we determine a failure on retreiving/parsing wsdl?
|
||||
if ($soap->wsdl->fault) {
|
||||
$fault = $soap->wsdl->fault->getFault();
|
||||
$soap_test->setResult(0,'WSDL',
|
||||
$fault->faultstring."\n\n".$fault->detail,
|
||||
$fault->faultstring,
|
||||
$fault
|
||||
);
|
||||
return FALSE;
|
||||
}
|
||||
} else {
|
||||
$fault = new SoapFault('WSDL',"no WSDL defined for $endpoint");
|
||||
$soap_test->setResult(0,'WSDL',
|
||||
$fault->faultstring,
|
||||
$fault->faultstring,
|
||||
$fault
|
||||
);
|
||||
return FALSE;
|
||||
}
|
||||
$namespace = false;
|
||||
$soapaction = false;
|
||||
} else {
|
||||
$namespace = $soapaction = 'http://soapinterop.org/';
|
||||
// hack to make tests work with MS SoapToolkit
|
||||
// it's the only one that uses this soapaction, and breaks if
|
||||
// it isn't right. Can't wait for soapaction to be fully depricated
|
||||
if ($this->currentTest == 'base' &&
|
||||
strstr($endpoint_info['endpointName'],'MS SOAP ToolKit 2.0')) {
|
||||
$soapaction = 'urn:soapinterop';
|
||||
}
|
||||
if (!array_key_exists('client',$endpoint_info)) {
|
||||
$endpoint_info['client'] = new SoapObject($endpoint_info['endpointURL'],$soapaction);
|
||||
}
|
||||
$soap = $endpoint_info['client'];
|
||||
}
|
||||
// add headers to the test
|
||||
if ($soap_test->headers) {
|
||||
// $header is already a SOAP_Header class
|
||||
foreach ($soap_test->headers as $header) {
|
||||
$soap->addHeader($header);
|
||||
}
|
||||
}
|
||||
// XXX no way to set encoding
|
||||
// this lets us set UTF-8, US-ASCII or other
|
||||
//$soap->setEncoding($soap_test->encoding);
|
||||
|
||||
if ($this->useWSDL) {
|
||||
$args = '';
|
||||
foreach ($soap_test->method_params as $pname => $param) {
|
||||
$arg = '$soap_test->method_params["'.$pname.'"]';
|
||||
$args .= $args?','.$arg:$arg;
|
||||
}
|
||||
$return = eval('return $soap->'.$soap_test->method_name.'('.$args.');');
|
||||
} else {
|
||||
$return = $soap->__call($soap_test->method_name,$soap_test->method_params,$soapaction, $namespace);
|
||||
}
|
||||
|
||||
// save the wire
|
||||
$wire = $soap->__getlastrequest()."\n\n".$soap->__getlastresponse();
|
||||
$wire = str_replace('>',">\n",$wire);
|
||||
$wire = str_replace('" ',"\" \n",$wire);
|
||||
#print $wire;
|
||||
|
||||
if(!$soap->__isfault()){
|
||||
if (is_array($soap_test->method_params) && count($soap_test->method_params) == 1) {
|
||||
$sent = array_shift($soap_test->method_params);
|
||||
} else {
|
||||
$sent = $soap_test->method_params;
|
||||
}
|
||||
|
||||
// compare header results
|
||||
$header_result = array();
|
||||
$headers_ok = TRUE;
|
||||
|
||||
# XXX need to implement header support!
|
||||
#
|
||||
#if ($soap_test->headers) {
|
||||
# // $header is already a SOAP_Header class
|
||||
# foreach ($soap_test->headers as $header) {
|
||||
# if (get_class($header) != 'soap_header') {
|
||||
# // assume it's an array
|
||||
# $header = new SOAP_Header($header[0], NULL, $header[1], $header[2], $header[3], $header[4]);
|
||||
# }
|
||||
# $expect = $soap_test->headers_expect[$header->name];
|
||||
# $header_result[$header->name] = array();
|
||||
# // XXX need to fix need_result to identify the actor correctly
|
||||
# $need_result = $hresult ||
|
||||
# ($header->attributes['SOAP-ENV:actor'] == 'http://schemas.xmlsoap.org/soap/actor/next'
|
||||
# && $header->attributes['SOAP-ENV:mustUnderstand']);
|
||||
# if ($expect) {
|
||||
# $hresult = $soap->headers[key($expect)];
|
||||
# $ok = !$need_result || $this->compareResult($hresult ,$expect[key($expect)]);
|
||||
# } else {
|
||||
# $hresult = $soap->headers[$header->name];
|
||||
# $expect = $this->decodeSoapval($header);
|
||||
# $ok = !$need_result || $this->compareResult($hresult ,$expect);
|
||||
# }
|
||||
# $header_result[$header->name]['ok'] = $ok;
|
||||
# if (!$ok) $headers_ok = FALSE;
|
||||
# }
|
||||
#}
|
||||
|
||||
# we need to decode what we sent so we can compare!
|
||||
$sent_d = $this->decodeSoapval($sent);
|
||||
|
||||
$soap_test->result['sent'] = $sent;
|
||||
$soap_test->result['return'] = $return;
|
||||
// compare the results with what we sent
|
||||
$ok = $this->compareResult($sent_d,$return, $sent->type);
|
||||
if (!$ok && $soap_test->expect) {
|
||||
$ok = $this->compareResult($soap_test->expect,$return);
|
||||
}
|
||||
|
||||
if($ok){
|
||||
if (!$headers_ok) {
|
||||
$fault = new SoapFault('HEADER','The returned result did not match what we expected to receive');
|
||||
$soap_test->setResult(0,$fault->faultcode,
|
||||
$wire,
|
||||
$fault->faultstring,
|
||||
$fault
|
||||
);
|
||||
} else {
|
||||
$soap_test->setResult(1,'OK',$wire);
|
||||
$success = TRUE;
|
||||
}
|
||||
} else {
|
||||
$fault = new SoapFault('RESULT','The returned result did not match what we expected to receive');
|
||||
$soap_test->setResult(0,$fault->faultcode,
|
||||
$wire,
|
||||
$fault->faultstring,
|
||||
$fault
|
||||
);
|
||||
}
|
||||
} else {
|
||||
$fault = $soap->__getfault();
|
||||
if ($soap_test->expect_fault) {
|
||||
$ok = 1;
|
||||
$res = 'OK';
|
||||
} else {
|
||||
$ok = 0;
|
||||
$res =$fault->faultcode;
|
||||
}
|
||||
$soap_test->setResult($ok,$res, $wire,$fault->faultstring, $fault);
|
||||
}
|
||||
return $ok;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* doTest
|
||||
* run a single round of tests
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function doTest() {
|
||||
global $soap_tests;
|
||||
// get endpoints for this test
|
||||
$this->getEndpoints($this->currentTest);
|
||||
#clear totals
|
||||
$this->totals = array();
|
||||
|
||||
$i = 0;
|
||||
foreach($this->endpoints as $endpoint => $endpoint_info){
|
||||
|
||||
// if we specify an endpoint, skip until we find it
|
||||
if ($this->specificEndpoint && $endpoint != $this->specificEndpoint) continue;
|
||||
if ($this->useWSDL && !$endpoint_info['endpointURL']) continue;
|
||||
|
||||
$skipendpoint = FALSE;
|
||||
$this->totals['servers']++;
|
||||
#$endpoint_info['tests'] = array();
|
||||
|
||||
if ($this->show) print "Processing $endpoint at {$endpoint_info['endpointURL']}<br>\n";
|
||||
|
||||
foreach($soap_tests[$this->currentTest] as $soap_test) {
|
||||
//foreach(array_keys($method_params[$this->currentTest][$this->paramType]) as $method)
|
||||
|
||||
// only run the type of test we're looking for (php or soapval)
|
||||
if ($soap_test->type != $this->paramType) continue;
|
||||
|
||||
// if we haven't reached our startpoint, skip
|
||||
if ($this->startAt && $this->startAt != $endpoint_info['endpointName']) continue;
|
||||
$this->startAt = '';
|
||||
|
||||
// if this is in our skip list, skip it
|
||||
if (in_array($endpoint, $this->skipEndpointList)) {
|
||||
$skipendpoint = TRUE;
|
||||
$skipfault = new SoapFault('SKIP','endpoint skipped');
|
||||
$soap_test->setResult(0,$fault->faultcode, '',
|
||||
$skipfault->faultstring,
|
||||
$skipfault
|
||||
);
|
||||
#$endpoint_info['tests'][] = &$soap_test;
|
||||
#$soap_test->showTestResult($this->debug);
|
||||
#$this->_saveResults($endpoint_info['id'], $soap_test->method_name);
|
||||
$soap_test->result = NULL;
|
||||
continue;
|
||||
}
|
||||
|
||||
// if we're looking for a specific method, skip unless we have it
|
||||
if ($this->testMethod && !strstr($this->testMethod,$soap_test->test_name)) continue;
|
||||
if ($this->testMethod && $this->currentTest == 'GroupC') {
|
||||
// we have to figure things out now
|
||||
if (!preg_match('/(.*):(.*),(\d),(\d)/',$this->testMethod, $m)) continue;
|
||||
|
||||
// is the header in the headers list?
|
||||
$gotit = FALSE;
|
||||
foreach ($soap_test->headers as $header) {
|
||||
if (get_class($header) == 'soap_header') {
|
||||
if ($header->name == $m[2]) {
|
||||
$gotit = $header->attributes['SOAP-ENV:actor'] == ($m[3]?SOAP_TEST_ACTOR_NEXT:SOAP_TEST_ACTOR_OTHER);
|
||||
$gotit = $gotit && $header->attributes['SOAP-ENV:mustUnderstand'] == $m[4];
|
||||
}
|
||||
} else {
|
||||
if ($header[0] == $m[2]) {
|
||||
$gotit = $gotit && $header[3] == ($m[3]?SOAP_TEST_ACTOR_NEXT:SOAP_TEST_ACTOR_OTHER);
|
||||
$gotit = $gotit && $header[4] == $m[4];
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!$gotit) continue;
|
||||
}
|
||||
|
||||
// if we are skipping the rest of the tests (due to error) note a fault
|
||||
if ($skipendpoint) {
|
||||
$soap_test->setResult(0,$fault->faultcode, '',
|
||||
$skipfault->faultstring,
|
||||
$skipfault
|
||||
);
|
||||
#$endpoint_info['tests'][] = &$soap_test;
|
||||
$this->totals['fail']++;
|
||||
} else {
|
||||
// run the endpoint test
|
||||
if ($this->doEndpointMethod($endpoint_info, $soap_test)) {
|
||||
$this->totals['success']++;
|
||||
} else {
|
||||
$skipendpoint = $soap_test->result['fault']->faultcode=='HTTP'
|
||||
&& strstr($soap_test->result['fault']->faultstring,'Connect Error');
|
||||
$skipfault = $soap_test->result['fault'];
|
||||
$this->totals['fail']++;
|
||||
}
|
||||
#$endpoint_info['tests'][] = &$soap_test;
|
||||
}
|
||||
$soap_test->showTestResult($this->debug);
|
||||
$this->_saveResults($endpoint_info['id'], $soap_test);
|
||||
$soap_test->result = NULL;
|
||||
$this->totals['calls']++;
|
||||
}
|
||||
if ($this->numservers && ++$i >= $this->numservers) break;
|
||||
}
|
||||
}
|
||||
|
||||
function doGroupTests() {
|
||||
$dowsdl = array(0,1);
|
||||
foreach($dowsdl as $usewsdl) {
|
||||
$this->useWSDL = $usewsdl;
|
||||
foreach($this->paramTypes as $ptype) {
|
||||
// skip a pointless test
|
||||
if ($usewsdl && $ptype == 'soapval') break;
|
||||
$this->paramType = $ptype;
|
||||
$this->doTest();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* doTests
|
||||
* go all out. This takes time.
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function doTests() {
|
||||
// the mother of all interop tests
|
||||
$dowsdl = array(0,1);
|
||||
foreach($this->tests as $test) {
|
||||
$this->currentTest = $test;
|
||||
foreach($dowsdl as $usewsdl) {
|
||||
$this->useWSDL = $usewsdl;
|
||||
foreach($this->paramTypes as $ptype) {
|
||||
// skip a pointless test
|
||||
if ($usewsdl && $ptype == 'soapval') break;
|
||||
$this->paramType = $ptype;
|
||||
$this->doTest();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ***********************************************************
|
||||
// output functions
|
||||
|
||||
/**
|
||||
* getResults
|
||||
* retreive results from the database, stuff them into the endpoint array
|
||||
*
|
||||
* @access private
|
||||
*/
|
||||
function getMethodList($test = 'base') {
|
||||
// retreive the results and put them into the endpoint info
|
||||
$sql = "select distinct(function) from results where class='$test' order by function";
|
||||
$results = $this->dbc->getAll($sql);
|
||||
$ar = array();
|
||||
foreach($results as $result) {
|
||||
$ar[] = $result[0];
|
||||
}
|
||||
return $ar;
|
||||
}
|
||||
|
||||
function outputTable()
|
||||
{
|
||||
$methods = $this->getMethodList($this->currentTest);
|
||||
if (!$methods) return;
|
||||
$this->getResults($this->currentTest,$this->paramType,$this->useWSDL);
|
||||
|
||||
echo "<b>Testing $this->currentTest ";
|
||||
if ($this->useWSDL) echo "using WSDL ";
|
||||
else echo "using Direct calls ";
|
||||
echo "with $this->paramType values</b><br>\n";
|
||||
|
||||
// calculate totals for this table
|
||||
$this->totals['success'] = 0;
|
||||
$this->totals['fail'] = 0;
|
||||
$this->totals['servers'] = 0; #count($this->endpoints);
|
||||
foreach ($this->endpoints as $endpoint => $endpoint_info) {
|
||||
if (count($endpoint_info['methods']) > 0) {
|
||||
$this->totals['servers']++;
|
||||
foreach ($methods as $method) {
|
||||
$r = $endpoint_info['methods'][$method]['result'];
|
||||
if ($r == 'OK') $this->totals['success']++;
|
||||
else $this->totals['fail']++;
|
||||
}
|
||||
} else {
|
||||
unset($this->endpoints[$endpoint]);
|
||||
}
|
||||
}
|
||||
$this->totals['calls'] = count($methods) * $this->totals['servers'];
|
||||
|
||||
if ($this->totals['fail'] == $this->totals['calls']) {
|
||||
// assume tests have not run, skip outputing table
|
||||
print "No Data Available<br>\n";
|
||||
return;
|
||||
}
|
||||
|
||||
echo "\n\n<b>Servers: {$this->totals['servers']} Calls: {$this->totals['calls']} Success: {$this->totals['success']} Fail: {$this->totals['fail']}</b><br>\n";
|
||||
|
||||
echo "<table border=\"1\" cellspacing=\"0\" cellpadding=\"2\">\n";
|
||||
echo "<tr><td class=\"BLANK\">Endpoint</td>\n";
|
||||
foreach ($methods as $method) {
|
||||
$info = split(':', $method);
|
||||
echo "<td class='BLANK' valign='top'>";
|
||||
foreach ($info as $m) {
|
||||
$hi = split(',',$m);
|
||||
echo '<b>'.$hi[0]."</b><br>\n";
|
||||
if (count($hi) > 1) {
|
||||
echo " Actor=".($hi[1]?'Target':'Not Target')."<br>\n";
|
||||
echo " MustUnderstand=$hi[2]<br>\n";
|
||||
}
|
||||
}
|
||||
echo "</td>\n";
|
||||
}
|
||||
echo "</tr>\n";
|
||||
$faults = array();
|
||||
$fi = 0;
|
||||
foreach ($this->endpoints as $endpoint => $endpoint_info) {
|
||||
if (array_key_exists('wsdlURL',$endpoint_info)) {
|
||||
echo "<tr><td class=\"BLANK\"><a href=\"{$endpoint_info['wsdlURL']}\">$endpoint</a></td>\n";
|
||||
} else {
|
||||
echo "<tr><td class=\"BLANK\">$endpoint</td>\n";
|
||||
}
|
||||
foreach ($methods as $method) {
|
||||
$id = $endpoint_info['methods'][$method]['id'];
|
||||
$r = $endpoint_info['methods'][$method]['result'];
|
||||
$e = $endpoint_info['methods'][$method]['error'];
|
||||
if ($e) {
|
||||
$faults[$fi++] = $e;
|
||||
}
|
||||
if ($r) {
|
||||
echo "<td class='$r'><a href='$PHP_SELF?wire=$id'>$r</a></td>\n";
|
||||
} else {
|
||||
echo "<td class='untested'>untested</td>\n";
|
||||
}
|
||||
}
|
||||
echo "</tr>\n";
|
||||
}
|
||||
echo "</table><br>\n";
|
||||
if ($this->showFaults && count($faults) > 0) {
|
||||
echo "<b>ERROR Details:</b><br>\n<ul>\n";
|
||||
# output more error detail
|
||||
foreach ($faults as $fault) {
|
||||
echo '<li>'.HTMLSpecialChars($fault)."</li>\n";
|
||||
}
|
||||
}
|
||||
echo "</ul><br><br>\n";
|
||||
}
|
||||
|
||||
function outputTables() {
|
||||
// the mother of all interop tests
|
||||
$dowsdl = array(0,1);
|
||||
foreach($this->tests as $test) {
|
||||
$this->currentTest = $test;
|
||||
foreach($dowsdl as $usewsdl) {
|
||||
$this->useWSDL = $usewsdl;
|
||||
foreach($this->paramTypes as $ptype) {
|
||||
// skip a pointless test
|
||||
if ($usewsdl && $ptype == 'soapval') break;
|
||||
$this->paramType = $ptype;
|
||||
$this->outputTable();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function showWire($id) {
|
||||
$results = $this->dbc->getAll("select * from results where id=$id",NULL, DB_FETCHMODE_ASSOC );
|
||||
#$wire = preg_replace("/>/",">\n",$results[0]['wire']);
|
||||
$wire = $results[0]['wire'];
|
||||
echo "<pre>\n".HTMLSpecialChars($wire)."</pre>\n";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -1,636 +0,0 @@
|
||||
<?php
|
||||
//
|
||||
// +----------------------------------------------------------------------+
|
||||
// | PHP Version 4 |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | Copyright (c) 1997-2002 The PHP Group |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | This source file is subject to version 2.02 of the PHP license, |
|
||||
// | that is bundled with this package in the file LICENSE, and is |
|
||||
// | available at through the world-wide-web at |
|
||||
// | http://www.php.net/license/2_02.txt. |
|
||||
// | If you did not receive a copy of the PHP license and are unable to |
|
||||
// | obtain it through the world-wide-web, please send a note to |
|
||||
// | license@php.net so we can mail you a copy immediately. |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | Authors: Shane Caraveo <Shane@Caraveo.com> |
|
||||
// +----------------------------------------------------------------------+
|
||||
//
|
||||
// $Id$
|
||||
//
|
||||
|
||||
define('SOAP_TEST_ACTOR_NEXT','http://schemas.xmlsoap.org/soap/actor/next');
|
||||
define('SOAP_TEST_ACTOR_OTHER','http://some/other/actor');
|
||||
|
||||
class SOAP_Test {
|
||||
var $type = 'php';
|
||||
var $test_name = NULL;
|
||||
var $method_name = NULL;
|
||||
var $method_params = NULL;
|
||||
var $expect = NULL;
|
||||
var $expect_fault = FALSE;
|
||||
var $headers = NULL;
|
||||
var $headers_expect = NULL;
|
||||
var $result = array();
|
||||
var $show = 1;
|
||||
var $debug = 0;
|
||||
var $encoding = 'UTF-8';
|
||||
|
||||
function SOAP_Test($methodname, $params, $expect = NULL) {
|
||||
# XXX we have to do this to make php-soap happy with NULL params
|
||||
if (!$params) $params = array();
|
||||
|
||||
if (strchr($methodname,'(')) {
|
||||
preg_match('/(.*)\((.*)\)/',$methodname,$matches);
|
||||
$this->test_name = $methodname;
|
||||
$this->method_name = $matches[1];
|
||||
} else {
|
||||
$this->test_name = $this->method_name = $methodname;
|
||||
}
|
||||
$this->method_params = $params;
|
||||
$this->expect = $expect;
|
||||
|
||||
// determine test type
|
||||
if ($params) {
|
||||
$v = array_values($params);
|
||||
if (gettype($v[0]) == 'object' &&
|
||||
(get_class($v[0]) == 'soapvar' || get_class($v[0]) == 'soapparam'))
|
||||
$this->type = 'soapval';
|
||||
}
|
||||
}
|
||||
|
||||
function setResult($ok, $result, $wire, $error = '', $fault = NULL)
|
||||
{
|
||||
$this->result['success'] = $ok;
|
||||
$this->result['result'] = $result;
|
||||
$this->result['error'] = $error;
|
||||
$this->result['wire'] = $wire;
|
||||
$this->result['fault'] = $fault;
|
||||
}
|
||||
|
||||
/**
|
||||
* showMethodResult
|
||||
* print simple output about a methods result
|
||||
*
|
||||
* @param array endpoint_info
|
||||
* @param string method
|
||||
* @access public
|
||||
*/
|
||||
function showTestResult($debug = 0) {
|
||||
// debug output
|
||||
if ($debug) $this->show = 1;
|
||||
if ($debug) {
|
||||
echo str_repeat("-",50)."<br>\n";
|
||||
}
|
||||
|
||||
echo "testing $this->test_name : ";
|
||||
if ($this->headers) {
|
||||
foreach ($this->headers as $h) {
|
||||
if (get_class($h) == 'soap_header') {
|
||||
|
||||
echo "\n {$h->name},{$h->attributes['SOAP-ENV:actor']},{$h->attributes['SOAP-ENV:mustUnderstand']} : ";
|
||||
} else {
|
||||
if (!$h[4]) $h[4] = SOAP_TEST_ACTOR_NEXT;
|
||||
if (!$h[3]) $h[3] = 0;
|
||||
echo "\n $h[0],$h[4],$h[3] : ";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($debug) {
|
||||
print "method params: ";
|
||||
print_r($this->params);
|
||||
print "\n";
|
||||
}
|
||||
|
||||
$ok = $this->result['success'];
|
||||
if ($ok) {
|
||||
print "SUCCESS\n";
|
||||
} else {
|
||||
$fault = $this->result['fault'];
|
||||
if ($fault) {
|
||||
print "FAILED: {$fault->faultcode} {$fault->faultstring}\n";
|
||||
} else {
|
||||
print "FAILED: ".$this->result['result']."\n";
|
||||
}
|
||||
}
|
||||
if ($debug) {
|
||||
echo "<pre>\n".htmlentities($this->result['wire'])."</pre>\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# XXX I know this isn't quite right, need to deal with this better
|
||||
function make_2d($x, $y)
|
||||
{
|
||||
for ($_x = 0; $_x < $x; $_x++) {
|
||||
for ($_y = 0; $_y < $y; $_y++) {
|
||||
$a[$_x][$_y] = "x{$_x}y{$_y}";
|
||||
}
|
||||
}
|
||||
return $a;
|
||||
}
|
||||
|
||||
function soap_value($name, $value, $type) {
|
||||
return new soapparam(new soapvar($value,$type),$name);
|
||||
}
|
||||
|
||||
class SOAPStruct {
|
||||
var $varString;
|
||||
var $varInt;
|
||||
var $varFloat;
|
||||
function SOAPStruct($s, $i, $f) {
|
||||
$this->varString = $s;
|
||||
$this->varInt = $i;
|
||||
$this->varFloat = $f;
|
||||
}
|
||||
}
|
||||
|
||||
//***********************************************************
|
||||
// Base echoString
|
||||
|
||||
$soap_tests['base'][] = new SOAP_Test('echoString', array('inputString' => 'hello world!'));
|
||||
$soap_tests['base'][] = new SOAP_Test('echoString', array('inputString' => soap_value('inputString','hello world',XSD_STRING)));
|
||||
$soap_tests['base'][] = new SOAP_Test('echoString(null)', array('inputString' => ""));
|
||||
$soap_tests['base'][] = new SOAP_Test('echoString(null)', array('inputString' => soap_value('inputString','',XSD_STRING)));
|
||||
$soap_tests['base'][] = new SOAP_Test('echoString(entities)', array('inputString' => 'hello world\nline 2\n'));
|
||||
$soap_tests['base'][] = new SOAP_Test('echoString(entities)', array('inputString' => soap_value('inputString','hello world\nline 2\n',XSD_STRING)));
|
||||
$test = new SOAP_Test('echoString(utf-8)', array('inputString' => utf8_encode('ỗÈéóÒ₧⅜ỗỸ')));
|
||||
$test->encoding = 'UTF-8';
|
||||
$soap_tests['base'][] = $test;
|
||||
$test = new SOAP_Test('echoString(utf-8)', array('inputString' => soap_value('inputString',utf8_encode('ỗÈéóÒ₧⅜ỗỸ'),XSD_STRING)));
|
||||
$test->encoding = 'UTF-8';
|
||||
$soap_tests['base'][] = $test;
|
||||
|
||||
//***********************************************************
|
||||
// Base echoStringArray
|
||||
|
||||
$soap_tests['base'][] = new SOAP_Test('echoStringArray',
|
||||
array('inputStringArray' => array('good','bad')));
|
||||
$soap_tests['base'][] = new SOAP_Test('echoStringArray',
|
||||
array('inputStringArray' =>
|
||||
soap_value('inputStringArray',array('good','bad'),SOAP_ENC_ARRAY)));
|
||||
|
||||
// null array test
|
||||
# XXX NULL Arrays not supported
|
||||
#$soap_tests['base'][] = new SOAP_Test('echoStringArray(null)', array('inputStringArray' => NULL));
|
||||
#$soap_tests['base'][] = new SOAP_Test('echoStringArray(null)', array('inputStringArray' => soap_value('inputStringArray',NULL,XSD_STRING)));
|
||||
|
||||
//***********************************************************
|
||||
// Base echoInteger
|
||||
|
||||
$soap_tests['base'][] = new SOAP_Test('echoInteger', array('inputInteger' => 34345));
|
||||
$soap_tests['base'][] = new SOAP_Test('echoInteger', array('inputInteger' => soap_value('inputInteger',12345,XSD_INT)));
|
||||
|
||||
//***********************************************************
|
||||
// Base echoIntegerArray
|
||||
|
||||
$soap_tests['base'][] = new SOAP_Test('echoIntegerArray', array('inputIntegerArray' => array(1,234324324,2)));
|
||||
$soap_tests['base'][] = new SOAP_Test('echoIntegerArray',
|
||||
array('inputIntegerArray' =>
|
||||
soap_value('inputIntegerArray',
|
||||
array(new soapvar(12345,XSD_INT),new soapvar(654321,XSD_INT)),
|
||||
SOAP_ENC_ARRAY)));
|
||||
#
|
||||
#// null array test
|
||||
# XXX NULL Arrays not supported
|
||||
#$soap_tests['base'][] = new SOAP_Test('echoIntegerArray(null)', array('inputIntegerArray' => NULL));
|
||||
#$soap_tests['base'][] = new SOAP_Test('echoIntegerArray(null)', array('inputIntegerArray' => new SOAP_Value('inputIntegerArray','Array',NULL)));
|
||||
#
|
||||
//***********************************************************
|
||||
// Base echoFloat
|
||||
|
||||
$soap_tests['base'][] = new SOAP_Test('echoFloat', array('inputFloat' => 342.23));
|
||||
$soap_tests['base'][] = new SOAP_Test('echoFloat', array('inputFloat' => soap_value('inputFloat',123.45,XSD_FLOAT)));
|
||||
|
||||
//***********************************************************
|
||||
// Base echoFloatArray
|
||||
|
||||
$soap_tests['base'][] = new SOAP_Test('echoFloatArray', array('inputFloatArray' => array(1.3223,34.2,325.325)));
|
||||
$soap_tests['base'][] = new SOAP_Test('echoFloatArray',
|
||||
array('inputFloatArray' =>
|
||||
soap_value('inputFloatArray',
|
||||
array(new soapvar(123.45,XSD_FLOAT),new soapvar(654.321,XSD_FLOAT)),
|
||||
SOAP_ENC_ARRAY)));
|
||||
//***********************************************************
|
||||
// Base echoStruct
|
||||
|
||||
$soapstruct = new SOAPStruct('arg',34,325.325);
|
||||
# XXX no way to set a namespace!!!
|
||||
$soapsoapstruct = soap_value('inputStruct',$soapstruct,SOAP_ENC_OBJECT);
|
||||
$soap_tests['base'][] = new SOAP_Test('echoStruct', array('inputStruct' =>$soapstruct));
|
||||
$soap_tests['base'][] = new SOAP_Test('echoStruct', array('inputStruct' =>$soapsoapstruct));
|
||||
|
||||
//***********************************************************
|
||||
// Base echoStructArray
|
||||
|
||||
$soap_tests['base'][] = new SOAP_Test('echoStructArray', array('inputStructArray' => array(
|
||||
$soapstruct,$soapstruct,$soapstruct)));
|
||||
$soap_tests['base'][] = new SOAP_Test('echoStructArray', array('inputStructArray' =>
|
||||
soap_value('inputStructArray',array($soapstruct,$soapstruct,$soapstruct),SOAP_ENC_ARRAY)));
|
||||
|
||||
|
||||
//***********************************************************
|
||||
// Base echoVoid
|
||||
|
||||
$soap_tests['base'][] = new SOAP_Test('echoVoid', NULL);
|
||||
$test = new SOAP_Test('echoVoid', NULL);
|
||||
$test->type = 'soapval';
|
||||
$soap_tests['base'][] = $test;
|
||||
|
||||
//***********************************************************
|
||||
// Base echoBase64
|
||||
|
||||
$soap_tests['base'][] = new SOAP_Test('echoBase64', array('inputBase64' => 'TmVicmFza2E='));
|
||||
$soap_tests['base'][] = new SOAP_Test('echoBase64', array('inputBase64' =>
|
||||
soap_value('inputBase64','TmVicmFza2E=',XSD_BASE64BINARY)));
|
||||
|
||||
//***********************************************************
|
||||
// Base echoHexBinary
|
||||
|
||||
$soap_tests['base'][] = new SOAP_Test('echoHexBinary', array('inputHexBinary' => '736F61707834'));
|
||||
$soap_tests['base'][] = new SOAP_Test('echoHexBinary', array('inputHexBinary' =>
|
||||
soap_value('inputHexBinary','736F61707834',XSD_HEXBINARY)));
|
||||
|
||||
//***********************************************************
|
||||
// Base echoDecimal
|
||||
|
||||
# XXX test fails because php-soap incorrectly sets decimal to long rather than float
|
||||
$soap_tests['base'][] = new SOAP_Test('echoDecimal', array('inputDecimal' => 12345.67890));
|
||||
$soap_tests['base'][] = new SOAP_Test('echoDecimal', array('inputDecimal' =>
|
||||
soap_value('inputDecimal',12345.67890,XSD_DECIMAL)));
|
||||
|
||||
//***********************************************************
|
||||
// Base echoDate
|
||||
|
||||
# php-soap doesn't handle datetime types properly yet
|
||||
$soap_tests['base'][] = new SOAP_Test('echoDate', array('inputDate' => '2001-05-24T17:31:41Z'));
|
||||
$soap_tests['base'][] = new SOAP_Test('echoDate', array('inputDate' =>
|
||||
soap_value('inputDate','2001-05-24T17:31:41Z',XSD_DATETIME)));#'2001-04-25T13:31:41-0700'
|
||||
|
||||
//***********************************************************
|
||||
// Base echoBoolean
|
||||
|
||||
# php-soap sends boolean as zero or one, which is ok, but to be explicit, send true or false.
|
||||
$soap_tests['base'][] = new SOAP_Test('echoBoolean', array('inputBoolean' => TRUE));
|
||||
$soap_tests['base'][] = new SOAP_Test('echoBoolean', array('inputBoolean' =>
|
||||
soap_value('inputBoolean',TRUE,XSD_BOOLEAN)));
|
||||
$soap_tests['base'][] = new SOAP_Test('echoBoolean', array('inputBoolean' => FALSE));
|
||||
$soap_tests['base'][] = new SOAP_Test('echoBoolean', array('inputBoolean' =>
|
||||
soap_value('inputBoolean',FALSE,XSD_BOOLEAN)));
|
||||
|
||||
#
|
||||
#
|
||||
#//***********************************************************
|
||||
#// GROUP B
|
||||
#
|
||||
#
|
||||
#//***********************************************************
|
||||
#// GroupB echoStructAsSimpleTypes
|
||||
#
|
||||
#$expect = array(
|
||||
# 'outputString'=>'arg',
|
||||
# 'outputInteger'=>34,
|
||||
# 'outputFloat'=>325.325
|
||||
# );
|
||||
#$soap_tests['GroupB'][] = new SOAP_Test('echoStructAsSimpleTypes',
|
||||
# array('inputStruct' => array(
|
||||
# 'varString'=>'arg',
|
||||
# 'varInt'=>34,
|
||||
# 'varFloat'=>325.325
|
||||
# )), $expect);
|
||||
#$soap_tests['GroupB'][] = new SOAP_Test('echoStructAsSimpleTypes',
|
||||
# array('inputStruct' =>
|
||||
# new SOAP_Value('inputStruct','SOAPStruct',
|
||||
# array( #push struct elements into one soap value
|
||||
# new SOAP_Value('varString','string','arg'),
|
||||
# new SOAP_Value('varInt','int',34),
|
||||
# new SOAP_Value('varFloat','float',325.325)
|
||||
# ))), $expect);
|
||||
#
|
||||
#//***********************************************************
|
||||
#// GroupB echoSimpleTypesAsStruct
|
||||
#
|
||||
#$expect =
|
||||
# array(
|
||||
# 'varString'=>'arg',
|
||||
# 'varInt'=>34,
|
||||
# 'varFloat'=>325.325
|
||||
# );
|
||||
#$soap_tests['GroupB'][] = new SOAP_Test('echoSimpleTypesAsStruct',
|
||||
# array(
|
||||
# 'inputString'=>'arg',
|
||||
# 'inputInteger'=>34,
|
||||
# 'inputFloat'=>325.325
|
||||
# ), $expect);
|
||||
#$soap_tests['GroupB'][] = new SOAP_Test('echoSimpleTypesAsStruct',
|
||||
# array(
|
||||
# new SOAP_Value('inputString','string','arg'),
|
||||
# new SOAP_Value('inputInteger','int',34),
|
||||
# new SOAP_Value('inputFloat','float',325.325)
|
||||
# ), $expect);
|
||||
#
|
||||
#//***********************************************************
|
||||
#// GroupB echo2DStringArray
|
||||
#
|
||||
#$soap_tests['GroupB'][] = new SOAP_Test('echo2DStringArray',
|
||||
# array('input2DStringArray' => make_2d(3,3)));
|
||||
#
|
||||
#$multidimarray =
|
||||
# new SOAP_Value('input2DStringArray','Array',
|
||||
# array(
|
||||
# array(
|
||||
# new SOAP_Value('item','string','row0col0'),
|
||||
# new SOAP_Value('item','string','row0col1'),
|
||||
# new SOAP_Value('item','string','row0col2')
|
||||
# ),
|
||||
# array(
|
||||
# new SOAP_Value('item','string','row1col0'),
|
||||
# new SOAP_Value('item','string','row1col1'),
|
||||
# new SOAP_Value('item','string','row1col2')
|
||||
# )
|
||||
# )
|
||||
# );
|
||||
#$multidimarray->options['flatten'] = TRUE;
|
||||
#$soap_tests['GroupB'][] = new SOAP_Test('echo2DStringArray',
|
||||
# array('input2DStringArray' => $multidimarray));
|
||||
#
|
||||
#//***********************************************************
|
||||
#// GroupB echoNestedStruct
|
||||
#
|
||||
#$soap_tests['GroupB'][] = new SOAP_Test('echoNestedStruct',
|
||||
# array('inputStruct' => array(
|
||||
# 'varString'=>'arg',
|
||||
# 'varInt'=>34,
|
||||
# 'varFloat'=>325.325,
|
||||
# 'varStruct' => array(
|
||||
# 'varString'=>'arg',
|
||||
# 'varInt'=>34,
|
||||
# 'varFloat'=>325.325
|
||||
# )
|
||||
# )));
|
||||
#$soap_tests['GroupB'][] = new SOAP_Test('echoNestedStruct',
|
||||
# array('inputStruct' =>
|
||||
# new SOAP_Value('inputStruct','struct',
|
||||
# array( #push struct elements into one soap value
|
||||
# new SOAP_Value('varString','string','arg'),
|
||||
# new SOAP_Value('varInt','int',34),
|
||||
# new SOAP_Value('varFloat','float',325.325),
|
||||
# new SOAP_Value('varStruct','SOAPStruct',
|
||||
# array( #push struct elements into one soap value
|
||||
# new SOAP_Value('varString','string','arg'),
|
||||
# new SOAP_Value('varInt','int',34),
|
||||
# new SOAP_Value('varFloat','float',325.325)
|
||||
# )
|
||||
# /*,NULL,'http://soapinterop.org/xsd'*/)
|
||||
# )
|
||||
# )));
|
||||
#
|
||||
#//***********************************************************
|
||||
#// GroupB echoNestedArray
|
||||
#
|
||||
#$soap_tests['GroupB'][] = new SOAP_Test('echoNestedArray',
|
||||
# array('inputStruct' => array(
|
||||
# 'varString'=>'arg',
|
||||
# 'varInt'=>34,
|
||||
# 'varFloat'=>325.325,
|
||||
# 'varArray' => array('red','blue','green')
|
||||
# )));
|
||||
#$soap_tests['GroupB'][] = new SOAP_Test('echoNestedArray',
|
||||
# array('inputStruct' =>
|
||||
# new SOAP_Value('inputStruct','struct',
|
||||
# array( #push struct elements into one soap value
|
||||
# new SOAP_Value('varString','string','arg'),
|
||||
# new SOAP_Value('varInt','int',34),
|
||||
# new SOAP_Value('varFloat','float',325.325),
|
||||
# new SOAP_Value('varArray','Array',
|
||||
# array( #push struct elements into one soap value
|
||||
# new SOAP_Value('item','string','red'),
|
||||
# new SOAP_Value('item','string','blue'),
|
||||
# new SOAP_Value('item','string','green')
|
||||
# )
|
||||
# )
|
||||
# )
|
||||
# )));
|
||||
#
|
||||
#
|
||||
#//***********************************************************
|
||||
#// GROUP C header tests
|
||||
#
|
||||
#//***********************************************************
|
||||
#// echoMeStringRequest php val tests
|
||||
#
|
||||
#// echoMeStringRequest with endpoint as header destination, doesn't have to understand
|
||||
#$test = new SOAP_Test('echoVoid', NULL);
|
||||
#$test->headers[] = array('{http://soapinterop.org/echoheader/}echoMeStringRequest', 'hello world', 0,SOAP_TEST_ACTOR_NEXT);
|
||||
#$test->headers_expect['echoMeStringRequest'] = array('echoMeStringResponse'=>'hello world');
|
||||
#$soap_tests['GroupC'][] = $test;
|
||||
#
|
||||
#// echoMeStringRequest with endpoint as header destination, must understand
|
||||
#$test = new SOAP_Test('echoVoid', NULL);
|
||||
#$test->headers[] = array('{http://soapinterop.org/echoheader/}echoMeStringRequest', 'hello world', 1,SOAP_TEST_ACTOR_NEXT);
|
||||
#$this->type = 'soapval'; // force a soapval version of this test
|
||||
#$test->headers_expect['echoMeStringRequest'] = array('echoMeStringResponse'=>'hello world');
|
||||
#$soap_tests['GroupC'][] = $test;
|
||||
#
|
||||
#// echoMeStringRequest with endpoint NOT header destination, doesn't have to understand
|
||||
#$test = new SOAP_Test('echoVoid', NULL);
|
||||
#$test->headers[] = array('{http://soapinterop.org/echoheader/}echoMeStringRequest', 'hello world', 0, SOAP_TEST_ACTOR_OTHER);
|
||||
#$test->headers_expect['echoMeStringRequest'] = array();
|
||||
#$soap_tests['GroupC'][] = $test;
|
||||
#
|
||||
#// echoMeStringRequest with endpoint NOT header destination, must understand
|
||||
#$test = new SOAP_Test('echoVoid', NULL);
|
||||
#$test->headers[] = array('{http://soapinterop.org/echoheader/}echoMeStringRequest', 'hello world', 1, SOAP_TEST_ACTOR_OTHER);
|
||||
#$test->headers_expect['echoMeStringRequest'] = array();
|
||||
#$soap_tests['GroupC'][] = $test;
|
||||
#
|
||||
#//***********************************************************
|
||||
#// echoMeStringRequest soapval tests
|
||||
#
|
||||
#// echoMeStringRequest with endpoint as header destination, doesn't have to understand
|
||||
#$test = new SOAP_Test('echoVoid', NULL);
|
||||
#$test->type = 'soapval';
|
||||
#$test->headers[] = new SOAP_Header('{http://soapinterop.org/echoheader/}echoMeStringRequest', 'string', 'hello world');
|
||||
#$test->headers_expect['echoMeStringRequest'] = array('echoMeStringResponse'=>'hello world');
|
||||
#$soap_tests['GroupC'][] = $test;
|
||||
#
|
||||
#// echoMeStringRequest with endpoint as header destination, must understand
|
||||
#$test = new SOAP_Test('echoVoid', NULL);
|
||||
#$test->type = 'soapval';
|
||||
#$test->headers[] = new SOAP_Header('{http://soapinterop.org/echoheader/}echoMeStringRequest', 'string', 'hello world', 1);
|
||||
#$this->type = 'soapval'; // force a soapval version of this test
|
||||
#$test->headers_expect['echoMeStringRequest'] = array('echoMeStringResponse'=>'hello world');
|
||||
#$soap_tests['GroupC'][] = $test;
|
||||
#
|
||||
#// echoMeStringRequest with endpoint NOT header destination, doesn't have to understand
|
||||
#$test = new SOAP_Test('echoVoid', NULL);
|
||||
#$test->type = 'soapval';
|
||||
#$test->headers[] = new SOAP_Header('{http://soapinterop.org/echoheader/}echoMeStringRequest', 'string', 'hello world', 0, SOAP_TEST_ACTOR_OTHER);
|
||||
#$test->headers_expect['echoMeStringRequest'] = array();
|
||||
#$soap_tests['GroupC'][] = $test;
|
||||
#
|
||||
#// echoMeStringRequest with endpoint NOT header destination, must understand
|
||||
#$test = new SOAP_Test('echoVoid', NULL);
|
||||
#$test->type = 'soapval';
|
||||
#$test->headers[] = new SOAP_Header('{http://soapinterop.org/echoheader/}echoMeStringRequest', 'string', 'hello world', 1, SOAP_TEST_ACTOR_OTHER);
|
||||
#$test->headers_expect['echoMeStringRequest'] = array();
|
||||
#$soap_tests['GroupC'][] = $test;
|
||||
#
|
||||
#// echoMeStringRequest with endpoint header destination, must understand,
|
||||
#// invalid namespace, should recieve a fault
|
||||
##$test = new SOAP_Test('echoVoid', NULL);
|
||||
##$test->type = 'soapval';
|
||||
##$test->headers[] = new SOAP_Header('{http://unknown.org/echoheader/}echoMeStringRequest', 'string', 'hello world', 1);
|
||||
##$test->headers_expect['echoMeStringRequest'] = array();
|
||||
##$test->expect_fault = TRUE;
|
||||
##$soap_tests['GroupC'][] = $test;
|
||||
#
|
||||
#//***********************************************************
|
||||
#// php val tests
|
||||
#// echoMeStructRequest with endpoint as header destination, doesn't have to understand
|
||||
#$test = new SOAP_Test('echoVoid', NULL);
|
||||
#$test->headers[] = array('{http://soapinterop.org/echoheader/}echoMeStructRequest',
|
||||
# array('varString'=>'arg', 'varInt'=>34, 'varFloat'=>325.325),
|
||||
# 0,SOAP_TEST_ACTOR_NEXT);
|
||||
#$test->headers_expect['echoMeStructRequest'] =
|
||||
# array('echoMeStructResponse'=> array('varString'=>'arg','varInt'=>34,'varFloat'=>325.325));
|
||||
#$soap_tests['GroupC'][] = $test;
|
||||
#
|
||||
#// echoMeStructRequest with endpoint as header destination, must understand
|
||||
#$test = new SOAP_Test('echoVoid', NULL);
|
||||
#$test->headers[] = array('{http://soapinterop.org/echoheader/}echoMeStructRequest',
|
||||
# array('varString'=>'arg', 'varInt'=>34, 'varFloat'=>325.325),
|
||||
# 1,SOAP_TEST_ACTOR_NEXT);
|
||||
#$test->headers_expect['echoMeStructRequest'] =
|
||||
# array('echoMeStructResponse'=> array('varString'=>'arg','varInt'=>34,'varFloat'=>325.325));
|
||||
#$soap_tests['GroupC'][] = $test;
|
||||
#
|
||||
#// echoMeStructRequest with endpoint NOT header destination, doesn't have to understand
|
||||
#$test = new SOAP_Test('echoVoid', NULL);
|
||||
#$test->headers[] = array('{http://soapinterop.org/echoheader/}echoMeStructRequest',
|
||||
# array('varString'=>'arg', 'varInt'=>34, 'varFloat'=>325.325),
|
||||
# 0, SOAP_TEST_ACTOR_OTHER);
|
||||
#$test->headers_expect['echoMeStructRequest'] = array();
|
||||
#$soap_tests['GroupC'][] = $test;
|
||||
#
|
||||
#// echoMeStructRequest with endpoint NOT header destination, must understand
|
||||
#$test = new SOAP_Test('echoVoid', NULL);
|
||||
#$test->headers[] = array('{http://soapinterop.org/echoheader/}echoMeStructRequest',
|
||||
# array('varString'=>'arg', 'varInt'=>34, 'varFloat'=>325.325),
|
||||
# 1, SOAP_TEST_ACTOR_OTHER);
|
||||
#$test->headers_expect['echoMeStructRequest'] = array();
|
||||
#$soap_tests['GroupC'][] = $test;
|
||||
#
|
||||
#//***********************************************************
|
||||
#// soapval tests
|
||||
#// echoMeStructRequest with endpoint as header destination, doesn't have to understand
|
||||
#$test = new SOAP_Test('echoVoid', NULL);
|
||||
#$test->type = 'soapval';
|
||||
#$test->headers[] = new SOAP_Header('{http://soapinterop.org/echoheader/}echoMeStructRequest',NULL,
|
||||
# array( #push struct elements into one soap value
|
||||
# new SOAP_Value('varString','string','arg'),
|
||||
# new SOAP_Value('varInt','int',34),
|
||||
# new SOAP_Value('varFloat','float',325.325)
|
||||
# ));
|
||||
#$test->headers_expect['echoMeStructRequest'] =
|
||||
# array('echoMeStructResponse'=> array('varString'=>'arg','varInt'=>34,'varFloat'=>325.325));
|
||||
#$soap_tests['GroupC'][] = $test;
|
||||
#
|
||||
#// echoMeStructRequest with endpoint as header destination, must understand
|
||||
#$test = new SOAP_Test('echoVoid', NULL);
|
||||
#$test->type = 'soapval';
|
||||
#$test->headers[] = new SOAP_Header('{http://soapinterop.org/echoheader/}echoMeStructRequest',NULL,
|
||||
# array( #push struct elements into one soap value
|
||||
# new SOAP_Value('varString','string','arg'),
|
||||
# new SOAP_Value('varInt','int',34),
|
||||
# new SOAP_Value('varFloat','float',325.325)
|
||||
# ), 1);
|
||||
#$test->headers_expect['echoMeStructRequest'] =
|
||||
# array('echoMeStructResponse'=> array('varString'=>'arg','varInt'=>34,'varFloat'=>325.325));
|
||||
#$soap_tests['GroupC'][] = $test;
|
||||
#
|
||||
#// echoMeStructRequest with endpoint NOT header destination, doesn't have to understand
|
||||
#$test = new SOAP_Test('echoVoid', NULL);
|
||||
#$test->type = 'soapval';
|
||||
#$test->headers[] = new SOAP_Header('{http://soapinterop.org/echoheader/}echoMeStructRequest',NULL,
|
||||
# array( #push struct elements into one soap value
|
||||
# new SOAP_Value('varString','string','arg'),
|
||||
# new SOAP_Value('varInt','int',34),
|
||||
# new SOAP_Value('varFloat','float',325.325)
|
||||
# ), 0, SOAP_TEST_ACTOR_OTHER);
|
||||
#$test->headers_expect['echoMeStructRequest'] = array();
|
||||
#$soap_tests['GroupC'][] = $test;
|
||||
#
|
||||
#// echoMeStructRequest with endpoint NOT header destination, must understand
|
||||
#$test = new SOAP_Test('echoVoid', NULL);
|
||||
#$test->type = 'soapval';
|
||||
#$test->headers[] = new SOAP_Header('{http://soapinterop.org/echoheader/}echoMeStructRequest',NULL,
|
||||
# array( #push struct elements into one soap value
|
||||
# new SOAP_Value('varString','string','arg'),
|
||||
# new SOAP_Value('varInt','int',34),
|
||||
# new SOAP_Value('varFloat','float',325.325)
|
||||
# ), 1, SOAP_TEST_ACTOR_OTHER);
|
||||
#$test->headers_expect['echoMeStructRequest'] = array();
|
||||
#$soap_tests['GroupC'][] = $test;
|
||||
#
|
||||
#//***********************************************************
|
||||
#// echoMeUnknown php val tests
|
||||
#// echoMeUnknown with endpoint as header destination, doesn't have to understand
|
||||
#$test = new SOAP_Test('echoVoid', NULL);
|
||||
#$test->headers[] = array('{http://soapinterop.org/echoheader/}echoMeUnknown', 'nobody understands me!',0,SOAP_TEST_ACTOR_NEXT);
|
||||
#$test->headers_expect['echoMeUnknown'] = array();
|
||||
#$soap_tests['GroupC'][] = $test;
|
||||
#
|
||||
#// echoMeUnknown with endpoint as header destination, must understand
|
||||
#$test = new SOAP_Test('echoVoid', NULL);
|
||||
#$test->headers[] = array('{http://soapinterop.org/echoheader/}echoMeUnknown', 'nobody understands me!',1,SOAP_TEST_ACTOR_NEXT);
|
||||
#$test->headers_expect['echoMeUnknown'] = array();
|
||||
#$test->expect_fault = TRUE;
|
||||
#$soap_tests['GroupC'][] = $test;
|
||||
#
|
||||
#// echoMeUnknown with endpoint NOT header destination, doesn't have to understand
|
||||
#$test = new SOAP_Test('echoVoid', NULL);
|
||||
#$test->headers[] = array('{http://soapinterop.org/echoheader/}echoMeUnknown', 'nobody understands me!',0, SOAP_TEST_ACTOR_OTHER);
|
||||
#$test->headers_expect['echoMeUnknown'] = array();
|
||||
#$soap_tests['GroupC'][] = $test;
|
||||
#
|
||||
#// echoMeUnknown with endpoint NOT header destination, must understand
|
||||
#$test = new SOAP_Test('echoVoid', NULL);
|
||||
#$test->headers[] = array('{http://soapinterop.org/echoheader/}echoMeUnknown', 'nobody understands me!', 1, SOAP_TEST_ACTOR_OTHER);
|
||||
#$test->headers_expect['echoMeUnknown'] = array();
|
||||
#$soap_tests['GroupC'][] = $test;
|
||||
#
|
||||
#//***********************************************************
|
||||
#// echoMeUnknown soapval tests
|
||||
#// echoMeUnknown with endpoint as header destination, doesn't have to understand
|
||||
#$test = new SOAP_Test('echoVoid', NULL);
|
||||
#$test->type = 'soapval';
|
||||
#$test->headers[] = new SOAP_Header('{http://soapinterop.org/echoheader/}echoMeUnknown','string','nobody understands me!');
|
||||
#$test->headers_expect['echoMeUnknown'] = array();
|
||||
#$soap_tests['GroupC'][] = $test;
|
||||
#
|
||||
#// echoMeUnknown with endpoint as header destination, must understand
|
||||
#$test = new SOAP_Test('echoVoid', NULL);
|
||||
#$test->type = 'soapval';
|
||||
#$test->headers[] = new SOAP_Header('{http://soapinterop.org/echoheader/}echoMeUnknown','string','nobody understands me!',1);
|
||||
#$test->headers_expect['echoMeUnknown'] = array();
|
||||
#$test->expect_fault = TRUE;
|
||||
#$soap_tests['GroupC'][] = $test;
|
||||
#
|
||||
#// echoMeUnknown with endpoint NOT header destination, doesn't have to understand
|
||||
#$test = new SOAP_Test('echoVoid', NULL);
|
||||
#$test->type = 'soapval';
|
||||
#$test->headers[] = new SOAP_Header('{http://soapinterop.org/echoheader/}echoMeUnknown','string','nobody understands me!', 0, SOAP_TEST_ACTOR_OTHER);
|
||||
#$test->headers_expect['echoMeUnknown'] = array();
|
||||
#$soap_tests['GroupC'][] = $test;
|
||||
#
|
||||
#// echoMeUnknown with endpoint NOT header destination, must understand
|
||||
#$test = new SOAP_Test('echoVoid', NULL);
|
||||
#$test->type = 'soapval';
|
||||
#$test->headers[] = new SOAP_Header('{http://soapinterop.org/echoheader/}echoMeUnknown','string','nobody understands me!', 1, SOAP_TEST_ACTOR_OTHER);
|
||||
#$test->headers_expect['echoMeUnknown'] = array();
|
||||
#$soap_tests['GroupC'][] = $test;
|
||||
|
||||
|
||||
?>
|
||||
@@ -1,75 +0,0 @@
|
||||
<?php
|
||||
// NOTE: do not run this directly under a web server, as it will take a very long
|
||||
// time to execute. Run from a command line or something, and redirect output
|
||||
// to an html file.
|
||||
//
|
||||
// +----------------------------------------------------------------------+
|
||||
// | PHP Version 4 |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | Copyright (c) 1997-2002 The PHP Group |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | This source file is subject to version 2.02 of the PHP license, |
|
||||
// | that is bundled with this package in the file LICENSE, and is |
|
||||
// | available at through the world-wide-web at |
|
||||
// | http://www.php.net/license/2_02.txt. |
|
||||
// | If you did not receive a copy of the PHP license and are unable to |
|
||||
// | obtain it through the world-wide-web, please send a note to |
|
||||
// | license@php.net so we can mail you a copy immediately. |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | Authors: Shane Caraveo <Shane@Caraveo.com> |
|
||||
// +----------------------------------------------------------------------+
|
||||
//
|
||||
// $Id$
|
||||
//
|
||||
require_once 'client_round2_interop.php';
|
||||
?>
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<style>
|
||||
TD { background-color: Red; }
|
||||
TD.BLANK { background-color: White; }
|
||||
TD.OK { background-color: Lime; }
|
||||
TD.RESULT { background-color: Green; }
|
||||
TD.untested { background-color: White; }
|
||||
TD.CONNECT { background-color: Yellow; }
|
||||
TD.TRANSPORT { background-color: Yellow; }
|
||||
TD.WSDL { background-color: Yellow; }
|
||||
TD.WSDLCACHE { background-color: Yellow; }
|
||||
TD.WSDLPARSER { background-color: Yellow; }
|
||||
TD.HTTP { background-color: Yellow; }
|
||||
TD.SMTP { background-color: Yellow; }
|
||||
</style>
|
||||
<title>PEAR-PHP SOAP Interop Tests</title>
|
||||
</head>
|
||||
|
||||
<body bgcolor="White" text="Black">
|
||||
<h2 align="center">SOAP Client Interop Test Results: Round2</h2>
|
||||
|
||||
<a href="index.php">Back to Interop Index</a><br>
|
||||
<p> </p>
|
||||
|
||||
<?php
|
||||
$iop = new Interop_Client();
|
||||
|
||||
if ($_GET['detail'] == 1) $iop->showFaults = 1;
|
||||
|
||||
if ($_GET['wire']) {
|
||||
$iop->showWire($_GET['wire']);
|
||||
} else {
|
||||
$iop->getEndpoints();
|
||||
$iop->getResults();
|
||||
|
||||
if ($_GET['test']) {
|
||||
$iop->currentTest = $_GET['test'];
|
||||
$iop->useWSDL = $_GET['wsdl']?$_GET['wsdl']:0;
|
||||
$iop->paramType = $_GET['type']?$_GET['type']:'php';
|
||||
$iop->outputTable();
|
||||
} else {
|
||||
$iop->outputTables();
|
||||
}
|
||||
}
|
||||
?>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,54 +0,0 @@
|
||||
<?php
|
||||
// this script is usefull for quickly testing stuff, use the 'pretty' file for html output
|
||||
//
|
||||
// +----------------------------------------------------------------------+
|
||||
// | PHP Version 4 |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | Copyright (c) 1997-2002 The PHP Group |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | This source file is subject to version 2.02 of the PHP license, |
|
||||
// | that is bundled with this package in the file LICENSE, and is |
|
||||
// | available at through the world-wide-web at |
|
||||
// | http://www.php.net/license/2_02.txt. |
|
||||
// | If you did not receive a copy of the PHP license and are unable to |
|
||||
// | obtain it through the world-wide-web, please send a note to |
|
||||
// | license@php.net so we can mail you a copy immediately. |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | Authors: Shane Caraveo <Shane@Caraveo.com> |
|
||||
// +----------------------------------------------------------------------+
|
||||
//
|
||||
// $Id$
|
||||
//
|
||||
set_time_limit(0);
|
||||
require_once 'client_round2_interop.php';
|
||||
|
||||
$iop = new Interop_Client();
|
||||
// force a fetch of endpoints, this happens irregardless if no endpoints in database
|
||||
#$iop->fetchEndpoints();
|
||||
|
||||
// set some options
|
||||
$iop->currentTest = 'base'; // see $tests above
|
||||
$iop->paramType = 'php'; // 'php' or 'soapval'
|
||||
$iop->useWSDL = 1; // 1= do wsdl tests
|
||||
$iop->numServers = 0; // 0 = all
|
||||
$iop->specificEndpoint = '4s4c'; // test only this endpoint
|
||||
$iop->testMethod = 'echoString'; // test only this method
|
||||
|
||||
#XXX MS SOAP ToolKit 2.0/3.0 crashes php-soap in __getfault!
|
||||
|
||||
// endpoints to skip
|
||||
$iop->skipEndpointList = array('Apache Axis','IONA XMLBus','IONA XMLBus (CORBA)','MS SOAP ToolKit 2.0','MS SOAP ToolKit 3.0','Spheon JSOAP','SQLData SOAP Server','WASP Advanced 3.0');
|
||||
$iop->startAt='';
|
||||
$this->nosave = 0; // 1= disable saving results to database
|
||||
// debug output
|
||||
$iop->show = 1;
|
||||
$iop->debug = 0;
|
||||
$iop->showFaults = 0; // used in result table output
|
||||
|
||||
$iop->doTest(); // run a single set of tests using above options
|
||||
#$iop->doGroupTests(); // run a group of tests set in $currentTest
|
||||
#$iop->doTests(); // run all tests, ignore above options
|
||||
#$iop->outputTables();
|
||||
echo "done";
|
||||
|
||||
?>
|
||||
@@ -1,45 +0,0 @@
|
||||
# phpMyAdmin MySQL-Dump
|
||||
# version 2.2.5
|
||||
# http://phpwizard.net/phpMyAdmin/
|
||||
# http://phpmyadmin.sourceforge.net/ (download page)
|
||||
#
|
||||
# Host: localhost
|
||||
# Generation Time: Apr 08, 2002 at 08:32 PM
|
||||
# Server version: 3.23.49
|
||||
# PHP Version: 4.1.1
|
||||
# Database : `interop`
|
||||
# --------------------------------------------------------
|
||||
|
||||
#
|
||||
# Table structure for table `endpoints`
|
||||
#
|
||||
|
||||
CREATE TABLE endpoints (
|
||||
id int(11) NOT NULL auto_increment,
|
||||
endpointName varchar(50) NOT NULL default '',
|
||||
endpointURL varchar(255) NOT NULL default '',
|
||||
wsdlURL varchar(255) NOT NULL default '',
|
||||
class varchar(20) NOT NULL default '',
|
||||
status int(11) NOT NULL default '1',
|
||||
PRIMARY KEY (id)
|
||||
) TYPE=MyISAM;
|
||||
# --------------------------------------------------------
|
||||
|
||||
#
|
||||
# Table structure for table `results`
|
||||
#
|
||||
|
||||
CREATE TABLE results (
|
||||
id int(11) NOT NULL auto_increment,
|
||||
endpoint int(11) NOT NULL default '0',
|
||||
stamp int(11) NOT NULL default '0',
|
||||
class varchar(10) NOT NULL default '',
|
||||
type varchar(10) default NULL,
|
||||
wsdl int(11) NOT NULL default '0',
|
||||
function varchar(255) NOT NULL default '',
|
||||
result varchar(25) NOT NULL default '',
|
||||
error text,
|
||||
wire text NOT NULL,
|
||||
PRIMARY KEY (id)
|
||||
) TYPE=MyISAM;
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
<definitions name="InteropTest" targetNamespace="http://soapinterop.org/" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns="http://soapinterop.org/" xmlns:s="http://soapinterop.org/xsd" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
|
||||
|
||||
<import location="http://www.whitemesa.com/interop/InteropTest.wsdl" namespace="http://soapinterop.org/"/>
|
||||
<import location="http://www.whitemesa.com/interop/InteropTest.wsdl" namespace="http://soapinterop.org/xsd"/>
|
||||
<import location="http://www.whitemesa.com/interop/InteropTestC.wsdl" namespace="http://soapinterop.org/"/>
|
||||
|
||||
<service name="interopLabEchoHeader">
|
||||
|
||||
<port name="interopPortEchoHdr" binding="tns:InteropEchoHeaderBinding">
|
||||
<soap:address location="http://localhost/soap_interop/server_round2.php"/>
|
||||
</port>
|
||||
|
||||
</service>
|
||||
|
||||
</definitions>
|
||||
@@ -1,85 +0,0 @@
|
||||
# phpMyAdmin MySQL-Dump
|
||||
# version 2.2.5
|
||||
# http://phpwizard.net/phpMyAdmin/
|
||||
# http://phpmyadmin.sourceforge.net/ (download page)
|
||||
#
|
||||
# Host: localhost
|
||||
# Generation Time: Jul 14, 2002 at 03:13 PM
|
||||
# Server version: 3.23.49
|
||||
# PHP Version: 4.2.1
|
||||
# Database : `interop2`
|
||||
|
||||
#
|
||||
# Dumping data for table `endpoints`
|
||||
#
|
||||
|
||||
INSERT INTO endpoints VALUES (1, '4s4c', 'http://soap.4s4c.com/ilab/soap.asp', 'http://www.pocketsoap.com/services/ilab.wsdl', 'base', 1);
|
||||
INSERT INTO endpoints VALUES (2, '4s4c v2.0', 'http://soap.4s4c.com/ilab2/soap.asp', 'http://soap.4s4c.com/ilab2/ilab.wsdl', 'base', 1);
|
||||
INSERT INTO endpoints VALUES (3, 'Apache Axis', 'http://nagoya.apache.org:5049/axis/services/echo', 'http://nagoya.apache.org:5049/axis/services/echo?wsdl', 'base', 1);
|
||||
INSERT INTO endpoints VALUES (4, 'Apache SOAP 2.2', 'http://nagoya.apache.org:5049/soap/servlet/rpcrouter', 'http://www.apache.org/~rubys/ApacheSoap.wsdl', 'base', 1);
|
||||
INSERT INTO endpoints VALUES (5, 'ASP.NET Web Services', 'http://www.mssoapinterop.org/asmx/simple.asmx', 'http://www.mssoapinterop.org/asmx/simple.asmx?wsdl', 'base', 1);
|
||||
INSERT INTO endpoints VALUES (6, 'CapeConnect', 'http://interop.capeclear.com/ccx/soapbuilders-round2', 'http://interop.capeclear.com/wsdl/soapbuilders-round2.wsdl', 'base', 1);
|
||||
INSERT INTO endpoints VALUES (7, 'Delphi SOAP', 'http://soap-server.borland.com/WebServices/Interop/cgi-bin/InteropService.exe/soap/InteropTestPortType', 'http://soap-server.borland.com/WebServices/Interop/cgi-bin/InteropService.exe/wsdl/InteropTestPortType', 'base', 1);
|
||||
INSERT INTO endpoints VALUES (8, 'EasySoap++', 'http://easysoap.sourceforge.net/cgi-bin/interopserver', 'http://easysoap.sourceforge.net/interopA.wsdl', 'base', 1);
|
||||
INSERT INTO endpoints VALUES (9, 'eSOAP', 'http://www.quakersoft.net/cgi-bin/interop2_server.cgi', 'http://www.quakersoft.net/wsdl/interop2.wsdl', 'base', 1);
|
||||
INSERT INTO endpoints VALUES (10, 'gSOAP', 'http://websrv.cs.fsu.edu/~engelen/interop2.cgi', 'http://www.cs.fsu.edu/~engelen/interop2.wsdl', 'base', 1);
|
||||
INSERT INTO endpoints VALUES (11, 'Frontier', 'http://www.soapware.org/xmethodsInterop', '', 'base', 1);
|
||||
INSERT INTO endpoints VALUES (12, 'GLUE', 'http://www.themindelectric.net:8005/glue/round2', 'http://www.themindelectric.net:8005/glue/round2.wsdl', 'base', 1);
|
||||
INSERT INTO endpoints VALUES (13, 'HP SOAP', 'http://soap.bluestone.com/hpws/soap/EchoService', 'http://soap.bluestone.com/hpws/soap/EchoService.wsdl', 'base', 1);
|
||||
INSERT INTO endpoints VALUES (14, 'IONA XMLBus', 'http://interop.xmlbus.com:7002/xmlbus/container/InteropTest/BaseService/BasePort', 'http://interop.xmlbus.com:7002/xmlbus/container/InteropTest/BaseService/BasePort', 'base', 1);
|
||||
INSERT INTO endpoints VALUES (15, 'IONA XMLBus (CORBA)', 'http://interop.xmlbus.com:7002/xmlbus/container/CORBAInterop/BaseService/BasePort', 'http://interop.xmlbus.com:7002/xmlbus/container/CORBAInterop/BaseService/BasePort', 'base', 1);
|
||||
INSERT INTO endpoints VALUES (16, 'kSOAP', 'http://kissen.cs.uni-dortmund.de:8080/ksoapinterop', 'http://www.whitemesa.com/interop/kSOAP.wsdl', 'base', 1);
|
||||
INSERT INTO endpoints VALUES (17, 'MS .NET Remoting', 'http://www.mssoapinterop.org/remoting/ServiceA.soap', 'http://www.mssoapinterop.org/remoting/ServiceA.soap?wsdl', 'base', 1);
|
||||
INSERT INTO endpoints VALUES (18, 'MS SOAP ToolKit 2.0', 'http://mssoapinterop.org/stk/Interop.wsdl', 'http://mssoapinterop.org/stk/Interop.wsdl', 'base', 1);
|
||||
INSERT INTO endpoints VALUES (19, 'MS SOAP ToolKit 3.0', 'http://mssoapinterop.org/stkV3/Interop.wsdl', 'http://mssoapinterop.org/stkV3/Interop.wsdl', 'base', 1);
|
||||
INSERT INTO endpoints VALUES (20, 'NuSOAP', 'http://dietrich.ganx4.com/nusoap/testbed/round2_base_server.php', 'http://dietrich.ganx4.com/nusoap/testbed/round2_base.wsdl', 'base', 1);
|
||||
INSERT INTO endpoints VALUES (21, 'OpenLink', 'http://demo.openlinksw.com:8890/Interop', 'http://demo.openlinksw.com:8890/Interop/services.wsdl', 'base', 1);
|
||||
INSERT INTO endpoints VALUES (24, 'SIM', 'http://soapinterop.simdb.com/round2', 'http://soapinterop.simdb.com/round2?WSDL', 'base', 1);
|
||||
INSERT INTO endpoints VALUES (25, 'SOAP4R', 'http://www.jin.gr.jp/~nahi/Ruby/SOAP4R/SOAPBuildersInterop/', 'http://www.jin.gr.jp/~nahi/Ruby/SOAP4R/SOAPBuildersInterop/SOAP4R_SOAPBuildersInteropTest_R2base.wsdl', 'base', 1);
|
||||
INSERT INTO endpoints VALUES (26, 'SOAP:Lite', 'http://services.soaplite.com/interop.cgi', 'http://services.soaplite.com/interop2.wsdl', 'base', 1);
|
||||
INSERT INTO endpoints VALUES (27, 'Spheon JSOAP', 'http://213.23.125.181:8081/RPC', 'http://213.23.125.181:8081/interop.wsdl', 'base', 1);
|
||||
INSERT INTO endpoints VALUES (28, 'Spray 2001', 'http://www.dolphinharbor.org/services/interop2001', 'http://www.dolphinharbor.org/services/interop2001/service.wsdl', 'base', 1);
|
||||
INSERT INTO endpoints VALUES (29, 'SQLData SOAP Server', 'http://soapclient.com/interop/sqldatainterop.wsdl', 'http://soapclient.com/interop/sqldatainterop.wsdl', 'base', 1);
|
||||
INSERT INTO endpoints VALUES (30, 'WASP Advanced 3.0', 'http://soap.systinet.net:6060/InteropService/', 'http://soap.systinet.net:6060/InteropService/', 'base', 1);
|
||||
INSERT INTO endpoints VALUES (32, 'White Mesa SOAP Server', 'http://www.whitemesa.net/interop/std', 'http://www.whitemesa.net/wsdl/std/interop.wsdl', 'base', 1);
|
||||
INSERT INTO endpoints VALUES (33, 'PEAR SOAP', 'http://localhost/soap_interop/server_round2.php', 'http://localhost/soap_interop/interop.wsdl.php', 'base', 1);
|
||||
INSERT INTO endpoints VALUES (34, '4s4c', 'http://soap.4s4c.com/ilab/soap.asp', 'http://www.pocketsoap.com/services/ilab_b.wsdl', 'GroupB', 1);
|
||||
INSERT INTO endpoints VALUES (35, '4s4c v2.0', 'http://soap.4s4c.com/ilab2/soap.asp', 'http://soap.4s4c.com/ilab2/ilab_b.wsdl', 'GroupB', 1);
|
||||
INSERT INTO endpoints VALUES (36, 'Apache Axis', 'http://nagoya.apache.org:5049/axis/services/echo', 'http://nagoya.apache.org:5049/axis/services/echo?wsdl', 'GroupB', 1);
|
||||
INSERT INTO endpoints VALUES (37, 'ASP.NET Web Services', 'http://www.mssoapinterop.org/asmx/simpleB.asmx', 'http://www.mssoapinterop.org/asmx/simpleb.asmx?wsdl', 'GroupB', 1);
|
||||
INSERT INTO endpoints VALUES (38, 'Delphi SOAP', 'http://soap-server.borland.com/WebServices/Interop/cgi-bin/InteropGroupB.exe/soap/InteropTestPortTypeB', 'http://soap-server.borland.com/WebServices/Interop/cgi-bin/InteropGroupB.exe/wsdl/InteropTestPortTypeB', 'GroupB', 1);
|
||||
INSERT INTO endpoints VALUES (39, 'EasySoap++', 'http://easysoap.sourceforge.net/cgi-bin/interopserver', 'http://easysoap.sourceforge.net/interopB.wsdl', 'GroupB', 1);
|
||||
INSERT INTO endpoints VALUES (40, 'GLUE', 'http://www.themindelectric.net:8005/glue/round2B', 'http://www.themindelectric.net:8005/glue/round2B.wsdl', 'GroupB', 1);
|
||||
INSERT INTO endpoints VALUES (41, 'gSOAP', 'http://websrv.cs.fsu.edu/~engelen/interop2B.cgi', 'http://www.cs.fsu.edu/~engelen/interop2B.wsdl', 'GroupB', 1);
|
||||
INSERT INTO endpoints VALUES (42, 'HP SOAP', 'http://soap.bluestone.com/hpws/soap/EchoService', 'http://soap.bluestone.com/hpws/soap/EchoService.wsdl', 'GroupB', 1);
|
||||
INSERT INTO endpoints VALUES (43, 'IONA XMLBus', 'http://interop.xmlbus.com:7002/xmlbus/container/InteropTest/GroupBService/GroupBPort', 'http://interop.xmlbus.com:7002/xmlbus/container/InteropTest/GroupBService/GroupBPort', 'GroupB', 1);
|
||||
INSERT INTO endpoints VALUES (44, 'MS .NET Remoting', 'http://www.mssoapinterop.org/remoting/ServiceB.soap', 'http://www.mssoapinterop.org/remoting/ServiceB.soap?wsdl', 'GroupB', 1);
|
||||
INSERT INTO endpoints VALUES (45, 'MS SOAP ToolKit 2.0', 'http://mssoapinterop.org/stk/InteropBtyped.wsdl', 'http://mssoapinterop.org/stk/InteropBtyped.wsdl', 'GroupB', 1);
|
||||
INSERT INTO endpoints VALUES (46, 'MS SOAP ToolKit 3.0', 'http://mssoapinterop.org/stkV3/InteropB.wsdl', 'http://mssoapinterop.org/stkV3/InteropB.wsdl', 'GroupB', 1);
|
||||
INSERT INTO endpoints VALUES (47, 'NuSOAP', 'http://dietrich.ganx4.com/nusoap/testbed/round2_groupb_server.php', 'http://dietrich.ganx4.com/nusoap/testbed/round2_groupb.wsdl', 'GroupB', 1);
|
||||
INSERT INTO endpoints VALUES (48, 'OpenLink', 'http://demo.openlinksw.com:8890/Interop', 'http://demo.openlinksw.com:8890/Interop/services.wsdl', 'GroupB', 1);
|
||||
INSERT INTO endpoints VALUES (50, 'SIM', 'http://soapinterop.simdb.com/round2B', 'http://soapinterop.simdb.com/round2B?WSDL', 'GroupB', 1);
|
||||
INSERT INTO endpoints VALUES (51, 'SOAP4R', 'http://www.jin.gr.jp/~nahi/Ruby/SOAP4R/SOAPBuildersInterop/', 'http://www.jin.gr.jp/~nahi/Ruby/SOAP4R/SOAPBuildersInterop/SOAP4R_SOAPBuildersInteropTest_R2GroupB.wsdl', 'GroupB', 1);
|
||||
INSERT INTO endpoints VALUES (52, 'SOAP:Lite', 'http://services.soaplite.com/interop.cgi', 'http://services.soaplite.com/InteropTestB.wsdl', 'GroupB', 1);
|
||||
INSERT INTO endpoints VALUES (53, 'Spheon JSOAP', 'http://213.23.125.181:8081/RPC', 'http://213.23.125.181:8081/interopb.wsdl', 'GroupB', 1);
|
||||
INSERT INTO endpoints VALUES (54, 'Spray 2001', 'http://www.dolphinharbor.org/services/interopB2001', 'http://www.dolphinharbor.org/services/interopB2001/service.wsdl', 'GroupB', 1);
|
||||
INSERT INTO endpoints VALUES (55, 'SQLData SOAP Server', 'http://soapclient.com/interop/InteropB.wsdl', 'http://soapclient.com/interop/InteropB.wsdl', 'GroupB', 1);
|
||||
INSERT INTO endpoints VALUES (56, 'WASP Advanced 3.0', 'http://soap.systinet.net:6060/InteropBService/', 'http://soap.systinet.net:6060/InteropBService/', 'GroupB', 1);
|
||||
INSERT INTO endpoints VALUES (58, 'White Mesa SOAP Server', 'http://www.whitemesa.net/interop/std/groupB', 'http://www.whitemesa.net/wsdl/std/interopB.wsdl', 'GroupB', 1);
|
||||
INSERT INTO endpoints VALUES (59, 'PEAR SOAP', 'http://localhost/soap_interop/server_round2.php', 'http://localhost/soap_interop/interopB.wsdl.php', 'GroupB', 1);
|
||||
INSERT INTO endpoints VALUES (60, '4s4c v2.0', 'http://soap.4s4c.com/ilab2/soap.asp', 'http://soap.4s4c.com/ilab2/ilab_c.wsdl', 'GroupC', 1);
|
||||
INSERT INTO endpoints VALUES (61, 'Apache Axis', 'http://nagoya.apache.org:5049/axis/services/echo', 'http://nagoya.apache.org:5049/axis/services/echo?wsdl', 'GroupC', 1);
|
||||
INSERT INTO endpoints VALUES (62, 'ASP.NET Web Services', 'http://mssoapinterop.org/asmx/header.asmx', 'http://mssoapinterop.org/asmx/header.asmx?wsdl', 'GroupC', 1);
|
||||
INSERT INTO endpoints VALUES (63, 'EasySoap++', 'http://easysoap.sourceforge.net/cgi-bin/interopserver', 'http://easysoap.sourceforge.net/interopC.wsdl', 'GroupC', 1);
|
||||
INSERT INTO endpoints VALUES (64, 'MS SOAP ToolKit 2.0', 'http://mssoapinterop.org/stk/InteropC.wsdl', 'http://mssoapinterop.org/stk/InteropC.wsdl', 'GroupC', 1);
|
||||
INSERT INTO endpoints VALUES (65, 'MS SOAP ToolKit 3.0', 'http://mssoapinterop.org/stkV3/InteropC.wsdl', 'http://mssoapinterop.org/stkV3/InteropC.wsdl', 'GroupC', 1);
|
||||
INSERT INTO endpoints VALUES (66, 'OpenLink', 'http://demo.openlinksw.com:8890/Interop', 'http://demo.openlinksw.com:8890/Interop/services.wsdl', 'GroupC', 1);
|
||||
INSERT INTO endpoints VALUES (67, 'SOAP:Lite', 'http://services.soaplite.com/interopC.cgi', 'http://services.soaplite.com/InteropTestC.wsdl', 'GroupC', 1);
|
||||
INSERT INTO endpoints VALUES (68, 'Spray 2001', 'http://www.dolphinharbor.org/services/interopC', 'http://www.dolphinharbor.org/services/interopC/service.wsdl', 'GroupC', 1);
|
||||
INSERT INTO endpoints VALUES (69, 'SQLData SOAP Server', 'http://soapclient.com/interop/interopC.wsdl', 'http://soapclient.com/interop/interopC.wsdl', 'GroupC', 1);
|
||||
INSERT INTO endpoints VALUES (70, 'WASP Advanced 3.0', 'http://soap.systinet.net:6060/InteropCService/', 'http://soap.systinet.net:6060/InteropCService/', 'GroupC', 1);
|
||||
INSERT INTO endpoints VALUES (71, 'White Mesa SOAP Server', 'http://www.whitemesa.net/interop/std/echohdr', 'http://www.whitemesa.net/wsdl/std/echoheadersvc.wsdl', 'GroupC', 1);
|
||||
INSERT INTO endpoints VALUES (72, 'PEAR SOAP', 'http://localhost/soap_interop/server_round2.php', 'http://localhost/soap_interop/echoheadersvc.wsdl.php', 'GroupC', 1);
|
||||
|
||||
|
||||
|
||||
@@ -1,70 +0,0 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title>PEAR SOAP Interop</title>
|
||||
</head>
|
||||
<?php
|
||||
// get our endpoint
|
||||
$server = $_SERVER['SERVER_NAME'].':'.$_SERVER['SERVER_PORT'];
|
||||
$endpoint = 'http://'.$server."/soap_interop/server_round2.php";
|
||||
$base = 'http://'.$server."/soap_interop/interop.wsdl";
|
||||
$groupb = 'http://'.$server."/soap_interop/interopB.wsdl";
|
||||
$groupc = 'http://'.$server."/soap_interop/echoheadersvc.wsdl";
|
||||
?>
|
||||
<body>
|
||||
|
||||
<h2 align='center'>PEAR SOAP Interop</h2>
|
||||
<p>Welcome to the PEAR SOAP Interop pages. These pages are set up for
|
||||
SOAP Builder interop tests. You can find out more about the interop tests
|
||||
at <a href="http://www.whitemesa.com/interop.htm">White Mesa</a>.</p>
|
||||
<p>Currently Round 2 base, Group B and Group C interop tests are enabled.</p>
|
||||
|
||||
<h3>Round 2 Interop Server</h3>
|
||||
Endpoint: <?php echo $endpoint; ?><br>
|
||||
Base WSDL: <a href="<?php echo $base ?>"><?php echo $base ?></a><br>
|
||||
Group B WSDL: <a href="<?php echo $groupb ?>"><?php echo $groupb ?></a><br>
|
||||
Group C WSDL: <a href="<?php echo $groupc ?>"><?php echo $groupc ?></a><br>
|
||||
|
||||
<h3>Interop Client</h3>
|
||||
|
||||
<p>
|
||||
Notes:
|
||||
Tests are done both "Direct" and with "WSDL". WSDL tests use the supplied interop WSDL
|
||||
to run the tests against. The Direct method uses an internal prebuilt list of methods and parameters
|
||||
for the test.</p>
|
||||
<p>
|
||||
Tests are also run against two methods of generating method parameters. The first, 'php', attempts
|
||||
to directly serialize PHP variables into soap values. The second method, 'soapval', uses a SOAP_Value
|
||||
class to define what the type of the value is. The second method is more interopable than the first
|
||||
by nature.
|
||||
</p>
|
||||
|
||||
<h3>Client Test Interface</h3>
|
||||
<p>The <a href="client_round2.php">client interface</a> allows you to run the PEAR SOAP
|
||||
Client against a choosen interop server. Each run updates the results database below.</p>
|
||||
|
||||
<h3>Interop Client Test Results</h3>
|
||||
<p>This is a database of the current test results using PEAR SOAP Clients against interop servers.</p>
|
||||
<p>
|
||||
More detail (wire) about errors (marked yellow or red) can be obtained by clicking on the
|
||||
link in the result box. If we have an HTTP error
|
||||
attempting to connect to the endpoint, we will mark all consecutive attempts as errors, and skip
|
||||
testing that endpoint. This reduces the time it takes to run the tests if a server is unavailable.
|
||||
WSDLCACHE errors mean we cannot retreive the WSDL file specified for the endpoint.
|
||||
</p>
|
||||
|
||||
<ul>
|
||||
<li><a href="client_round2_results.php?test=base&type=php&wsdl=0">Base results using PHP native types</a></li>
|
||||
<li><a href="client_round2_results.php?test=base&type=soapval&wsdl=0">Base results using SOAP types</a></li>
|
||||
<li><a href="client_round2_results.php?test=base&type=php&wsdl=1">Base results using PHP native types with WSDL</a></li>
|
||||
<li><a href="client_round2_results.php?test=GroupB&type=php&wsdl=0">Group B results using PHP native types</a></li>
|
||||
<li><a href="client_round2_results.php?test=GroupB&type=soapval&wsdl=0">Group B results using SOAP types</a></li>
|
||||
<li><a href="client_round2_results.php?test=GroupB&type=php&wsdl=1">Group B results using PHP native types with WSDL</a></li>
|
||||
<li><a href="client_round2_results.php?test=GroupC&type=php&wsdl=0">Group C results using PHP native types</a></li>
|
||||
<li><a href="client_round2_results.php?test=GroupC&type=soapval&wsdl=0">Group C results using SOAP types</a></li>
|
||||
<li><a href="client_round2_results.php?test=GroupC&type=php&wsdl=1">Group C results using PHP native types with WSDL</a></li>
|
||||
<li><a href="client_round2_results.php">Show All Results</a></li>
|
||||
</ul>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1 +0,0 @@
|
||||
<?php phpinfo(); ?>
|
||||
@@ -1,18 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
|
||||
<definitions name="InteropTest" targetNamespace="http://soapinterop.org/"
|
||||
xmlns="http://schemas.xmlsoap.org/wsdl/"
|
||||
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
|
||||
xmlns:tns="http://soapinterop.org/">
|
||||
|
||||
<import location="http://www.whitemesa.com/wsdl/wmmsgrouter.xsd" namespace="http://whitemesa.com/headers/soapmsgrouter.xsd"/>
|
||||
<import location="http://www.whitemesa.com/interop/InteropTest.wsdl" namespace="http://soapinterop.org/"/>
|
||||
<import location="http://www.whitemesa.com/interop/InteropTest.wsdl" namespace="http://soapinterop.org/xsd"/>
|
||||
|
||||
<service name="interopLab">
|
||||
<port name="interopTestPort" binding="tns:InteropTestSoapBinding">
|
||||
<soap:address location="http://localhost/soap_interop/server_round2.php"/>
|
||||
</port>
|
||||
</service>
|
||||
|
||||
</definitions>
|
||||
@@ -1,13 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
<definitions name="InteropTest" targetNamespace="http://soapinterop.org/" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns="http://soapinterop.org/" xmlns:s="http://soapinterop.org/xsd" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
|
||||
|
||||
<import location="http://www.whitemesa.com/interop/InteropTestB.wsdl" namespace="http://soapinterop.org/"/>
|
||||
<import location="http://www.whitemesa.com/interop/InteropTestB.wsdl" namespace="http://soapinterop.org/xsd"/>
|
||||
|
||||
<service name="interopLabB">
|
||||
<port name="interopTestPortB" binding="tns:InteropTestSoapBindingB">
|
||||
<soap:address location="http://localhost/soap_interop/server_round2.php"/>
|
||||
</port>
|
||||
</service>
|
||||
|
||||
</definitions>
|
||||
@@ -1,35 +0,0 @@
|
||||
<?php
|
||||
//
|
||||
// +----------------------------------------------------------------------+
|
||||
// | PHP Version 4 |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | Copyright (c) 1997-2002 The PHP Group |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | This source file is subject to version 2.02 of the PHP license, |
|
||||
// | that is bundled with this package in the file LICENSE, and is |
|
||||
// | available at through the world-wide-web at |
|
||||
// | http://www.php.net/license/2_02.txt. |
|
||||
// | If you did not receive a copy of the PHP license and are unable to |
|
||||
// | obtain it through the world-wide-web, please send a note to |
|
||||
// | license@php.net so we can mail you a copy immediately. |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | Authors: Shane Caraveo <Shane@Caraveo.com> |
|
||||
// +----------------------------------------------------------------------+
|
||||
//
|
||||
// $Id$
|
||||
//
|
||||
|
||||
require_once 'SOAP/Server.php';
|
||||
|
||||
$server = new SOAP_Server;
|
||||
|
||||
require_once 'server_round2_base.php';
|
||||
require_once 'server_round2_groupB.php';
|
||||
require_once 'server_round2_groupC.php';
|
||||
|
||||
$server->service(isset($HTTP_RAW_POST_DATA)?$HTTP_RAW_POST_DATA:NULL);
|
||||
#echo "Content-Length is {$_SERVER['CONTENT_LENGTH']}\n\n";
|
||||
#echo "<!---\n\nlen:".strlen($HTTP_RAW_POST_DATA)."\n\n";
|
||||
#echo "[$HTTP_RAW_POST_DATA";
|
||||
#print "]\n\nend of input data-->";
|
||||
?>
|
||||
@@ -1,184 +0,0 @@
|
||||
<?
|
||||
//
|
||||
// +----------------------------------------------------------------------+
|
||||
// | PHP Version 4 |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | Copyright (c) 1997-2002 The PHP Group |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | This source file is subject to version 2.02 of the PHP license, |
|
||||
// | that is bundled with this package in the file LICENSE, and is |
|
||||
// | available at through the world-wide-web at |
|
||||
// | http://www.php.net/license/2_02.txt. |
|
||||
// | If you did not receive a copy of the PHP license and are unable to |
|
||||
// | obtain it through the world-wide-web, please send a note to |
|
||||
// | license@php.net so we can mail you a copy immediately. |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | Authors: Shane Caraveo <Shane@Caraveo.com> Port to PEAR and more |
|
||||
// | Authors: Dietrich Ayala <dietrich@ganx4.com> Original Author |
|
||||
// +----------------------------------------------------------------------+
|
||||
//
|
||||
// $Id$
|
||||
//
|
||||
require_once 'SOAP/Server.php';
|
||||
|
||||
function generateFault($short, $long)
|
||||
{
|
||||
$params = array(
|
||||
"faultcode" => "Server",
|
||||
"faultstring" => $short,
|
||||
"detail" => $long
|
||||
);
|
||||
|
||||
$faultmsg = new SOAP_Message("Fault",$params,"http://schemas.xmlsoap.org/soap/envelope/");
|
||||
return $faultmsg;
|
||||
}
|
||||
|
||||
function hex2bin($data)
|
||||
{
|
||||
$len = strlen($data);
|
||||
return pack("H" . $len, $data);
|
||||
}
|
||||
|
||||
|
||||
class SOAP_Interop_Base {
|
||||
var $method_namespace = 'http://soapinterop.org/';
|
||||
|
||||
function SOAP_Interop_Base() {
|
||||
#if ($server) {
|
||||
# $server->addToMap("echoString",array("string"),array("string"));
|
||||
# $server->addToMap("echoStringArray",array(),array());
|
||||
# $server->addToMap("echoInteger",array("int"),array("int"));
|
||||
# $server->addToMap("echoIntegerArray",array(),array());
|
||||
# $server->addToMap("echoFloat",array("float"),array("float"));
|
||||
# $server->addToMap("echoFloatArray",array(),array());
|
||||
# $server->addToMap("echoStruct",array(),array());
|
||||
# $server->addToMap("echoStructArray",array(),array());
|
||||
# $server->addToMap("echoVoid",array(),array());
|
||||
# $server->addToMap("echoBase64",array("base64Binary"),array("base64Binary"));
|
||||
# $server->addToMap("echoDate",array("dateTime"),array("dateTime"));
|
||||
# $server->addToMap("echoHexBinary",array("hexBinary"),array("hexBinary"));
|
||||
# $server->addToMap("echoDecimal",array("decimal"),array("decimal"));
|
||||
# $server->addToMap("echoBoolean",array("boolean"),array("boolean"));
|
||||
#}
|
||||
}
|
||||
|
||||
function echoString($inputString)
|
||||
{
|
||||
return new SOAP_Value('outputString','string',$inputString);
|
||||
}
|
||||
|
||||
function echoStringArray($inputStringArray)
|
||||
{
|
||||
$ra = array();
|
||||
if ($inputStringArray) {
|
||||
foreach($inputStringArray as $s) {
|
||||
$ra[] = new SOAP_Value('item','string',$s);
|
||||
}
|
||||
}
|
||||
return new SOAP_Value('outputStringArray',NULL,$ra);
|
||||
}
|
||||
|
||||
|
||||
function echoInteger($inputInteger)
|
||||
{
|
||||
return new SOAP_Value('outputInteger','int',(integer)$inputInteger);
|
||||
}
|
||||
|
||||
function echoIntegerArray($inputIntegerArray)
|
||||
{
|
||||
$ra = array();
|
||||
if ($inputIntegerArray) {
|
||||
foreach ($inputIntegerArray as $i) {
|
||||
$ra[] = new SOAP_Value('item','int',$i);
|
||||
}
|
||||
}
|
||||
return new SOAP_Value('outputIntArray',NULL,$ra);
|
||||
}
|
||||
|
||||
function echoFloat($inputFloat)
|
||||
{
|
||||
return new SOAP_Value('outputFloat','float',(FLOAT)$inputFloat);
|
||||
}
|
||||
|
||||
function echoFloatArray($inputFloatArray)
|
||||
{
|
||||
$ra = array();
|
||||
if ($inputFloatArray) {
|
||||
foreach($inputFloatArray as $float) {
|
||||
$ra[] = new SOAP_Value('item','float',(FLOAT)$float);
|
||||
}
|
||||
}
|
||||
return new SOAP_Value('outputFloatArray',NULL,$ra);
|
||||
}
|
||||
|
||||
function echoStruct($inputStruct)
|
||||
{
|
||||
return new SOAP_Value('return','{http://soapinterop.org/xsd}SOAPStruct',
|
||||
array(
|
||||
new SOAP_Value('varInt','int',$inputStruct['varInt']),
|
||||
new SOAP_Value('varFloat','float',$inputStruct['varFloat']),
|
||||
new SOAP_Value('varString','string',$inputStruct['varString'])
|
||||
));
|
||||
}
|
||||
|
||||
function echoStructArray($inputStructArray)
|
||||
{
|
||||
$ra = array();
|
||||
if ($inputStructArray) {
|
||||
foreach($inputStructArray as $struct) {
|
||||
$ra[] = new SOAP_Value('item','{http://soapinterop.org/xsd}SOAPStruct',
|
||||
array(
|
||||
new SOAP_Value('varInt','int',$struct['varInt']),
|
||||
new SOAP_Value('varFloat','float',$struct['varFloat']),
|
||||
new SOAP_Value('varString','string',$struct['varString'])
|
||||
));
|
||||
}
|
||||
}
|
||||
return $ra;
|
||||
}
|
||||
|
||||
function echoVoid()
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
function echoBase64($b_encoded)
|
||||
{
|
||||
return new SOAP_Value('return','base64Binary',base64_encode(base64_decode($b_encoded)));
|
||||
}
|
||||
|
||||
function echoDate($timeInstant)
|
||||
{
|
||||
$dt = new SOAP_Type_dateTime($timeInstant);
|
||||
if ($dt->toUnixtime() != -1) {
|
||||
$value = $dt->toSOAP();
|
||||
return new SOAP_Value('return','dateTime',$value);
|
||||
} else {
|
||||
return new SOAP_Fault("Value $timeInstant is not a dateTime value");
|
||||
}
|
||||
}
|
||||
|
||||
function echoHexBinary($hb)
|
||||
{
|
||||
return new SOAP_Value('return','hexBinary',bin2hex(hex2bin($hb)));
|
||||
}
|
||||
|
||||
function echoDecimal($dec)
|
||||
{
|
||||
return new SOAP_Value('return','decimal',(FLOAT)$dec);
|
||||
}
|
||||
|
||||
function echoBoolean($boolean)
|
||||
{
|
||||
return new SOAP_Value('return','boolean',$boolean);
|
||||
}
|
||||
|
||||
function echoMimeAttachment($stuff)
|
||||
{
|
||||
return new SOAP_Attachment('return','application/octet-stream',NULL,$stuff);
|
||||
}
|
||||
}
|
||||
|
||||
$base = new SOAP_Interop_Base();
|
||||
$server->addObjectMap($base);
|
||||
?>
|
||||
@@ -1,87 +0,0 @@
|
||||
<?
|
||||
//
|
||||
// +----------------------------------------------------------------------+
|
||||
// | PHP Version 4 |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | Copyright (c) 1997-2002 The PHP Group |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | This source file is subject to version 2.02 of the PHP license, |
|
||||
// | that is bundled with this package in the file LICENSE, and is |
|
||||
// | available at through the world-wide-web at |
|
||||
// | http://www.php.net/license/2_02.txt. |
|
||||
// | If you did not receive a copy of the PHP license and are unable to |
|
||||
// | obtain it through the world-wide-web, please send a note to |
|
||||
// | license@php.net so we can mail you a copy immediately. |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | Authors: Shane Caraveo <Shane@Caraveo.com> Port to PEAR and more |
|
||||
// | Authors: Dietrich Ayala <dietrich@ganx4.com> Original Author |
|
||||
// +----------------------------------------------------------------------+
|
||||
//
|
||||
// $Id$
|
||||
//
|
||||
require_once 'SOAP/Server.php';
|
||||
|
||||
class SOAP_Interop_GroupB {
|
||||
var $method_namespace = 'http://soapinterop.org/';
|
||||
var $dispatch_map = array();
|
||||
|
||||
function SOAP_Interop_GroupB() {
|
||||
$this->dispatch_map['echoStructAsSimpleTypes'] =
|
||||
array('in' => array('inputStruct' => 'SOAPStruct'),
|
||||
'out' => array('outputString' => 'string', 'outputInteger' => 'int', 'outputFloat' => 'float')
|
||||
);
|
||||
|
||||
# $server->addToMap('echoSimpleTypesAsStruct',
|
||||
# array('outputString' => 'string', 'outputInteger' => 'int', 'outputFloat' => 'float'),
|
||||
# array('return' => 'struct'));
|
||||
# $server->addToMap('echoNestedStruct', array(), array());
|
||||
# $server->addToMap('echo2DStringArray', array(), array());
|
||||
# $server->addToMap('echoNestedArray', array(), array());
|
||||
}
|
||||
function echoStructAsSimpleTypes ($struct)
|
||||
{
|
||||
# convert a SOAPStruct to an array
|
||||
$vals = array_values($struct);
|
||||
return array(
|
||||
new SOAP_Value('outputString','string',$struct['varString']),
|
||||
new SOAP_Value('outputInteger','int',$struct['varInt']),
|
||||
new SOAP_Value('outputFloat','float',$struct['varFloat'])
|
||||
);
|
||||
return array_values($struct);
|
||||
}
|
||||
|
||||
function echoSimpleTypesAsStruct($string, $int, $float)
|
||||
{
|
||||
# convert a input into struct
|
||||
$ret = new SOAP_Value('return','{http://soapinterop.org/xsd}SOAPStruct',
|
||||
array( #push struct elements into one soap value
|
||||
new SOAP_Value('varString','string',$string),
|
||||
new SOAP_Value('varInt','int',(int)$int),
|
||||
new SOAP_Value('varFloat','float',(FLOAT)$float)
|
||||
)
|
||||
);
|
||||
return $ret;
|
||||
}
|
||||
|
||||
function echoNestedStruct($struct)
|
||||
{
|
||||
return $struct;
|
||||
}
|
||||
|
||||
function echo2DStringArray($ary)
|
||||
{
|
||||
$ret = new SOAP_Value('return','Array',$ary);
|
||||
$ret->options['flatten'] = TRUE;
|
||||
return $ret;
|
||||
}
|
||||
|
||||
function echoNestedArray($ary)
|
||||
{
|
||||
return $ary;
|
||||
}
|
||||
}
|
||||
|
||||
$groupb = new SOAP_Interop_GroupB();
|
||||
$server->addObjectMap($groupb);
|
||||
|
||||
?>
|
||||
@@ -1,41 +0,0 @@
|
||||
<?
|
||||
//
|
||||
// +----------------------------------------------------------------------+
|
||||
// | PHP Version 4 |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | Copyright (c) 1997-2002 The PHP Group |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | This source file is subject to version 2.02 of the PHP license, |
|
||||
// | that is bundled with this package in the file LICENSE, and is |
|
||||
// | available at through the world-wide-web at |
|
||||
// | http://www.php.net/license/2_02.txt. |
|
||||
// | If you did not receive a copy of the PHP license and are unable to |
|
||||
// | obtain it through the world-wide-web, please send a note to |
|
||||
// | license@php.net so we can mail you a copy immediately. |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | Authors: Shane Caraveo <Shane@Caraveo.com> |
|
||||
// +----------------------------------------------------------------------+
|
||||
//
|
||||
// $Id$
|
||||
//
|
||||
require_once 'SOAP/Server.php';
|
||||
require_once 'SOAP/Value.php';
|
||||
|
||||
class SOAP_Interop_GroupC {
|
||||
var $method_namespace = 'http://soapinterop.org/echoheader/';
|
||||
|
||||
function echoMeStringRequest($string)
|
||||
{
|
||||
return new SOAP_Value('{'.$this->method_namespace.'}echoMeStringResponse','string',$string);
|
||||
}
|
||||
|
||||
function echoMeStructRequest($struct)
|
||||
{
|
||||
return new SOAP_Value('{'.$this->method_namespace.'}echoMeStructResponse','SOAPStruct',$struct);
|
||||
}
|
||||
}
|
||||
|
||||
$groupc = new SOAP_Interop_GroupC();
|
||||
$server->addObjectMap($groupc);
|
||||
|
||||
?>
|
||||
@@ -1,258 +0,0 @@
|
||||
<?php
|
||||
//
|
||||
// +----------------------------------------------------------------------+
|
||||
// | PHP Version 4 |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | Copyright (c) 1997-2002 The PHP Group |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | This source file is subject to version 2.02 of the PHP license, |
|
||||
// | that is bundled with this package in the file LICENSE, and is |
|
||||
// | available at through the world-wide-web at |
|
||||
// | http://www.php.net/license/2_02.txt. |
|
||||
// | If you did not receive a copy of the PHP license and are unable to |
|
||||
// | obtain it through the world-wide-web, please send a note to |
|
||||
// | license@php.net so we can mail you a copy immediately. |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | Authors: Shane Caraveo <Shane@Caraveo.com> Port to PEAR and more |
|
||||
// +----------------------------------------------------------------------+
|
||||
//
|
||||
// $Id$
|
||||
//
|
||||
|
||||
require_once 'SOAP/Server.php';
|
||||
|
||||
$server = new SOAP_Server;
|
||||
|
||||
require_once 'server_round2_base.php';
|
||||
require_once 'server_round2_groupB.php';
|
||||
require_once 'server_round2_groupC.php';
|
||||
|
||||
$test = '<?xml version="1.0"?>
|
||||
|
||||
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
|
||||
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
|
||||
xmlns:si="http://soapinterop.org/xsd"
|
||||
xmlns:ns6="http://soapinterop.org/echoheader/"
|
||||
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
|
||||
<SOAP-ENV:Header>
|
||||
|
||||
<ns6:echoMeStringRequest xsi:type="xsd:string" SOAP-ENV:actor="http://schemas.xmlsoap.org/soap/actor/next" SOAP-ENV:mustUnderstand="0">hello world</ns6:echoMeStringRequest>
|
||||
</SOAP-ENV:Header>
|
||||
<SOAP-ENV:Body>
|
||||
|
||||
<echoVoid></echoVoid>
|
||||
</SOAP-ENV:Body>
|
||||
</SOAP-ENV:Envelope>';
|
||||
|
||||
$test = '<?xml version="1.0"?>
|
||||
|
||||
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
|
||||
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
|
||||
xmlns:si="http://soapinterop.org/xsd"
|
||||
xmlns:ns6="http://soapinterop.org/echoheader/"
|
||||
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
|
||||
<SOAP-ENV:Header>
|
||||
|
||||
<ns6:echoMeStructRequest xsi:type="si:SOAPStruct"
|
||||
SOAP-ENV:actor="http://schemas.xmlsoap.org/soap/actor/next"
|
||||
SOAP-ENV:mustUnderstand="1">
|
||||
<varString xsi:type="xsd:string">arg</varString>
|
||||
|
||||
<varInt xsi:type="xsd:int">34</varInt>
|
||||
|
||||
<varFloat xsi:type="xsd:float">325.325</varFloat>
|
||||
</ns6:echoMeStructRequest>
|
||||
</SOAP-ENV:Header>
|
||||
<SOAP-ENV:Body>
|
||||
|
||||
<echoVoid></echoVoid>
|
||||
</SOAP-ENV:Body>
|
||||
</SOAP-ENV:Envelope>
|
||||
';
|
||||
|
||||
$test = '<?xml version="1.0"?>
|
||||
|
||||
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
|
||||
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
|
||||
xmlns:si="http://soapinterop.org/xsd"
|
||||
xmlns:ns6="http://soapinterop.org/echoheader/"
|
||||
xmlns:ns7="http://soapinterop.org/"
|
||||
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
|
||||
<SOAP-ENV:Body>
|
||||
|
||||
<ns7:echoString>
|
||||
<inputString xsi:type="xsd:string"></inputString>
|
||||
</ns7:echoString>
|
||||
</SOAP-ENV:Body>
|
||||
</SOAP-ENV:Envelope>
|
||||
';
|
||||
$test = '<?xml version="1.0" encoding="US-ASCII"?>
|
||||
|
||||
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
|
||||
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
|
||||
xmlns:si="http://soapinterop.org/xsd"
|
||||
xmlns:ns6="http://soapinterop.org/"
|
||||
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
|
||||
<SOAP-ENV:Body>
|
||||
<ns6:echoVoid/>
|
||||
</SOAP-ENV:Body>
|
||||
</SOAP-ENV:Envelope>';
|
||||
|
||||
$test = '<?xml version="1.0" encoding="US-ASCII"?>
|
||||
|
||||
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
|
||||
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
|
||||
xmlns:si="http://soapinterop.org/xsd"
|
||||
xmlns:ns6="http://soapinterop.org/"
|
||||
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
|
||||
<SOAP-ENV:Body>
|
||||
<ns6:echoIntegerArray><inputIntegerArray xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="xsd:int[3]" SOAP-ENC:offset="[0]"><item xsi:type="xsd:int">1</item>
|
||||
<item xsi:type="xsd:int">234324324</item>
|
||||
<item xsi:type="xsd:int">2</item>
|
||||
</inputIntegerArray>
|
||||
</ns6:echoIntegerArray>
|
||||
</SOAP-ENV:Body>
|
||||
</SOAP-ENV:Envelope>';
|
||||
|
||||
#$test = "<S:Envelope
|
||||
#S:encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'
|
||||
#xmlns:Enc='http://schemas.xmlsoap.org/soap/encoding/'
|
||||
#xmlns:S='http://schemas.xmlsoap.org/soap/envelope/'
|
||||
#xmlns:a='http://soapinterop.org/'
|
||||
#xmlns:b='http://soapinterop.org/xsd'
|
||||
#xmlns:XS='http://www.w3.org/2001/XMLSchema'
|
||||
#xmlns:XI='http://www.w3.org/2001/XMLSchema-instance'>
|
||||
#<S:Body>
|
||||
#<b:SOAPStruct Enc:root='0' id='21b56c4' XI:type='b:SOAPStruct'>
|
||||
#<varInt XI:type='XS:int'>1</varInt>
|
||||
#<varFloat XI:type='XS:float'>2</varFloat>
|
||||
#<varString XI:type='XS:string'>wilma</varString>
|
||||
#</b:SOAPStruct>
|
||||
#<a:echoStructArray>
|
||||
#<inputStructArray XI:type='Enc:Array' Enc:arrayType='XS:anyType[3]'>
|
||||
#<fred href='#21b56c4'/>
|
||||
#<i href='#21b56c4'/>
|
||||
#<i href='#21b56c4'/>
|
||||
#</inputStructArray>
|
||||
#</a:echoStructArray>
|
||||
#</S:Body></S:Envelope>";
|
||||
|
||||
#$test = "<S:Envelope S:encodingStyle='http://schemas.xmlsoap.org/soap/encoding/' xmlns:Enc='http://schemas.xmlsoap.org/soap/encoding/' xmlns:S='http://schemas.xmlsoap.org/soap/envelope/' xmlns:a='http://soapinterop.org/' xmlns:b='http://soapinterop.org/xsd' xmlns:XS='http://www.w3.org/2001/XMLSchema' xmlns:XI='http://www.w3.org/2001/XMLSchema-instance'> <S:Body><a:echoStructArray><inputStructArray XI:type='Enc:Array' Enc:arrayType='b:SOAPStruct[2]'><inputStruct href='#213e654'/> <inputStruct href='#21b8c4c'/> </inputStructArray> </a:echoStructArray> <b:SOAPStruct Enc:root='0' id='21b8c4c' XI:type='b:SOAPStruct'><varInt XI:type='XS:int'>-1</varInt> <varFloat XI:type='XS:float'>-1</varFloat> <varString XI:type='XS:string'>lean on into the groove y'all</varString> </b:SOAPStruct> <b:SOAPStruct Enc:root='0' id='213e654' XI:type='b:SOAPStruct'><varInt XI:type='XS:int'>1073741824</varInt> <varFloat XI:type='XS:float'>-42.24</varFloat> <varString XI:type='XS:string'>pocketSOAP rocks!<g></varString> </b:SOAPStruct> </S:Body></S:Envelope>";
|
||||
|
||||
#$test = "<S:Envelope S:encodingStyle='http://schemas.xmlsoap.org/soap/encoding/' xmlns:S='http://schemas.xmlsoap.org/soap/envelope/' xmlns:b='http://soapinterop.org/' xmlns:a='http://soapinterop.org/headers/' xmlns:XS='http://www.w3.org/2001/XMLSchema' xmlns:XI='http://www.w3.org/2001/XMLSchema-instance'> <S:Header> <a:Transaction S:mustUnderstand='1' XI:type='XS:short'>5</a:Transaction> </S:Header> <S:Body><b:echoString><inputString XI:type='XS:string'>Opps, should never see me</inputString> </b:echoString> </S:Body></S:Envelope>";
|
||||
#$test = "<S:Envelope S:encodingStyle='http://schemas.xmlsoap.org/soap/encoding/' xmlns:S='http://schemas.xmlsoap.org/soap/envelope/' xmlns:b='http://soapinterop.org/' xmlns:a='http://soapinterop.org/headers/' xmlns:XS='http://www.w3.org/2001/XMLSchema' xmlns:XI='http://www.w3.org/2001/XMLSchema-instance'> <S:Header> <a:Transaction XI:type='XS:short'>5</a:Transaction> </S:Header> <S:Body><b:echoString><inputString XI:type='XS:string'>Opps, should never see me</inputString> </b:echoString> </S:Body></S:Envelope>";
|
||||
#$test = "<S:Envelope S:encodingStyle='http://schemas.xmlsoap.org/soap/encoding/' xmlns:Enc='http://schemas.xmlsoap.org/soap/encoding/' xmlns:S='http://schemas.xmlsoap.org/soap/envelope/' xmlns:a='http://soapinterop.org/' xmlns:b='http://soapinterop.org/xsd' xmlns:XS='http://www.w3.org/2001/XMLSchema' xmlns:XI='http://www.w3.org/2001/XMLSchema-instance'> <S:Body><a:echoStructAsSimpleTypes><inputStruct href='#213e59c'/> </a:echoStructAsSimpleTypes> <b:SOAPStruct Enc:root='0' id='213e59c' XI:type='b:SOAPStruct'><varInt XI:type='XS:int'>42</varInt> <varString XI:type='XS:string'>Orbital</varString> <varFloat XI:type='XS:float'>-42.42</varFloat> </b:SOAPStruct> </S:Body></S:Envelope>";
|
||||
|
||||
// white mesa failures
|
||||
/*$test = '<?xml version="1.0" encoding="UTF-8"?><SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"><SOAP-ENV:Header><h:echoMeStringRequest SOAP-ENV:actor="http://schemas.xmlsoap.org/soap/actor/next" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:mustUnderstand="1" xmlns:h="http://unknown.org/">White Mesa Test Header String.</h:echoMeStringRequest></SOAP-ENV:Header><SOAP-ENV:Body><m:echoVoid SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:m="http://soapinterop.org/" /></SOAP-ENV:Body></SOAP-ENV:Envelope>';
|
||||
*/
|
||||
/*
|
||||
$test = '<?xml version="1.0" encoding="UTF-8"?><SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"><SOAP-ENV:Header><h:echoMeStringRequest SOAP-ENV:actor="http://schemas.xmlsoap.org/soap/actor/next" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:mustUnderstand="1" xmlns:h="http://unknown.org/">White Mesa Test Header String.</h:echoMeStringRequest></SOAP-ENV:Header><SOAP-ENV:Body><m:echoVoid SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:m="http://soapinterop.org/" /></SOAP-ENV:Body></SOAP-ENV:Envelope>';
|
||||
*/
|
||||
//$test = "<S:Envelope S:encodingStyle='http://schemas.xmlsoap.org/soap/encoding/' xmlns:S='http://schemas.xmlsoap.org/soap/envelope/' xmlns:a='http://soapinterop.org/' xmlns:XI='http://www.w3.org/2001/XMLSchema-instance'> <S:Body><a:echoIntegerArray><inputIntegerArray XI:nil='true'></inputIntegerArray> </a:echoIntegerArray> </S:Body></S:Envelope>";
|
||||
|
||||
$test = '<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
|
||||
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
|
||||
xmlns:ns4="http://soapinterop.org/"
|
||||
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
|
||||
<SOAP-ENV:Body>
|
||||
|
||||
<ns4:echo2DStringArray>
|
||||
<input2DStringArray xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="xsd:string[2,3]">
|
||||
<item xsi:type="xsd:string">row0col0</item>
|
||||
<item xsi:type="xsd:string">row0col1</item>
|
||||
<item xsi:type="xsd:string">row0col2</item>
|
||||
<item xsi:type="xsd:string">row1col0</item>
|
||||
<item xsi:type="xsd:string">row1col1</item>
|
||||
<item xsi:type="xsd:string">row1col2</item></input2DStringArray></ns4:echo2DStringArray>
|
||||
</SOAP-ENV:Body>
|
||||
</SOAP-ENV:Envelope>';
|
||||
|
||||
$_SERVER['REQUEST_METHOD'] = "POST";
|
||||
$_SERVER['CONTENT_TYPE'] = 'multipart/related; type=text/xml; boundary="=_d624611fe466a88d956a205651c74fdb"';
|
||||
|
||||
$test = '--=_d624611fe466a88d956a205651c74fdb
|
||||
Content-Type: text/xml; charset="UTF-8"
|
||||
Content-Transfer-Encoding: base64
|
||||
|
||||
PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4NCg0KPFNPQVAtRU5WOkVudmVs
|
||||
b3BlICB4bWxuczpTT0FQLUVOVj0iaHR0cDovL3NjaGVtYXMueG1sc29hcC5vcmcvc29hcC9lbnZl
|
||||
bG9wZS8iDQogIHhtbG5zOnhzZD0iaHR0cDovL3d3dy53My5vcmcvMjAwMS9YTUxTY2hlbWEiDQog
|
||||
IHhtbG5zOnhzaT0iaHR0cDovL3d3dy53My5vcmcvMjAwMS9YTUxTY2hlbWEtaW5zdGFuY2UiDQog
|
||||
IHhtbG5zOlNPQVAtRU5DPSJodHRwOi8vc2NoZW1hcy54bWxzb2FwLm9yZy9zb2FwL2VuY29kaW5n
|
||||
LyINCiAgU09BUC1FTlY6ZW5jb2RpbmdTdHlsZT0iaHR0cDovL3NjaGVtYXMueG1sc29hcC5vcmcv
|
||||
c29hcC9lbmNvZGluZy8iPg0KPFNPQVAtRU5WOkJvZHk+DQoNCjxlY2hvTWltZUF0dGFjaG1lbnQ+
|
||||
DQo8dGVzdCBocmVmPSJjaWQ6ZTZiOTg0M2JiYzUxY2JiMDAzOTk0MGVmN2VlNzY2MDMiLz48L2Vj
|
||||
aG9NaW1lQXR0YWNobWVudD4NCjwvU09BUC1FTlY6Qm9keT4NCjwvU09BUC1FTlY6RW52ZWxvcGU+
|
||||
DQo=
|
||||
--=_d624611fe466a88d956a205651c74fdb
|
||||
Content-Disposition: attachment.php
|
||||
Content-Type: text/plain
|
||||
Content-Transfer-Encoding: base64
|
||||
Content-ID: <e6b9843bbc51cbb0039940ef7ee76603>
|
||||
|
||||
PD9waHANCnJlcXVpcmVfb25jZSgiU09BUC9DbGllbnQucGhwIik7DQpyZXF1aXJlX29uY2UoIlNP
|
||||
QVAvdGVzdC90ZXN0LnV0aWxpdHkucGhwIik7DQpyZXF1aXJlX29uY2UoIlNPQVAvVmFsdWUucGhw
|
||||
Iik7DQokc29hcF9iYXNlID0gbmV3IFNPQVBfQmFzZSgpOw0KDQokdiA9ICBuZXcgU09BUF9BdHRh
|
||||
Y2htZW50KCd0ZXN0JywndGV4dC9wbGFpbicsJ2F0dGFjaG1lbnQucGhwJyk7DQokbWV0aG9kVmFs
|
||||
dWUgPSBuZXcgU09BUF9WYWx1ZSgndGVzdGF0dGFjaCcsICdTdHJ1Y3QnLCBhcnJheSgkdikpOw0K
|
||||
DQovLyBzZWUgdGhlIG1pbWUgYXJyYXkNCi8vJHZhbCA9ICRzb2FwX2Jhc2UtPl9tYWtlRW52ZWxv
|
||||
cGUoJG1ldGhvZFZhbHVlKTsNCi8vcHJpbnRfcigkdmFsKTsNCg0KJGNsaWVudCA9IG5ldyBTT0FQ
|
||||
X0NsaWVudCgnaHR0cDovL2xvY2FsaG9zdC9zb2FwX2ludGVyb3Avc2VydmVyX3JvdW5kMi5waHAn
|
||||
KTsNCiRyZXNwID0gJGNsaWVudC0+Y2FsbCgnZWNob01pbWVBdHRhY2htZW50JyxhcnJheSgkdikp
|
||||
Ow0KcHJpbnRfcigkcmVzcCk7DQpwcmludCAkY2xpZW50LT53aXJlOw0KPz4=
|
||||
--=_d624611fe466a88d956a205651c74fdb--';
|
||||
|
||||
$_SERVER['CONTENT_TYPE'] = 'multipart/related; type=text/xml; boundary="=_a2cbb051424cc43e72d3c8c8d0b8f70e"';
|
||||
$test='--=_a2cbb051424cc43e72d3c8c8d0b8f70e
|
||||
Content-Type: text/xml; charset="UTF-8"
|
||||
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
|
||||
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
|
||||
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
|
||||
<SOAP-ENV:Body>
|
||||
|
||||
<echoMimeAttachment>
|
||||
<test href="cid:a223fea3c35b5f0e6dedf8da75efd6b3"/></echoMimeAttachment>
|
||||
</SOAP-ENV:Body>
|
||||
</SOAP-ENV:Envelope>
|
||||
|
||||
--=_a2cbb051424cc43e72d3c8c8d0b8f70e
|
||||
Content-Disposition: attachment.php
|
||||
Content-Type: text/plain
|
||||
Content-Transfer-Encoding: base64
|
||||
Content-ID: <a223fea3c35b5f0e6dedf8da75efd6b3>
|
||||
|
||||
PD9waHANCnJlcXVpcmVfb25jZSgiU09BUC9DbGllbnQucGhwIik7DQpyZXF1aXJlX29uY2UoIlNP
|
||||
QVAvdGVzdC90ZXN0LnV0aWxpdHkucGhwIik7DQpyZXF1aXJlX29uY2UoIlNPQVAvVmFsdWUucGhw
|
||||
Iik7DQokc29hcF9iYXNlID0gbmV3IFNPQVBfQmFzZSgpOw0KDQokdiA9ICBuZXcgU09BUF9BdHRh
|
||||
Y2htZW50KCd0ZXN0JywndGV4dC9wbGFpbicsJ2F0dGFjaG1lbnQucGhwJyk7DQokbWV0aG9kVmFs
|
||||
dWUgPSBuZXcgU09BUF9WYWx1ZSgndGVzdGF0dGFjaCcsICdTdHJ1Y3QnLCBhcnJheSgkdikpOw0K
|
||||
DQovLyBzZWUgdGhlIG1pbWUgYXJyYXkNCi8vJHZhbCA9ICRzb2FwX2Jhc2UtPl9tYWtlRW52ZWxv
|
||||
cGUoJG1ldGhvZFZhbHVlKTsNCi8vcHJpbnRfcigkdmFsKTsNCg0KJGNsaWVudCA9IG5ldyBTT0FQ
|
||||
X0NsaWVudCgnaHR0cDovL2xvY2FsaG9zdC9zb2FwX2ludGVyb3Avc2VydmVyX3JvdW5kMi5waHAn
|
||||
KTsNCiRyZXNwID0gJGNsaWVudC0+Y2FsbCgnZWNob01pbWVBdHRhY2htZW50JyxhcnJheSgkdikp
|
||||
Ow0KI3ByaW50X3IoJHJlc3ApOw0KcHJpbnQgJGNsaWVudC0+d2lyZTsNCj8+
|
||||
--=_a2cbb051424cc43e72d3c8c8d0b8f70e--
|
||||
';
|
||||
$server->service($test, '',TRUE);
|
||||
print $server->response;
|
||||
?>
|
||||
@@ -1,81 +0,0 @@
|
||||
<?php
|
||||
require_once("SOAP/Parser.php");
|
||||
require_once("SOAP/Value.php");
|
||||
|
||||
function number_compare($f1, $f2)
|
||||
{
|
||||
# figure out which has the least fractional digits
|
||||
preg_match('/.*?\.(.*)/',$f1,$m1);
|
||||
preg_match('/.*?\.(.*)/',$f2,$m2);
|
||||
#print_r($m1);
|
||||
# always use at least 2 digits of precision
|
||||
$d = max(min(strlen(count($m1)?$m1[1]:'0'),strlen(count($m2)?$m2[1]:'0')),2);
|
||||
$f1 = round($f1, $d);
|
||||
$f2 = round($f2, $d);
|
||||
return bccomp($f1, $f2, $d) == 0;
|
||||
}
|
||||
|
||||
function boolean_compare($f1, $f2)
|
||||
{
|
||||
if (($f1 == 'true' || $f1 === TRUE || $f1 != 0) &&
|
||||
($f2 == 'true' || $f2 === TRUE || $f2 != 0)) return TRUE;
|
||||
if (($f1 == 'false' || $f1 === FALSE || $f1 == 0) &&
|
||||
($f2 == 'false' || $f2 === FALSE || $f2 == 0)) return TRUE;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
function string_compare($e1, $e2)
|
||||
{
|
||||
if (is_numeric($e1) && is_numeric($e2)) {
|
||||
return number_compare($e1, $e2);
|
||||
}
|
||||
# handle dateTime comparison
|
||||
$e1_type = gettype($e1);
|
||||
$e2_type = gettype($e2);
|
||||
$ok = FALSE;
|
||||
if ($e1_type == "string") {
|
||||
$dt = new SOAP_Type_dateTime();
|
||||
$ok = $dt->compare($e1, $e2) == 0;
|
||||
}
|
||||
return $ok || $e1 == $e2 || strcasecmp(trim($e1), trim($e2)) == 0;
|
||||
}
|
||||
|
||||
function array_compare(&$ar1, &$ar2)
|
||||
{
|
||||
if (gettype($ar1) != 'array' || gettype($ar2) != 'array') return FALSE;
|
||||
# first a shallow diff
|
||||
if (count($ar1) != count($ar2)) return FALSE;
|
||||
$diff = array_diff($ar1, $ar2);
|
||||
if (count($diff) == 0) return TRUE;
|
||||
|
||||
# diff failed, do a full check of the array
|
||||
foreach ($ar1 as $k => $v) {
|
||||
#print "comparing $v == $ar2[$k]\n";
|
||||
if (gettype($v) == "array") {
|
||||
if (!array_compare($v, $ar2[$k])) return FALSE;
|
||||
} else {
|
||||
if (!string_compare($v, $ar2[$k])) return FALSE;
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
function parseMessage($msg)
|
||||
{
|
||||
# strip line endings
|
||||
#$msg = preg_replace('/\r|\n/', ' ', $msg);
|
||||
$response = new SOAP_Parser($msg);
|
||||
if ($response->fault) {
|
||||
return $response->fault->getFault();
|
||||
}
|
||||
$return = $response->getResponse();
|
||||
$v = $response->decode($return);
|
||||
if (gettype($v) == 'array' && count($v)==1) {
|
||||
return array_shift($v);
|
||||
}
|
||||
return $v;
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
@@ -1,17 +0,0 @@
|
||||
<html><body>
|
||||
<?
|
||||
error_reporting(2039);
|
||||
include("SOAP/Client.php");
|
||||
|
||||
$txt = "Bjoern";
|
||||
|
||||
$soapc = new SOAP_Client("http://localhost/soap_interop/testserver.php");
|
||||
$soapc->debug_flag = TRUE;
|
||||
print_r($soapc->call("testMethod",array("txt" => $txt)));
|
||||
print "<br>Debug: ";
|
||||
print $soapc->wire;
|
||||
print "<br><br>";
|
||||
unset($soapc);
|
||||
|
||||
?>
|
||||
</html></body>
|
||||
@@ -1,17 +0,0 @@
|
||||
<?php
|
||||
include "SOAP/Server.php";
|
||||
|
||||
function testMethod($arg) {
|
||||
if ($arg != "") {
|
||||
return crypt($arg);
|
||||
} else {
|
||||
return "Please supply a text";
|
||||
}
|
||||
}
|
||||
|
||||
$server = new soap_server();
|
||||
|
||||
$server->addToMap("testMethod",array("string"),array("string"));
|
||||
$server->service($HTTP_RAW_POST_DATA);
|
||||
echo "<!-- this is a test -->";
|
||||
?>
|
||||
@@ -1,7 +0,0 @@
|
||||
include $(top_builddir)/config_vars.mk
|
||||
LTLIBRARY_OBJECTS = $(LTLIBRARY_SOURCES:.c=.lo) $(LTLIBRARY_OBJECTS_X)
|
||||
LTLIBRARY_SHARED_OBJECTS = $(LTLIBRARY_OBJECTS:.lo=.slo)
|
||||
$(LTLIBRARY_NAME): $(LTLIBRARY_OBJECTS) $(LTLIBRARY_DEPENDENCIES)
|
||||
$(LINK) $(LTLIBRARY_LDFLAGS) $(LTLIBRARY_OBJECTS) $(LTLIBRARY_LIBADD)
|
||||
|
||||
targets = $(LTLIBRARY_NAME)
|
||||
@@ -1,61 +0,0 @@
|
||||
<?xml version="1.0" encoding="ISO-8859-1" ?>
|
||||
<!-- do not use the "Type" attribute here, that one is only for
|
||||
generated package.xml files -->
|
||||
<package>
|
||||
<name>soap</name>
|
||||
<summary>Provides SOAP Services</summary>
|
||||
<description>
|
||||
Description of package....
|
||||
</description>
|
||||
<status>beta</status>
|
||||
<maintainers>
|
||||
<maintainer>
|
||||
<user>rodif_bl</user>
|
||||
<name>Brad Lafountain</name>
|
||||
<email>rodif_bl@yahoo.com</email>
|
||||
<role>lead</role>
|
||||
</maintainer>
|
||||
<maintainer>
|
||||
<user>shane</user>
|
||||
<name>Shane Caraveo</name>
|
||||
<email>shane@caraveo.com</email>
|
||||
<role>lead</role>
|
||||
</maintainer>
|
||||
</maintainers>
|
||||
<license>PHP</license>
|
||||
<release>
|
||||
<version>0.1</version>
|
||||
<date>2002-07-07</date>
|
||||
<state>alpha</state>
|
||||
<notes>
|
||||
- First offical PEAR/PECL release
|
||||
</notes>
|
||||
</release>
|
||||
<filelist>
|
||||
<dir name="/">
|
||||
<file role="doc">EXPERIMENTAL</file>
|
||||
<file role="doc">TODO</file>
|
||||
<file role="src">config.m4</file>
|
||||
<file role="src">Makefile</file>
|
||||
<file role="src">Makefile.in</file>
|
||||
<file role="src">libs.mk</file>
|
||||
<file role="src">php_encoding.c</file>
|
||||
<file role="src">php_encoding.h</file>
|
||||
<file role="src">php_http.c</file>
|
||||
<file role="src">php_http.h</file>
|
||||
<file role="src">php_packet_soap.c</file>
|
||||
<file role="src">php_packet_soap.h</file>
|
||||
<file role="src">php_schema.c</file>
|
||||
<file role="src">php_schema.h</file>
|
||||
<file role="src">php_sdl.c</file>
|
||||
<file role="src">php_sdl.h</file>
|
||||
<file role="src">php_soap.h</file>
|
||||
<file role="src">php_soap.h</file>
|
||||
<file role="src">php_xml.c</file>
|
||||
<file role="src">php_xml.h</file>
|
||||
<file role="src">soap.c</file>
|
||||
<file role="src">soap.dsp</file>
|
||||
</dir>
|
||||
</filelist>
|
||||
</package>
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,256 +0,0 @@
|
||||
#ifndef PHP_ENCODING_H
|
||||
#define PHP_ENCODING_H
|
||||
|
||||
#define XSD_1999_NAMESPACE "http://www.w3.org/1999/XMLSchema"
|
||||
#define XSD_1999_TIMEINSTANT 401
|
||||
#define XSD_1999_TIMEINSTANT_STRING "timeInstant"
|
||||
|
||||
#define XSD_NAMESPACE "http://www.w3.org/2001/XMLSchema"
|
||||
#define XSD_NS_PREFIX "xsd"
|
||||
#define XSD_STRING 101
|
||||
#define XSD_STRING_STRING "string"
|
||||
#define XSD_BOOLEAN 103
|
||||
#define XSD_BOOLEAN_STRING "boolean"
|
||||
#define XSD_DECIMAL 104
|
||||
#define XSD_DECIMAL_STRING "decimal"
|
||||
#define XSD_FLOAT 105
|
||||
#define XSD_FLOAT_STRING "float"
|
||||
#define XSD_DOUBLE 106
|
||||
#define XSD_DOUBLE_STRING "double"
|
||||
#define XSD_DURATION 107
|
||||
#define XSD_DURATION_STRING "duration"
|
||||
#define XSD_DATETIME 108
|
||||
#define XSD_DATETIME_STRING "dateTime"
|
||||
#define XSD_TIME 109
|
||||
#define XSD_TIME_STRING "time"
|
||||
#define XSD_DATE 110
|
||||
#define XSD_DATE_STRING "date"
|
||||
#define XSD_GYEARMONTH 111
|
||||
#define XSD_GYEARMONTH_STRING "gYearMonth"
|
||||
#define XSD_GYEAR 112
|
||||
#define XSD_GYEAR_STRING "gYear"
|
||||
#define XSD_GMONTHDAY 113
|
||||
#define XSD_GMONTHDAY_STRING "gMonthDay"
|
||||
#define XSD_GDAY 114
|
||||
#define XSD_GDAY_STRING "gDay"
|
||||
#define XSD_GMONTH 115
|
||||
#define XSD_GMONTH_STRING "gMonth"
|
||||
#define XSD_HEXBINARY 116
|
||||
#define XSD_HEXBINARY_STRING "hexBinary"
|
||||
#define XSD_BASE64BINARY 117
|
||||
#define XSD_BASE64BINARY_STRING "base64Binary"
|
||||
#define XSD_ANYURI 118
|
||||
#define XSD_ANYURI_STRING "anyURI"
|
||||
#define XSD_QNAME 119
|
||||
#define XSD_QNAME_STRING "QName"
|
||||
#define XSD_NOTATION 120
|
||||
#define XSD_NOTATION_STRING "NOTATION"
|
||||
#define XSD_NORMALIZEDSTRING 121
|
||||
#define XSD_NORMALIZEDSTRING_STRING "normalizedString"
|
||||
#define XSD_TOKEN 122
|
||||
#define XSD_TOKEN_STRING "token"
|
||||
#define XSD_LANGUAGE 123
|
||||
#define XSD_LANGUAGE_STRING "language"
|
||||
#define XSD_NMTOKEN 124
|
||||
#define XSD_NMTOKEN_STRING "NMTOKEN"
|
||||
#define XSD_NAME 124
|
||||
#define XSD_NAME_STRING "Name"
|
||||
#define XSD_NCNAME 125
|
||||
#define XSD_NCNAME_STRING "NCName"
|
||||
#define XSD_ID 126
|
||||
#define XSD_ID_STRING "ID"
|
||||
#define XSD_IDREF 127
|
||||
#define XSD_IDREF_STRING "IDREF"
|
||||
#define XSD_IDREFS 127
|
||||
#define XSD_IDREFS_STRING "IDREFS"
|
||||
#define XSD_ENTITY 128
|
||||
#define XSD_ENTITY_STRING "ENTITY"
|
||||
#define XSD_ENTITYS 129
|
||||
#define XSD_ENTITYS_STRING "ENTITYS"
|
||||
#define XSD_INTEGER 130
|
||||
#define XSD_INTEGER_STRING "integer"
|
||||
#define XSD_NONPOSITIVEINTEGER 131
|
||||
#define XSD_NONPOSITIVEINTEGER_STRING "nonPositiveInteger"
|
||||
#define XSD_NEGATIVEINTEGER 132
|
||||
#define XSD_NEGATIVEINTEGER_STRING "negativeInteger"
|
||||
#define XSD_LONG 133
|
||||
#define XSD_LONG_STRING "long"
|
||||
#define XSD_INT 134
|
||||
#define XSD_INT_STRING "int"
|
||||
#define XSD_SHORT 135
|
||||
#define XSD_SHORT_STRING "short"
|
||||
#define XSD_BYTE 136
|
||||
#define XSD_BYTE_STRING "byte"
|
||||
#define XSD_NONNEGATIVEINTEGER 137
|
||||
#define XSD_NONNEGATIVEINTEGER_STRING "nonNegativeInteger"
|
||||
#define XSD_UNSIGNEDLONG 138
|
||||
#define XSD_UNSIGNEDLONG_STRING "unsignedLong"
|
||||
#define XSD_UNSIGNEDINT 139
|
||||
#define XSD_UNSIGNEDINT_STRING "unsignedInt"
|
||||
#define XSD_UNSIGNEDSHORT 140
|
||||
#define XSD_UNSIGNEDSHORT_STRING "unsignedShort"
|
||||
#define XSD_UNSIGNEDBYTE 141
|
||||
#define XSD_UNSIGNEDBYTE_STRING "unsignedByte"
|
||||
#define XSD_POSITIVEINTEGER 142
|
||||
#define XSD_POSITIVEINTEGER_STRING "positiveInteger"
|
||||
|
||||
#define APACHE_NAMESPACE "http://xml.apache.org/xml-soap"
|
||||
#define APACHE_NS_PREFIX "apache"
|
||||
#define APACHE_MAP 200
|
||||
#define APACHE_MAP_STRING "Map"
|
||||
|
||||
#define SOAP_ENC_NAMESPACE "http://schemas.xmlsoap.org/soap/encoding/"
|
||||
#define SOAP_ENC_NS_PREFIX "SOAP-ENC"
|
||||
#define SOAP_ENC_ARRAY 300
|
||||
#define SOAP_ENC_ARRAY_STRING "Array"
|
||||
#define SOAP_ENC_OBJECT 301
|
||||
#define SOAP_ENC_OBJECT_STRING "Struct"
|
||||
|
||||
#define SCHEMA_NAMESPACE "http://www.w3.org/2001/XMLSchema"
|
||||
#define SCHEMA_NS_PREFIX "s"
|
||||
|
||||
#define WSDL_NAMESPACE "http://schemas.xmlsoap.org/wsdl/"
|
||||
#define WSDL_NS_PREFIX "wsdl"
|
||||
|
||||
#define WSDL_SOAP_NAMESPACE "http://schemas.xmlsoap.org/wsdl/soap/"
|
||||
#define WSDL_SOAP_NS_PREFIX "wsdlSoap"
|
||||
|
||||
#define WSDL_HTTP_NAMESPACE "http://schemas.xmlsoap.org/wsdl/http/"
|
||||
#define WSDL_HTTP_NS_PREFIX "http"
|
||||
|
||||
#define WSDL_HTTP_TRANSPORT "http://schemas.xmlsoap.org/soap/http"
|
||||
|
||||
#define UNKNOWN_TYPE 999998
|
||||
#define END_KNOWN_TYPES 999999
|
||||
|
||||
struct _encodeType
|
||||
{
|
||||
int type;
|
||||
char *type_str;
|
||||
char *ns;
|
||||
sdlTypePtr sdl_type;
|
||||
soapMappingPtr map;
|
||||
};
|
||||
|
||||
struct _encode
|
||||
{
|
||||
encodeType details;
|
||||
zval *(*to_zval)(encodeType type, xmlNodePtr data);
|
||||
xmlNodePtr (*to_xml)(encodeType type, zval *data, int style);
|
||||
|
||||
xmlNodePtr (*to_zval_before)(encodeType type, xmlNodePtr data, int style);
|
||||
zval *(*to_zval_after)(encodeType type, zval *data);
|
||||
|
||||
zval *(*to_xml_before)(encodeType type, zval *data);
|
||||
xmlNodePtr (*to_xml_after)(encodeType type, xmlNodePtr data, int style);
|
||||
};
|
||||
|
||||
smart_str *build_soap_action(zval *this_ptr, char *soapaction);
|
||||
|
||||
// Master functions all encode/decode should be called thur these functions
|
||||
xmlNodePtr master_to_xml(encodePtr encode, zval *data, int style);
|
||||
zval *master_to_zval(encodePtr encode, xmlNodePtr data);
|
||||
|
||||
#ifdef HAVE_PHP_DOMXML
|
||||
//user defined mapping
|
||||
zval *to_xml_before_user(encodeType type, zval *data);
|
||||
xmlNodePtr to_xml_user(encodeType type, zval *data, int style);
|
||||
xmlNodePtr to_xml_after_user(encodeType type, xmlNodePtr node, int style);
|
||||
xmlNodePtr to_zval_before_user(encodeType type, xmlNodePtr node, int style);
|
||||
zval *to_zval_user(encodeType type, xmlNodePtr node);
|
||||
zval *to_zval_after_user(encodeType type, zval *data);
|
||||
#endif
|
||||
|
||||
//zval type decode
|
||||
zval *to_zval_double(encodeType type, xmlNodePtr data);
|
||||
zval *to_zval_long(encodeType type, xmlNodePtr data);
|
||||
zval *to_zval_bool(encodeType type, xmlNodePtr data);
|
||||
zval *to_zval_object(encodeType type, xmlNodePtr data);
|
||||
zval *to_zval_string(encodeType type, xmlNodePtr data);
|
||||
zval *to_zval_array(encodeType type, xmlNodePtr data);
|
||||
zval *to_zval_map(encodeType type, xmlNodePtr data);
|
||||
zval *to_zval_null(encodeType type, xmlNodePtr data);
|
||||
zval *guess_zval_convert(encodeType type, xmlNodePtr data);
|
||||
|
||||
xmlNodePtr to_xml_long(encodeType type, zval *data, int style);
|
||||
xmlNodePtr to_xml_bool(encodeType type, zval *data, int style);
|
||||
|
||||
//String encode
|
||||
xmlNodePtr to_xml_string(encodeType type, zval *data, int style);
|
||||
xmlNodePtr to_xml_stringl(encodeType type, zval *data, int style);
|
||||
|
||||
//Null encode
|
||||
xmlNodePtr to_xml_null(encodeType type, zval *data, int style);
|
||||
|
||||
//Struct encode
|
||||
xmlNodePtr to_xml_object(encodeType type, zval *data, int style);
|
||||
|
||||
//Array encode
|
||||
xmlNodePtr guess_array_map(encodeType type, zval *data, int style);
|
||||
xmlNodePtr to_xml_array(encodeType type, zval *data, int style);
|
||||
xmlNodePtr to_xml_map(encodeType type, zval *data, int style);
|
||||
|
||||
//Try and guess for non-wsdl clients and servers
|
||||
xmlNodePtr guess_xml_convert(encodeType type, zval *data, int style);
|
||||
|
||||
//Datetime encode/decode
|
||||
xmlNodePtr to_xml_datetime_ex(encodeType type, zval *data, char *format, int style);
|
||||
xmlNodePtr to_xml_datetime(encodeType type, zval *data, int style);
|
||||
xmlNodePtr to_xml_time(encodeType type, zval *data, int style);
|
||||
xmlNodePtr to_xml_date(encodeType type, zval *data, int style);
|
||||
xmlNodePtr to_xml_gyearmonth(encodeType type, zval *data, int style);
|
||||
xmlNodePtr to_xml_gyear(encodeType type, zval *data, int style);
|
||||
xmlNodePtr to_xml_gmonthday(encodeType type, zval *data, int style);
|
||||
xmlNodePtr to_xml_gday(encodeType type, zval *data, int style);
|
||||
xmlNodePtr to_xml_gmonth(encodeType type, zval *data, int style);
|
||||
|
||||
#define get_conversion(e) get_conversion_ex(SOAP_GLOBAL(defEncIndex), e)
|
||||
#define get_conversion_from_type(n, t) get_conversion_from_type_ex(SOAP_GLOBAL(defEnc), n, t)
|
||||
#define get_conversion_from_href_type(t) get_conversion_from_href_type_ex(SOAP_GLOBAL(defEnc), t, strlen(t))
|
||||
|
||||
void encode_reset_ns();
|
||||
smart_str *encode_new_ns();
|
||||
|
||||
void set_ns_and_type(xmlNodePtr node, encodeType type);
|
||||
void set_ns_and_type_ex(xmlNodePtr node, char *ns, char *type);
|
||||
encodePtr get_conversion_ex(HashTable *encoding, int encode);
|
||||
encodePtr get_conversion_from_type_ex(HashTable *encoding, xmlNodePtr node, char *type);
|
||||
encodePtr get_conversion_from_href_type_ex(HashTable *encoding, char *type, int len);
|
||||
|
||||
int is_map(zval *array);
|
||||
void get_array_type(zval *array, smart_str *out_type);
|
||||
|
||||
void delete_encoder(void *handle);
|
||||
|
||||
extern encode defaultEncoding[];
|
||||
|
||||
#define FIND_XML_NULL(xml,zval) \
|
||||
{ \
|
||||
xmlAttrPtr null; \
|
||||
if(!xml || !xml->children) \
|
||||
{ \
|
||||
ZVAL_NULL(zval); \
|
||||
return zval; \
|
||||
} \
|
||||
if(xml->properties) \
|
||||
{ \
|
||||
null = get_attribute(xml->properties, "null"); \
|
||||
if(null) \
|
||||
{ \
|
||||
ZVAL_NULL(zval); \
|
||||
return zval; \
|
||||
} \
|
||||
} \
|
||||
}
|
||||
|
||||
#define FIND_ZVAL_NULL(zval, xml) \
|
||||
{ \
|
||||
if(!zval) \
|
||||
{ \
|
||||
xmlSetProp(xml, "xsi:null", "1"); \
|
||||
return xml; \
|
||||
} \
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
@@ -1,494 +0,0 @@
|
||||
#include "php_soap.h"
|
||||
|
||||
void send_http_soap_request(zval *this_ptr, xmlDoc *doc, char *function_name, char *soapaction)
|
||||
{
|
||||
xmlChar *buf;
|
||||
char *soap_headers;
|
||||
int buf_size,err,ret;
|
||||
sdlPtr sdl;
|
||||
php_url *phpurl = NULL;
|
||||
SOAP_STREAM stream;
|
||||
zval **trace;
|
||||
|
||||
TSRMLS_FETCH();
|
||||
|
||||
FETCH_THIS_SOCKET(stream);
|
||||
FETCH_THIS_URL(phpurl);
|
||||
FETCH_THIS_SDL(sdl);
|
||||
|
||||
xmlDocDumpMemory(doc, &buf, &buf_size);
|
||||
|
||||
if(!buf)
|
||||
php_error(E_ERROR, "Error build soap request");
|
||||
|
||||
if(zend_hash_find(Z_OBJPROP_P(this_ptr), "trace", sizeof("trace"), (void **) &trace) == SUCCESS
|
||||
&& Z_LVAL_PP(trace) > 0)
|
||||
add_property_stringl(this_ptr, "__last_request", buf, buf_size, 1);
|
||||
|
||||
if(!stream)
|
||||
{
|
||||
char *url;
|
||||
|
||||
if(!sdl)
|
||||
{
|
||||
zval **location;
|
||||
if(zend_hash_find(Z_OBJPROP_P(this_ptr), "location", sizeof("location"),(void **) &location) == FAILURE)
|
||||
php_error(E_ERROR, "Error could not find location");
|
||||
url = Z_STRVAL_PP(location);
|
||||
}
|
||||
else
|
||||
{
|
||||
sdlBindingPtr binding;
|
||||
FETCH_THIS_PORT(binding);
|
||||
url = binding->location;
|
||||
}
|
||||
|
||||
phpurl = php_url_parse(url);
|
||||
|
||||
#ifdef PHP_STREAMS
|
||||
stream = php_stream_sock_open_host(phpurl->host, (unsigned short)(phpurl->port == 0 ? 80 : phpurl->port), SOCK_STREAM, 0, 0);
|
||||
#else
|
||||
stream = get_socket(phpurl->host, (phpurl->port == 0 ? 80 : phpurl->port), 10);
|
||||
#endif
|
||||
if(stream)
|
||||
{
|
||||
ret = zend_list_insert((void *)stream, le_http_socket);
|
||||
add_property_resource(this_ptr, "httpsocket", ret);
|
||||
zend_list_addref(ret);
|
||||
|
||||
ret = zend_list_insert(phpurl, le_url);
|
||||
add_property_resource(this_ptr, "httpurl", ret);
|
||||
zend_list_addref(ret);
|
||||
}
|
||||
else
|
||||
php_error(E_ERROR,"Could not connect to host");
|
||||
//php_url_free(phpurl);
|
||||
}
|
||||
|
||||
if(stream)
|
||||
{
|
||||
zval **cookies;
|
||||
char *header = "POST %s HTTP/1.1\r\nConnection: close\r\nAccept: text/html; text/xml; text/plain\r\nUser-Agent: PHP SOAP 0.1\r\nHost: %s\r\nContent-Type: text/xml\r\nContent-Length: %d\r\nSOAPAction: \"%s\"\r\n";
|
||||
int size = strlen(header) + strlen(phpurl->host) + strlen(phpurl->path) + 10;
|
||||
|
||||
// TODO: Add authication
|
||||
if(sdl != NULL)
|
||||
{
|
||||
// TODO: need to grab soap action from wsdl....
|
||||
soap_headers = emalloc(size + strlen(soapaction));
|
||||
sprintf(soap_headers, header, phpurl->path, phpurl->host, buf_size, soapaction);
|
||||
}
|
||||
else
|
||||
{
|
||||
soap_headers = emalloc(size + strlen(soapaction));
|
||||
sprintf(soap_headers, header, phpurl->path, phpurl->host, buf_size, soapaction);
|
||||
}
|
||||
|
||||
#ifdef PHP_STREAMS
|
||||
err = php_stream_write(stream, soap_headers, strlen(soap_headers));
|
||||
#else
|
||||
err = send(stream, soap_headers, strlen(soap_headers), 0);
|
||||
#endif
|
||||
if(err != (int)strlen(soap_headers))
|
||||
php_error(E_ERROR,"Failed Sending HTTP Headers");
|
||||
|
||||
// Send cookies along with request
|
||||
if(zend_hash_find(Z_OBJPROP_P(this_ptr), "_cookies", sizeof("_cookies"), (void **)&cookies) == SUCCESS)
|
||||
{
|
||||
smart_str cookie_str = {0};
|
||||
zval **data;
|
||||
char *key;
|
||||
int index, i;
|
||||
|
||||
zend_hash_internal_pointer_reset(Z_ARRVAL_PP(cookies));
|
||||
for(i = 0;i < (int)Z_ARRVAL_PP(cookies)->nNumOfElements;i++)
|
||||
{
|
||||
zend_hash_get_current_data(Z_ARRVAL_PP(cookies), (void **)&data);
|
||||
zend_hash_get_current_key(Z_ARRVAL_PP(cookies), &key, (long *)&index, FALSE);
|
||||
|
||||
smart_str_appendl(&cookie_str, "Cookie: ", 8);
|
||||
smart_str_appendl(&cookie_str, key, strlen(key));
|
||||
smart_str_appendc(&cookie_str, '=');
|
||||
smart_str_appendl(&cookie_str, Z_STRVAL_PP(data), Z_STRLEN_PP(data));
|
||||
smart_str_appendc(&cookie_str, ';');
|
||||
zend_hash_move_forward(Z_ARRVAL_PP(cookies));
|
||||
}
|
||||
smart_str_appendl(&cookie_str, "\r\n", 2);
|
||||
smart_str_0(&cookie_str);
|
||||
|
||||
#ifdef PHP_STREAMS
|
||||
err = php_stream_write(stream, cookie_str.c, cookie_str.len);
|
||||
#else
|
||||
err = send(stream, cookie_str.c, cookie_str.len,0);
|
||||
#endif
|
||||
if(err != (int)cookie_str.len)
|
||||
php_error(E_ERROR,"Failed Sending HTTP Headers");
|
||||
|
||||
smart_str_free(&cookie_str);
|
||||
}
|
||||
|
||||
#ifdef PHP_STREAMS
|
||||
err = php_stream_write(stream, "\r\n", 2);
|
||||
#else
|
||||
err = send(stream, "\r\n", 2, 0);
|
||||
#endif
|
||||
if(err != 2)
|
||||
php_error(E_ERROR,"Failed Sending HTTP Headers");
|
||||
|
||||
|
||||
#ifdef PHP_STREAMS
|
||||
err = php_stream_write(stream, buf, buf_size);
|
||||
#else
|
||||
err = send(stream, buf, buf_size, 0);
|
||||
#endif
|
||||
if(err != (int)strlen(buf))
|
||||
php_error(E_ERROR,"Failed Sending HTTP Content");
|
||||
|
||||
efree(soap_headers);
|
||||
}
|
||||
xmlFree(buf);
|
||||
}
|
||||
|
||||
void get_http_soap_response(zval *this_ptr, char **buffer, int *buffer_len)
|
||||
{
|
||||
char *http_headers, *http_body, *content_type, *http_version, http_status[4], *cookie_itt;
|
||||
int http_header_size, http_body_size, http_close;
|
||||
sdlPtr sdl;
|
||||
zval **socket_ref;
|
||||
SOAP_STREAM stream;
|
||||
zval **trace;
|
||||
|
||||
TSRMLS_FETCH();
|
||||
|
||||
FETCH_THIS_SDL(sdl);
|
||||
|
||||
if(FIND_SOCKET_PROPERTY(this_ptr, socket_ref) != FAILURE)
|
||||
{
|
||||
FETCH_SOCKET_RES(stream, socket_ref);
|
||||
}
|
||||
|
||||
if(!get_http_headers(stream, &http_headers, &http_header_size))
|
||||
php_error(E_ERROR, "Error Fetching http headers");
|
||||
|
||||
//Check to see what HTTP status was sent
|
||||
http_version = get_http_header_value(http_headers,"HTTP/");
|
||||
if(http_version)
|
||||
{
|
||||
char *tmp;
|
||||
|
||||
tmp = strstr(http_version," ");
|
||||
|
||||
if(tmp != NULL)
|
||||
{
|
||||
tmp++;
|
||||
strncpy(http_status,tmp,4);
|
||||
http_status[3] = '\0';
|
||||
}
|
||||
|
||||
/*
|
||||
Try and process any respsone that is xml might contain fault code
|
||||
|
||||
Maybe try and test for some of the 300's 400's specfics but not
|
||||
right now.
|
||||
|
||||
if(strcmp(http_status,"200"))
|
||||
{
|
||||
zval *err;
|
||||
char *http_err;
|
||||
|
||||
MAKE_STD_ZVAL(err);
|
||||
ZVAL_STRING(err, http_body, 1);
|
||||
http_err = emalloc(strlen("HTTP request failed ()") + 4);
|
||||
sprintf(http_err, "HTTP request failed (%s)", http_status);
|
||||
add_soap_fault(thisObj, "SOAP-ENV:Client", http_err, NULL, err);
|
||||
efree(http_err);
|
||||
return;
|
||||
}*/
|
||||
|
||||
//Try and get headers again
|
||||
if(!strcmp(http_status, "100"))
|
||||
{
|
||||
if(!get_http_headers(stream, &http_headers, &http_header_size))
|
||||
php_error(E_ERROR, "Error Fetching http headers");
|
||||
}
|
||||
|
||||
efree(http_version);
|
||||
}
|
||||
|
||||
|
||||
if(!get_http_body(stream, http_headers, &http_body, &http_body_size))
|
||||
php_error(E_ERROR, "Error Fetching http body");
|
||||
|
||||
if(zend_hash_find(Z_OBJPROP_P(this_ptr), "trace", sizeof("trace"), (void **) &trace) == SUCCESS
|
||||
&& Z_LVAL_PP(trace) > 0)
|
||||
add_property_stringl(this_ptr, "__last_response", http_body, http_body_size, 1);
|
||||
|
||||
// Close every time right now till i can spend more time on it
|
||||
// it works.. it's just slower??
|
||||
//See if the server requested a close
|
||||
http_close = TRUE;
|
||||
/*
|
||||
connection = get_http_header_value(http_headers,"Connection: ");
|
||||
if(connection)
|
||||
{
|
||||
if(!strcmp(connection, "Keep-Alive"))
|
||||
http_close = FALSE;
|
||||
efree(connection);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(!strncmp(http_version,"1.1", 3))
|
||||
http_close = FALSE;
|
||||
}
|
||||
*/
|
||||
|
||||
if(http_close)
|
||||
{
|
||||
#ifdef PHP_STREAMS
|
||||
php_stream_close(stream);
|
||||
#else
|
||||
SOCK_CLOSE(stream);
|
||||
#endif
|
||||
zend_list_delete(Z_RESVAL_PP(socket_ref));
|
||||
zend_hash_del(Z_OBJPROP_P(this_ptr), "httpsocket", strlen("httpsocket") + 1);
|
||||
}
|
||||
|
||||
//Check and see if the server even sent a xml document
|
||||
content_type = get_http_header_value(http_headers,"Content-Type: ");
|
||||
if(content_type)
|
||||
{
|
||||
char *pos = NULL;
|
||||
int cmplen;
|
||||
pos = strstr(content_type,";");
|
||||
if(pos != NULL)
|
||||
cmplen = pos - content_type;
|
||||
else
|
||||
cmplen = strlen(content_type);
|
||||
|
||||
if(strncmp(content_type, "text/xml", cmplen))
|
||||
{
|
||||
if(strncmp(http_body, "<?xml", 5))
|
||||
{
|
||||
zval *err;
|
||||
MAKE_STD_ZVAL(err);
|
||||
ZVAL_STRINGL(err, http_body, http_body_size, 1);
|
||||
add_soap_fault(this_ptr, "SOAP-ENV:Client", "Didn't recieve an xml document", NULL, err);
|
||||
efree(content_type);
|
||||
return;
|
||||
}
|
||||
}
|
||||
efree(content_type);
|
||||
}
|
||||
|
||||
//Grab and send back every cookie
|
||||
//Not going to worry about Path: because
|
||||
//we shouldn't be changing urls so path dont
|
||||
//matter too much
|
||||
cookie_itt = strstr(http_headers,"Set-Cookie: ");
|
||||
while(cookie_itt)
|
||||
{
|
||||
char *end_pos, *cookie;
|
||||
char *eqpos, *sempos;
|
||||
smart_str name = {0}, value = {0};
|
||||
zval **cookies, *z_cookie;
|
||||
|
||||
if(zend_hash_find(Z_OBJPROP_P(this_ptr), "_cookies", sizeof("_cookies"), (void **)&cookies) == FAILURE)
|
||||
{
|
||||
zval *tmp_cookies;
|
||||
MAKE_STD_ZVAL(tmp_cookies);
|
||||
array_init(tmp_cookies);
|
||||
zend_hash_update(Z_OBJPROP_P(this_ptr), "_cookies", sizeof("_cookies"), &tmp_cookies, sizeof(zval *), (void **)&cookies);
|
||||
}
|
||||
|
||||
end_pos = strstr(cookie_itt,"\r\n");
|
||||
cookie = get_http_header_value(cookie_itt,"Set-Cookie: ");
|
||||
|
||||
eqpos = strstr(cookie, "=");
|
||||
sempos = strstr(cookie, ";");
|
||||
|
||||
smart_str_appendl(&name, cookie, eqpos - cookie);
|
||||
smart_str_0(&name);
|
||||
|
||||
smart_str_appendl(&value, eqpos + 1, sempos - (eqpos + 1));
|
||||
smart_str_0(&value);
|
||||
|
||||
MAKE_STD_ZVAL(z_cookie);
|
||||
ZVAL_STRINGL(z_cookie, value.c, value.len, 1);
|
||||
|
||||
zend_hash_update(Z_ARRVAL_PP(cookies), name.c, name.len + 1, &z_cookie, sizeof(zval *), NULL);
|
||||
|
||||
cookie_itt = strstr(cookie_itt + sizeof("Set-Cookie: "), "Set-Cookie: ");
|
||||
|
||||
smart_str_free(&value);
|
||||
smart_str_free(&name);
|
||||
efree(cookie);
|
||||
cookie_itt = FALSE;
|
||||
}
|
||||
|
||||
*buffer = http_body;
|
||||
*buffer_len = http_body_size;
|
||||
efree(http_headers);
|
||||
}
|
||||
|
||||
char *get_http_header_value(char *headers, char *type)
|
||||
{
|
||||
char *tmp = NULL,*var = NULL;
|
||||
int size;
|
||||
|
||||
tmp = strstr(headers, type);
|
||||
if(tmp != NULL)
|
||||
{
|
||||
tmp += strlen(type);
|
||||
size = strstr(tmp, "\r\n") - tmp;
|
||||
var = emalloc(size + 1);
|
||||
strncpy(var, tmp, size);
|
||||
var[size] = '\0';
|
||||
}
|
||||
return var;
|
||||
}
|
||||
|
||||
int get_http_body(SOAP_STREAM stream, char *headers, char **response, int *out_size)
|
||||
{
|
||||
char *trans_enc, *content_length, *http_buf;
|
||||
int http_buf_size = 0;
|
||||
TSRMLS_FETCH();
|
||||
|
||||
trans_enc = get_http_header_value(headers, "Transfer-Encoding: ");
|
||||
content_length = get_http_header_value(headers, "Content-Length: ");
|
||||
|
||||
//this is temp...
|
||||
// netscape enterprise server sends in lowercase???
|
||||
if(content_length == NULL)
|
||||
content_length = get_http_header_value(headers, "Content-length: ");
|
||||
|
||||
if(trans_enc && !strcmp(trans_enc, "chunked"))
|
||||
{
|
||||
int cur = 0, size = 0, buf_size = 0, len_size;
|
||||
char done, chunk_size[10];
|
||||
|
||||
done = FALSE;
|
||||
http_buf = emalloc(1);
|
||||
while(!done)
|
||||
{
|
||||
cur = 0;
|
||||
while(!(chunk_size[cur - 2] == '\r' && chunk_size[cur - 1] == '\n'))
|
||||
#ifdef PHP_STREAMS
|
||||
chunk_size[cur++] = php_stream_getc(stream);
|
||||
#else
|
||||
chunk_size[cur++] = php_sock_fgetc(stream);
|
||||
#endif
|
||||
if(sscanf(chunk_size,"%x",&buf_size) != -1)
|
||||
{
|
||||
http_buf = erealloc(http_buf,http_buf_size + buf_size);
|
||||
len_size = 0;
|
||||
while(http_buf_size < buf_size)
|
||||
{
|
||||
#ifdef PHP_STREAMS
|
||||
len_size += php_stream_read(stream, &http_buf[http_buf_size], buf_size - len_size);
|
||||
#else
|
||||
len_size += php_sock_fread(&http_buf[http_buf_size], buf_size - len_size, stream);
|
||||
#endif
|
||||
http_buf_size += len_size;
|
||||
}
|
||||
#ifdef PHP_STREAMS
|
||||
php_stream_getc(stream);php_stream_getc(stream);
|
||||
#else
|
||||
//Eat up '\r' '\n'
|
||||
php_sock_fgetc(stream);php_sock_fgetc(stream);
|
||||
#endif
|
||||
}
|
||||
if(buf_size == 0)
|
||||
done = TRUE;
|
||||
}
|
||||
efree(trans_enc);
|
||||
}
|
||||
else if(content_length)
|
||||
{
|
||||
int size;
|
||||
size = atoi(content_length);
|
||||
http_buf = emalloc(size + 1);
|
||||
|
||||
while(http_buf_size < size)
|
||||
#ifdef PHP_STREAMS
|
||||
http_buf_size += php_stream_read(stream, &http_buf[http_buf_size], size - http_buf_size);
|
||||
#else
|
||||
http_buf_size += php_sock_fread(&http_buf[http_buf_size], size - http_buf_size, stream);
|
||||
#endif
|
||||
http_buf[size] = '\0';
|
||||
efree(content_length);
|
||||
}
|
||||
else
|
||||
php_error(E_ERROR,"Don't know how to read http body, No Content-Length or chunked data");
|
||||
|
||||
(*response) = http_buf;
|
||||
(*out_size) = http_buf_size;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
int get_http_headers(SOAP_STREAM stream, char **response, int *out_size)
|
||||
{
|
||||
int done;
|
||||
char chr;
|
||||
smart_str tmp_response = {0};
|
||||
TSRMLS_FETCH();
|
||||
|
||||
done = FALSE;
|
||||
|
||||
while(!done)
|
||||
{
|
||||
#ifdef PHP_STREAMS
|
||||
chr = php_stream_getc(stream);
|
||||
#else
|
||||
chr = php_sock_fgetc(stream);
|
||||
#endif
|
||||
if(chr != EOF)
|
||||
{
|
||||
smart_str_appendc(&tmp_response, chr);
|
||||
if(tmp_response.c[tmp_response.len - 2] == '\r' && tmp_response.c[tmp_response.len - 1] == '\n' &&
|
||||
tmp_response.c[tmp_response.len - 4] == '\r' && tmp_response.c[tmp_response.len - 3] == '\n')
|
||||
{
|
||||
smart_str_0(&tmp_response);
|
||||
done = TRUE;
|
||||
}
|
||||
}
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
(*response) = tmp_response.c;
|
||||
(*out_size) = tmp_response.len;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
#ifndef PHP_STREAMS
|
||||
SOCKET get_socket(char* host,int portno,int time)
|
||||
{
|
||||
SOCKET socketd = -1;
|
||||
struct sockaddr_in server;
|
||||
struct timeval timeout;
|
||||
|
||||
memset(&server, 0, sizeof(server));
|
||||
socketd = socket(AF_INET,SOCK_STREAM,0);
|
||||
if (socketd == SOCK_ERR) {
|
||||
if(socketd > 0)
|
||||
SOCK_CLOSE(socketd);
|
||||
return FALSE;
|
||||
}
|
||||
server.sin_family = AF_INET;
|
||||
|
||||
if(php_lookup_hostname(host,&server.sin_addr)) {
|
||||
if(socketd > 0)
|
||||
SOCK_CLOSE(socketd);
|
||||
return FALSE;
|
||||
}
|
||||
server.sin_port = htons((unsigned short)portno);
|
||||
timeout.tv_sec = time;
|
||||
timeout.tv_usec = 0;
|
||||
if (php_connect_nonb(socketd, (struct sockaddr *)&server, sizeof(struct sockaddr_in), &timeout) == SOCK_CONN_ERR) {
|
||||
if(socketd > 0)
|
||||
SOCK_CLOSE(socketd);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return socketd;
|
||||
}
|
||||
#endif
|
||||
@@ -1,25 +0,0 @@
|
||||
#ifndef PHP_HTTP_H
|
||||
#define PHP_HTTP_H
|
||||
|
||||
void send_http_soap_request(zval *this_ptr, xmlDoc *doc, char *function_name, char *soapaction);
|
||||
void get_http_soap_response(zval *this_ptr, char **buffer, int *buffer_len);
|
||||
|
||||
char *get_http_header_value(char *headers, char *type);
|
||||
int get_http_body(SOAP_STREAM socketd, char *headers, char **response, int *out_size);
|
||||
int get_http_headers(SOAP_STREAM socketd,char **response, int *out_size);
|
||||
|
||||
#ifndef PHP_STREAMS
|
||||
#ifndef ZEND_WIN32
|
||||
# ifndef closesocket
|
||||
# define closesocket close
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef SOCK_CLOSE
|
||||
# define SOCK_CLOSE(s) shutdown(s, 0); closesocket(s)
|
||||
#endif
|
||||
|
||||
SOCKET get_socket(char* host,int portno,int timeout);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -1,138 +0,0 @@
|
||||
#include "php_soap.h"
|
||||
|
||||
int parse_packet_soap(zval *this_ptr, char *buffer, int buffer_size, sdlFunctionPtr fn, char *fn_name, zval ***ret, int *num_params)
|
||||
{
|
||||
xmlDocPtr response;
|
||||
xmlNodePtr trav, trav2, env, body, resp, cur, fault;
|
||||
zval **tmp_ret;
|
||||
TSRMLS_FETCH();
|
||||
|
||||
response = xmlParseMemory(buffer, buffer_size);
|
||||
xmlCleanupParser();
|
||||
|
||||
(*num_params) = 0;
|
||||
|
||||
trav = response->children;
|
||||
FOREACHNODE(trav,"Envelope",env)
|
||||
{
|
||||
trav2 = env->children;
|
||||
FOREACHNODE(trav2,"Body",body)
|
||||
{
|
||||
fault = get_node(body->children,"Fault");
|
||||
if(fault != NULL)
|
||||
{
|
||||
char *faultcode = NULL, *faultstring = NULL, *faultactor = NULL;
|
||||
zval *details = NULL;
|
||||
xmlNodePtr tmp;
|
||||
|
||||
tmp = get_node(fault->children,"faultcode");
|
||||
if(tmp != NULL && tmp->children != NULL)
|
||||
faultcode = tmp->children->content;
|
||||
|
||||
tmp = get_node(fault->children,"faultstring");
|
||||
if(tmp != NULL && tmp->children != NULL)
|
||||
faultstring = tmp->children->content;
|
||||
|
||||
tmp = get_node(fault->children,"faultactor");
|
||||
if(tmp != NULL && tmp->children != NULL)
|
||||
faultactor = tmp->children->content;
|
||||
|
||||
tmp = get_node(fault->children,"detail");
|
||||
if(tmp != NULL)
|
||||
{
|
||||
encodePtr enc;
|
||||
enc = get_conversion(UNKNOWN_TYPE);
|
||||
details = enc->to_zval(enc->details, tmp);
|
||||
}
|
||||
|
||||
add_soap_fault(this_ptr, faultcode, faultstring, faultactor, details);
|
||||
}
|
||||
else
|
||||
{
|
||||
resp = body->children;
|
||||
if(fn != NULL)
|
||||
{
|
||||
sdlParamPtr *h_param, param = NULL;
|
||||
xmlNodePtr val = NULL;
|
||||
encodePtr enc;
|
||||
char *name, *ns;
|
||||
|
||||
if(fn->bindingType == BINDING_SOAP)
|
||||
{
|
||||
sdlSoapBindingFunctionPtr fnb = (sdlSoapBindingFunctionPtr)fn->bindingAttributes;
|
||||
|
||||
zend_hash_internal_pointer_reset(fn->responseParameters);
|
||||
if(zend_hash_get_current_data(fn->responseParameters, (void **)&h_param) != SUCCESS)
|
||||
php_error(E_ERROR, "Can't find response parameter \"%s\"", param->paramName);
|
||||
|
||||
param = (*h_param);
|
||||
if(fnb->style == SOAP_DOCUMENT)
|
||||
{
|
||||
name = (*h_param)->encode->details.type_str;
|
||||
ns = (*h_param)->encode->details.ns;
|
||||
}
|
||||
else
|
||||
{
|
||||
name = fn->responseName;
|
||||
/* ns = ? */
|
||||
}
|
||||
|
||||
cur = get_node_ex(resp, name, ns);
|
||||
/* TODO: produce warning invalid ns */
|
||||
if(!cur)
|
||||
cur = get_node(resp, name);
|
||||
|
||||
if(!cur)
|
||||
php_error(E_ERROR, "Can't find response data");
|
||||
|
||||
|
||||
if(fnb->style == SOAP_DOCUMENT)
|
||||
val = cur;
|
||||
else
|
||||
val = get_node(cur->children, param->paramName);
|
||||
|
||||
if(!val)
|
||||
php_error(E_ERROR, "Can't find response data");
|
||||
|
||||
tmp_ret = emalloc(sizeof(zval **));
|
||||
if(param != NULL)
|
||||
enc = param->encode;
|
||||
else
|
||||
enc = get_conversion(UNKNOWN_TYPE);
|
||||
|
||||
tmp_ret[0] = master_to_zval(enc, val);
|
||||
(*ret) = tmp_ret;
|
||||
(*num_params) = 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
cur = resp;
|
||||
while(cur && cur->type != XML_ELEMENT_NODE)
|
||||
cur = cur->next;
|
||||
if(cur != NULL)
|
||||
{
|
||||
xmlNodePtr val;
|
||||
val = cur->children;
|
||||
while(val && val->type != XML_ELEMENT_NODE)
|
||||
val = val->next;
|
||||
|
||||
if(val != NULL)
|
||||
{
|
||||
encodePtr enc;
|
||||
enc = get_conversion(UNKNOWN_TYPE);
|
||||
tmp_ret = emalloc(sizeof(zval **));
|
||||
tmp_ret[0] = master_to_zval(enc, val);
|
||||
(*ret) = tmp_ret;
|
||||
(*num_params) = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
ENDFOREACH(trav2);
|
||||
}
|
||||
ENDFOREACH(trav);
|
||||
xmlFreeDoc(response);
|
||||
return TRUE;
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
#ifndef PHP_PACKET_SOAP_H
|
||||
#define PHP_PACKET_SOAP_H
|
||||
|
||||
int parse_packet_soap(zval *this_ptr, char *buffer, int buffer_size, sdlFunctionPtr fn, char *fn_name, zval ***ret, int *num_params);
|
||||
|
||||
#endif
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,28 +0,0 @@
|
||||
#ifndef PHP_SCHEMA_H
|
||||
#define PHP_SCHEMA_H
|
||||
|
||||
int load_schema(sdlPtr *sdl,xmlNodePtr schema);
|
||||
int schema_simpleType(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr simpleType, sdlTypePtr cur_type);
|
||||
int schema_complexType(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr compType, sdlTypePtr cur_type);
|
||||
int schema_sequence(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr seqType, sdlTypePtr cur_type);
|
||||
int schema_list(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr listType, sdlTypePtr cur_type);
|
||||
int schema_union(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr unionType, sdlTypePtr cur_type);
|
||||
int schema_simpleContent(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr simpCompType, sdlTypePtr cur_type);
|
||||
int schema_restriction_simpleType(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr restType, sdlTypePtr cur_type);
|
||||
int schema_restriction_simpleContent(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr restType, sdlTypePtr cur_type);
|
||||
int schema_restriction_complexContent(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr restType, sdlTypePtr cur_type);
|
||||
int schema_extension(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr extType, sdlTypePtr cur_type);
|
||||
int schema_all(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr extType, sdlTypePtr cur_type);
|
||||
int schema_group(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr groupType, sdlTypePtr cur_type);
|
||||
int schema_choice(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr choiceType, sdlTypePtr cur_type);
|
||||
int schema_element(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr element, sdlTypePtr cur_type);
|
||||
int schema_attribute(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr attrType, sdlTypePtr cur_type);
|
||||
int schema_any(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr extType, sdlTypePtr cur_type);
|
||||
|
||||
int schema_restriction_var_int(xmlNodePtr val, sdlRestrictionIntPtr *valptr);
|
||||
void delete_restriction_var_int(void *rvi);
|
||||
|
||||
int schema_restriction_var_char(xmlNodePtr val, sdlRestrictionCharPtr *valptr);
|
||||
void delete_schema_restriction_var_char(void *srvc);
|
||||
|
||||
#endif
|
||||
-1126
File diff suppressed because it is too large.
Load diff
@@ -1,167 +0,0 @@
|
||||
#ifndef PHP_SDL_H
|
||||
#define PHP_SDL_H
|
||||
|
||||
#define XSD_WHITESPACE_COLLAPSE 1
|
||||
#define XSD_WHITESPACE_PRESERVE 1
|
||||
#define XSD_WHITESPACE_REPLACE 1
|
||||
|
||||
#define BINDING_SOAP 1
|
||||
#define BINDING_HTTP 2
|
||||
|
||||
#define SOAP_RPC 1
|
||||
#define SOAP_DOCUMENT 2
|
||||
|
||||
#define SOAP_ENCODED 1
|
||||
#define SOAP_LITERAL 2
|
||||
|
||||
struct _sdl
|
||||
{
|
||||
xmlDocPtr doc; //pointer to the parsed xml file
|
||||
HashTable *types; //array of sdlTypesPtr
|
||||
HashTable *encoders; //array of encodePtr
|
||||
HashTable *bindings; //array of sdlBindings (key'd by name)
|
||||
char *target_ns;
|
||||
char *source;
|
||||
};
|
||||
|
||||
struct _sdlBinding
|
||||
{
|
||||
char *name;
|
||||
HashTable *functions;
|
||||
char *location;
|
||||
int bindingType;
|
||||
void *bindingAttributes;
|
||||
};
|
||||
|
||||
//Soap Binding Specfic stuff
|
||||
struct _sdlSoapBinding
|
||||
{
|
||||
char *transport;
|
||||
int style;
|
||||
};
|
||||
|
||||
struct _sdlSoapBindingFunctionBody
|
||||
{
|
||||
char *ns;
|
||||
int use;
|
||||
char *parts; //not implemented yet
|
||||
char *encodingStyle; //not implemented yet
|
||||
};
|
||||
|
||||
struct _sdlSoapBindingFunction
|
||||
{
|
||||
char *soapAction;
|
||||
int style;
|
||||
|
||||
sdlSoapBindingFunctionBody input;
|
||||
sdlSoapBindingFunctionBody output;
|
||||
sdlSoapBindingFunctionBody falut;
|
||||
};
|
||||
|
||||
//HTTP Binding Specfic stuff
|
||||
/*********** not implemented yet ************
|
||||
struct _sdlHttpBinding
|
||||
{
|
||||
int holder;
|
||||
};
|
||||
*********************************************/
|
||||
|
||||
struct _sdlRestrictionInt
|
||||
{
|
||||
int value;
|
||||
char fixed;
|
||||
char *id;
|
||||
};
|
||||
|
||||
struct _sdlRestrictionChar
|
||||
{
|
||||
char *value;
|
||||
char fixed;
|
||||
char *id;
|
||||
};
|
||||
|
||||
struct _sdlRestrictions
|
||||
{
|
||||
HashTable *enumeration; //array of sdlRestrictionCharPtr
|
||||
sdlRestrictionIntPtr minExclusive;
|
||||
sdlRestrictionIntPtr minInclusive;
|
||||
sdlRestrictionIntPtr maxExclusive;
|
||||
sdlRestrictionIntPtr maxInclusive;
|
||||
sdlRestrictionIntPtr totalDigits;
|
||||
sdlRestrictionIntPtr fractionDigits;
|
||||
sdlRestrictionIntPtr length;
|
||||
sdlRestrictionIntPtr minLength;
|
||||
sdlRestrictionIntPtr maxLength;
|
||||
sdlRestrictionCharPtr whiteSpace;
|
||||
sdlRestrictionCharPtr pattern;
|
||||
};
|
||||
|
||||
struct _sdlType
|
||||
{
|
||||
char *name;
|
||||
char *namens;
|
||||
int nullable;
|
||||
int min_occurs;
|
||||
int max_occurs;
|
||||
HashTable *elements; //array of sdlTypePtr
|
||||
HashTable *attributes; //array of sdlAttributePtr
|
||||
sdlRestrictionsPtr restrictions;
|
||||
encodePtr encode;
|
||||
};
|
||||
|
||||
struct _sdlParam
|
||||
{
|
||||
int order;
|
||||
encodePtr encode;
|
||||
char *paramName;
|
||||
};
|
||||
|
||||
struct _sdlFunction
|
||||
{
|
||||
char *functionName;
|
||||
char *requestName;
|
||||
char *responseName;
|
||||
HashTable *requestParameters; //array of sdlParamPtr
|
||||
HashTable *responseParameters; //array of sdlParamPtr (this should only be one)
|
||||
int bindingType;
|
||||
void *bindingAttributes;
|
||||
};
|
||||
|
||||
struct _sdlAttribute
|
||||
{
|
||||
char *def;
|
||||
char *fixed;
|
||||
char *form;
|
||||
char *id;
|
||||
char *name;
|
||||
char *ref;
|
||||
char *type;
|
||||
char *use;
|
||||
HashTable *extraAttributes; //array of xmlNodePtr
|
||||
};
|
||||
|
||||
sdlPtr get_sdl(char *uri);
|
||||
sdlPtr load_wsdl(char *struri, sdlPtr parent);
|
||||
int load_sdl(char *struri, int force_load);
|
||||
int load_ms_sdl(char *struri, int force_load);
|
||||
|
||||
encodePtr get_encoder_from_prefix(sdlPtr sdl, xmlNodePtr data, char *type);
|
||||
encodePtr get_encoder(sdlPtr sdl, char *ns, char *type);
|
||||
encodePtr get_encoder_ex(sdlPtr sdl, char *nscat);
|
||||
encodePtr get_create_encoder(sdlPtr sdl, sdlTypePtr cur_type, char *ns, char *type);
|
||||
encodePtr create_encoder(sdlPtr sdl, sdlTypePtr cur_type, char *ns, char *type);
|
||||
|
||||
sdlBindingPtr get_binding_from_type(sdlPtr sdl, int type);
|
||||
sdlBindingPtr get_binding_from_name(sdlPtr sdl, char *name, char *ns);
|
||||
|
||||
xmlNodePtr sdl_guess_convert_xml(encodeType enc, zval* data, int style);
|
||||
zval *sdl_guess_convert_zval(encodeType enc, xmlNodePtr data);
|
||||
|
||||
xmlNodePtr sdl_to_xml_array(sdlTypePtr type, zval *data, int style);
|
||||
xmlNodePtr sdl_to_xml_object(sdlTypePtr type, zval *data, int style);
|
||||
|
||||
void delete_type(void *type);
|
||||
void delete_attribute(void *attribute);
|
||||
#endif
|
||||
|
||||
|
||||
@@ -1,148 +0,0 @@
|
||||
# Microsoft Developer Studio Project File - Name="php_soap" - Package Owner=<4>
|
||||
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||
# ** DO NOT EDIT **
|
||||
|
||||
# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
|
||||
|
||||
CFG=php_soap - Win32 Debug
|
||||
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
||||
!MESSAGE use the Export Makefile command and run
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "php_soap.mak".
|
||||
!MESSAGE
|
||||
!MESSAGE You can specify a configuration when running NMAKE
|
||||
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "php_soap.mak" CFG="php_soap - Win32 Debug"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "php_soap - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
|
||||
!MESSAGE "php_soap - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
|
||||
!MESSAGE
|
||||
|
||||
# Begin Project
|
||||
# PROP AllowPerConfigDependencies 0
|
||||
# PROP Scc_ProjName ""
|
||||
# PROP Scc_LocalPath ""
|
||||
CPP=cl.exe
|
||||
MTL=midl.exe
|
||||
RSC=rc.exe
|
||||
|
||||
!IF "$(CFG)" == "php_soap - Win32 Release"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
# PROP BASE Output_Dir "Release"
|
||||
# PROP BASE Intermediate_Dir "Release"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir "Release"
|
||||
# PROP Intermediate_Dir "Release"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "PHP_SOAP_EXPORTS" /YX /FD /c
|
||||
# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\main" /I "..\..\..\libxml2-2.4.12\include" /I "..\..\bind" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "PHP_SOAP_EXPORTSWS" /D "PHP_SOAP_EXPORTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "ZTS" /D ZEND_DEBUG=0 /D "COMPILE_DL_SOAP" /YX /FD /c
|
||||
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||
# ADD BASE RSC /l 0x409 /d "NDEBUG"
|
||||
# ADD RSC /l 0x409 /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts.lib libxml2.lib wsock32.lib resolv.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS\php_soap.dll" /libpath:"..\..\\" /libpath:"..\..\..\libxml2-2.4.12\lib" /libpath:"..\..\Release_TS"
|
||||
|
||||
!ELSEIF "$(CFG)" == "php_soap - Win32 Debug"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 1
|
||||
# PROP BASE Output_Dir "Debug"
|
||||
# PROP BASE Intermediate_Dir "Debug"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 1
|
||||
# PROP Output_Dir "Debug"
|
||||
# PROP Intermediate_Dir "Debug"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "PHP_SOAP_EXPORTS" /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\.." /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\main" /I "..\..\..\libxml2-2.4.12\include" /I "..\..\bind" /D "WS" /D "_MBCS" /D "_USRDLL" /D "PHP_SOAP_EXPORTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "ZTS" /D ZEND_DEBUG=1 /D "COMPILE_DL_SOAP" /FR"Release_TS/" /Fp"Release_TS/gd.pch" /YX /Fo"Release_TS/" /Fd"Release_TS/" /FD /c
|
||||
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
||||
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
||||
# ADD BASE RSC /l 0x409 /d "_DEBUG"
|
||||
# ADD RSC /l 0x409 /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts_debug.lib libxml2.lib wsock32.lib resolv.lib /nologo /dll /debug /machine:I386 /out:"..\..\Debug_TS\php_soap.dll" /implib:"Release_TS/php_gd.lib" /pdbtype:sept /libpath:"..\..\\" /libpath:"..\..\..\libxml2-2.4.12\lib" /libpath:"..\..\Debug_TS"
|
||||
# SUBTRACT LINK32 /pdb:none /incremental:no
|
||||
|
||||
!ENDIF
|
||||
|
||||
# Begin Target
|
||||
|
||||
# Name "php_soap - Win32 Release"
|
||||
# Name "php_soap - Win32 Debug"
|
||||
# Begin Group "Source Files"
|
||||
|
||||
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\php_encoding.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\php_http.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\php_schema.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\php_sdl.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\php_xml.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\soap.c
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Header Files"
|
||||
|
||||
# PROP Default_Filter "h;hpp;hxx;hm;inl"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\php_encoding.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\php_http.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\php_schema.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\php_sdl.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\php_soap.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\php_xml.h
|
||||
# End Source File
|
||||
# End Group
|
||||
# End Target
|
||||
# End Project
|
||||
@@ -1,418 +0,0 @@
|
||||
#ifndef PHP_SOAP_H
|
||||
#define PHP_SOAP_H
|
||||
|
||||
#include "php.h"
|
||||
#include "php_globals.h"
|
||||
#include "ext/standard/info.h"
|
||||
#include "ext/standard/php_standard.h"
|
||||
#include "ext/session/php_session.h"
|
||||
#include "ext/standard/php_smart_str.h"
|
||||
#include "php_ini.h"
|
||||
#include "SAPI.h"
|
||||
#include <libxml/parser.h>
|
||||
#include <libxml/xpath.h>
|
||||
|
||||
#ifdef HAVE_PHP_DOMXML
|
||||
# include "ext/domxml/php_domxml.h"
|
||||
#endif
|
||||
|
||||
// PHP_STREAMS were introduced php-4.2.0.. i think
|
||||
// Make this part of configure
|
||||
#ifdef STREAMS_DC
|
||||
# define PHP_STREAMS
|
||||
#endif
|
||||
|
||||
#ifdef PHP_WIN32
|
||||
# ifdef PHP_STREAMS
|
||||
# define SOAP_STREAM php_stream *
|
||||
# else
|
||||
# define SOAP_STREAM SOCKET
|
||||
# endif
|
||||
#else
|
||||
# ifdef PHP_STREAMS
|
||||
# define SOAP_STREAM php_stream *
|
||||
# else
|
||||
# define SOCKET unsigned int
|
||||
# define SOAP_STREAM SOCKET
|
||||
# endif
|
||||
# define TRUE 1
|
||||
# define FALSE 0
|
||||
# define stricmp strcasecmp
|
||||
#endif
|
||||
|
||||
typedef struct _encodeType encodeType, *encodeTypePtr;
|
||||
typedef struct _encode encode, *encodePtr;
|
||||
|
||||
typedef struct _sdl sdl, *sdlPtr;
|
||||
typedef struct _sdlRestrictionInt sdlRestrictionInt, *sdlRestrictionIntPtr;
|
||||
typedef struct _sdlRestrictionChar sdlRestrictionChar, *sdlRestrictionCharPtr;
|
||||
typedef struct _sdlRestrictions sdlRestrictions, *sdlRestrictionsPtr;
|
||||
typedef struct _sdlType sdlType, *sdlTypePtr;
|
||||
typedef struct _sdlParam sdlParam, *sdlParamPtr;
|
||||
typedef struct _sdlFunction sdlFunction, *sdlFunctionPtr;
|
||||
typedef struct _sdlAttribute sdlAttribute, *sdlAttributePtr;
|
||||
typedef struct _sdlBinding sdlBinding, *sdlBindingPtr;
|
||||
typedef struct _sdlSoapBinding sdlSoapBinding, *sdlSoapBindingPtr;
|
||||
typedef struct _sdlSoapBindingFunction sdlSoapBindingFunction, *sdlSoapBindingFunctionPtr;
|
||||
typedef struct _sdlSoapBindingFunctionBody sdlSoapBindingFunctionBody, *sdlSoapBindingFunctionBodyPtr;
|
||||
|
||||
typedef struct _soapMapping soapMapping, *soapMappingPtr;
|
||||
typedef struct _soapService soapService, *soapServicePtr;
|
||||
|
||||
#include "php_xml.h"
|
||||
#include "php_encoding.h"
|
||||
#include "php_sdl.h"
|
||||
#include "php_schema.h"
|
||||
#include "php_http.h"
|
||||
#include "php_packet_soap.h"
|
||||
|
||||
extern int le_sdl;
|
||||
extern int le_http_socket;
|
||||
extern int le_url;
|
||||
extern int le_service;
|
||||
|
||||
|
||||
struct _soapHeaderHandler
|
||||
{
|
||||
char *ns;
|
||||
int type;
|
||||
|
||||
struct _function_handler
|
||||
{
|
||||
char *functionName;
|
||||
char *type;
|
||||
} function_handler;
|
||||
|
||||
struct _class_handler
|
||||
{
|
||||
zend_class_entry *ce;
|
||||
} class_handler;
|
||||
};
|
||||
|
||||
struct _soapMapping
|
||||
{
|
||||
char *ns;
|
||||
char *ctype;
|
||||
int type;
|
||||
|
||||
struct _map_functions
|
||||
{
|
||||
zval *to_xml_before;
|
||||
zval *to_xml;
|
||||
zval *to_xml_after;
|
||||
zval *to_zval_before;
|
||||
zval *to_zval;
|
||||
zval *to_zval_after;
|
||||
} map_functions;
|
||||
|
||||
struct _map_class
|
||||
{
|
||||
int type;
|
||||
zend_class_entry *ce;
|
||||
} map_class;
|
||||
};
|
||||
|
||||
struct _soapService
|
||||
{
|
||||
sdlPtr sdl;
|
||||
|
||||
struct _soap_functions
|
||||
{
|
||||
HashTable *ft;
|
||||
int functions_all;
|
||||
} soap_functions;
|
||||
|
||||
struct _soap_class
|
||||
{
|
||||
zend_class_entry *ce;
|
||||
zval **argv;
|
||||
int argc;
|
||||
int persistance;
|
||||
} soap_class;
|
||||
|
||||
HashTable *mapping;
|
||||
int type;
|
||||
int enabled;
|
||||
char *uri;
|
||||
};
|
||||
|
||||
#define SOAP_CLASS 1
|
||||
#define SOAP_FUNCTIONS 2
|
||||
#define SOAP_FUNCTIONS_ALL 999
|
||||
|
||||
#define SOAP_MAP_FUNCTION 1
|
||||
#define SOAP_MAP_CLASS 2
|
||||
|
||||
#define SOAP_PERSISTENCE_SESSION 1
|
||||
#define SOAP_PERSISTENCE_REQUEST 2
|
||||
|
||||
ZEND_BEGIN_MODULE_GLOBALS(soap)
|
||||
HashTable *defEncNs;
|
||||
HashTable *defEncPrefix;
|
||||
HashTable *defEnc;
|
||||
HashTable *defEncIndex;
|
||||
HashTable *sdls;
|
||||
HashTable *services;
|
||||
HashTable *overrides;
|
||||
int cur_uniq_ns;
|
||||
ZEND_END_MODULE_GLOBALS(soap)
|
||||
|
||||
ZEND_EXTERN_MODULE_GLOBALS(soap);
|
||||
|
||||
#ifdef ZTS
|
||||
# define SOAP_GLOBAL(v) TSRMG(soap_globals_id, zend_soap_globals *, v)
|
||||
#else
|
||||
# define SOAP_GLOBAL(v) (soap_globals.v)
|
||||
#endif
|
||||
|
||||
#define PHP_SOAP_SERVER_CLASSNAME "soapserver"
|
||||
#define PHP_SOAP_CLASSNAME "soapobject"
|
||||
#define PHP_SOAP_VAR_CLASSNAME "soapvar"
|
||||
#define PHP_SOAP_FAULT_CLASSNAME "soapfault"
|
||||
#define PHP_SOAP_PARAM_CLASSNAME "soapparam"
|
||||
|
||||
|
||||
extern zend_module_entry soap_module_entry;
|
||||
#define soap_module_ptr & soap_module_entry
|
||||
|
||||
PHP_MINIT_FUNCTION(soap);
|
||||
PHP_MSHUTDOWN_FUNCTION(soap);
|
||||
PHP_MINFO_FUNCTION(soap);
|
||||
|
||||
//Registry Functions
|
||||
//TODO: this!
|
||||
PHP_FUNCTION(load_sdl);
|
||||
PHP_FUNCTION(unload_sdl);
|
||||
PHP_FUNCTION(unload_all_sdls);
|
||||
PHP_FUNCTION(get_available_sdls);
|
||||
PHP_FUNCTION(get_available_functions);
|
||||
PHP_FUNCTION(get_function_parameters);
|
||||
PHP_FUNCTION(soap_encode_to_xml);
|
||||
PHP_FUNCTION(soap_encode_to_zval);
|
||||
|
||||
|
||||
//Server Functions
|
||||
PHP_FUNCTION(soapserver);
|
||||
PHP_FUNCTION(setclass);
|
||||
PHP_FUNCTION(addfunction);
|
||||
PHP_FUNCTION(getfunctions);
|
||||
PHP_FUNCTION(handle);
|
||||
PHP_FUNCTION(setpersistence);
|
||||
PHP_FUNCTION(bind);
|
||||
#ifdef HAVE_PHP_DOMXML
|
||||
PHP_FUNCTION(map);
|
||||
#endif
|
||||
|
||||
//Client Functions
|
||||
PHP_FUNCTION(soapobject);
|
||||
PHP_FUNCTION(__use);
|
||||
PHP_FUNCTION(__style);
|
||||
PHP_FUNCTION(__isfault);
|
||||
PHP_FUNCTION(__getfault);
|
||||
PHP_FUNCTION(__call);
|
||||
PHP_FUNCTION(__parse);
|
||||
PHP_FUNCTION(__generate);
|
||||
PHP_FUNCTION(__trace);
|
||||
PHP_FUNCTION(__getfunctions);
|
||||
PHP_FUNCTION(__gettypes);
|
||||
PHP_FUNCTION(__getlastresponse);
|
||||
PHP_FUNCTION(__getlastrequest);
|
||||
PHP_FUNCTION(__headerclass);
|
||||
PHP_FUNCTION(__headerfunction);
|
||||
|
||||
//SoapVar Functions
|
||||
PHP_FUNCTION(soapvar);
|
||||
|
||||
//SoapFault Functions
|
||||
PHP_FUNCTION(soapfault);
|
||||
|
||||
//SoapParam Functions
|
||||
PHP_FUNCTION(soapparam);
|
||||
|
||||
|
||||
#define DECLARE_TRACE(file) \
|
||||
FILE *trace_fp; \
|
||||
char *trace_file = file;
|
||||
|
||||
#define TRACE(place) \
|
||||
trace_fp = fopen(trace_file, "a+"); \
|
||||
fwrite(place, strlen(place), 1, trace_fp); \
|
||||
fclose(trace_fp);
|
||||
|
||||
extern zend_class_entry soap_var_class_entry;
|
||||
|
||||
PS_SERIALIZER_FUNCS(soap);
|
||||
|
||||
void clear_soap_fault(zval *obj);
|
||||
void set_soap_fault(zval *obj, char *fault_code, char *fault_string, char *fault_actor, zval *fault_detail);
|
||||
void add_soap_fault(zval *obj, char *fault_code, char *fault_string, char *fault_actor, zval *fault_detail);
|
||||
|
||||
sdlParamPtr get_param(sdlFunctionPtr function, char *param_name, int index, int);
|
||||
sdlFunctionPtr get_function(sdlBindingPtr sdl, char *function_name);
|
||||
|
||||
void delete_sdl(void *handle);
|
||||
void delete_binding(void *binding);
|
||||
void delete_sdl_soap_binding_function_body(sdlSoapBindingFunctionBody body);
|
||||
void delete_function(void *function);
|
||||
void delete_paramater(void *paramater);
|
||||
void delete_service(void *service);
|
||||
void delete_http_socket(void *handle);
|
||||
void delete_url(void *handle);
|
||||
void delete_mapping(void *data);
|
||||
|
||||
void soap_call_function_handler(INTERNAL_FUNCTION_PARAMETERS, zend_property_reference *property_reference);
|
||||
zval soap_get_property_handler(zend_property_reference *property_reference);
|
||||
int soap_set_property_handler(zend_property_reference *property_reference, zval *value);
|
||||
void soap_destructor(void *jobject);
|
||||
|
||||
void deseralize_function_call(sdlPtr sdl, xmlDocPtr request, zval *function_name, int *num_params, zval **parameters[]);
|
||||
xmlDocPtr seralize_response_call(sdlFunctionPtr function, char *function_name,char *uri,zval *ret);
|
||||
xmlDocPtr seralize_function_call(zval *this_ptr, sdlFunctionPtr function, char *function_name, char *uri, zval **arguments, int arg_count);
|
||||
xmlNodePtr seralize_parameter(sdlParamPtr param,zval *param_val,int index,char *name, int style);
|
||||
xmlNodePtr seralize_zval(zval *val, sdlParamPtr param, char *paramName, int style);
|
||||
zval *desearlize_zval(sdlPtr sdl, xmlNodePtr data, sdlParamPtr param);
|
||||
|
||||
void soap_error_handler(int error_num, const char *error_filename, const uint error_lineno, const char *format, va_list args);
|
||||
int my_call_user_function(HashTable *function_table, zval **object_pp, zval *function_name, zval *retval_ptr, int param_count, zval *params[] TSRMLS_DC);
|
||||
|
||||
#define phpext_soap_ptr soap_module_ptr
|
||||
|
||||
#define HTTP_RAW_POST_DATA "HTTP_RAW_POST_DATA"
|
||||
|
||||
#define SOAP_SERVER_BEGIN_CODE() \
|
||||
zend_error_cb = soap_error_handler
|
||||
|
||||
#define SOAP_SERVER_END_CODE() \
|
||||
zend_error_cb = old_handler
|
||||
|
||||
|
||||
#define FOREACHATTRNODE(n,c,i) \
|
||||
do \
|
||||
{ \
|
||||
if(n == NULL) \
|
||||
break; \
|
||||
if(c) \
|
||||
i = get_attribute(n,c); \
|
||||
else \
|
||||
i = n; \
|
||||
if(i != NULL) \
|
||||
{ \
|
||||
n = i;
|
||||
|
||||
#define FOREACHNODE(n,c,i) \
|
||||
do \
|
||||
{ \
|
||||
if(n == NULL) \
|
||||
break; \
|
||||
if(c) \
|
||||
i = get_node(n,c); \
|
||||
else \
|
||||
i = n; \
|
||||
if(i != NULL) \
|
||||
{ \
|
||||
n = i;
|
||||
|
||||
#define ENDFOREACH(n) \
|
||||
} \
|
||||
} while(n = n->next);
|
||||
|
||||
#define ZERO_PARAM() \
|
||||
if(ZEND_NUM_ARGS() != 0) \
|
||||
WRONG_PARAM_COUNT;
|
||||
|
||||
#define ONE_PARAM(p) \
|
||||
if(ZEND_NUM_ARGS() != 1 || getParameters(ht, 1, &p) == FAILURE) \
|
||||
WRONG_PARAM_COUNT;
|
||||
|
||||
#define TWO_PARAM(p,p1) \
|
||||
if(ZEND_NUM_ARGS() != 1 || getParameters(ht, 2, &p, &p1) == FAILURE) \
|
||||
WRONG_PARAM_COUNT;
|
||||
|
||||
#define THREE_PARAM(p,p1,p2) \
|
||||
if(ZEND_NUM_ARGS() != 1 || getParameters(ht, 3, &p, &p1, &p2) == FAILURE) \
|
||||
WRONG_PARAM_COUNT;
|
||||
|
||||
#define FETCH_THIS_PORT(ss) \
|
||||
{ \
|
||||
zval *__thisObj; zval *__port; sdlBindingPtr *__tmp; \
|
||||
GET_THIS_OBJECT(__thisObj) \
|
||||
if(FIND_PORT_PROPERTY(__thisObj, __port) == FAILURE) { \
|
||||
ss = NULL; \
|
||||
php_error(E_ERROR, "Error could find current port"); \
|
||||
} \
|
||||
__tmp = (sdlBindingPtr*)Z_LVAL_P(__port); \
|
||||
ss = *__tmp; \
|
||||
}
|
||||
|
||||
#define FIND_PORT_PROPERTY(ss,tmp) zend_hash_find(ss->value.obj.properties, "port", sizeof("port"), (void **)&tmp)
|
||||
|
||||
#define FETCH_THIS_SDL(ss) \
|
||||
{ \
|
||||
zval *__thisObj,**__tmp; \
|
||||
GET_THIS_OBJECT(__thisObj) \
|
||||
if(FIND_SDL_PROPERTY(__thisObj,__tmp) != FAILURE) \
|
||||
{ \
|
||||
FETCH_SDL_RES(ss,__tmp); \
|
||||
} \
|
||||
else \
|
||||
ss = NULL; \
|
||||
}
|
||||
|
||||
#define FIND_SDL_PROPERTY(ss,tmp) zend_hash_find(ss->value.obj.properties, "sdl", sizeof("sdl"), (void **)&tmp)
|
||||
#define FETCH_SDL_RES(ss,tmp) ss = (sdlPtr) zend_fetch_resource(tmp TSRMLS_CC, -1, "sdl", NULL, 1, le_sdl)
|
||||
|
||||
#define FETCH_THIS_SERVICE(ss) \
|
||||
{ \
|
||||
zval *__thisObj,**__tmp; \
|
||||
GET_THIS_OBJECT(__thisObj) \
|
||||
if(FIND_SERVICE_PROPERTY(__thisObj,__tmp) != FAILURE) \
|
||||
{ \
|
||||
FETCH_SERVICE_RES(ss,__tmp); \
|
||||
} \
|
||||
else \
|
||||
ss = NULL; \
|
||||
}
|
||||
|
||||
#define FIND_SERVICE_PROPERTY(ss,tmp) zend_hash_find(ss->value.obj.properties, "service", sizeof("service"), (void **)&tmp)
|
||||
#define FETCH_SERVICE_RES(ss,tmp) ss = (soapServicePtr) zend_fetch_resource(tmp TSRMLS_CC, -1, "service", NULL, 1, le_service)
|
||||
|
||||
#define FETCH_THIS_URL(ss) \
|
||||
{ \
|
||||
zval *__thisObj,**__tmp; \
|
||||
GET_THIS_OBJECT(__thisObj) \
|
||||
if(FIND_URL_PROPERTY(__thisObj,__tmp) != FAILURE) \
|
||||
{ \
|
||||
FETCH_URL_RES(ss,__tmp); \
|
||||
} \
|
||||
else \
|
||||
ss = NULL; \
|
||||
}
|
||||
|
||||
#define FIND_URL_PROPERTY(ss,tmp) zend_hash_find(ss->value.obj.properties, "httpurl", sizeof("httpurl"), (void **)&tmp)
|
||||
#define FETCH_URL_RES(ss,tmp) ss = (php_url *) zend_fetch_resource(tmp TSRMLS_CC, -1, "httpurl", NULL, 1, le_url)
|
||||
|
||||
#define FETCH_THIS_SOCKET(ss) \
|
||||
{ \
|
||||
zval *__thisObj,**__tmp; \
|
||||
GET_THIS_OBJECT(__thisObj) \
|
||||
if(FIND_SOCKET_PROPERTY(__thisObj,__tmp) != FAILURE) \
|
||||
{ \
|
||||
FETCH_SOCKET_RES(ss,__tmp); \
|
||||
} \
|
||||
else \
|
||||
ss = NULL; \
|
||||
}
|
||||
|
||||
#define FIND_SOCKET_PROPERTY(ss,tmp) zend_hash_find(ss->value.obj.properties, "httpsocket", sizeof("httpsocket"), (void **)&tmp)
|
||||
#define FETCH_SOCKET_RES(ss,tmp) ss = (SOAP_STREAM)zend_fetch_resource(tmp TSRMLS_CC, -1, "httpsocket", NULL, 1, le_http_socket)
|
||||
|
||||
#define GET_THIS_OBJECT(o) \
|
||||
o = getThis(); \
|
||||
if (!o) \
|
||||
{ \
|
||||
php_error(E_WARNING, "Cannot Get Class Info"); \
|
||||
return; \
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
@@ -1,214 +0,0 @@
|
||||
#include "php_soap.h"
|
||||
|
||||
xmlNsPtr attr_find_ns(xmlAttrPtr node)
|
||||
{
|
||||
if(node->ns)
|
||||
return node->ns;
|
||||
else if(node->parent->ns)
|
||||
return node->parent->ns;
|
||||
else
|
||||
return xmlSearchNs(node->doc, node->parent, NULL);
|
||||
}
|
||||
|
||||
xmlNsPtr node_find_ns(xmlNodePtr node)
|
||||
{
|
||||
if(node->ns)
|
||||
return node->ns;
|
||||
else
|
||||
return xmlSearchNs(node->doc, node, NULL);
|
||||
}
|
||||
|
||||
int attr_is_equal_ex(xmlAttrPtr node, char *name, char *ns)
|
||||
{
|
||||
if(!strcmp(node->name, name))
|
||||
{
|
||||
if(ns)
|
||||
{
|
||||
xmlNsPtr nsPtr;
|
||||
if(node->ns)
|
||||
nsPtr = node->ns;
|
||||
else if(node->parent->ns)
|
||||
nsPtr = node->parent->ns;
|
||||
else
|
||||
nsPtr = xmlSearchNs(node->doc, node->parent, NULL);
|
||||
if(!strcmp(nsPtr->href, ns))
|
||||
return TRUE;
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
int node_is_equal_ex(xmlNodePtr node, char *name, char *ns)
|
||||
{
|
||||
if(!strcmp(node->name, name))
|
||||
{
|
||||
if(ns)
|
||||
{
|
||||
xmlNsPtr nsPtr;
|
||||
if(node->ns)
|
||||
nsPtr = node->ns;
|
||||
else
|
||||
nsPtr = xmlSearchNs(node->doc, node, NULL);
|
||||
if(!strcmp(nsPtr->href, ns))
|
||||
return TRUE;
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
xmlAttrPtr get_attribute_ex(xmlAttrPtr node, char *name, char *ns)
|
||||
{
|
||||
xmlAttrPtr trav = node;
|
||||
if(node == NULL) return NULL;
|
||||
do {
|
||||
if(attr_is_equal_ex(trav, name, ns))
|
||||
return trav;
|
||||
} while(trav = trav->next);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
xmlNodePtr get_node_ex(xmlNodePtr node, char *name, char *ns)
|
||||
{
|
||||
xmlNodePtr trav = node;
|
||||
if(node == NULL) return NULL;
|
||||
do {
|
||||
if(node_is_equal_ex(trav, name, ns))
|
||||
return trav;
|
||||
} while(trav = trav->next);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
xmlNodePtr get_node_recurisve_ex(xmlNodePtr node, char *name, char *ns)
|
||||
{
|
||||
xmlNodePtr trav = node;
|
||||
if(node == NULL) return NULL;
|
||||
do
|
||||
{
|
||||
if(node_is_equal_ex(trav, name, ns))
|
||||
return trav;
|
||||
else
|
||||
{
|
||||
if(node->children != NULL)
|
||||
{
|
||||
xmlNodePtr tmp;
|
||||
tmp = get_node_recurisve_ex(node->children, name, ns);
|
||||
if(tmp)
|
||||
return tmp;
|
||||
}
|
||||
}
|
||||
} while(trav = trav->next);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
xmlNodePtr get_node_with_attribute_ex(xmlNodePtr node, char *name, char *name_ns, char *attribute, char *value, char *attr_ns)
|
||||
{
|
||||
xmlNodePtr trav = node, cur = NULL;
|
||||
xmlAttrPtr attr;
|
||||
|
||||
if(node == NULL) return NULL;
|
||||
do
|
||||
{
|
||||
if(name != NULL)
|
||||
{
|
||||
cur = get_node_ex(trav, name, name_ns);
|
||||
if(!cur)
|
||||
return cur;
|
||||
}
|
||||
else
|
||||
cur = trav;
|
||||
|
||||
attr = get_attribute_ex(cur->properties, attribute, attr_ns);
|
||||
if(attr != NULL && strcmp(attr->children->content, value) == 0)
|
||||
return cur;
|
||||
else
|
||||
{
|
||||
if(cur->children != NULL)
|
||||
{
|
||||
xmlNodePtr tmp;
|
||||
tmp = get_node_with_attribute_ex(cur->children, name, name_ns, attribute, value, attr_ns);
|
||||
if(tmp)
|
||||
return tmp;
|
||||
}
|
||||
}
|
||||
}while(trav = trav->next);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
xmlNodePtr get_node_with_attribute_recursive_ex(xmlNodePtr node, char *name, char *name_ns, char *attribute, char *value, char *attr_ns)
|
||||
{
|
||||
xmlNodePtr trav = node, cur;
|
||||
xmlAttrPtr attr;
|
||||
|
||||
if(node == NULL) return NULL;
|
||||
do
|
||||
{
|
||||
if(name != NULL)
|
||||
{
|
||||
cur = get_node_recurisve_ex(trav, name, name_ns);
|
||||
if(!cur)
|
||||
return cur;
|
||||
}
|
||||
else
|
||||
cur = trav;
|
||||
|
||||
attr = get_attribute_ex(cur->properties, attribute, attr_ns);
|
||||
if(attr != NULL && strcmp(attr->children->content, value) == 0)
|
||||
return cur;
|
||||
else
|
||||
{
|
||||
if(cur->children != NULL)
|
||||
{
|
||||
xmlNodePtr tmp;
|
||||
tmp = get_node_with_attribute_recursive_ex(cur->children, name, name_ns, attribute, value, attr_ns);
|
||||
if(tmp)
|
||||
return tmp;
|
||||
}
|
||||
}
|
||||
}while(trav = trav->next);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
xmlNodePtr check_and_resolve_href(xmlNodePtr data)
|
||||
{
|
||||
xmlAttrPtr href;
|
||||
xmlNodePtr ret = data;
|
||||
|
||||
if(!data || !data->properties)
|
||||
return ret;
|
||||
|
||||
href = get_attribute(data->properties, "href");
|
||||
if(href)
|
||||
{
|
||||
// Internal href try and find node
|
||||
if(href->children->content[0] == '#')
|
||||
{
|
||||
ret = get_node_with_attribute_recursive(data->doc->children, NULL, "id", &href->children->content[1]);
|
||||
}
|
||||
// External href....?
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int parse_namespace(char *inval, char **value, char **namespace)
|
||||
{
|
||||
char *found = strchr(inval, ':');
|
||||
|
||||
if(found != NULL)
|
||||
{
|
||||
(*namespace) = estrndup(inval, found - inval);
|
||||
(*value) = estrdup(++found);
|
||||
}
|
||||
else
|
||||
{
|
||||
(*value) = estrdup(inval);
|
||||
(*namespace) = NULL;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
#ifndef PHP_SOAP_XML_H
|
||||
#define PHP_SOAP_XML_H
|
||||
|
||||
#define get_attribute(node, name) get_attribute_ex(node, name, NULL)
|
||||
#define get_node(node, name) get_node_ex(node, name, NULL)
|
||||
#define get_node_recursive(node, name) get_node_recursive_ex(node, name, NULL)
|
||||
#define get_node_with_attribute(node, name, attr, val) get_node_with_attribute_ex(node, name, NULL, attr, val, NULL)
|
||||
#define get_node_with_attribute_recursive(node, name, attr, val) get_node_with_attribute_recursive_ex(node, name, NULL, attr, val, NULL)
|
||||
#define attr_is_equal(node, name) attr_is_equal_ex(node, name, NULL)
|
||||
|
||||
xmlNsPtr attr_find_ns(xmlAttrPtr node);
|
||||
xmlNsPtr node_find_ns(xmlNodePtr node);
|
||||
int attr_is_equal_ex(xmlAttrPtr node, char *name, char *ns);
|
||||
int node_is_equal_ex(xmlNodePtr node, char *name, char *ns);
|
||||
xmlAttrPtr get_attribute_ex(xmlAttrPtr node,char *name, char *ns);
|
||||
xmlNodePtr get_node_ex(xmlNodePtr node,char *name, char *ns);
|
||||
xmlNodePtr get_node_recurisve_ex(xmlNodePtr node,char *name, char *ns);
|
||||
xmlNodePtr get_node_with_attribute_ex(xmlNodePtr node, char *name, char *name_ns, char *attribute, char *value, char *attr_ns);
|
||||
xmlNodePtr get_node_with_attribute_recursive_ex(xmlNodePtr node, char *name, char *name_ns, char *attribute, char *value, char *attr_ns);
|
||||
int parse_namespace(char *inval,char **value,char **namespace);
|
||||
xmlNodePtr check_and_resolve_href(xmlNodePtr data);
|
||||
|
||||
#endif
|
||||
-2268
File diff suppressed because it is too large.
Load diff
+7
-1
@@ -1991,8 +1991,14 @@ PHP_FUNCTION(fgetcsv)
|
||||
while(isspace((int) *bptr) && (*bptr!=delimiter)) bptr++;
|
||||
/* 2. Read field, leaving bptr pointing at start of next field */
|
||||
if (enclosure && *bptr == enclosure) {
|
||||
bptr++; /* move on to first character in field */
|
||||
|
||||
/* Check if there is an end to the enclosure */
|
||||
if (!strchr(bptr, enclosure)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
/* 2A. handle enclosure delimited field */
|
||||
bptr++; /* move on to first character in field */
|
||||
while (*bptr) {
|
||||
if (*bptr == enclosure) {
|
||||
/* handle the enclosure */
|
||||
|
||||
@@ -375,12 +375,20 @@ PHPAPI int php_var_unserialize(UNSERIALIZE_PARAMETER)
|
||||
zend_error(E_WARNING, "'unserialize_callback_func' (%s) hasn't defined the class it was called for", user_func->value.str.val);
|
||||
incomplete_class = 1;
|
||||
ce = PHP_IC_ENTRY;
|
||||
} else
|
||||
} else {
|
||||
#ifdef ZEND_ENGINE_2
|
||||
ce = *(zend_class_entry **)ce; /* Bad hack, TBF! */
|
||||
#endif
|
||||
efree(class_name);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else
|
||||
} else {
|
||||
#ifdef ZEND_ENGINE_2
|
||||
ce = *(zend_class_entry **)ce; /* Bad hack, TBF! */
|
||||
#endif
|
||||
efree(class_name);
|
||||
}
|
||||
|
||||
*p = YYCURSOR;
|
||||
elements = object_common1(UNSERIALIZE_PASSTHRU, ce);
|
||||
|
||||
@@ -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:
|
||||
*/
|
||||
@@ -46,9 +46,9 @@ IFS="$old_IFS"
|
||||
|
||||
PHPROOT=:pserver:cvsread@cvs.php.net:/repository
|
||||
ZENDROOT=:pserver:cvsread@cvs.php.net:/repository
|
||||
PHPMOD=php4
|
||||
ZENDMOD=ZendEngine2
|
||||
TSRMMOD=TSRM
|
||||
PHPMOD=php4-ze2
|
||||
#ZENDMOD=ZendEngine2
|
||||
#TSRMMOD=TSRM
|
||||
LT_TARGETS='ltconfig ltmain.sh config.guess config.sub'
|
||||
|
||||
if echo '\c' | grep -s c >/dev/null 2>&1
|
||||
@@ -96,10 +96,10 @@ echo ""
|
||||
cd $DIR || exit 5
|
||||
|
||||
# Export Zend
|
||||
$ECHO_N "makedist: exporting tag '$CVSTAG' from '$ZENDMOD'...$ECHO_C"
|
||||
cvs -z 9 -d $ZENDROOT -Q export -r $CVSTAG $ZENDMOD || exit 4
|
||||
mv ZendEngine2 Zend
|
||||
echo ""
|
||||
#$ECHO_N "makedist: exporting tag '$CVSTAG' from '$ZENDMOD'...$ECHO_C"
|
||||
#cvs -z 9 -d $ZENDROOT -Q export -r $CVSTAG $ZENDMOD || exit 4
|
||||
#mv ZendEngine2 Zend
|
||||
#echo ""
|
||||
|
||||
# Export TSRM
|
||||
#$ECHO_N "makedist: exporting tag '$CVSTAG' from '$TSRMMOD'...$ECHO_C"
|
||||
|
||||
-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
|
||||
Reference in new issue
Block a user