diff options
-rw-r--r-- | sapi/phpdbg/config.m4 | 6 | ||||
-rw-r--r-- | sapi/phpdbg/config.w32 | 5 | ||||
-rw-r--r-- | sapi/phpdbg/phpdbg_wait.c | 13 | ||||
-rw-r--r-- | sapi/phpdbg/phpdbg_webdata_transfer.c | 19 |
4 files changed, 25 insertions, 18 deletions
diff --git a/sapi/phpdbg/config.m4 b/sapi/phpdbg/config.m4 index b8aa8526c5..87d38ea8c5 100644 --- a/sapi/phpdbg/config.m4 +++ b/sapi/phpdbg/config.m4 @@ -25,11 +25,7 @@ if test "$BUILD_PHPDBG" == "" && test "$PHP_PHPDBG" != "no"; then if ! test -d $abs_srcdir/ext/phpdbg_webhelper; then ln -s ../sapi/phpdbg $abs_srcdir/ext/phpdbg_webhelper fi - if test "$PHP_JSON" != "no"; then - PHP_NEW_EXTENSION(phpdbg_webhelper, phpdbg_rinit_hook.c phpdbg_webdata_transfer.c, $ext_shared) - else - AC_MSG_ERROR(Webhelper extension of phpdbg needs json enabled) - fi + PHP_NEW_EXTENSION(phpdbg_webhelper, phpdbg_rinit_hook.c phpdbg_webdata_transfer.c, $ext_shared) fi PHP_PHPDBG_CFLAGS="-D_GNU_SOURCE" diff --git a/sapi/phpdbg/config.w32 b/sapi/phpdbg/config.w32 index 6f0bd8f811..651c7e6d16 100644 --- a/sapi/phpdbg/config.w32 +++ b/sapi/phpdbg/config.w32 @@ -1,5 +1,6 @@ ARG_ENABLE('phpdbg', 'Build phpdbg', 'no'); ARG_ENABLE('phpdbgs', 'Build phpdbg shared', 'no'); +ARG_ENABLE('phpdbgwebhelper', 'Build phpdbg webhelper', 'yes'); PHPDBG_SOURCES='phpdbg.c phpdbg_prompt.c phpdbg_cmd.c phpdbg_info.c phpdbg_help.c phpdbg_break.c ' + 'phpdbg_print.c phpdbg_bp.c phpdbg_opcode.c phpdbg_list.c phpdbg_utils.c ' + @@ -14,6 +15,10 @@ if (PHP_PHPDBG == "yes") { ADD_FLAG("LIBS_PHPDBG", "ws2_32.lib user32.lib"); ADD_FLAG("CFLAGS_PHPDBG", "/D YY_NO_UNISTD_H"); ADD_FLAG("LDFLAGS_PHPDBG", "/stack:8388608"); + + if (PHP_PHPDBGWEBHELPER == "yes") { + EXTENSION('phpdbg-webhelper', 'phpdbg_rinit_hook.c phpdbg_webdata_compress.c'); + } } if (PHP_PHPDBGS == "yes") { diff --git a/sapi/phpdbg/phpdbg_wait.c b/sapi/phpdbg/phpdbg_wait.c index 9051ca379f..68ccf6c123 100644 --- a/sapi/phpdbg/phpdbg_wait.c +++ b/sapi/phpdbg/phpdbg_wait.c @@ -18,7 +18,7 @@ #include "phpdbg_wait.h" #include "phpdbg_prompt.h" -#include "ext/json/JSON_parser.h" +#include "ext/standard/php_var.h" #include "ext/standard/basic_functions.h" ZEND_EXTERN_MODULE_GLOBALS(phpdbg); @@ -126,16 +126,18 @@ static int phpdbg_array_intersect(phpdbg_intersect_ptr *info, zval **ptr) { } void phpdbg_webdata_decompress(char *msg, int len TSRMLS_DC) { -#ifdef HAVE_JSON zval *free_zv = NULL; zval zv, *zvp; HashTable *ht; - php_json_decode(&zv, msg, len, 1, 1000 /* enough */ TSRMLS_CC); + php_unserialize_data_t var_hash; - if (JSON_G(error_code) != PHP_JSON_ERROR_NONE) { - phpdbg_error("wait", "type=\"invaliddata\" import=\"fail\"", "Malformed JSON was sent to this socket, arborting"); + PHP_VAR_UNSERIALIZE_INIT(var_hash); + if (!php_var_unserialize(&zv, (const unsigned char **) &msg, (unsigned char *) msg + len, &var_hash TSRMLS_CC)) { + PHP_VAR_UNSERIALIZE_DESTROY(var_hash); + phpdbg_error("wait", "type=\"invaliddata\" import=\"fail\"", "Malformed serialized was sent to this socket, arborting"); return; } + PHP_VAR_UNSERIALIZE_DESTROY(var_hash); ht = Z_ARRVAL(zv); @@ -339,7 +341,6 @@ void phpdbg_webdata_decompress(char *msg, int len TSRMLS_DC) { /* Reapply raw input */ /* ??? */ -#endif } PHPDBG_COMMAND(wait) /* {{{ */ diff --git a/sapi/phpdbg/phpdbg_webdata_transfer.c b/sapi/phpdbg/phpdbg_webdata_transfer.c index 2f18b9d082..5ce6759062 100644 --- a/sapi/phpdbg/phpdbg_webdata_transfer.c +++ b/sapi/phpdbg/phpdbg_webdata_transfer.c @@ -17,7 +17,7 @@ */ #include "phpdbg_webdata_transfer.h" -#include "ext/json/php_json.h" +#include "ext/standard/php_var.h" static int phpdbg_is_auto_global(char *name, int len TSRMLS_DC) { int ret; @@ -28,8 +28,6 @@ static int phpdbg_is_auto_global(char *name, int len TSRMLS_DC) { } PHPDBG_API void phpdbg_webdata_compress(char **msg, int *len TSRMLS_DC) { -#ifdef HAVE_JSON - smart_str buf = {0}; zval array; HashTable *ht; zval zv[9] = {{{0}}}; @@ -162,9 +160,16 @@ PHPDBG_API void phpdbg_webdata_compress(char **msg, int *len TSRMLS_DC) { } /* encode data */ - php_json_encode(&buf, &array, 0 TSRMLS_CC); - *msg = buf.s->val; - *len = buf.s->len; + { + php_serialize_data_t var_hash; + smart_str buf = {0}; + + PHP_VAR_SERIALIZE_INIT(var_hash); + php_var_serialize(&buf, &array, &var_hash TSRMLS_CC); + PHP_VAR_SERIALIZE_DESTROY(var_hash); + *msg = buf.s->val; + *len = buf.s->len; + } + zval_dtor(&array); -#endif } |