From 6bbb18a0b6bef11222caaa55c00abdbcbb55d54b Mon Sep 17 00:00:00 2001 From: "Christoph M. Becker" Date: Wed, 20 Mar 2019 14:15:50 +0100 Subject: [PATCH] Unbundle ext/wddx The extension is now available from . Cf. . --- EXTENSIONS | 5 - NEWS | 2 +- UPGRADING | 2 +- ext/wddx/CREDITS | 2 - ext/wddx/config.m4 | 68 -- ext/wddx/config.w32 | 23 - ext/wddx/php_wddx.h | 45 - ext/wddx/php_wddx_api.h | 65 -- ext/wddx/tests/001-64bit.phpt | 63 -- ext/wddx/tests/001.phpt | 63 -- ext/wddx/tests/002.phpt | 26 - ext/wddx/tests/003.phpt | 27 - ext/wddx/tests/004.phpt | 63 -- ext/wddx/tests/005.phpt | 74 -- ext/wddx/tests/bug27287.phpt | 23 - ext/wddx/tests/bug34306.phpt | 15 - ext/wddx/tests/bug35410.phpt | 77 -- ext/wddx/tests/bug35410_64bit.phpt | 77 -- ext/wddx/tests/bug37569.phpt | 786 ---------------- ext/wddx/tests/bug37587.phpt | 35 - ext/wddx/tests/bug41283.phpt | 30 - ext/wddx/tests/bug41527.phpt | 25 - ext/wddx/tests/bug45901.phpt | 21 - ext/wddx/tests/bug48562.phpt | 38 - ext/wddx/tests/bug52468.phpt | 29 - ext/wddx/tests/bug68996.phpt | 15 - ext/wddx/tests/bug70661.phpt | 70 -- ext/wddx/tests/bug70741.phpt | 26 - ext/wddx/tests/bug71335.phpt | 34 - ext/wddx/tests/bug71587.phpt | 44 - ext/wddx/tests/bug72142.phpt | 18 - ext/wddx/tests/bug72340.phpt | 25 - ext/wddx/tests/bug72564.phpt | 31 - ext/wddx/tests/bug72749.phpt | 35 - ext/wddx/tests/bug72750.phpt | 35 - ext/wddx/tests/bug72790.phpt | 36 - ext/wddx/tests/bug72799.phpt | 29 - ext/wddx/tests/bug72860.phpt | 28 - ext/wddx/tests/bug73065.phpt | 107 --- ext/wddx/tests/bug73173.phpt | 26 - ext/wddx/tests/bug73331.phpt | 15 - ext/wddx/tests/bug73631.phpt | 21 - ext/wddx/tests/bug73793.phpt | 19 - ext/wddx/tests/bug73831.phpt | 25 - ext/wddx/tests/bug74145.phpt | 17 - ext/wddx/tests/bug74145.xml | 9 - ext/wddx/tests/bug75055.phpt | 22 - ext/wddx/tests/bug75055.wddx | 13 - ext/wddx/tests/wddx.xml | 60 -- ext/wddx/wddx.c | 1330 ---------------------------- main/internal_functions_win32.c | 6 - 51 files changed, 2 insertions(+), 3778 deletions(-) delete mode 100644 ext/wddx/CREDITS delete mode 100644 ext/wddx/config.m4 delete mode 100644 ext/wddx/config.w32 delete mode 100644 ext/wddx/php_wddx.h delete mode 100644 ext/wddx/php_wddx_api.h delete mode 100644 ext/wddx/tests/001-64bit.phpt delete mode 100644 ext/wddx/tests/001.phpt delete mode 100644 ext/wddx/tests/002.phpt delete mode 100644 ext/wddx/tests/003.phpt delete mode 100644 ext/wddx/tests/004.phpt delete mode 100644 ext/wddx/tests/005.phpt delete mode 100644 ext/wddx/tests/bug27287.phpt delete mode 100644 ext/wddx/tests/bug34306.phpt delete mode 100644 ext/wddx/tests/bug35410.phpt delete mode 100644 ext/wddx/tests/bug35410_64bit.phpt delete mode 100644 ext/wddx/tests/bug37569.phpt delete mode 100644 ext/wddx/tests/bug37587.phpt delete mode 100644 ext/wddx/tests/bug41283.phpt delete mode 100644 ext/wddx/tests/bug41527.phpt delete mode 100644 ext/wddx/tests/bug45901.phpt delete mode 100644 ext/wddx/tests/bug48562.phpt delete mode 100644 ext/wddx/tests/bug52468.phpt delete mode 100644 ext/wddx/tests/bug68996.phpt delete mode 100644 ext/wddx/tests/bug70661.phpt delete mode 100644 ext/wddx/tests/bug70741.phpt delete mode 100644 ext/wddx/tests/bug71335.phpt delete mode 100644 ext/wddx/tests/bug71587.phpt delete mode 100644 ext/wddx/tests/bug72142.phpt delete mode 100644 ext/wddx/tests/bug72340.phpt delete mode 100644 ext/wddx/tests/bug72564.phpt delete mode 100644 ext/wddx/tests/bug72749.phpt delete mode 100644 ext/wddx/tests/bug72750.phpt delete mode 100644 ext/wddx/tests/bug72790.phpt delete mode 100644 ext/wddx/tests/bug72799.phpt delete mode 100644 ext/wddx/tests/bug72860.phpt delete mode 100644 ext/wddx/tests/bug73065.phpt delete mode 100644 ext/wddx/tests/bug73173.phpt delete mode 100644 ext/wddx/tests/bug73331.phpt delete mode 100644 ext/wddx/tests/bug73631.phpt delete mode 100644 ext/wddx/tests/bug73793.phpt delete mode 100644 ext/wddx/tests/bug73831.phpt delete mode 100644 ext/wddx/tests/bug74145.phpt delete mode 100644 ext/wddx/tests/bug74145.xml delete mode 100644 ext/wddx/tests/bug75055.phpt delete mode 100644 ext/wddx/tests/bug75055.wddx delete mode 100644 ext/wddx/tests/wddx.xml delete mode 100644 ext/wddx/wddx.c diff --git a/EXTENSIONS b/EXTENSIONS index 387fde18f008c..ce75f64f6bbba 100644 --- a/EXTENSIONS +++ b/EXTENSIONS @@ -201,11 +201,6 @@ PRIMARY MAINTAINER: Dmitry Stogov (2004 - 2018) MAINTENANCE: Maintained STATUS: Working ------------------------------------------------------------------------------- -EXTENSION: wddx -PRIMARY MAINTAINER: Andrei Zmievski (1999 - 2003) -MAINTENANCE: Orphaned -STATUS: Working -------------------------------------------------------------------------------- EXTENSION: xml PRIMARY MAINTAINER: Thies C. Arntzen (1999 - 2002) Rob Richards (2003 - 2013) diff --git a/NEWS b/NEWS index 00a77993e4d9a..d88c458808277 100644 --- a/NEWS +++ b/NEWS @@ -113,6 +113,6 @@ PHP NEWS tidy_get_root, and tidy_getopt) (tandre) - WDDX: - . Deprecated the WDDX extension. (cmb) + . Deprecated and unbundled the WDDX extension. (cmb) <<< NOTE: Insert NEWS from last stable release here prior to actual release! >>> diff --git a/UPGRADING b/UPGRADING index 6934c767a147d..cc9507c50fb78 100644 --- a/UPGRADING +++ b/UPGRADING @@ -287,7 +287,7 @@ PHP 7.4 UPGRADE NOTES . The @param notation can now also be used to denote SQL query parameters. - WDDX: - . The WDDX extension has been deprecated. + . The WDDX extension has been deprecated and moved to PECL. - Zip: . The bundled libzip library has been removed. A system libzip >= 0.11 is now diff --git a/ext/wddx/CREDITS b/ext/wddx/CREDITS deleted file mode 100644 index 4c98513048e0f..0000000000000 --- a/ext/wddx/CREDITS +++ /dev/null @@ -1,2 +0,0 @@ -WDDX -Andrei Zmievski diff --git a/ext/wddx/config.m4 b/ext/wddx/config.m4 deleted file mode 100644 index 548009ec140f6..0000000000000 --- a/ext/wddx/config.m4 +++ /dev/null @@ -1,68 +0,0 @@ -dnl config.m4 for extension wddx - -PHP_ARG_ENABLE([wddx], - [whether to enable WDDX support], - [AS_HELP_STRING([--enable-wddx], - [Enable WDDX support])]) - -if test -z "$PHP_LIBXML_DIR"; then - PHP_ARG_WITH([libxml-dir], - [libxml2 install dir], - [AS_HELP_STRING([--with-libxml-dir=DIR], - [WDDX: libxml2 install prefix])], - [no], - [no]) -fi - -PHP_ARG_WITH([libexpat-dir], - [libexpat dir for WDDX], - [AS_HELP_STRING([--with-libexpat-dir=DIR], - [WDDX: libexpat dir for XMLRPC-EPI (deprecated)])], - [no], - [no]) - -if test "$PHP_WDDX" != "no"; then - - dnl - dnl Default to libxml2 if --with-libexpat-dir is not used - dnl - if test "$PHP_LIBEXPAT_DIR" = "no"; then - if test "$PHP_LIBXML" = "no"; then - AC_MSG_ERROR([WDDX extension requires LIBXML extension, add --enable-libxml]) - fi - - PHP_SETUP_LIBXML(WDDX_SHARED_LIBADD, [ - if test "$PHP_XML" = "no"; then - PHP_ADD_SOURCES(ext/xml, compat.c) - PHP_ADD_BUILD_DIR(ext/xml) - fi - ], [ - AC_MSG_ERROR([libxml2 not found. Use --with-libxml-dir=]) - ]) - fi - - dnl - dnl Check for expat only if --with-libexpat-dir is used. - dnl - if test "$PHP_LIBEXPAT_DIR" != "no"; then - for i in $PHP_XML $PHP_LIBEXPAT_DIR /usr /usr/local; do - if test -f "$i/$PHP_LIBDIR/libexpat.a" || test -f "$i/$PHP_LIBDIR/libexpat.$SHLIB_SUFFIX_NAME"; then - EXPAT_DIR=$i - break - fi - done - - if test -z "$EXPAT_DIR"; then - AC_MSG_ERROR([not found. Please reinstall the expat distribution.]) - fi - - PHP_ADD_INCLUDE($EXPAT_DIR/include) - PHP_ADD_LIBRARY_WITH_PATH(expat, $EXPAT_DIR/$PHP_LIBDIR, WDDX_SHARED_LIBADD) - AC_DEFINE(HAVE_LIBEXPAT, 1, [ ]) - fi - - AC_DEFINE(HAVE_WDDX, 1, [ ]) - PHP_NEW_EXTENSION(wddx, wddx.c, $ext_shared) - PHP_ADD_EXTENSION_DEP(wddx, libxml) - PHP_SUBST(XMLRPC_SHARED_LIBADD) -fi diff --git a/ext/wddx/config.w32 b/ext/wddx/config.w32 deleted file mode 100644 index d5d4e80e5eed5..0000000000000 --- a/ext/wddx/config.w32 +++ /dev/null @@ -1,23 +0,0 @@ -// vim:ft=javascript - -ARG_WITH("wddx", "WDDX support", "yes"); - -if (PHP_WDDX == "yes" && - PHP_LIBXML == "yes" && - CHECK_HEADER_ADD_INCLUDE("libxml/parser.h", "CFLAGS_WDDX", PHP_PHP_BUILD + "\\include\\libxml2") -) { - EXTENSION("wddx", "wddx.c"); - AC_DEFINE("HAVE_WDDX", 1, "WDDX support"); - - if (!PHP_WDDX_SHARED) { - ADD_FLAG("CFLAGS_WDDX", "/D LIBXML_STATIC"); - } else { - if (!CHECK_LIB("libxml2.lib", "wddx")) { - WARNING("wddx support can't be enabled, libxml is not found") - } - } - - ADD_EXTENSION_DEP('wddx', 'libxml'); - ADD_EXTENSION_DEP('wddx', 'xml') - CHECK_HEADER_ADD_INCLUDE("timelib_config.h", "CFLAGS_WDDX", "ext/date/lib"); -} diff --git a/ext/wddx/php_wddx.h b/ext/wddx/php_wddx.h deleted file mode 100644 index 457c50af2db05..0000000000000 --- a/ext/wddx/php_wddx.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | PHP Version 7 | - +----------------------------------------------------------------------+ - | Copyright (c) The PHP Group | - +----------------------------------------------------------------------+ - | This source file is subject to version 3.01 of the PHP license, | - | that is bundled with this package in the file LICENSE, and is | - | available through the world-wide-web at the following url: | - | http://www.php.net/license/3_01.txt | - | If you did not receive a copy of the PHP license and are unable to | - | obtain it through the world-wide-web, please send a note to | - | license@php.net so we can mail you a copy immediately. | - +----------------------------------------------------------------------+ - | Author: Andrei Zmievski | - +----------------------------------------------------------------------+ - */ - -#ifndef PHP_WDDX_H -#define PHP_WDDX_H - -#if HAVE_WDDX - -extern zend_module_entry wddx_module_entry; -#define wddx_module_ptr &wddx_module_entry - -#include "php_version.h" -#define PHP_WDDX_VERSION PHP_VERSION - -PHP_FUNCTION(wddx_serialize_value); -PHP_FUNCTION(wddx_serialize_vars); -PHP_FUNCTION(wddx_packet_start); -PHP_FUNCTION(wddx_packet_end); -PHP_FUNCTION(wddx_add_vars); -PHP_FUNCTION(wddx_deserialize); - -#else - -#define wddx_module_ptr NULL - -#endif /* HAVE_WDDX */ - -#define phpext_wddx_ptr wddx_module_ptr - -#endif /* !PHP_WDDX_H */ diff --git a/ext/wddx/php_wddx_api.h b/ext/wddx/php_wddx_api.h deleted file mode 100644 index d980d7f64526d..0000000000000 --- a/ext/wddx/php_wddx_api.h +++ /dev/null @@ -1,65 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | PHP Version 7 | - +----------------------------------------------------------------------+ - | Copyright (c) The PHP Group | - +----------------------------------------------------------------------+ - | This source file is subject to version 3.01 of the PHP license, | - | that is bundled with this package in the file LICENSE, and is | - | available through the world-wide-web at the following url: | - | http://www.php.net/license/3_01.txt | - | If you did not receive a copy of the PHP license and are unable to | - | obtain it through the world-wide-web, please send a note to | - | license@php.net so we can mail you a copy immediately. | - +----------------------------------------------------------------------+ - | Author: Andrei Zmievski | - +----------------------------------------------------------------------+ - */ - -#ifndef PHP_WDDX_API_H -#define PHP_WDDX_API_H - -#include "zend_smart_str_public.h" - -#define WDDX_ARRAY_S "" -#define WDDX_ARRAY_E "" -#define WDDX_BINARY_S "" -#define WDDX_BINARY_E "" -#define WDDX_BOOLEAN_TRUE "" -#define WDDX_BOOLEAN_FALSE "" -#define WDDX_CHAR "" -#define WDDX_COMMENT_S "" -#define WDDX_COMMENT_E "" -#define WDDX_DATA_S "" -#define WDDX_DATA_E "" -#define WDDX_HEADER "
" -#define WDDX_HEADER_S "
" -#define WDDX_HEADER_E "
" -#define WDDX_NULL "" -#define WDDX_NUMBER "%s" -#define WDDX_PACKET_S "" -#define WDDX_PACKET_E "" -#define WDDX_STRING_S "" -#define WDDX_STRING_E "" -#define WDDX_STRUCT_S "" -#define WDDX_STRUCT_E "" -#define WDDX_VAR_S "" -#define WDDX_VAR_E "" - -#define php_wddx_add_chunk(packet, str) smart_str_appends(packet, str) -#define php_wddx_add_chunk_ex(packet, str, len) smart_str_appendl(packet, str, len) -#define php_wddx_add_chunk_static(packet, str) smart_str_appendl(packet, str, sizeof(str)-1) - -typedef smart_str wddx_packet; - -wddx_packet* php_wddx_constructor(void); -void php_wddx_destructor(wddx_packet *packet); - -void php_wddx_packet_start(wddx_packet *packet, char *comment, size_t comment_len); -void php_wddx_packet_end(wddx_packet *packet); - -void php_wddx_serialize_var(wddx_packet *packet, zval *var, zend_string *name); -int php_wddx_deserialize_ex(const char *, size_t, zval *return_value); -#define php_wddx_gather(packet) estrndup(packet->c, packet->len) - -#endif /* PHP_WDDX_API_H */ diff --git a/ext/wddx/tests/001-64bit.phpt b/ext/wddx/tests/001-64bit.phpt deleted file mode 100644 index c0cd49c835a02..0000000000000 --- a/ext/wddx/tests/001-64bit.phpt +++ /dev/null @@ -1,63 +0,0 @@ ---TEST-- -wddx deserialization test (64-bit) ---SKIPIF-- - - ---INI-- -precision=14 ---FILE-- - ---EXPECTF-- -Deprecated: Function wddx_deserialize() is deprecated in %s on line %d -array(11) { - ["aNull"]=> - NULL - ["aString"]=> - string(8) "a string" - ["aNumber"]=> - float(-12.456) - ["aDateTime"]=> - int(897625932) - ["aDateTime2"]=> - int(329632332) - ["aDateTime3"]=> - int(2223088332) - ["aBoolean"]=> - bool(true) - ["anArray"]=> - array(2) { - [0]=> - int(10) - [1]=> - string(14) "second element" - } - ["aBinary"]=> - string(11) "binary data" - ["anObject"]=> - array(2) { - ["s"]=> - string(8) "a string" - ["n"]=> - float(-12.456) - } - ["aRecordset"]=> - array(2) { - ["NAME"]=> - array(2) { - [0]=> - string(8) "John Doe" - [1]=> - string(8) "Jane Doe" - } - ["AGE"]=> - array(2) { - [0]=> - int(34) - [1]=> - int(31) - } - } -} diff --git a/ext/wddx/tests/001.phpt b/ext/wddx/tests/001.phpt deleted file mode 100644 index a38d7d12cbeb6..0000000000000 --- a/ext/wddx/tests/001.phpt +++ /dev/null @@ -1,63 +0,0 @@ ---TEST-- -wddx deserialization test (32-bit) ---SKIPIF-- - - ---INI-- -precision=14 ---FILE-- - ---EXPECTF-- -Deprecated: Function wddx_deserialize() is deprecated in %s on line %d -array(11) { - ["aNull"]=> - NULL - ["aString"]=> - string(8) "a string" - ["aNumber"]=> - float(-12.456) - ["aDateTime"]=> - int(897625932) - ["aDateTime2"]=> - int(329632332) - ["aDateTime3"]=> - string(22) "2040-06-12T04:32:12+00" - ["aBoolean"]=> - bool(true) - ["anArray"]=> - array(2) { - [0]=> - int(10) - [1]=> - string(14) "second element" - } - ["aBinary"]=> - string(11) "binary data" - ["anObject"]=> - array(2) { - ["s"]=> - string(8) "a string" - ["n"]=> - float(-12.456) - } - ["aRecordset"]=> - array(2) { - ["NAME"]=> - array(2) { - [0]=> - string(8) "John Doe" - [1]=> - string(8) "Jane Doe" - } - ["AGE"]=> - array(2) { - [0]=> - int(34) - [1]=> - int(31) - } - } -} diff --git a/ext/wddx/tests/002.phpt b/ext/wddx/tests/002.phpt deleted file mode 100644 index 1783cbea7b464..0000000000000 --- a/ext/wddx/tests/002.phpt +++ /dev/null @@ -1,26 +0,0 @@ ---TEST-- -wddx packet construction using wddx ressource ---SKIPIF-- - ---INI-- -precision=14 ---FILE-- - ---EXPECTF-- -Deprecated: Function wddx_packet_start() is deprecated in %s on line %d - -Deprecated: Function wddx_add_vars() is deprecated in %s on line %d - -Deprecated: Function wddx_packet_end() is deprecated in %s on line %d -
TEST comment
some string756
diff --git a/ext/wddx/tests/003.phpt b/ext/wddx/tests/003.phpt deleted file mode 100644 index b9155b1ae19b1..0000000000000 --- a/ext/wddx/tests/003.phpt +++ /dev/null @@ -1,27 +0,0 @@ ---TEST-- -wddx deserialize from ressource ---SKIPIF-- - ---INI-- -precision=14 ---FILE-- -
TEST comment
some string756"); - rewind($fp); - var_dump(wddx_deserialize($fp)); - fclose($fp); -?> ---EXPECTF-- -Deprecated: Function wddx_deserialize() is deprecated in %s on line %d -array(4) { - ["var1"]=> - NULL - ["var2"]=> - string(11) "some string" - ["var3"]=> - int(756) - ["var4"]=> - bool(true) -} diff --git a/ext/wddx/tests/004.phpt b/ext/wddx/tests/004.phpt deleted file mode 100644 index ae5a6b4bd5974..0000000000000 --- a/ext/wddx/tests/004.phpt +++ /dev/null @@ -1,63 +0,0 @@ ---TEST-- -wddx session serializer handler (serialize) ---SKIPIF-- - ---INI-- -precision=14 -session.serialize_handler=wddx -session.use_cookies=0 -session.cache_limiter= -session.save_handler=files ---FILE-- -yes = "done"; } - - public function __sleep() { return array('bar', 'yes'); } - } - - session_start(); - - $_SESSION['data'] = array( - 'test1' => true, - 'test2' => 'some string', - 'test3' => 654321, - 'test4' => array( - 'some string', - true, - null - ), - ); - - $_SESSION['class'] = new foo(); - $_SESSION['class']->method(); - - var_dump(session_encode()); - - session_destroy(); -?> ---EXPECT-- -string(550) "
some string654321some stringfoookdone" diff --git a/ext/wddx/tests/005.phpt b/ext/wddx/tests/005.phpt deleted file mode 100644 index 99e7a9e31f954..0000000000000 --- a/ext/wddx/tests/005.phpt +++ /dev/null @@ -1,74 +0,0 @@ ---TEST-- -wddx session serializer handler (deserialize) ---SKIPIF-- - ---INI-- -precision=14 -session.serialize_handler=wddx -session.use_cookies=0 -session.cache_limiter= -session.save_handler=files ---FILE-- -yes = "done"; } - } - - session_start(); - - session_decode("
some string654321some stringfoookdone"); - - var_dump($_SESSION); - - session_destroy(); -?> ---EXPECT-- -array(2) { - ["data"]=> - array(4) { - ["test1"]=> - bool(true) - ["test2"]=> - string(11) "some string" - ["test3"]=> - int(654321) - ["test4"]=> - array(3) { - [0]=> - string(11) "some string" - [1]=> - bool(true) - [2]=> - NULL - } - } - ["class"]=> - object(foo)#1 (2) { - ["bar"]=> - string(2) "ok" - ["yes"]=> - string(4) "done" - } -} diff --git a/ext/wddx/tests/bug27287.phpt b/ext/wddx/tests/bug27287.phpt deleted file mode 100644 index 823aa10f3d028..0000000000000 --- a/ext/wddx/tests/bug27287.phpt +++ /dev/null @@ -1,23 +0,0 @@ ---TEST-- -Bug #27287 (segfault with deserializing object data) ---SKIPIF-- - ---FILE-- -abc = 'def'; - - $string = wddx_serialize_value($foo); - $bar = wddx_deserialize($string); - - echo "OK\n"; - -?> ---EXPECTF-- -Deprecated: Function wddx_serialize_value() is deprecated in %s on line %d - -Deprecated: Function wddx_deserialize() is deprecated in %s on line %d -OK diff --git a/ext/wddx/tests/bug34306.phpt b/ext/wddx/tests/bug34306.phpt deleted file mode 100644 index a7247d5c07c29..0000000000000 --- a/ext/wddx/tests/bug34306.phpt +++ /dev/null @@ -1,15 +0,0 @@ ---TEST-- -#34306 (wddx_serialize_value() crashes with long array keys) ---SKIPIF-- - ---FILE-- - 1); -$buf = wddx_serialize_value($var, 'name'); -echo "OK\n"; - -?> ---EXPECTF-- -Deprecated: Function wddx_serialize_value() is deprecated in %s on line %d -OK diff --git a/ext/wddx/tests/bug35410.phpt b/ext/wddx/tests/bug35410.phpt deleted file mode 100644 index 2100c8a38e4d8..0000000000000 --- a/ext/wddx/tests/bug35410.phpt +++ /dev/null @@ -1,77 +0,0 @@ ---TEST-- -#35410 (wddx_deserialize() doesn't handle large ints as keys properly) ---SKIPIF-- - ---FILE-- - -
-Content Configuration File -
- - - - - - - - - -10 - - -4 - - - - - - -desc - - - - - - - - - - - - - - -WDX; - -var_dump(wddx_deserialize($wddx)); -?> ---EXPECTF-- -Deprecated: Function wddx_deserialize() is deprecated in %s on line %d -array(1) { - ["content_queries"]=> - array(1) { - ["content_113300831086270200"]=> - array(1) { - ["113301888545229100"]=> - array(3) { - ["max"]=> - int(10) - ["cache"]=> - int(4) - ["order"]=> - array(1) { - ["content_113300831086270200"]=> - array(1) { - ["CMS_BUILD"]=> - string(4) "desc" - } - } - } - } - } -} diff --git a/ext/wddx/tests/bug35410_64bit.phpt b/ext/wddx/tests/bug35410_64bit.phpt deleted file mode 100644 index ffe4e0818883e..0000000000000 --- a/ext/wddx/tests/bug35410_64bit.phpt +++ /dev/null @@ -1,77 +0,0 @@ ---TEST-- -#35410 (wddx_deserialize() doesn't handle large ints as keys properly) ---SKIPIF-- - ---FILE-- - -
-Content Configuration File -
- - - - - - - - - -10 - - -4 - - - - - - -desc - - - - - - - - - - - - - - -WDX; - -var_dump(wddx_deserialize($wddx)); -?> ---EXPECTF-- -Deprecated: Function wddx_deserialize() is deprecated in %s on line %d -array(1) { - ["content_queries"]=> - array(1) { - ["content_113300831086270200"]=> - array(1) { - [113301888545229100]=> - array(3) { - ["max"]=> - int(10) - ["cache"]=> - int(4) - ["order"]=> - array(1) { - ["content_113300831086270200"]=> - array(1) { - ["CMS_BUILD"]=> - string(4) "desc" - } - } - } - } - } -} diff --git a/ext/wddx/tests/bug37569.phpt b/ext/wddx/tests/bug37569.phpt deleted file mode 100644 index 7099f9669a13e..0000000000000 --- a/ext/wddx/tests/bug37569.phpt +++ /dev/null @@ -1,786 +0,0 @@ ---TEST-- -Bug #37569 (WDDX incorrectly encodes high-ascii characters) ---SKIPIF-- - ---INI-- -error_reporting=E_ALL & ~E_DEPRECATED ---FILE-- -= 0xc0) { - $v = chr(0xc3) . chr($i - 64); - } elseif ($i >= 0x80) { - $v = chr(0xc2) . chr($i); - } else { - $v = chr($i); // make it UTF-8 - } - $ret = wddx_serialize_value($v); - echo $ret . "\n"; - var_dump(bin2hex($v), bin2hex(wddx_deserialize($ret)), $v == wddx_deserialize($ret)); -} -?> ---EXPECT-- -
A -string(2) "41" -string(2) "41" -bool(true) -
B -string(2) "42" -string(2) "42" -bool(true) -
C -string(2) "43" -string(2) "43" -bool(true) -
D -string(2) "44" -string(2) "44" -bool(true) -
E -string(2) "45" -string(2) "45" -bool(true) -
F -string(2) "46" -string(2) "46" -bool(true) -
G -string(2) "47" -string(2) "47" -bool(true) -
H -string(2) "48" -string(2) "48" -bool(true) -
I -string(2) "49" -string(2) "49" -bool(true) -
J -string(2) "4a" -string(2) "4a" -bool(true) -
K -string(2) "4b" -string(2) "4b" -bool(true) -
L -string(2) "4c" -string(2) "4c" -bool(true) -
M -string(2) "4d" -string(2) "4d" -bool(true) -
N -string(2) "4e" -string(2) "4e" -bool(true) -
O -string(2) "4f" -string(2) "4f" -bool(true) -
P -string(2) "50" -string(2) "50" -bool(true) -
Q -string(2) "51" -string(2) "51" -bool(true) -
R -string(2) "52" -string(2) "52" -bool(true) -
S -string(2) "53" -string(2) "53" -bool(true) -
T -string(2) "54" -string(2) "54" -bool(true) -
U -string(2) "55" -string(2) "55" -bool(true) -
V -string(2) "56" -string(2) "56" -bool(true) -
W -string(2) "57" -string(2) "57" -bool(true) -
X -string(2) "58" -string(2) "58" -bool(true) -
Y -string(2) "59" -string(2) "59" -bool(true) -
Z -string(2) "5a" -string(2) "5a" -bool(true) -
[ -string(2) "5b" -string(2) "5b" -bool(true) -
\ -string(2) "5c" -string(2) "5c" -bool(true) -
] -string(2) "5d" -string(2) "5d" -bool(true) -
^ -string(2) "5e" -string(2) "5e" -bool(true) -
_ -string(2) "5f" -string(2) "5f" -bool(true) -
` -string(2) "60" -string(2) "60" -bool(true) -
a -string(2) "61" -string(2) "61" -bool(true) -
b -string(2) "62" -string(2) "62" -bool(true) -
c -string(2) "63" -string(2) "63" -bool(true) -
d -string(2) "64" -string(2) "64" -bool(true) -
e -string(2) "65" -string(2) "65" -bool(true) -
f -string(2) "66" -string(2) "66" -bool(true) -
g -string(2) "67" -string(2) "67" -bool(true) -
h -string(2) "68" -string(2) "68" -bool(true) -
i -string(2) "69" -string(2) "69" -bool(true) -
j -string(2) "6a" -string(2) "6a" -bool(true) -
k -string(2) "6b" -string(2) "6b" -bool(true) -
l -string(2) "6c" -string(2) "6c" -bool(true) -
m -string(2) "6d" -string(2) "6d" -bool(true) -
n -string(2) "6e" -string(2) "6e" -bool(true) -
o -string(2) "6f" -string(2) "6f" -bool(true) -
p -string(2) "70" -string(2) "70" -bool(true) -
q -string(2) "71" -string(2) "71" -bool(true) -
r -string(2) "72" -string(2) "72" -bool(true) -
s -string(2) "73" -string(2) "73" -bool(true) -
t -string(2) "74" -string(2) "74" -bool(true) -
u -string(2) "75" -string(2) "75" -bool(true) -
v -string(2) "76" -string(2) "76" -bool(true) -
w -string(2) "77" -string(2) "77" -bool(true) -
x -string(2) "78" -string(2) "78" -bool(true) -
y -string(2) "79" -string(2) "79" -bool(true) -
z -string(2) "7a" -string(2) "7a" -bool(true) -
{ -string(2) "7b" -string(2) "7b" -bool(true) -
| -string(2) "7c" -string(2) "7c" -bool(true) -
} -string(2) "7d" -string(2) "7d" -bool(true) -
~ -string(2) "7e" -string(2) "7e" -bool(true) -
 -string(2) "7f" -string(2) "7f" -bool(true) -
€ -string(4) "c280" -string(4) "c280" -bool(true) -
 -string(4) "c281" -string(4) "c281" -bool(true) -
‚ -string(4) "c282" -string(4) "c282" -bool(true) -
ƒ -string(4) "c283" -string(4) "c283" -bool(true) -
„ -string(4) "c284" -string(4) "c284" -bool(true) -
… -string(4) "c285" -string(4) "c285" -bool(true) -
† -string(4) "c286" -string(4) "c286" -bool(true) -
‡ -string(4) "c287" -string(4) "c287" -bool(true) -
ˆ -string(4) "c288" -string(4) "c288" -bool(true) -
‰ -string(4) "c289" -string(4) "c289" -bool(true) -
Š -string(4) "c28a" -string(4) "c28a" -bool(true) -
‹ -string(4) "c28b" -string(4) "c28b" -bool(true) -
Π-string(4) "c28c" -string(4) "c28c" -bool(true) -
 -string(4) "c28d" -string(4) "c28d" -bool(true) -
Ž -string(4) "c28e" -string(4) "c28e" -bool(true) -
 -string(4) "c28f" -string(4) "c28f" -bool(true) -
 -string(4) "c290" -string(4) "c290" -bool(true) -
‘ -string(4) "c291" -string(4) "c291" -bool(true) -
’ -string(4) "c292" -string(4) "c292" -bool(true) -
“ -string(4) "c293" -string(4) "c293" -bool(true) -
” -string(4) "c294" -string(4) "c294" -bool(true) -
• -string(4) "c295" -string(4) "c295" -bool(true) -
– -string(4) "c296" -string(4) "c296" -bool(true) -
— -string(4) "c297" -string(4) "c297" -bool(true) -
˜ -string(4) "c298" -string(4) "c298" -bool(true) -
™ -string(4) "c299" -string(4) "c299" -bool(true) -
š -string(4) "c29a" -string(4) "c29a" -bool(true) -
› -string(4) "c29b" -string(4) "c29b" -bool(true) -
œ -string(4) "c29c" -string(4) "c29c" -bool(true) -
 -string(4) "c29d" -string(4) "c29d" -bool(true) -
ž -string(4) "c29e" -string(4) "c29e" -bool(true) -
Ÿ -string(4) "c29f" -string(4) "c29f" -bool(true) -
  -string(4) "c2a0" -string(4) "c2a0" -bool(true) -
¡ -string(4) "c2a1" -string(4) "c2a1" -bool(true) -
¢ -string(4) "c2a2" -string(4) "c2a2" -bool(true) -
£ -string(4) "c2a3" -string(4) "c2a3" -bool(true) -
¤ -string(4) "c2a4" -string(4) "c2a4" -bool(true) -
¥ -string(4) "c2a5" -string(4) "c2a5" -bool(true) -
¦ -string(4) "c2a6" -string(4) "c2a6" -bool(true) -
§ -string(4) "c2a7" -string(4) "c2a7" -bool(true) -
¨ -string(4) "c2a8" -string(4) "c2a8" -bool(true) -
© -string(4) "c2a9" -string(4) "c2a9" -bool(true) -
ª -string(4) "c2aa" -string(4) "c2aa" -bool(true) -
« -string(4) "c2ab" -string(4) "c2ab" -bool(true) -
¬ -string(4) "c2ac" -string(4) "c2ac" -bool(true) -
­ -string(4) "c2ad" -string(4) "c2ad" -bool(true) -
® -string(4) "c2ae" -string(4) "c2ae" -bool(true) -
¯ -string(4) "c2af" -string(4) "c2af" -bool(true) -
° -string(4) "c2b0" -string(4) "c2b0" -bool(true) -
± -string(4) "c2b1" -string(4) "c2b1" -bool(true) -
² -string(4) "c2b2" -string(4) "c2b2" -bool(true) -
³ -string(4) "c2b3" -string(4) "c2b3" -bool(true) -
´ -string(4) "c2b4" -string(4) "c2b4" -bool(true) -
µ -string(4) "c2b5" -string(4) "c2b5" -bool(true) -
-string(4) "c2b6" -string(4) "c2b6" -bool(true) -
· -string(4) "c2b7" -string(4) "c2b7" -bool(true) -
¸ -string(4) "c2b8" -string(4) "c2b8" -bool(true) -
¹ -string(4) "c2b9" -string(4) "c2b9" -bool(true) -
º -string(4) "c2ba" -string(4) "c2ba" -bool(true) -
» -string(4) "c2bb" -string(4) "c2bb" -bool(true) -
¼ -string(4) "c2bc" -string(4) "c2bc" -bool(true) -
½ -string(4) "c2bd" -string(4) "c2bd" -bool(true) -
¾ -string(4) "c2be" -string(4) "c2be" -bool(true) -
¿ -string(4) "c2bf" -string(4) "c2bf" -bool(true) -
À -string(4) "c380" -string(4) "c380" -bool(true) -
Á -string(4) "c381" -string(4) "c381" -bool(true) -
 -string(4) "c382" -string(4) "c382" -bool(true) -
à -string(4) "c383" -string(4) "c383" -bool(true) -
Ä -string(4) "c384" -string(4) "c384" -bool(true) -
Å -string(4) "c385" -string(4) "c385" -bool(true) -
Æ -string(4) "c386" -string(4) "c386" -bool(true) -
Ç -string(4) "c387" -string(4) "c387" -bool(true) -
È -string(4) "c388" -string(4) "c388" -bool(true) -
É -string(4) "c389" -string(4) "c389" -bool(true) -
Ê -string(4) "c38a" -string(4) "c38a" -bool(true) -
Ë -string(4) "c38b" -string(4) "c38b" -bool(true) -
Ì -string(4) "c38c" -string(4) "c38c" -bool(true) -
Í -string(4) "c38d" -string(4) "c38d" -bool(true) -
Î -string(4) "c38e" -string(4) "c38e" -bool(true) -
Ï -string(4) "c38f" -string(4) "c38f" -bool(true) -
Ð -string(4) "c390" -string(4) "c390" -bool(true) -
Ñ -string(4) "c391" -string(4) "c391" -bool(true) -
Ò -string(4) "c392" -string(4) "c392" -bool(true) -
Ó -string(4) "c393" -string(4) "c393" -bool(true) -
Ô -string(4) "c394" -string(4) "c394" -bool(true) -
Õ -string(4) "c395" -string(4) "c395" -bool(true) -
Ö -string(4) "c396" -string(4) "c396" -bool(true) -
× -string(4) "c397" -string(4) "c397" -bool(true) -
Ø -string(4) "c398" -string(4) "c398" -bool(true) -
Ù -string(4) "c399" -string(4) "c399" -bool(true) -
Ú -string(4) "c39a" -string(4) "c39a" -bool(true) -
Û -string(4) "c39b" -string(4) "c39b" -bool(true) -
Ü -string(4) "c39c" -string(4) "c39c" -bool(true) -
Ý -string(4) "c39d" -string(4) "c39d" -bool(true) -
Þ -string(4) "c39e" -string(4) "c39e" -bool(true) -
ß -string(4) "c39f" -string(4) "c39f" -bool(true) -
à -string(4) "c3a0" -string(4) "c3a0" -bool(true) -
á -string(4) "c3a1" -string(4) "c3a1" -bool(true) -
â -string(4) "c3a2" -string(4) "c3a2" -bool(true) -
ã -string(4) "c3a3" -string(4) "c3a3" -bool(true) -
ä -string(4) "c3a4" -string(4) "c3a4" -bool(true) -
å -string(4) "c3a5" -string(4) "c3a5" -bool(true) -
æ -string(4) "c3a6" -string(4) "c3a6" -bool(true) -
ç -string(4) "c3a7" -string(4) "c3a7" -bool(true) -
è -string(4) "c3a8" -string(4) "c3a8" -bool(true) -
é -string(4) "c3a9" -string(4) "c3a9" -bool(true) -
ê -string(4) "c3aa" -string(4) "c3aa" -bool(true) -
ë -string(4) "c3ab" -string(4) "c3ab" -bool(true) -
ì -string(4) "c3ac" -string(4) "c3ac" -bool(true) -
í -string(4) "c3ad" -string(4) "c3ad" -bool(true) -
î -string(4) "c3ae" -string(4) "c3ae" -bool(true) -
ï -string(4) "c3af" -string(4) "c3af" -bool(true) -
ð -string(4) "c3b0" -string(4) "c3b0" -bool(true) -
ñ -string(4) "c3b1" -string(4) "c3b1" -bool(true) -
ò -string(4) "c3b2" -string(4) "c3b2" -bool(true) -
ó -string(4) "c3b3" -string(4) "c3b3" -bool(true) -
ô -string(4) "c3b4" -string(4) "c3b4" -bool(true) -
õ -string(4) "c3b5" -string(4) "c3b5" -bool(true) -
ö -string(4) "c3b6" -string(4) "c3b6" -bool(true) -
÷ -string(4) "c3b7" -string(4) "c3b7" -bool(true) -
ø -string(4) "c3b8" -string(4) "c3b8" -bool(true) -
ù -string(4) "c3b9" -string(4) "c3b9" -bool(true) -
ú -string(4) "c3ba" -string(4) "c3ba" -bool(true) -
û -string(4) "c3bb" -string(4) "c3bb" -bool(true) -
ü -string(4) "c3bc" -string(4) "c3bc" -bool(true) -
ý -string(4) "c3bd" -string(4) "c3bd" -bool(true) -
þ -string(4) "c3be" -string(4) "c3be" -bool(true) -
ÿ -string(4) "c3bf" -string(4) "c3bf" -bool(true) diff --git a/ext/wddx/tests/bug37587.phpt b/ext/wddx/tests/bug37587.phpt deleted file mode 100644 index e91e451238763..0000000000000 --- a/ext/wddx/tests/bug37587.phpt +++ /dev/null @@ -1,35 +0,0 @@ ---TEST-- -Bug #37587 (var without attribute causes segfault) ---SKIPIF-- - ---FILE-- - -
- - - - - Hello World - - - - - -EOF -)); - -?> -===DONE=== ---EXPECTF-- -Deprecated: Function wddx_deserialize() is deprecated in %s on line %d -array(1) { - [0]=> - array(1) { - ["test"]=> - string(11) "Hello World" - } -} -===DONE=== diff --git a/ext/wddx/tests/bug41283.phpt b/ext/wddx/tests/bug41283.phpt deleted file mode 100644 index 4a1f92b991f82..0000000000000 --- a/ext/wddx/tests/bug41283.phpt +++ /dev/null @@ -1,30 +0,0 @@ ---TEST-- -Bug #41283 (Bug with serializing array key that are doubles or floats) ---SKIPIF-- - ---FILE-- - array('1.1' => 'One 1','1.2' => 'One 2', '1.0' => 'Three') -); - -var_dump(wddx_deserialize(wddx_serialize_vars('data'))); -?> ---EXPECTF-- -Deprecated: Function wddx_serialize_vars() is deprecated in %s on line %d - -Deprecated: Function wddx_deserialize() is deprecated in %s on line %d -array(1) { - ["data"]=> - array(1) { - ["somearray"]=> - array(3) { - ["1.1"]=> - string(5) "One 1" - ["1.2"]=> - string(5) "One 2" - ["1.0"]=> - string(5) "Three" - } - } -} diff --git a/ext/wddx/tests/bug41527.phpt b/ext/wddx/tests/bug41527.phpt deleted file mode 100644 index 329f732a197db..0000000000000 --- a/ext/wddx/tests/bug41527.phpt +++ /dev/null @@ -1,25 +0,0 @@ ---TEST-- -Bug #41527 (WDDX deserialize numeric string array keys) ---SKIPIF-- - ---FILE-- - 'Zero', '+1' => 'Plus sign', ' 1' => 'Space'); - -var_dump(wddx_deserialize(wddx_serialize_vars('data'))); -?> ---EXPECTF-- -Deprecated: Function wddx_serialize_vars() is deprecated in %s on line %d - -Deprecated: Function wddx_deserialize() is deprecated in %s on line %d -array(1) { - ["data"]=> - array(3) { - ["01"]=> - string(4) "Zero" - ["+1"]=> - string(9) "Plus sign" - [" 1"]=> - string(5) "Space" - } -} diff --git a/ext/wddx/tests/bug45901.phpt b/ext/wddx/tests/bug45901.phpt deleted file mode 100644 index c89b230eb9595..0000000000000 --- a/ext/wddx/tests/bug45901.phpt +++ /dev/null @@ -1,21 +0,0 @@ ---TEST-- -Bug #45901 (wddx_serialize_value crash with SimpleXMLElement object) ---SKIPIF-- - ---FILE-- -'); -$xml->addChild('test'); -echo wddx_serialize_value($xml, 'Variables') . "\n"; -echo "DONE"; -?> ---EXPECTF-- -Deprecated: Function wddx_serialize_value() is deprecated in %sbug45901.php on line %d - -Warning: wddx_serialize_value(): Class SimpleXMLElement can not be serialized in %sbug45901.php on line %d -
Variables
-DONE diff --git a/ext/wddx/tests/bug48562.phpt b/ext/wddx/tests/bug48562.phpt deleted file mode 100644 index 10a2b65660988..0000000000000 --- a/ext/wddx/tests/bug48562.phpt +++ /dev/null @@ -1,38 +0,0 @@ ---TEST-- -Bug #48562 (Reference recursion causes segfault when used in wddx_serialize_vars()) ---SKIPIF-- - ---FILE-- - ---EXPECTF-- -Deprecated: Function wddx_serialize_vars() is deprecated in %s on line %d - -Warning: wddx_serialize_vars(): recursion detected in %s on line %d -string(78) "
" - -Deprecated: Function wddx_serialize_vars() is deprecated in %s on line %d -string(120) "
bar" diff --git a/ext/wddx/tests/bug52468.phpt b/ext/wddx/tests/bug52468.phpt deleted file mode 100644 index 1fd3df9e4ad63..0000000000000 --- a/ext/wddx/tests/bug52468.phpt +++ /dev/null @@ -1,29 +0,0 @@ ---TEST-- -Bug #52468 (wddx_deserialize corrupts integer field value when left empty) ---SKIPIF-- - ---FILE-- -
my_command
"; - -print_r(wddx_deserialize($message)); -print_r(wddx_deserialize($message)); - -?> ---EXPECTF-- -Deprecated: Function wddx_deserialize() is deprecated in %s on line %d -Array -( - [handle] => 0 -) - -Deprecated: Function wddx_deserialize() is deprecated in %s on line %d -Array -( - [handle] => 0 -) diff --git a/ext/wddx/tests/bug68996.phpt b/ext/wddx/tests/bug68996.phpt deleted file mode 100644 index cba4b3f1942a7..0000000000000 --- a/ext/wddx/tests/bug68996.phpt +++ /dev/null @@ -1,15 +0,0 @@ ---TEST-- -Bug #68996 (Invalid free of CG(interned_empty_string)) ---SKIPIF-- - ---FILE-- - "foo" ]) . "\n"; -?> ---EXPECT-- -
-
foo diff --git a/ext/wddx/tests/bug70661.phpt b/ext/wddx/tests/bug70661.phpt deleted file mode 100644 index 60683d571952c..0000000000000 --- a/ext/wddx/tests/bug70661.phpt +++ /dev/null @@ -1,70 +0,0 @@ ---TEST-- -Bug #70661 (Use After Free Vulnerability in WDDX Packet Deserialization) ---SKIPIF-- - ---FILE-- - - -
- - - - - - stdClass - - - - - - - -EOT; - -$y = wddx_deserialize($x); - -for ($i = 0; $i < 5; $i++) { - $v[$i] = $fakezval.$i; -} - -var_dump($y); - -function ptr2str($ptr) -{ - $out = ''; - - for ($i = 0; $i < 8; $i++) { - $out .= chr($ptr & 0xff); - $ptr >>= 8; - } - - return $out; -} -?> -DONE ---EXPECTF-- -Deprecated: Function wddx_deserialize() is deprecated in %s on line %d -array(1) { - [0]=> - array(1) { - ["ryat"]=> - array(2) { - ["php_class_name"]=> - string(8) "stdClass" - [0]=> - NULL - } - } -} -DONE diff --git a/ext/wddx/tests/bug70741.phpt b/ext/wddx/tests/bug70741.phpt deleted file mode 100644 index 061fa65ef812e..0000000000000 --- a/ext/wddx/tests/bug70741.phpt +++ /dev/null @@ -1,26 +0,0 @@ ---TEST-- -Bug #70741 (Session WDDX Packet Deserialization Type Confusion Vulnerability) ---SKIPIF-- - ---FILE-- - - -
- - $hashtable - -"; -session_decode($wddx); -?> -DONE ---EXPECTF-- -Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s on line %d -DONE diff --git a/ext/wddx/tests/bug71335.phpt b/ext/wddx/tests/bug71335.phpt deleted file mode 100644 index 9fdbb2582264b..0000000000000 --- a/ext/wddx/tests/bug71335.phpt +++ /dev/null @@ -1,34 +0,0 @@ ---TEST-- -Bug #71335 (Type Confusion in WDDX Packet Deserialization) ---SKIPIF-- - ---FILE-- - - -
- - - - stdClass - - - stdClass - - - -"; - -$d = wddx_deserialize($x); -var_dump($d); -?> -DONE ---EXPECTF-- -Deprecated: Function wddx_deserialize() is deprecated in %s on line %d -object(stdClass)#%d (1) { - ["php_class_name"]=> - string(8) "stdClass" -} -DONE diff --git a/ext/wddx/tests/bug71587.phpt b/ext/wddx/tests/bug71587.phpt deleted file mode 100644 index bb7c00b586840..0000000000000 --- a/ext/wddx/tests/bug71587.phpt +++ /dev/null @@ -1,44 +0,0 @@ ---TEST-- -Bug #71587 (Use-After-Free / Double-Free in WDDX Deserialize) ---SKIPIF-- - ---FILE-- - - - - - - manhluat - - - - - -EOF; - -$wddx = wddx_deserialize($xml); -var_dump($wddx); -// Print mem leak -foreach($wddx as $k=>$v) - printf("Key: %s\nValue: %s\n",bin2hex($k),bin2hex($v)); - -?> -DONE ---EXPECTF-- -Deprecated: Function wddx_deserialize() is deprecated in %s on line %d -array(2) { - [0]=> - string(8) "manhluat" - [1]=> - bool(true) -} -Key: 30 -Value: 6d616e686c756174 -Key: 31 -Value: 31 -DONE diff --git a/ext/wddx/tests/bug72142.phpt b/ext/wddx/tests/bug72142.phpt deleted file mode 100644 index 955af38131f09..0000000000000 --- a/ext/wddx/tests/bug72142.phpt +++ /dev/null @@ -1,18 +0,0 @@ ---TEST-- -Bug #72142: WDDX Packet Injection Vulnerability in wddx_serialize_value() ---SKIPIF-- - ---FILE-- -
stdClass
'); -var_dump($wddx); -var_dump(wddx_deserialize($wddx)); - -?> ---EXPECTF-- -Deprecated: Function wddx_serialize_value() is deprecated in %s on line %d -string(301) "
</comment></header><data><struct><var name="php_class_name"><string>stdClass</string></var></struct></data></wddxPacket>
" - -Deprecated: Function wddx_deserialize() is deprecated in %s on line %d -string(0) "" diff --git a/ext/wddx/tests/bug72340.phpt b/ext/wddx/tests/bug72340.phpt deleted file mode 100644 index 7597a2f479589..0000000000000 --- a/ext/wddx/tests/bug72340.phpt +++ /dev/null @@ -1,25 +0,0 @@ ---TEST-- -Bug #72340: Double Free Courruption in wddx_deserialize ---SKIPIF-- - ---FILE-- - - - - TEST - - - - -EOF; -$array = wddx_deserialize($xml); -var_dump($array); -?> ---EXPECTF-- -Deprecated: Function wddx_deserialize() is deprecated in %s on line %d -array(0) { -} diff --git a/ext/wddx/tests/bug72564.phpt b/ext/wddx/tests/bug72564.phpt deleted file mode 100644 index a1037a8662d53..0000000000000 --- a/ext/wddx/tests/bug72564.phpt +++ /dev/null @@ -1,31 +0,0 @@ ---TEST-- -Bug #72564: wddx deserialization of boolean ---SKIPIF-- - ---FILE-- - -Done ---EXPECTF-- -Deprecated: Function wddx_serialize_value() is deprecated in %s on line %d - -Deprecated: Function wddx_deserialize() is deprecated in %s on line %d -string(84) "
" -bool(true) - -Deprecated: Function wddx_serialize_value() is deprecated in %s on line %d - -Deprecated: Function wddx_deserialize() is deprecated in %s on line %d -string(85) "
" -bool(false) - -Deprecated: Function wddx_serialize_value() is deprecated in %s on line %d - -Deprecated: Function wddx_deserialize() is deprecated in %s on line %d -string(68) "
" -NULL -Done diff --git a/ext/wddx/tests/bug72749.phpt b/ext/wddx/tests/bug72749.phpt deleted file mode 100644 index 49a7af9c73317..0000000000000 --- a/ext/wddx/tests/bug72749.phpt +++ /dev/null @@ -1,35 +0,0 @@ ---TEST-- -Bug #72749: wddx_deserialize allows illegal memory access ---SKIPIF-- - ---FILE-- - - - -
- - - - 2\r2004-09-10T05:52:49+00 - - - - -XML; - -$array = wddx_deserialize($xml); -var_dump($array); -?> ---EXPECTF-- -Deprecated: Function wddx_deserialize() is deprecated in %s on line %d -array(1) { - ["aDateTime3"]=> - string(24) "2 -2004-09-10T05:52:49+00" -} diff --git a/ext/wddx/tests/bug72750.phpt b/ext/wddx/tests/bug72750.phpt deleted file mode 100644 index a789900a6045f..0000000000000 --- a/ext/wddx/tests/bug72750.phpt +++ /dev/null @@ -1,35 +0,0 @@ ---TEST-- -Bug #72750: wddx_deserialize null dereference ---SKIPIF-- - ---FILE-- - - - -
- - - - \\tYmluYXJRhdGE= - - - - -XML; - -$array = wddx_deserialize($xml); -var_dump($array); -?> ---EXPECTF-- -Deprecated: Function wddx_deserialize() is deprecated in %s on line %d -array(1) { - ["aBinary"]=> - string(9) "FF" -} diff --git a/ext/wddx/tests/bug72790.phpt b/ext/wddx/tests/bug72790.phpt deleted file mode 100644 index 335cee0d8322c..0000000000000 --- a/ext/wddx/tests/bug72790.phpt +++ /dev/null @@ -1,36 +0,0 @@ ---TEST-- -Bug #72790: wddx_deserialize null dereference with invalid xml ---SKIPIF-- - ---FILE-- - - - - |array> - - - - - - - - - - - - -XML; - -$array = wddx_deserialize($xml); -var_dump($array); -?> ---EXPECTF-- -Deprecated: Function wddx_deserialize() is deprecated in %s on line %d -NULL diff --git a/ext/wddx/tests/bug72799.phpt b/ext/wddx/tests/bug72799.phpt deleted file mode 100644 index a5fea7a4da7fc..0000000000000 --- a/ext/wddx/tests/bug72799.phpt +++ /dev/null @@ -1,29 +0,0 @@ ---TEST-- -Bug #72799: wddx_deserialize null dereference in php_wddx_pop_element ---SKIPIF-- - ---FILE-- - - - - - - 1998-06-12T04:32:12+00 - - - -XML; - -$array = wddx_deserialize($xml); -var_dump($array); -?> ---EXPECTF-- -Deprecated: Function wddx_deserialize() is deprecated in %s on line %d -NULL diff --git a/ext/wddx/tests/bug72860.phpt b/ext/wddx/tests/bug72860.phpt deleted file mode 100644 index 831811b8423f0..0000000000000 --- a/ext/wddx/tests/bug72860.phpt +++ /dev/null @@ -1,28 +0,0 @@ ---TEST-- -Bug #72860: wddx_deserialize use-after-free ---SKIPIF-- - ---FILE-- - - - - - - - -XML; - -var_dump(wddx_deserialize($xml)); -?> -DONE ---EXPECTF-- -Deprecated: Function wddx_deserialize() is deprecated in %s on line %d -NULL -DONE diff --git a/ext/wddx/tests/bug73065.phpt b/ext/wddx/tests/bug73065.phpt deleted file mode 100644 index 5481b88fd6197..0000000000000 --- a/ext/wddx/tests/bug73065.phpt +++ /dev/null @@ -1,107 +0,0 @@ ---TEST-- -Bug #73065: Out-Of-Bounds Read in php_wddx_push_element of wddx.c ---SKIPIF-- - ---FILE-- - - - - - - - - - - - - - - -XML; - -$xml2 = << - - - - - - - - -XML; - -$xml3 = << - - - - - - - - -XML; - -$xml4 = << - - - - - - - - -XML; - -$xml5 = << - - - - - - - - -XML; - -for($i=1;$i<=5;$i++) { - $xmlvar = "xml$i"; - $array = wddx_deserialize($$xmlvar); - var_dump($array); -} -?> -DONE ---EXPECTF-- -Deprecated: Function wddx_deserialize() is deprecated in %s on line %d -array(0) { -} - -Deprecated: Function wddx_deserialize() is deprecated in %s on line %d -array(0) { -} - -Deprecated: Function wddx_deserialize() is deprecated in %s on line %d -array(0) { -} - -Deprecated: Function wddx_deserialize() is deprecated in %s on line %d -array(1) { - [0]=> - array(0) { - } -} - -Deprecated: Function wddx_deserialize() is deprecated in %s on line %d -array(0) { -} -DONE diff --git a/ext/wddx/tests/bug73173.phpt b/ext/wddx/tests/bug73173.phpt deleted file mode 100644 index d9e6644b8ba69..0000000000000 --- a/ext/wddx/tests/bug73173.phpt +++ /dev/null @@ -1,26 +0,0 @@ ---TEST-- -Bug #73173: huge memleak when wddx_unserialize ---SKIPIF-- - ---FILE-- - - - - - -XML; -var_dump(wddx_deserialize($xml)); - -?> ---EXPECTF-- -Deprecated: Function wddx_deserialize() is deprecated in %s on line %d -NULL diff --git a/ext/wddx/tests/bug73331.phpt b/ext/wddx/tests/bug73331.phpt deleted file mode 100644 index 3ee2e596efb80..0000000000000 --- a/ext/wddx/tests/bug73331.phpt +++ /dev/null @@ -1,15 +0,0 @@ ---TEST-- -Bug #73331 (NULL Pointer Dereference in WDDX Packet Deserialization with PDORow) ---SKIPIF-- - ---FILE-- -
PDORow"; -var_dump(wddx_deserialize($wddx)); -?> ---EXPECTF-- -Deprecated: Function wddx_deserialize() is deprecated in %s on line %d - -Warning: wddx_deserialize(): Class pdorow can not be unserialized in %s73331.php on line %d -NULL diff --git a/ext/wddx/tests/bug73631.phpt b/ext/wddx/tests/bug73631.phpt deleted file mode 100644 index 061932e732a02..0000000000000 --- a/ext/wddx/tests/bug73631.phpt +++ /dev/null @@ -1,21 +0,0 @@ ---TEST-- -Bug #73631 (Memory leak due to invalid wddx stack processing) ---SKIPIF-- - ----XFAIL-- -Still has memory leaks in debug build. ---FILE-- - - -1234 - - -EOF; -$wddx = wddx_deserialize($xml); -var_dump($wddx); -?> ---EXPECTF-- -Deprecated: Function wddx_deserialize() is deprecated in %s on line %d -int(1234) diff --git a/ext/wddx/tests/bug73793.phpt b/ext/wddx/tests/bug73793.phpt deleted file mode 100644 index dad2f35ed0e73..0000000000000 --- a/ext/wddx/tests/bug73793.phpt +++ /dev/null @@ -1,19 +0,0 @@ ---TEST-- -Bug #73793 (WDDX uses wrong decimal separator) ---SKIPIF-- - ---FILE-- - 5.1])); -?> -===DONE=== ---EXPECTF-- -Deprecated: Function wddx_serialize_value() is deprecated in %s on line %d -string(120) "
5.1" -===DONE=== diff --git a/ext/wddx/tests/bug73831.phpt b/ext/wddx/tests/bug73831.phpt deleted file mode 100644 index dc25f3c092c55..0000000000000 --- a/ext/wddx/tests/bug73831.phpt +++ /dev/null @@ -1,25 +0,0 @@ ---TEST-- -Bug #73831 (NULL Pointer Dereference while unserialize php object) ---SKIPIF-- - ---FILE-- - - - - - Throwable - - - -EOF; -try { - $wddx = wddx_deserialize($xml); -} catch(Error $e) { echo $e->getMessage(); } -?> ---EXPECTF-- -Deprecated: Function wddx_deserialize() is deprecated in %s on line %d - -Warning: wddx_deserialize(): Class throwable can not be instantiated in %sbug73831.php on line %d -Cannot instantiate interface Throwable diff --git a/ext/wddx/tests/bug74145.phpt b/ext/wddx/tests/bug74145.phpt deleted file mode 100644 index 1daa189accb3d..0000000000000 --- a/ext/wddx/tests/bug74145.phpt +++ /dev/null @@ -1,17 +0,0 @@ ---TEST-- -Bug #74145 (wddx parsing empty boolean tag leads to SIGSEGV) ---SKIPIF-- - ---FILE-- - -DONE ---EXPECTF-- -Deprecated: Function wddx_deserialize() is deprecated in %s on line %d -NULL -DONE diff --git a/ext/wddx/tests/bug74145.xml b/ext/wddx/tests/bug74145.xml deleted file mode 100644 index e5d35fb0a4905..0000000000000 --- a/ext/wddx/tests/bug74145.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/ext/wddx/tests/bug75055.phpt b/ext/wddx/tests/bug75055.phpt deleted file mode 100644 index cd84c9b8fa3dd..0000000000000 --- a/ext/wddx/tests/bug75055.phpt +++ /dev/null @@ -1,22 +0,0 @@ ---TEST-- -Bug #75055 Out-Of-Bounds Read in timelib_meridian() ---SKIPIF-- - ---FILE-- - ---EXPECTF-- -323 bytes read. - -Deprecated: Function wddx_deserialize() is deprecated in %s on line %d -array(1) { - ["aDateTime"]=> - string(12) "frONt of 0 0" -} diff --git a/ext/wddx/tests/bug75055.wddx b/ext/wddx/tests/bug75055.wddx deleted file mode 100644 index 64933524696ab..0000000000000 --- a/ext/wddx/tests/bug75055.wddx +++ /dev/null @@ -1,13 +0,0 @@ - - - -
- - - - frONt of 0 0 - - - - - diff --git a/ext/wddx/tests/wddx.xml b/ext/wddx/tests/wddx.xml deleted file mode 100644 index 00857095c9809..0000000000000 --- a/ext/wddx/tests/wddx.xml +++ /dev/null @@ -1,60 +0,0 @@ - - - -
- - - - - - - a string - - - -12.456 - - - 1998-06-12T04:32:12+00 - - - 1980-06-12T04:32:12+00 - - - 2040-06-12T04:32:12+00 - - - - - - - 10 - second element - - - - YmluYXJ5IGRhdGE= - - - - - a string - - - -12.456 - - - - - - - John Doe - Jane Doe - - - 34 - 31 - - - - - diff --git a/ext/wddx/wddx.c b/ext/wddx/wddx.c deleted file mode 100644 index b32623f3d817c..0000000000000 --- a/ext/wddx/wddx.c +++ /dev/null @@ -1,1330 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | PHP Version 7 | - +----------------------------------------------------------------------+ - | Copyright (c) The PHP Group | - +----------------------------------------------------------------------+ - | This source file is subject to version 3.01 of the PHP license, | - | that is bundled with this package in the file LICENSE, and is | - | available through the world-wide-web at the following url: | - | http://www.php.net/license/3_01.txt | - | If you did not receive a copy of the PHP license and are unable to | - | obtain it through the world-wide-web, please send a note to | - | license@php.net so we can mail you a copy immediately. | - +----------------------------------------------------------------------+ - | Author: Andrei Zmievski | - +----------------------------------------------------------------------+ - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include "php.h" - -#if HAVE_WDDX - -#include "ext/xml/expat_compat.h" -#include "php_wddx.h" -#include "php_wddx_api.h" - -#include "ext/xml/php_xml.h" -#include "ext/standard/php_incomplete_class.h" -#include "ext/standard/base64.h" -#include "ext/standard/info.h" -#include "zend_smart_str.h" -#include "ext/standard/html.h" -#include "ext/standard/php_string.h" -#include "ext/date/php_date.h" -#include "zend_globals.h" - -#define WDDX_BUF_LEN 256 -#define PHP_CLASS_NAME_VAR "php_class_name" - -#define EL_ARRAY "array" -#define EL_BINARY "binary" -#define EL_BOOLEAN "boolean" -#define EL_CHAR "char" -#define EL_CHAR_CODE "code" -#define EL_NULL "null" -#define EL_NUMBER "number" -#define EL_PACKET "wddxPacket" -#define EL_STRING "string" -#define EL_STRUCT "struct" -#define EL_VALUE "value" -#define EL_VAR "var" -#define EL_NAME "name" -#define EL_VERSION "version" -#define EL_RECORDSET "recordset" -#define EL_FIELD "field" -#define EL_DATETIME "dateTime" - -#define php_wddx_deserialize(a,b) \ - php_wddx_deserialize_ex(Z_STRVAL_P(a), Z_STRLEN_P(a), (b)) - -#define SET_STACK_VARNAME \ - if (stack->varname) { \ - ent.varname = estrdup(stack->varname); \ - efree(stack->varname); \ - stack->varname = NULL; \ - } else \ - ent.varname = NULL; \ - -static int le_wddx; - -typedef struct { - zval data; - enum { - ST_ARRAY, - ST_BOOLEAN, - ST_NULL, - ST_NUMBER, - ST_STRING, - ST_BINARY, - ST_STRUCT, - ST_RECORDSET, - ST_FIELD, - ST_DATETIME - } type; - char *varname; -} st_entry; - -typedef struct { - int top, max; - char *varname; - zend_bool done; - void **elements; -} wddx_stack; - - -static void php_wddx_process_data(void *user_data, const XML_Char *s, int len); - -/* {{{ arginfo */ -ZEND_BEGIN_ARG_INFO_EX(arginfo_wddx_serialize_value, 0, 0, 1) - ZEND_ARG_INFO(0, var) - ZEND_ARG_INFO(0, comment) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_wddx_serialize_vars, 0, 0, 1) - ZEND_ARG_VARIADIC_INFO(0, var_names) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_wddx_serialize_start, 0, 0, 0) - ZEND_ARG_INFO(0, comment) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_wddx_packet_end, 0, 0, 1) - ZEND_ARG_INFO(0, packet_id) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_wddx_add_vars, 0, 0, 2) - ZEND_ARG_INFO(0, packet_id) - ZEND_ARG_VARIADIC_INFO(0, var_names) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_wddx_deserialize, 0, 0, 1) - ZEND_ARG_INFO(0, packet) -ZEND_END_ARG_INFO() -/* }}} */ - -/* {{{ wddx_functions[] - */ -static const zend_function_entry wddx_functions[] = { - PHP_DEP_FE(wddx_serialize_value, arginfo_wddx_serialize_value) - PHP_DEP_FE(wddx_serialize_vars, arginfo_wddx_serialize_vars) - PHP_DEP_FE(wddx_packet_start, arginfo_wddx_serialize_start) - PHP_DEP_FE(wddx_packet_end, arginfo_wddx_packet_end) - PHP_DEP_FE(wddx_add_vars, arginfo_wddx_add_vars) - PHP_DEP_FE(wddx_deserialize, arginfo_wddx_deserialize) - PHP_FE_END -}; -/* }}} */ - -PHP_MINIT_FUNCTION(wddx); -PHP_MINFO_FUNCTION(wddx); - -/* {{{ dynamically loadable module stuff */ -#ifdef COMPILE_DL_WDDX -ZEND_GET_MODULE(wddx) -#endif /* COMPILE_DL_WDDX */ -/* }}} */ - -/* {{{ wddx_module_entry - */ -zend_module_entry wddx_module_entry = { - STANDARD_MODULE_HEADER, - "wddx", - wddx_functions, - PHP_MINIT(wddx), - NULL, - NULL, - NULL, - PHP_MINFO(wddx), - PHP_WDDX_VERSION, - STANDARD_MODULE_PROPERTIES -}; -/* }}} */ - -/* {{{ wddx_stack_init - */ -static int wddx_stack_init(wddx_stack *stack) -{ - stack->top = 0; - stack->elements = (void **) safe_emalloc(sizeof(void **), STACK_BLOCK_SIZE, 0); - stack->max = STACK_BLOCK_SIZE; - stack->varname = NULL; - stack->done = 0; - - return SUCCESS; -} -/* }}} */ - -/* {{{ wddx_stack_push - */ -static int wddx_stack_push(wddx_stack *stack, void *element, int size) -{ - if (stack->top >= stack->max) { /* we need to allocate more memory */ - stack->elements = (void **) erealloc(stack->elements, - (sizeof(void **) * (stack->max += STACK_BLOCK_SIZE))); - } - stack->elements[stack->top] = (void *) emalloc(size); - memcpy(stack->elements[stack->top], element, size); - return stack->top++; -} -/* }}} */ - -/* {{{ wddx_stack_top - */ -static int wddx_stack_top(wddx_stack *stack, void **element) -{ - if (stack->top > 0) { - *element = stack->elements[stack->top - 1]; - return SUCCESS; - } else { - *element = NULL; - return FAILURE; - } -} -/* }}} */ - -/* {{{ wddx_stack_is_empty - */ -static int wddx_stack_is_empty(wddx_stack *stack) -{ - if (stack->top == 0) { - return 1; - } else { - return 0; - } -} -/* }}} */ - -/* {{{ wddx_stack_destroy - */ -static int wddx_stack_destroy(wddx_stack *stack) -{ - register int i; - - if (stack->elements) { - for (i = 0; i < stack->top; i++) { - if (Z_TYPE(((st_entry *)stack->elements[i])->data) != IS_UNDEF - && ((st_entry *)stack->elements[i])->type != ST_FIELD) { - zval_ptr_dtor(&((st_entry *)stack->elements[i])->data); - } - if (((st_entry *)stack->elements[i])->varname) { - efree(((st_entry *)stack->elements[i])->varname); - } - efree(stack->elements[i]); - } - efree(stack->elements); - } - if (stack->varname) { - efree(stack->varname); - } - return SUCCESS; -} -/* }}} */ - -/* {{{ release_wddx_packet_rsrc - */ -static void release_wddx_packet_rsrc(zend_resource *rsrc) -{ - smart_str *str = (smart_str *)rsrc->ptr; - smart_str_free(str); - efree(str); -} -/* }}} */ - -#include "ext/session/php_session.h" - -#if HAVE_PHP_SESSION && !defined(COMPILE_DL_SESSION) -/* {{{ PS_SERIALIZER_ENCODE_FUNC - */ -PS_SERIALIZER_ENCODE_FUNC(wddx) -{ - wddx_packet *packet; - zend_string *str; - PS_ENCODE_VARS; - - packet = php_wddx_constructor(); - - php_wddx_packet_start(packet, NULL, 0); - php_wddx_add_chunk_static(packet, WDDX_STRUCT_S); - - PS_ENCODE_LOOP( - php_wddx_serialize_var(packet, struc, key); - ); - - php_wddx_add_chunk_static(packet, WDDX_STRUCT_E); - php_wddx_packet_end(packet); - smart_str_0(packet); - str = zend_string_copy(packet->s); - php_wddx_destructor(packet); - - return str; -} -/* }}} */ - -/* {{{ PS_SERIALIZER_DECODE_FUNC - */ -PS_SERIALIZER_DECODE_FUNC(wddx) -{ - zval retval; - zval *ent; - zend_string *key; - zend_ulong idx; - int ret; - - if (vallen == 0) { - return SUCCESS; - } - - ZVAL_UNDEF(&retval); - if ((ret = php_wddx_deserialize_ex(val, vallen, &retval)) == SUCCESS) { - if (Z_TYPE(retval) != IS_ARRAY) { - zval_ptr_dtor_nogc(&retval); - return FAILURE; - } - ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL(retval), idx, key, ent) { - if (key == NULL) { - key = zend_long_to_str(idx); - } else { - zend_string_addref(key); - } - if (php_set_session_var(key, ent, NULL)) { - Z_TRY_ADDREF_P(ent); - } - PS_ADD_VAR(key); - zend_string_release_ex(key, 0); - } ZEND_HASH_FOREACH_END(); - } - - zval_ptr_dtor(&retval); - - return ret; -} -/* }}} */ -#endif - -/* {{{ PHP_MINIT_FUNCTION - */ -PHP_MINIT_FUNCTION(wddx) -{ - le_wddx = zend_register_list_destructors_ex(release_wddx_packet_rsrc, NULL, "wddx", module_number); - -#if HAVE_PHP_SESSION && !defined(COMPILE_DL_SESSION) - php_session_register_serializer("wddx", - PS_SERIALIZER_ENCODE_NAME(wddx), - PS_SERIALIZER_DECODE_NAME(wddx)); -#endif - - return SUCCESS; -} -/* }}} */ - -/* {{{ PHP_MINFO_FUNCTION - */ -PHP_MINFO_FUNCTION(wddx) -{ - php_info_print_table_start(); -#if HAVE_PHP_SESSION && !defined(COMPILE_DL_SESSION) - php_info_print_table_header(2, "WDDX Support", "enabled" ); - php_info_print_table_row(2, "WDDX Session Serializer", "enabled" ); -#else - php_info_print_table_row(2, "WDDX Support", "enabled" ); -#endif - php_info_print_table_end(); -} -/* }}} */ - -/* {{{ php_wddx_packet_start - */ -void php_wddx_packet_start(wddx_packet *packet, char *comment, size_t comment_len) -{ - php_wddx_add_chunk_static(packet, WDDX_PACKET_S); - if (comment) { - zend_string *escaped = php_escape_html_entities( - comment, comment_len, 0, ENT_QUOTES, NULL); - - php_wddx_add_chunk_static(packet, WDDX_HEADER_S); - php_wddx_add_chunk_static(packet, WDDX_COMMENT_S); - php_wddx_add_chunk_ex(packet, ZSTR_VAL(escaped), ZSTR_LEN(escaped)); - php_wddx_add_chunk_static(packet, WDDX_COMMENT_E); - php_wddx_add_chunk_static(packet, WDDX_HEADER_E); - - zend_string_release_ex(escaped, 0); - } else { - php_wddx_add_chunk_static(packet, WDDX_HEADER); - } - php_wddx_add_chunk_static(packet, WDDX_DATA_S); -} -/* }}} */ - -/* {{{ php_wddx_packet_end - */ -void php_wddx_packet_end(wddx_packet *packet) -{ - php_wddx_add_chunk_static(packet, WDDX_DATA_E); - php_wddx_add_chunk_static(packet, WDDX_PACKET_E); -} -/* }}} */ - -#define FLUSH_BUF() \ - if (l > 0) { \ - php_wddx_add_chunk_ex(packet, buf, l); \ - l = 0; \ - } - -/* {{{ php_wddx_serialize_string - */ -static void php_wddx_serialize_string(wddx_packet *packet, zval *var) -{ - php_wddx_add_chunk_static(packet, WDDX_STRING_S); - - if (Z_STRLEN_P(var) > 0) { - zend_string *buf = php_escape_html_entities( - (unsigned char *) Z_STRVAL_P(var), Z_STRLEN_P(var), 0, ENT_QUOTES, NULL); - - php_wddx_add_chunk_ex(packet, ZSTR_VAL(buf), ZSTR_LEN(buf)); - - zend_string_release_ex(buf, 0); - } - php_wddx_add_chunk_static(packet, WDDX_STRING_E); -} -/* }}} */ - -/* {{{ php_wddx_serialize_number - */ -static void php_wddx_serialize_number(wddx_packet *packet, zval *var) -{ - char tmp_buf[WDDX_BUF_LEN], *dec_point; - zend_string *str = zval_get_string_func(var); - snprintf(tmp_buf, sizeof(tmp_buf), WDDX_NUMBER, ZSTR_VAL(str)); - zend_string_release_ex(str, 0); - - dec_point = strchr(tmp_buf, ','); - if (dec_point) { - *dec_point = '.'; - } - php_wddx_add_chunk(packet, tmp_buf); -} -/* }}} */ - -/* {{{ php_wddx_serialize_boolean - */ -static void php_wddx_serialize_boolean(wddx_packet *packet, zval *var) -{ - php_wddx_add_chunk(packet, Z_TYPE_P(var) == IS_TRUE ? WDDX_BOOLEAN_TRUE : WDDX_BOOLEAN_FALSE); -} -/* }}} */ - -/* {{{ php_wddx_serialize_unset - */ -static void php_wddx_serialize_unset(wddx_packet *packet) -{ - php_wddx_add_chunk_static(packet, WDDX_NULL); -} -/* }}} */ - -/* {{{ php_wddx_serialize_object - */ -static void php_wddx_serialize_object(wddx_packet *packet, zval *obj) -{ -/* OBJECTS_FIXME */ - zval *ent, fname, *varname; - zval retval; - zend_string *key; - zend_ulong idx; - char tmp_buf[WDDX_BUF_LEN]; - HashTable *objhash, *sleephash; - zend_class_entry *ce; - PHP_CLASS_ATTRIBUTES; - - PHP_SET_CLASS_ATTRIBUTES(obj); - ce = Z_OBJCE_P(obj); - if (!ce || ce->serialize || ce->unserialize) { - php_error_docref(NULL, E_WARNING, "Class %s can not be serialized", ZSTR_VAL(class_name)); - PHP_CLEANUP_CLASS_ATTRIBUTES(); - return; - } - - ZVAL_STRING(&fname, "__sleep"); - /* - * We try to call __sleep() method on object. It's supposed to return an - * array of property names to be serialized. - */ - if (call_user_function(CG(function_table), obj, &fname, &retval, 0, 0) == SUCCESS) { - if (!Z_ISUNDEF(retval) && (sleephash = HASH_OF(&retval))) { - php_wddx_add_chunk_static(packet, WDDX_STRUCT_S); - snprintf(tmp_buf, WDDX_BUF_LEN, WDDX_VAR_S, PHP_CLASS_NAME_VAR); - php_wddx_add_chunk(packet, tmp_buf); - php_wddx_add_chunk_static(packet, WDDX_STRING_S); - php_wddx_add_chunk_ex(packet, ZSTR_VAL(class_name), ZSTR_LEN(class_name)); - php_wddx_add_chunk_static(packet, WDDX_STRING_E); - php_wddx_add_chunk_static(packet, WDDX_VAR_E); - - objhash = Z_OBJPROP_P(obj); - - ZEND_HASH_FOREACH_VAL(sleephash, varname) { - if (Z_TYPE_P(varname) != IS_STRING) { - php_error_docref(NULL, E_NOTICE, "__sleep should return an array only containing the names of instance-variables to serialize."); - continue; - } - - if ((ent = zend_hash_find(objhash, Z_STR_P(varname))) != NULL) { - php_wddx_serialize_var(packet, ent, Z_STR_P(varname)); - } - } ZEND_HASH_FOREACH_END(); - - php_wddx_add_chunk_static(packet, WDDX_STRUCT_E); - } - } else { - php_wddx_add_chunk_static(packet, WDDX_STRUCT_S); - snprintf(tmp_buf, WDDX_BUF_LEN, WDDX_VAR_S, PHP_CLASS_NAME_VAR); - php_wddx_add_chunk(packet, tmp_buf); - php_wddx_add_chunk_static(packet, WDDX_STRING_S); - php_wddx_add_chunk_ex(packet, ZSTR_VAL(class_name), ZSTR_LEN(class_name)); - php_wddx_add_chunk_static(packet, WDDX_STRING_E); - php_wddx_add_chunk_static(packet, WDDX_VAR_E); - - objhash = Z_OBJPROP_P(obj); - ZEND_HASH_FOREACH_KEY_VAL(objhash, idx, key, ent) { - if (ent == obj) { - continue; - } - if (key) { - const char *class_name, *prop_name; - size_t prop_name_len; - zend_string *tmp; - - zend_unmangle_property_name_ex(key, &class_name, &prop_name, &prop_name_len); - tmp = zend_string_init(prop_name, prop_name_len, 0); - php_wddx_serialize_var(packet, ent, tmp); - zend_string_release_ex(tmp, 0); - } else { - key = zend_long_to_str(idx); - php_wddx_serialize_var(packet, ent, key); - zend_string_release_ex(key, 0); - } - } ZEND_HASH_FOREACH_END(); - php_wddx_add_chunk_static(packet, WDDX_STRUCT_E); - } - - PHP_CLEANUP_CLASS_ATTRIBUTES(); - - zval_ptr_dtor(&fname); - zval_ptr_dtor(&retval); -} -/* }}} */ - -/* {{{ php_wddx_serialize_array - */ -static void php_wddx_serialize_array(wddx_packet *packet, zval *arr) -{ - zval *ent; - zend_string *key; - int is_struct = 0; - zend_ulong idx; - HashTable *target_hash; - char tmp_buf[WDDX_BUF_LEN]; - zend_ulong ind = 0; - - target_hash = Z_ARRVAL_P(arr); - ZEND_HASH_FOREACH_KEY(target_hash, idx, key) { - if (key) { - is_struct = 1; - break; - } - - if (idx != ind) { - is_struct = 1; - break; - } - ind++; - } ZEND_HASH_FOREACH_END(); - - if (is_struct) { - php_wddx_add_chunk_static(packet, WDDX_STRUCT_S); - } else { - snprintf(tmp_buf, sizeof(tmp_buf), WDDX_ARRAY_S, zend_hash_num_elements(target_hash)); - php_wddx_add_chunk(packet, tmp_buf); - } - - ZEND_HASH_FOREACH_KEY_VAL(target_hash, idx, key, ent) { - if (ent == arr) { - continue; - } - - if (is_struct) { - if (key) { - php_wddx_serialize_var(packet, ent, key); - } else { - key = zend_long_to_str(idx); - php_wddx_serialize_var(packet, ent, key); - zend_string_release_ex(key, 0); - } - } else { - php_wddx_serialize_var(packet, ent, NULL); - } - } ZEND_HASH_FOREACH_END(); - - if (is_struct) { - php_wddx_add_chunk_static(packet, WDDX_STRUCT_E); - } else { - php_wddx_add_chunk_static(packet, WDDX_ARRAY_E); - } -} -/* }}} */ - -/* {{{ php_wddx_serialize_var - */ -void php_wddx_serialize_var(wddx_packet *packet, zval *var, zend_string *name) -{ - HashTable *ht; - - if (name) { - char *tmp_buf; - zend_string *name_esc = php_escape_html_entities((unsigned char *) ZSTR_VAL(name), ZSTR_LEN(name), 0, ENT_QUOTES, NULL); - tmp_buf = emalloc(ZSTR_LEN(name_esc) + sizeof(WDDX_VAR_S)); - snprintf(tmp_buf, ZSTR_LEN(name_esc) + sizeof(WDDX_VAR_S), WDDX_VAR_S, ZSTR_VAL(name_esc)); - php_wddx_add_chunk(packet, tmp_buf); - efree(tmp_buf); - zend_string_release_ex(name_esc, 0); - } - - if (Z_TYPE_P(var) == IS_INDIRECT) { - var = Z_INDIRECT_P(var); - } - ZVAL_DEREF(var); - switch (Z_TYPE_P(var)) { - case IS_STRING: - php_wddx_serialize_string(packet, var); - break; - - case IS_LONG: - case IS_DOUBLE: - php_wddx_serialize_number(packet, var); - break; - - case IS_TRUE: - case IS_FALSE: - php_wddx_serialize_boolean(packet, var); - break; - - case IS_NULL: - php_wddx_serialize_unset(packet); - break; - - case IS_ARRAY: - ht = Z_ARRVAL_P(var); - if (Z_REFCOUNTED_P(var)) { - if (GC_IS_RECURSIVE(ht)) { - zend_throw_error(NULL, "WDDX doesn't support circular references"); - return; - } - GC_PROTECT_RECURSION(ht); - } - php_wddx_serialize_array(packet, var); - if (Z_REFCOUNTED_P(var)) { - GC_UNPROTECT_RECURSION(ht); - } - break; - - case IS_OBJECT: - ht = Z_OBJPROP_P(var); - if (GC_IS_RECURSIVE(ht)) { - zend_throw_error(NULL, "WDDX doesn't support circular references"); - return; - } - GC_PROTECT_RECURSION(ht); - php_wddx_serialize_object(packet, var); - GC_UNPROTECT_RECURSION(ht); - break; - } - - if (name) { - php_wddx_add_chunk_static(packet, WDDX_VAR_E); - } -} -/* }}} */ - -/* {{{ php_wddx_add_var - */ -static void php_wddx_add_var(wddx_packet *packet, zval *name_var) -{ - zval *val; - HashTable *target_hash; - - if (Z_TYPE_P(name_var) == IS_STRING) { - zend_array *symbol_table = zend_rebuild_symbol_table(); - if ((val = zend_hash_find(symbol_table, Z_STR_P(name_var))) != NULL) { - if (Z_TYPE_P(val) == IS_INDIRECT) { - val = Z_INDIRECT_P(val); - } - php_wddx_serialize_var(packet, val, Z_STR_P(name_var)); - } - } else if (Z_TYPE_P(name_var) == IS_ARRAY || Z_TYPE_P(name_var) == IS_OBJECT) { - int is_array = Z_TYPE_P(name_var) == IS_ARRAY; - - target_hash = HASH_OF(name_var); - - if (!Z_REFCOUNTED_P(name_var)) { - ZEND_HASH_FOREACH_VAL(target_hash, val) { - php_wddx_add_var(packet, val); - } ZEND_HASH_FOREACH_END(); - } else { - if (is_array) { - if (GC_IS_RECURSIVE(target_hash)) { - php_error_docref(NULL, E_WARNING, "recursion detected"); - return; - } - GC_PROTECT_RECURSION(target_hash); - } - ZEND_HASH_FOREACH_VAL(target_hash, val) { - ZVAL_DEREF(val); - php_wddx_add_var(packet, val); - - } ZEND_HASH_FOREACH_END(); - if (is_array) { - GC_UNPROTECT_RECURSION(target_hash); - } - } - } -} -/* }}} */ - -/* {{{ php_wddx_push_element - */ -static void php_wddx_push_element(void *user_data, const XML_Char *name, const XML_Char **atts) -{ - st_entry ent; - wddx_stack *stack = (wddx_stack *)user_data; - if (!strcmp((char *)name, EL_PACKET)) { - int i; - - if (atts) for (i=0; atts[i]; i++) { - if (!strcmp((char *)atts[i], EL_VERSION)) { - /* nothing for now */ - } - } - } else if (!strcmp((char *)name, EL_STRING)) { - ent.type = ST_STRING; - SET_STACK_VARNAME; - - ZVAL_STR(&ent.data, ZSTR_EMPTY_ALLOC()); - wddx_stack_push((wddx_stack *)stack, &ent, sizeof(st_entry)); - } else if (!strcmp((char *)name, EL_BINARY)) { - ent.type = ST_BINARY; - SET_STACK_VARNAME; - - ZVAL_STR(&ent.data, ZSTR_EMPTY_ALLOC()); - wddx_stack_push((wddx_stack *)stack, &ent, sizeof(st_entry)); - } else if (!strcmp((char *)name, EL_CHAR)) { - int i; - - if (atts) for (i = 0; atts[i]; i++) { - if (!strcmp((char *)atts[i], EL_CHAR_CODE) && atts[i+1] && atts[i+1][0]) { - char tmp_buf[2]; - - snprintf(tmp_buf, sizeof(tmp_buf), "%c", (char)strtol((char *)atts[i+1], NULL, 16)); - php_wddx_process_data(user_data, (XML_Char *) tmp_buf, strlen(tmp_buf)); - break; - } - } - } else if (!strcmp((char *)name, EL_NUMBER)) { - ent.type = ST_NUMBER; - SET_STACK_VARNAME; - - ZVAL_LONG(&ent.data, 0); - wddx_stack_push((wddx_stack *)stack, &ent, sizeof(st_entry)); - } else if (!strcmp((char *)name, EL_BOOLEAN)) { - int i; - - ent.type = ST_BOOLEAN; - SET_STACK_VARNAME; - if (atts) for (i = 0; atts[i]; i++) { - if (!strcmp((char *)atts[i], EL_VALUE) && atts[i+1] && atts[i+1][0]) { - ZVAL_TRUE(&ent.data); - wddx_stack_push((wddx_stack *)stack, &ent, sizeof(st_entry)); - php_wddx_process_data(user_data, atts[i+1], strlen((char *)atts[i+1])); - break; - } - } else { - ZVAL_FALSE(&ent.data); - wddx_stack_push((wddx_stack *)stack, &ent, sizeof(st_entry)); - } - } else if (!strcmp((char *)name, EL_NULL)) { - ent.type = ST_NULL; - SET_STACK_VARNAME; - - ZVAL_NULL(&ent.data); - - wddx_stack_push((wddx_stack *)stack, &ent, sizeof(st_entry)); - } else if (!strcmp((char *)name, EL_ARRAY)) { - ent.type = ST_ARRAY; - SET_STACK_VARNAME; - - array_init(&ent.data); - wddx_stack_push((wddx_stack *)stack, &ent, sizeof(st_entry)); - } else if (!strcmp((char *)name, EL_STRUCT)) { - ent.type = ST_STRUCT; - SET_STACK_VARNAME; - array_init(&ent.data); - wddx_stack_push((wddx_stack *)stack, &ent, sizeof(st_entry)); - } else if (!strcmp((char *)name, EL_VAR)) { - int i; - - if (atts) for (i = 0; atts[i]; i++) { - if (!strcmp((char *)atts[i], EL_NAME) && atts[i+1] && atts[i+1][0]) { - if (stack->varname) efree(stack->varname); - stack->varname = estrdup((char *)atts[i+1]); - break; - } - } - } else if (!strcmp((char *)name, EL_RECORDSET)) { - int i; - - ent.type = ST_RECORDSET; - SET_STACK_VARNAME; - array_init(&ent.data); - - if (atts) for (i = 0; atts[i]; i++) { - if (!strcmp((char *)atts[i], "fieldNames") && atts[i+1] && atts[i+1][0]) { - zval tmp; - char *key; - const char *p1, *p2, *endp; - - i++; - endp = (char *)atts[i] + strlen((char *)atts[i]); - p1 = (char *)atts[i]; - while ((p2 = php_memnstr(p1, ",", sizeof(",")-1, endp)) != NULL) { - key = estrndup(p1, p2 - p1); - array_init(&tmp); - add_assoc_zval_ex(&ent.data, key, p2 - p1, &tmp); - p1 = p2 + sizeof(",")-1; - efree(key); - } - - if (p1 <= endp) { - array_init(&tmp); - add_assoc_zval_ex(&ent.data, p1, endp - p1, &tmp); - } - - break; - } - } - - wddx_stack_push((wddx_stack *)stack, &ent, sizeof(st_entry)); - } else if (!strcmp((char *)name, EL_FIELD)) { - int i; - st_entry ent; - - ent.type = ST_FIELD; - ent.varname = NULL; - ZVAL_UNDEF(&ent.data); - - if (atts) for (i = 0; atts[i]; i++) { - if (!strcmp((char *)atts[i], EL_NAME) && atts[i+1] && atts[i+1][0]) { - st_entry *recordset; - zval *field; - - if (wddx_stack_top(stack, (void**)&recordset) == SUCCESS && - recordset->type == ST_RECORDSET && - (field = zend_hash_str_find(Z_ARRVAL(recordset->data), (char*)atts[i+1], strlen((char *)atts[i+1]))) != NULL) { - ZVAL_COPY_VALUE(&ent.data, field); - } - - break; - } - } - - wddx_stack_push((wddx_stack *)stack, &ent, sizeof(st_entry)); - } else if (!strcmp((char *)name, EL_DATETIME)) { - ent.type = ST_DATETIME; - SET_STACK_VARNAME; - - ZVAL_LONG(&ent.data, 0); - wddx_stack_push((wddx_stack *)stack, &ent, sizeof(st_entry)); - } -} -/* }}} */ - -/* {{{ php_wddx_pop_element - */ -static void php_wddx_pop_element(void *user_data, const XML_Char *name) -{ - st_entry *ent1, *ent2; - wddx_stack *stack = (wddx_stack *)user_data; - HashTable *target_hash; - zend_class_entry *pce; - zval obj; - -/* OBJECTS_FIXME */ - if (stack->top == 0) { - return; - } - - if (!strcmp((char *)name, EL_STRING) || !strcmp((char *)name, EL_NUMBER) || - !strcmp((char *)name, EL_BOOLEAN) || !strcmp((char *)name, EL_NULL) || - !strcmp((char *)name, EL_ARRAY) || !strcmp((char *)name, EL_STRUCT) || - !strcmp((char *)name, EL_RECORDSET) || !strcmp((char *)name, EL_BINARY) || - !strcmp((char *)name, EL_DATETIME)) { - wddx_stack_top(stack, (void**)&ent1); - - if (Z_TYPE(ent1->data) == IS_UNDEF) { - if (stack->top > 1) { - stack->top--; - efree(ent1); - } else { - stack->done = 1; - } - return; - } - - if (!strcmp((char *)name, EL_BINARY)) { - zend_string *new_str = NULL; - - if (ZSTR_EMPTY_ALLOC() != Z_STR(ent1->data)) { - new_str = php_base64_decode( - (unsigned char *)Z_STRVAL(ent1->data), Z_STRLEN(ent1->data)); - } - - zval_ptr_dtor(&ent1->data); - if (new_str) { - ZVAL_STR(&ent1->data, new_str); - } else { - ZVAL_EMPTY_STRING(&ent1->data); - } - } - - /* Call __wakeup() method on the object. */ - if (Z_TYPE(ent1->data) == IS_OBJECT) { - zval fname, retval; - - ZVAL_STRING(&fname, "__wakeup"); - - call_user_function(NULL, &ent1->data, &fname, &retval, 0, 0); - - zval_ptr_dtor(&fname); - zval_ptr_dtor(&retval); - } - - if (stack->top > 1) { - stack->top--; - wddx_stack_top(stack, (void**)&ent2); - - /* if non-existent field */ - if (Z_ISUNDEF(ent2->data)) { - zval_ptr_dtor(&ent1->data); - efree(ent1); - return; - } - - if (Z_TYPE(ent2->data) == IS_ARRAY || Z_TYPE(ent2->data) == IS_OBJECT) { - target_hash = HASH_OF(&ent2->data); - - if (ent1->varname) { - if (!strcmp(ent1->varname, PHP_CLASS_NAME_VAR) && - Z_TYPE(ent1->data) == IS_STRING && Z_STRLEN(ent1->data) && - ent2->type == ST_STRUCT && Z_TYPE(ent2->data) == IS_ARRAY) { - zend_bool incomplete_class = 0; - - zend_str_tolower(Z_STRVAL(ent1->data), Z_STRLEN(ent1->data)); - zend_string_forget_hash_val(Z_STR(ent1->data)); - if ((pce = zend_hash_find_ptr(EG(class_table), Z_STR(ent1->data))) == NULL) { - incomplete_class = 1; - pce = PHP_IC_ENTRY; - } - - if (pce != PHP_IC_ENTRY && (pce->serialize || pce->unserialize)) { - zval_ptr_dtor(&ent2->data); - ZVAL_UNDEF(&ent2->data); - php_error_docref(NULL, E_WARNING, "Class %s can not be unserialized", Z_STRVAL(ent1->data)); - } else { - /* Initialize target object */ - if (object_init_ex(&obj, pce) != SUCCESS || EG(exception)) { - zval_ptr_dtor(&ent2->data); - ZVAL_UNDEF(&ent2->data); - php_error_docref(NULL, E_WARNING, "Class %s can not be instantiated", Z_STRVAL(ent1->data)); - } else { - /* Merge current hashtable with object's default properties */ - zend_hash_merge(Z_OBJPROP(obj), - Z_ARRVAL(ent2->data), - zval_add_ref, 0); - - if (incomplete_class) { - php_store_class_name(&obj, Z_STRVAL(ent1->data), Z_STRLEN(ent1->data)); - } - - /* Clean up old array entry */ - zval_ptr_dtor(&ent2->data); - - /* Set stack entry to point to the newly created object */ - ZVAL_COPY_VALUE(&ent2->data, &obj); - } - } - - /* Clean up class name var entry */ - zval_ptr_dtor(&ent1->data); - } else if (Z_TYPE(ent2->data) == IS_OBJECT) { - zend_update_property(Z_OBJCE(ent2->data), &ent2->data, ent1->varname, strlen(ent1->varname), &ent1->data); - Z_TRY_DELREF(ent1->data); - } else { - zend_symtable_str_update(target_hash, ent1->varname, strlen(ent1->varname), &ent1->data); - } - efree(ent1->varname); - } else { - zend_hash_next_index_insert(target_hash, &ent1->data); - } - } - efree(ent1); - } else { - stack->done = 1; - } - } else if (!strcmp((char *)name, EL_VAR) && stack->varname) { - efree(stack->varname); - stack->varname = NULL; - } else if (!strcmp((char *)name, EL_FIELD)) { - st_entry *ent; - wddx_stack_top(stack, (void **)&ent); - efree(ent); - stack->top--; - } -} -/* }}} */ - -/* {{{ php_wddx_process_data - */ -static void php_wddx_process_data(void *user_data, const XML_Char *s, int len) -{ - st_entry *ent; - wddx_stack *stack = (wddx_stack *)user_data; - - if (!wddx_stack_is_empty(stack) && !stack->done) { - wddx_stack_top(stack, (void**)&ent); - switch (ent->type) { - case ST_BINARY: - case ST_STRING: - if (Z_STRLEN(ent->data) == 0) { - zval_ptr_dtor(&ent->data); - ZVAL_STRINGL(&ent->data, (char *)s, len); - } else { - Z_STR(ent->data) = zend_string_extend(Z_STR(ent->data), Z_STRLEN(ent->data) + len, 0); - memcpy(Z_STRVAL(ent->data) + Z_STRLEN(ent->data) - len, (char *)s, len); - Z_STRVAL(ent->data)[Z_STRLEN(ent->data)] = '\0'; - } - break; - case ST_NUMBER: - ZVAL_STRINGL(&ent->data, (char *)s, len); - convert_scalar_to_number(&ent->data); - break; - - case ST_BOOLEAN: - if (!strcmp((char *)s, "true")) { - ZVAL_TRUE(&ent->data); - } else if (!strcmp((char *)s, "false")) { - ZVAL_FALSE(&ent->data); - } else { - zval_ptr_dtor(&ent->data); - if (ent->varname) { - efree(ent->varname); - ent->varname = NULL; - } - ZVAL_UNDEF(&ent->data); - } - break; - - case ST_DATETIME: { - zend_string *str; - - if (Z_TYPE(ent->data) == IS_STRING) { - str = zend_string_safe_alloc(Z_STRLEN(ent->data), 1, len, 0); - memcpy(ZSTR_VAL(str), Z_STRVAL(ent->data), Z_STRLEN(ent->data)); - memcpy(ZSTR_VAL(str) + Z_STRLEN(ent->data), s, len); - ZSTR_VAL(str)[ZSTR_LEN(str)] = '\0'; - zval_ptr_dtor_str(&ent->data); - } else { - str = zend_string_init((char *)s, len, 0); - } - - ZVAL_LONG(&ent->data, php_parse_date(ZSTR_VAL(str), NULL)); - /* date out of range < 1969 or > 2038 */ - if (Z_LVAL(ent->data) == -1) { - ZVAL_STR_COPY(&ent->data, str); - } - - zend_string_release_ex(str, 0); - } - break; - - default: - break; - } - } -} -/* }}} */ - -/* {{{ php_wddx_deserialize_ex - */ -int php_wddx_deserialize_ex(const char *value, size_t vallen, zval *return_value) -{ - wddx_stack stack; - XML_Parser parser; - st_entry *ent; - int retval; - - wddx_stack_init(&stack); - parser = XML_ParserCreate((XML_Char *) "UTF-8"); - - XML_SetUserData(parser, &stack); - XML_SetElementHandler(parser, php_wddx_push_element, php_wddx_pop_element); - XML_SetCharacterDataHandler(parser, php_wddx_process_data); - - /* XXX value should be parsed in the loop to exhaust size_t */ - XML_Parse(parser, (const XML_Char *) value, (int)vallen, 1); - - XML_ParserFree(parser); - - if (stack.top == 1) { - wddx_stack_top(&stack, (void**)&ent); - if (Z_ISUNDEF(ent->data)) { - retval = FAILURE; - } else { - ZVAL_COPY(return_value, &ent->data); - retval = SUCCESS; - } - } else { - retval = FAILURE; - } - - wddx_stack_destroy(&stack); - - return retval; -} -/* }}} */ - -/* {{{ proto string wddx_serialize_value(mixed var [, string comment]) - Creates a new packet and serializes the given value */ -PHP_FUNCTION(wddx_serialize_value) -{ - zval *var; - char *comment = NULL; - size_t comment_len = 0; - wddx_packet *packet; - - if (zend_parse_parameters(ZEND_NUM_ARGS(), "z|s", &var, &comment, &comment_len) == FAILURE) { - return; - } - - packet = php_wddx_constructor(); - - php_wddx_packet_start(packet, comment, comment_len); - php_wddx_serialize_var(packet, var, NULL); - php_wddx_packet_end(packet); - smart_str_0(packet); - - RETVAL_STR_COPY(packet->s); - php_wddx_destructor(packet); -} -/* }}} */ - -/* {{{ proto string wddx_serialize_vars(mixed var_name [, mixed ...]) - Creates a new packet and serializes given variables into a struct */ -PHP_FUNCTION(wddx_serialize_vars) -{ - int num_args, i; - wddx_packet *packet; - zval *args = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS(), "+", &args, &num_args) == FAILURE) { - return; - } - - packet = php_wddx_constructor(); - - php_wddx_packet_start(packet, NULL, 0); - php_wddx_add_chunk_static(packet, WDDX_STRUCT_S); - - for (i=0; is); - php_wddx_destructor(packet); -} -/* }}} */ - -/* {{{ php_wddx_constructor - */ -wddx_packet *php_wddx_constructor(void) -{ - smart_str *packet; - - packet = ecalloc(1, sizeof(smart_str)); - - return packet; -} -/* }}} */ - -/* {{{ php_wddx_destructor - */ -void php_wddx_destructor(wddx_packet *packet) -{ - smart_str_free(packet); - efree(packet); -} -/* }}} */ - -/* {{{ proto resource wddx_packet_start([string comment]) - Starts a WDDX packet with optional comment and returns the packet id */ -PHP_FUNCTION(wddx_packet_start) -{ - char *comment = NULL; - size_t comment_len = 0; - wddx_packet *packet; - - comment = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS(), "|s", &comment, &comment_len) == FAILURE) { - return; - } - - packet = php_wddx_constructor(); - - php_wddx_packet_start(packet, comment, comment_len); - php_wddx_add_chunk_static(packet, WDDX_STRUCT_S); - - RETURN_RES(zend_register_resource(packet, le_wddx)); -} -/* }}} */ - -/* {{{ proto string wddx_packet_end(resource packet_id) - Ends specified WDDX packet and returns the string containing the packet */ -PHP_FUNCTION(wddx_packet_end) -{ - zval *packet_id; - wddx_packet *packet = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &packet_id) == FAILURE) { - return; - } - - if ((packet = (wddx_packet *)zend_fetch_resource(Z_RES_P(packet_id), "WDDX packet ID", le_wddx)) == NULL) { - RETURN_FALSE; - } - - php_wddx_add_chunk_static(packet, WDDX_STRUCT_E); - - php_wddx_packet_end(packet); - smart_str_0(packet); - - RETVAL_STR_COPY(packet->s); - - zend_list_close(Z_RES_P(packet_id)); -} -/* }}} */ - -/* {{{ proto bool wddx_add_vars(resource packet_id, mixed var_names [, mixed ...]) - Serializes given variables and adds them to packet given by packet_id */ -PHP_FUNCTION(wddx_add_vars) -{ - int num_args, i; - zval *args = NULL; - zval *packet_id; - wddx_packet *packet = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS(), "r+", &packet_id, &args, &num_args) == FAILURE) { - return; - } - - if ((packet = (wddx_packet *)zend_fetch_resource(Z_RES_P(packet_id), "WDDX packet ID", le_wddx)) == NULL) { - RETURN_FALSE; - } - - for (i=0; i