diff options
author | Ondřej Surý <ondrej@sury.org> | 2014-08-01 11:17:55 +0200 |
---|---|---|
committer | Ondřej Surý <ondrej@sury.org> | 2014-08-01 11:17:55 +0200 |
commit | 76834325398bedd69d82072e128254f8a465cd10 (patch) | |
tree | 1b49048a71eeda7d307b91e693e04e72a9786be7 | |
parent | fd434c1ba544e3756938312c714ef96b47ff24c2 (diff) | |
parent | b60f6e95a473d1ae97fdf20cec4cfefc06b24ec2 (diff) | |
download | php-76834325398bedd69d82072e128254f8a465cd10.tar.gz |
Merge tag 'upstream/5.6.0_rc3+dfsg' into master-5.6
Upstream version 5.6.0~rc3+dfsg
99 files changed, 3051 insertions, 13004 deletions
diff --git a/.gitattributes b/.gitattributes index 79b218fcb..091043a35 100644 --- a/.gitattributes +++ b/.gitattributes @@ -22,6 +22,10 @@ sapi/nsapi/nsapi.c ident sapi/continuity/capi.c ident Zend/RFCs/002.txt ident Zend/RFCs/003.txt ident +ext/exif/exif.c ident +ext/ldap/ldap.c ident +ext/pdo_pgsql/pdo_pgsql.c ident +ext/tidy/tidy.c ident NEWS merge=NEWS UPGRADING merge=NEWS UPGRADING.INTERNALS merge=NEWS diff --git a/.travis.yml b/.travis.yml index 8c72df918..2125e8d3d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,6 +8,9 @@ notifications: email: on_failure: change +cache: + - apt + env: global: - MYSQL_TEST_HOST=127.0.0.1 @@ -21,6 +24,12 @@ env: - ENABLE_MAINTAINER_ZTS=0 ENABLE_DEBUG=0 - ENABLE_MAINTAINER_ZTS=1 ENABLE_DEBUG=1 +before_install: + - sudo apt-get update -qq + - sudo apt-get install -y libenchant-dev libaspell-dev libpspell-dev librecode-dev + - sudo cp ./travis/de /var/lib/locales/supported.d/de + - sudo dpkg-reconfigure locales + before_script: # Compile PHP - ./travis/compile.sh @@ -1,16 +1,95 @@ PHP NEWS ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| +31 Jul 2014, PHP 5.6.0 Release Candidate 3 + +- Core: + . Fixed bug #67497 (eval with parse error causes segmentation fault in + generator). (Nikita) + . Fixed bug #67151 (strtr with empty array crashes). (Nikita) + . Fixed bug #67407 (Windows 8.1/Server 2012 R2 reported as Windows 8/Server + 2012). (Christian Wenz) + . Fixed bug #66608 (Incorrect behavior with nested "finally" blocks). + (Laruence, Dmitry) + . Implemented FR #34407 (ucwords and Title Case). (Tjerk) + +- COM: + . Fixed missing type checks in com_event_sink (Yussuf Khalil, Stas). + +- CLI server: + . Fixed bug #66830 (Empty header causes PHP built-in web server to hang). + (Adam) + . Fixed bug #67594 (Unable to access to apache_request_headers() elements). + (Tjerk) + +- FPM: + . Fixed bug #67530 (error_log=syslog ignored). (Remi) + . Fixed bug #67635 (php links to systemd libraries without using pkg-config). + (pacho@gentoo.org, Remi) + +- Intl: + . Fixed bug #66921 (Wrong argument type hint for function + intltz_from_date_time_zone). (Stas) + . Fixed bug #67052 (NumberFormatter::parse() resets LC_NUMERIC setting). + (Stas) + +- pgsql: + . Fixed bug #67555 (Cannot build against libpq 7.3). (Adam) + +- ODBC: + . Fixed bug #60616 (odbc_fetch_into returns junk at end of multi-byte char + fields). (Keyur Govande) + +- OpenSSL: + . Fixed missing type checks in OpenSSL options (Yussuf Khalil, Stas). + . Fixed bug #67609 (TLS connections fail behind HTTP proxy). (Daniel Lowrey) + . Fixed broken build against OpenSSL older than 0.9.8 where ECDH unavailable. + (Lior Kaplan) + . Fixed bug #67666 (Subject altNames doesn't support wildcard matching). (Tjerk) + +- Phar: + . Fixed bug #67587 (Redirection loop on nginx with FPM). (Christian Weiske) + +- readline: + . Fixed bug #55496 (Interactive mode doesn't force a newline before the + prompt). (Bob, Johannes) + . Fixed bug #67496 (Save command history when exiting interactive shell + with control-c). (Dmitry Saprykin, Johannes) + +- Reflection: + . Implemented FR #67713 (loosen the restrictions on + ReflectionClass::newInstanceWithoutConstructor()). (Ferenc) + +- SPL: + . Fixed bug #67539 (ArrayIterator use-after-free due to object change during + sorting). (research at insighti dot org, Laruence) + . Fixed bug #67538 (SPL Iterators use-after-free). (CVE-2014-4670) (Laruence) + +- Session: + . Fixed missing type checks in php_session_create_id (Yussuf Khalil, Stas). + . Fixed bug #66827 (Session raises E_NOTICE when session name variable is array). + (Yasuo) + +- OPCache: + . Fixed bug #67215 (php-cgi work with opcache, may be segmentation fault + happen) (Dmitry, Laruence) + +- phpdbg + . Fixed bug #67575 (Compilation fails for phpdbg when the + build directory != src directory). (Andy Thompson) + 03 Jul 2014, PHP 5.6.0 Release Candidate 2 - Core: + . Fixed bug #67091 (make install fails to install libphp5.so on FreeBSD 10.0). + (Ferenc) . Fixed bug #67368 (Memory leak with immediately dereferenced array in class constant). (Laruence) . Fixed bug #67468 (Segfault in highlight_file()/highlight_string()). (Andreas Ferber) - . Fixed bug #67091 (make install fails to install libphp5.so on FreeBSD 10.0). - (Ferenc) . Fixed bug #67498 (phpinfo() Type Confusion Information Leak Vulnerability). (Stefan Esser) + . Fixed bug #67551 (php://input temp file will be located in sys_temp_dir + instead of upload_tmp_dir). (Mike) - FPM: . Fix bug #67531 (syslog cannot be set in pool configuration). (Remi) diff --git a/Zend/tests/bug66608.phpt b/Zend/tests/bug66608.phpt new file mode 100644 index 000000000..5a499a1da --- /dev/null +++ b/Zend/tests/bug66608.phpt @@ -0,0 +1,73 @@ +--TEST-- +Bug #66608 (Incorrect behavior with nested "finally" blocks) +--FILE-- +<?php +function bar() { + try { + echo "1\n"; + try { + } finally { + try { + } finally { + } + echo "2\n"; + } + } finally { + try { + throw new Exception (""); + } catch (Exception $ab) { + echo "3\n"; + } finally { + try { + } finally { + echo "4\n"; + try { + } finally { + } + echo "5\n"; + } + } + echo "6\n"; + try { + } finally { + while (1) { + try { + echo "7\n"; + break; + } finally { + echo "8\n"; + } + echo "bad"; + } + echo "9\n"; + while (1) { + try { + throw new Exception(""); + } catch(Exception $e) { + echo "10\n"; + break; + } finally { + echo "11\n"; + } + echo "bak\n"; + } + } + echo "12\n"; + } + echo "13\n"; +} +bar(); +--EXPECT-- +1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 diff --git a/Zend/tests/constant_expressions_arrays.phpt b/Zend/tests/constant_expressions_arrays.phpt new file mode 100644 index 000000000..061fcc6a9 --- /dev/null +++ b/Zend/tests/constant_expressions_arrays.phpt @@ -0,0 +1,35 @@ +--TEST-- +Constant expressions with arrays +--FILE-- +<?php +const a = [1,2,[3,[4]]]; +const b = a[0]; +const c = a[2][0]; +const d = a[2]; +const e = ["string" => [1]]["string"][0]; + +var_dump(b, c, e); + +function test ($a = d[1][0]) { + var_dump($a); +} + +test(); + +class foo { + const bar = [1][0]; +} + +var_dump(foo::bar); + +var_dump(a); // Eventually allow that later with array dereferencing of constants + +?> +--EXPECTF-- +int(1) +int(3) +int(1) +int(4) +int(1) + +Fatal error: Arrays are not allowed in constants at run-time in %s on line %d diff --git a/Zend/tests/constant_expressions_self_referencing_array.phpt b/Zend/tests/constant_expressions_self_referencing_array.phpt new file mode 100644 index 000000000..ae76a0860 --- /dev/null +++ b/Zend/tests/constant_expressions_self_referencing_array.phpt @@ -0,0 +1,13 @@ +--TEST-- +Self-referencing constant expression (part of a constant AST) +--FILE-- +<?php +class A { + const FOO = [self::BAR]; + const BAR = [self::FOO]; +} +var_dump(A::FOO); +?> +--EXPECTF-- +Fatal error: Cannot declare self-referencing constant 'self::FOO' in %s on line %d + diff --git a/Zend/tests/generators/bug67497.phpt b/Zend/tests/generators/bug67497.phpt new file mode 100644 index 000000000..483857b96 --- /dev/null +++ b/Zend/tests/generators/bug67497.phpt @@ -0,0 +1,19 @@ +--TEST-- +Bug #67467: eval with parse error causes segmentation fault in generator +--FILE-- +<?php + +function gen() { + $a = 1; + yield $a; +} + +@eval('abc'); + +$values = gen(); +$values->next(); + +?> +===DONE=== +--EXPECT-- +===DONE=== diff --git a/Zend/tests/try_finally_011.phpt b/Zend/tests/try_finally_011.phpt new file mode 100644 index 000000000..7aa3f35fe --- /dev/null +++ b/Zend/tests/try_finally_011.phpt @@ -0,0 +1,15 @@ +--TEST-- +Try finally (segfault with empty break) +--FILE-- +<?php +function foo () { + try { + break; + } finally { + } +} + +foo(); +?> +--EXPECTF-- +Fatal error: Cannot break/continue 1 level in %stry_finally_011.php on line %d diff --git a/Zend/zend_ast.c b/Zend/zend_ast.c index 12f940552..a7df0adba 100644 --- a/Zend/zend_ast.c +++ b/Zend/zend_ast.c @@ -251,10 +251,19 @@ ZEND_API void zend_ast_evaluate(zval *result, zend_ast *ast, zend_class_entry *s zval_dtor(&op2); break; case ZEND_CONST: - *result = *ast->u.val; - zval_copy_ctor(result); - if (IS_CONSTANT_TYPE(Z_TYPE_P(result))) { - zval_update_constant_ex(&result, 1, scope TSRMLS_CC); + /* class constants may be updated in-place */ + if (scope) { + if (IS_CONSTANT_TYPE(Z_TYPE_P(ast->u.val))) { + zval_update_constant_ex(&ast->u.val, 1, scope TSRMLS_CC); + } + *result = *ast->u.val; + zval_copy_ctor(result); + } else { + *result = *ast->u.val; + zval_copy_ctor(result); + if (IS_CONSTANT_TYPE(Z_TYPE_P(result))) { + zval_update_constant_ex(&result, 1, scope TSRMLS_CC); + } } break; case ZEND_BOOL_AND: diff --git a/Zend/zend_compile.h b/Zend/zend_compile.h index 99d3704b7..f86a41ae2 100644 --- a/Zend/zend_compile.h +++ b/Zend/zend_compile.h @@ -864,6 +864,9 @@ int zend_add_literal(zend_op_array *op_array, const zval *zv TSRMLS_DC); #define ZEND_FAST_RET_TO_CATCH 1 #define ZEND_FAST_RET_TO_FINALLY 2 +#define ZEND_FAST_CALL_FROM_CATCH 1 +#define ZEND_FAST_CALL_FROM_FINALLY 2 + END_EXTERN_C() #define ZEND_CLONE_FUNC_NAME "__clone" diff --git a/Zend/zend_generators.c b/Zend/zend_generators.c index 7d7c33071..2b4a8c9a1 100644 --- a/Zend/zend_generators.c +++ b/Zend/zend_generators.c @@ -125,6 +125,7 @@ ZEND_API void zend_generator_close(zend_generator *generator, zend_bool finished /* A fatal error / die occurred during the generator execution. Trying to clean * up the stack may not be safe in this case. */ if (CG(unclean_shutdown)) { + generator->execute_data = NULL; return; } diff --git a/Zend/zend_opcode.c b/Zend/zend_opcode.c index 457f08f31..bff314ef6 100644 --- a/Zend/zend_opcode.c +++ b/Zend/zend_opcode.c @@ -509,6 +509,49 @@ static void zend_check_finally_breakout(zend_op_array *op_array, zend_uint op_nu } } +static void zend_adjust_fast_call(zend_op_array *op_array, zend_uint fast_call, zend_uint start, zend_uint end TSRMLS_DC) +{ + int i; + zend_uint op_num = 0; + + for (i = 0; i < op_array->last_try_catch; i++) { + if (op_array->try_catch_array[i].finally_op > start + && op_array->try_catch_array[i].finally_end < end) { + op_num = op_array->try_catch_array[i].finally_op; + start = op_array->try_catch_array[i].finally_end; + } + } + + if (op_num) { + /* Must be ZEND_FAST_CALL */ + ZEND_ASSERT(op_array->opcodes[op_num - 2].opcode == ZEND_FAST_CALL); + op_array->opcodes[op_num - 2].extended_value = ZEND_FAST_CALL_FROM_FINALLY; + op_array->opcodes[op_num - 2].op2.opline_num = fast_call; + } +} + +static void zend_resolve_fast_call(zend_op_array *op_array, zend_uint fast_call, zend_uint op_num TSRMLS_DC) +{ + int i; + zend_uint finally_op_num = 0; + + for (i = 0; i < op_array->last_try_catch; i++) { + if (op_num >= op_array->try_catch_array[i].finally_op + && op_num < op_array->try_catch_array[i].finally_end) { + finally_op_num = op_array->try_catch_array[i].finally_op; + } + } + + if (finally_op_num) { + /* Must be ZEND_FAST_CALL */ + ZEND_ASSERT(op_array->opcodes[finally_op_num - 2].opcode == ZEND_FAST_CALL); + if (op_array->opcodes[fast_call].extended_value == 0) { + op_array->opcodes[fast_call].extended_value = ZEND_FAST_CALL_FROM_FINALLY; + op_array->opcodes[fast_call].op2.opline_num = finally_op_num - 2; + } + } +} + static void zend_resolve_finally_call(zend_op_array *op_array, zend_uint op_num, zend_uint dst_num TSRMLS_DC) { zend_uint start_op; @@ -536,11 +579,23 @@ static void zend_resolve_finally_call(zend_op_array *op_array, zend_uint op_num, opline->opcode = ZEND_FAST_CALL; SET_UNUSED(opline->op1); SET_UNUSED(opline->op2); - opline->op1.opline_num = op_array->try_catch_array[i].finally_op; + zend_adjust_fast_call(op_array, start_op, + op_array->try_catch_array[i].finally_op, + op_array->try_catch_array[i].finally_end TSRMLS_CC); if (op_array->try_catch_array[i].catch_op) { - opline->extended_value = 1; + opline->extended_value = ZEND_FAST_CALL_FROM_CATCH; opline->op2.opline_num = op_array->try_catch_array[i].catch_op; + opline->op1.opline_num = get_next_op_number(op_array); + /* generate a FAST_CALL to hole CALL_FROM_FINALLY */ + opline = get_next_op(op_array TSRMLS_CC); + opline->opcode = ZEND_FAST_CALL; + SET_UNUSED(opline->op1); + SET_UNUSED(opline->op2); + zend_resolve_fast_call(op_array, start_op + 1, op_array->try_catch_array[i].finally_op - 2 TSRMLS_CC); + } else { + zend_resolve_fast_call(op_array, start_op, op_array->try_catch_array[i].finally_op - 2 TSRMLS_CC); } + opline->op1.opline_num = op_array->try_catch_array[i].finally_op; /* generate a sequence of FAST_CALL to upward finally block */ while (i > 0) { @@ -605,10 +660,10 @@ static void zend_resolve_finally_ret(zend_op_array *op_array, zend_uint op_num T static void zend_resolve_finally_calls(zend_op_array *op_array TSRMLS_DC) { - zend_uint i; + zend_uint i, j; zend_op *opline; - for (i = 0; i < op_array->last; i++) { + for (i = 0, j = op_array->last; i < j; i++) { opline = op_array->opcodes + i; switch (opline->opcode) { case ZEND_RETURN: @@ -623,15 +678,16 @@ static void zend_resolve_finally_calls(zend_op_array *op_array TSRMLS_DC) zend_brk_cont_element *jmp_to; nest_levels = Z_LVAL(op_array->literals[opline->op2.constant].constant); - array_offset = opline->op1.opline_num; - do { - jmp_to = &op_array->brk_cont_array[array_offset]; - if (nest_levels > 1) { - array_offset = jmp_to->parent; - } - } while (--nest_levels > 0); - zend_resolve_finally_call(op_array, i, opline->opcode == ZEND_BRK ? jmp_to->brk : jmp_to->cont TSRMLS_CC); - break; + if ((array_offset = opline->op1.opline_num) != -1) { + do { + jmp_to = &op_array->brk_cont_array[array_offset]; + if (nest_levels > 1) { + array_offset = jmp_to->parent; + } + } while (--nest_levels > 0); + zend_resolve_finally_call(op_array, i, opline->opcode == ZEND_BRK ? jmp_to->brk : jmp_to->cont TSRMLS_CC); + break; + } } case ZEND_GOTO: if (Z_TYPE(op_array->literals[opline->op2.constant].constant) != IS_LONG) { @@ -644,6 +700,9 @@ static void zend_resolve_finally_calls(zend_op_array *op_array TSRMLS_DC) case ZEND_JMP: zend_resolve_finally_call(op_array, i, opline->op1.opline_num TSRMLS_CC); break; + case ZEND_FAST_CALL: + zend_resolve_fast_call(op_array, i, i TSRMLS_CC); + break; case ZEND_FAST_RET: zend_resolve_finally_ret(op_array, i TSRMLS_CC); break; diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h index c3fb86ddd..cadaaa757 100644 --- a/Zend/zend_vm_def.h +++ b/Zend/zend_vm_def.h @@ -5387,7 +5387,16 @@ ZEND_VM_HANDLER(143, ZEND_DECLARE_CONST, CONST, CONST) c.value = *tmp_ptr; } else { INIT_PZVAL_COPY(&c.value, val); - zval_copy_ctor(&c.value); + if (Z_TYPE(c.value) == IS_ARRAY) { + HashTable *ht; + + ALLOC_HASHTABLE(ht); + zend_hash_init(ht, zend_hash_num_elements(Z_ARRVAL(c.value)), NULL, ZVAL_PTR_DTOR, 0); + zend_hash_copy(ht, Z_ARRVAL(c.value), (copy_ctor_func_t) zval_deep_copy, NULL, sizeof(zval *)); + Z_ARRVAL(c.value) = ht; + } else { + zval_copy_ctor(&c.value); + } } c.flags = CONST_CS; /* non persistent, case sensetive */ c.name = str_strndup(Z_STRVAL_P(name), Z_STRLEN_P(name)); @@ -5625,13 +5634,13 @@ ZEND_VM_HANDLER(162, ZEND_FAST_CALL, ANY, ANY) { USE_OPLINE - if (opline->extended_value && + if ((opline->extended_value & ZEND_FAST_CALL_FROM_CATCH) && UNEXPECTED(EG(prev_exception) != NULL)) { /* in case of unhandled exception jump to catch block instead of finally */ ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[opline->op2.opline_num]); ZEND_VM_CONTINUE(); } - EX(fast_ret) = opline + 1; + EX(fast_ret) = opline; EX(delayed_exception) = NULL; ZEND_VM_SET_OPCODE(opline->op1.jmp_addr); ZEND_VM_CONTINUE(); @@ -5640,7 +5649,10 @@ ZEND_VM_HANDLER(162, ZEND_FAST_CALL, ANY, ANY) ZEND_VM_HANDLER(163, ZEND_FAST_RET, ANY, ANY) { if (EX(fast_ret)) { - ZEND_VM_SET_OPCODE(EX(fast_ret)); + ZEND_VM_SET_OPCODE(EX(fast_ret) + 1); + if ((EX(fast_ret)->extended_value & ZEND_FAST_CALL_FROM_FINALLY)) { + EX(fast_ret) = &EX(op_array)->opcodes[EX(fast_ret)->op2.opline_num]; + } ZEND_VM_CONTINUE(); } else { /* special case for unhandled exceptions */ diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h index 3fa94d12a..c085276a3 100644 --- a/Zend/zend_vm_execute.h +++ b/Zend/zend_vm_execute.h @@ -1344,13 +1344,13 @@ static int ZEND_FASTCALL ZEND_FAST_CALL_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { USE_OPLINE - if (opline->extended_value && + if ((opline->extended_value & ZEND_FAST_CALL_FROM_CATCH) && UNEXPECTED(EG(prev_exception) != NULL)) { /* in case of unhandled exception jump to catch block instead of finally */ ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[opline->op2.opline_num]); ZEND_VM_CONTINUE(); } - EX(fast_ret) = opline + 1; + EX(fast_ret) = opline; EX(delayed_exception) = NULL; ZEND_VM_SET_OPCODE(opline->op1.jmp_addr); ZEND_VM_CONTINUE(); @@ -1359,7 +1359,10 @@ static int ZEND_FASTCALL ZEND_FAST_CALL_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS) static int ZEND_FASTCALL ZEND_FAST_RET_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { if (EX(fast_ret)) { - ZEND_VM_SET_OPCODE(EX(fast_ret)); + ZEND_VM_SET_OPCODE(EX(fast_ret) + 1); + if ((EX(fast_ret)->extended_value & ZEND_FAST_CALL_FROM_FINALLY)) { + EX(fast_ret) = &EX(op_array)->opcodes[EX(fast_ret)->op2.opline_num]; + } ZEND_VM_CONTINUE(); } else { /* special case for unhandled exceptions */ @@ -4320,7 +4323,16 @@ static int ZEND_FASTCALL ZEND_DECLARE_CONST_SPEC_CONST_CONST_HANDLER(ZEND_OPCOD c.value = *tmp_ptr; } else { INIT_PZVAL_COPY(&c.value, val); - zval_copy_ctor(&c.value); + if (Z_TYPE(c.value) == IS_ARRAY) { + HashTable *ht; + + ALLOC_HASHTABLE(ht); + zend_hash_init(ht, zend_hash_num_elements(Z_ARRVAL(c.value)), NULL, ZVAL_PTR_DTOR, 0); + zend_hash_copy(ht, Z_ARRVAL(c.value), (copy_ctor_func_t) zval_deep_copy, NULL, sizeof(zval *)); + Z_ARRVAL(c.value) = ht; + } else { + zval_copy_ctor(&c.value); + } } c.flags = CONST_CS; /* non persistent, case sensetive */ c.name = str_strndup(Z_STRVAL_P(name), Z_STRLEN_P(name)); @@ -811,7 +811,6 @@ CXXFLAGS CXX ICU_CONFIG OPENSSL_INCDIR_OPT -PKG_CONFIG KRB5_CONFIG LTP_GENHTML LTP @@ -824,6 +823,7 @@ php_fpm_sysconfdir php_fpm_group php_fpm_user php_fpm_systemd +PKG_CONFIG SHLIB_DL_SUFFIX_NAME SHLIB_SUFFIX_NAME RE2C @@ -3666,7 +3666,7 @@ ac_config_headers="$ac_config_headers main/php_config.h" PHP_MAJOR_VERSION=5 PHP_MINOR_VERSION=6 PHP_RELEASE_VERSION=0 -PHP_EXTRA_VERSION="RC2" +PHP_EXTRA_VERSION="RC3" PHP_VERSION="$PHP_MAJOR_VERSION.$PHP_MINOR_VERSION.$PHP_RELEASE_VERSION$PHP_EXTRA_VERSION" PHP_VERSION_ID=`expr $PHP_MAJOR_VERSION \* 10000 + $PHP_MINOR_VERSION \* 100 + $PHP_RELEASE_VERSION` @@ -12704,7 +12704,72 @@ ext_output=$PHP_FPM_SYSTEMD if test "$PHP_FPM_SYSTEMD" != "no" ; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sd_notify in -lsystemd-daemon" >&5 + if test -z "$PKG_CONFIG"; then + # Extract the first word of "pkg-config", so it can be a program name with args. +set dummy pkg-config; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_path_PKG_CONFIG+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + case $PKG_CONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + test -z "$ac_cv_path_PKG_CONFIG" && ac_cv_path_PKG_CONFIG="no" + ;; +esac +fi +PKG_CONFIG=$ac_cv_path_PKG_CONFIG +if test -n "$PKG_CONFIG"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5 +$as_echo "$PKG_CONFIG" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + fi + unset SYSTEMD_LIBS + unset SYSTEMD_INCS + + if test -x "$PKG_CONFIG" && $PKG_CONFIG --exists libsystemd; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libsystemd" >&5 +$as_echo_n "checking for libsystemd... " >&6; } + SYSTEMD_LIBS=`$PKG_CONFIG --libs libsystemd` + SYSTEMD_INCS=`$PKG_CONFIG --cflags-only-I libsystemd` + SYSTEMD_VERS=`$PKG_CONFIG --modversion libsystemd` + { $as_echo "$as_me:${as_lineno-$LINENO}: result: version $SYSTEMD_VERS" >&5 +$as_echo "version $SYSTEMD_VERS" >&6; } + + elif test -x "$PKG_CONFIG" && $PKG_CONFIG --exists libsystemd-daemon; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libsystemd-daemon" >&5 +$as_echo_n "checking for libsystemd-daemon... " >&6; } + SYSTEMD_LIBS=`$PKG_CONFIG --libs libsystemd-daemon` + SYSTEMD_INCS=`$PKG_CONFIG --cflags-only-I libsystemd-daemon` + SYSTEMD_VERS=`$PKG_CONFIG --modversion libsystemd-daemon` + { $as_echo "$as_me:${as_lineno-$LINENO}: result: version $SYSTEMD_VERS" >&5 +$as_echo "version $SYSTEMD_VERS" >&6; } + + else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sd_notify in -lsystemd-daemon" >&5 $as_echo_n "checking for sd_notify in -lsystemd-daemon... " >&6; } if test "${ac_cv_lib_systemd_daemon_sd_notify+set}" = set; then : $as_echo_n "(cached) " >&6 @@ -12744,6 +12809,8 @@ if test "x$ac_cv_lib_systemd_daemon_sd_notify" = x""yes; then : SYSTEMD_LIBS="-lsystemd-daemon" fi + fi + for ac_header in systemd/sd-daemon.h do : ac_fn_c_check_header_mongrel "$LINENO" "systemd/sd-daemon.h" "ac_cv_header_systemd_sd_daemon_h" "$ac_includes_default" @@ -12766,15 +12833,116 @@ $as_echo "#define HAVE_SYSTEMD 1" >>confdefs.h PHP_FPM_SD_FILES="fpm/fpm_systemd.c" + for ac_i in $SYSTEMD_LIBS; do + case $ac_i in + -pthread) + if test "$ext_shared" = "yes"; then + ="$ -pthread" + else + + + unique=`echo $ac_i|$SED 's/[^a-zA-Z0-9]/_/g'` + + cmd="echo $ac_n \"\$EXTRA_LDFLAGS$unique$ac_c\"" + if test -n "$unique" && test "`eval $cmd`" = "" ; then + eval "EXTRA_LDFLAGS$unique=set" + EXTRA_LDFLAGS="$EXTRA_LDFLAGS $ac_i" + fi - case systemd-daemon in + fi + ;; + -l*) + ac_ii=`echo $ac_i|cut -c 3-` + + + case $ac_ii in c|c_r|pthread*) ;; *) - LIBS="-lsystemd-daemon $LIBS" + LIBS="$LIBS -l$ac_ii" ;; esac + ;; + -L*) + ac_ii=`echo $ac_i|cut -c 3-` + + if test "$ac_ii" != "/usr/$PHP_LIBDIR" && test "$ac_ii" != "/usr/lib"; then + + if test -z "$ac_ii" || echo "$ac_ii" | grep '^/' >/dev/null ; then + ai_p=$ac_ii + else + + ep_dir=`echo $ac_ii|$SED 's%/*[^/][^/]*/*$%%'` + + ep_realdir=`(cd "$ep_dir" && pwd)` + ai_p="$ep_realdir"/`basename "$ac_ii"` + fi + + + + + + unique=`echo $ai_p|$SED 's/[^a-zA-Z0-9]/_/g'` + + cmd="echo $ac_n \"\$LIBPATH$unique$ac_c\"" + if test -n "$unique" && test "`eval $cmd`" = "" ; then + eval "LIBPATH$unique=set" + + test -n "$ld_runpath_switch" && LDFLAGS="$LDFLAGS $ld_runpath_switch$ai_p" + LDFLAGS="$LDFLAGS -L$ai_p" + PHP_RPATHS="$PHP_RPATHS $ai_p" + + fi + + + + fi + + ;; + esac + done + + + for ac_i in $SYSTEMD_INCS; do + case $ac_i in + -I*) + ac_ii=`echo $ac_i|cut -c 3-` + + if test "$ac_ii" != "/usr/include"; then + + if test -z "$ac_ii" || echo "$ac_ii" | grep '^/' >/dev/null ; then + ai_p=$ac_ii + else + + ep_dir=`echo $ac_ii|$SED 's%/*[^/][^/]*/*$%%'` + + ep_realdir=`(cd "$ep_dir" && pwd)` + ai_p="$ep_realdir"/`basename "$ac_ii"` + fi + + + + unique=`echo $ai_p|$SED 's/[^a-zA-Z0-9]/_/g'` + + cmd="echo $ac_n \"\$INCLUDEPATH$unique$ac_c\"" + if test -n "$unique" && test "`eval $cmd`" = "" ; then + eval "INCLUDEPATH$unique=set" + + if test ""; then + INCLUDES="-I$ai_p $INCLUDES" + else + INCLUDES="$INCLUDES -I$ai_p" + fi + + fi + + fi + + ;; + esac + done + php_fpm_systemd=notify fi else @@ -105076,7 +105244,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<EOF -#line 105079 "configure" +#line 105247 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -106988,7 +107156,7 @@ ia64-*-hpux*) ;; *-*-irix6*) # Find out which ABI we are using. - echo '#line 106991 "configure"' > conftest.$ac_ext + echo '#line 107159 "configure"' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -108380,7 +108548,7 @@ else LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym" cat > conftest.$ac_ext <<EOF -#line 108383 "configure" +#line 108551 "configure" #include "confdefs.h" int main() { ; return 0; } @@ -108538,11 +108706,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"configure:108541: $lt_compile\"" >&5) + (eval echo "\"configure:108709: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "configure:108545: \$? = $ac_status" >&5 + echo "configure:108713: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -108836,11 +109004,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"configure:108839: $lt_compile\"" >&5) + (eval echo "\"configure:109007: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "configure:108843: \$? = $ac_status" >&5 + echo "configure:109011: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -108940,11 +109108,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"configure:108943: $lt_compile\"" >&5) + (eval echo "\"configure:109111: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "configure:108947: \$? = $ac_status" >&5 + echo "configure:109115: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -109404,7 +109572,7 @@ _LT_EOF # Determine the default libpath from the value encoded in an empty executable. cat > conftest.$ac_ext <<EOF -#line 109407 "configure" +#line 109575 "configure" #include "confdefs.h" int main() { ; return 0; } @@ -109446,7 +109614,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi # Determine the default libpath from the value encoded in an empty executable. cat > conftest.$ac_ext <<EOF -#line 109449 "configure" +#line 109617 "configure" #include "confdefs.h" int main() { ; return 0; } @@ -110963,7 +111131,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<EOF -#line 110966 "configure" +#line 111134 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -111063,7 +111231,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<EOF -#line 111066 "configure" +#line 111234 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -112128,7 +112296,7 @@ case $host_os in # Determine the default libpath from the value encoded in an empty executable. cat > conftest.$ac_ext <<EOF -#line 112131 "configure" +#line 112299 "configure" #include "confdefs.h" int main() { ; return 0; } @@ -112171,7 +112339,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi # Determine the default libpath from the value encoded in an empty executable. cat > conftest.$ac_ext <<EOF -#line 112174 "configure" +#line 112342 "configure" #include "confdefs.h" int main() { ; return 0; } @@ -113423,11 +113591,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"configure:113426: $lt_compile\"" >&5) + (eval echo "\"configure:113594: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "configure:113430: \$? = $ac_status" >&5 + echo "configure:113598: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -113527,11 +113695,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"configure:113530: $lt_compile\"" >&5) + (eval echo "\"configure:113698: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "configure:113534: \$? = $ac_status" >&5 + echo "configure:113702: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized diff --git a/configure.in b/configure.in index 12341b503..d3050559f 100644 --- a/configure.in +++ b/configure.in @@ -120,7 +120,7 @@ int zend_sprintf(char *buffer, const char *format, ...); PHP_MAJOR_VERSION=5 PHP_MINOR_VERSION=6 PHP_RELEASE_VERSION=0 -PHP_EXTRA_VERSION="RC2" +PHP_EXTRA_VERSION="RC3" PHP_VERSION="$PHP_MAJOR_VERSION.$PHP_MINOR_VERSION.$PHP_RELEASE_VERSION$PHP_EXTRA_VERSION" PHP_VERSION_ID=`expr [$]PHP_MAJOR_VERSION \* 10000 + [$]PHP_MINOR_VERSION \* 100 + [$]PHP_RELEASE_VERSION` diff --git a/ext/com_dotnet/com_com.c b/ext/com_dotnet/com_com.c index f77779d69..500cabd41 100644 --- a/ext/com_dotnet/com_com.c +++ b/ext/com_dotnet/com_com.c @@ -698,9 +698,9 @@ PHP_FUNCTION(com_event_sink) /* 0 => typelibname, 1 => dispname */ zval **tmp; - if (zend_hash_index_find(Z_ARRVAL_P(sink), 0, (void**)&tmp) == SUCCESS) + if (zend_hash_index_find(Z_ARRVAL_P(sink), 0, (void**)&tmp) == SUCCESS && Z_TYPE_PP(tmp) == IS_STRING) typelibname = Z_STRVAL_PP(tmp); - if (zend_hash_index_find(Z_ARRVAL_P(sink), 1, (void**)&tmp) == SUCCESS) + if (zend_hash_index_find(Z_ARRVAL_P(sink), 1, (void**)&tmp) == SUCCESS && Z_TYPE_PP(tmp) == IS_STRING) dispname = Z_STRVAL_PP(tmp); } else if (sink != NULL) { convert_to_string(sink); diff --git a/ext/date/php_date.c b/ext/date/php_date.c index 1809d6653..278988036 100644 --- a/ext/date/php_date.c +++ b/ext/date/php_date.c @@ -50,7 +50,11 @@ static inline long long php_date_llabs( long long i ) { return i >= 0 ? i : -i; int st = snprintf(s, len, "%lld", i); \ s[st] = '\0'; \ } while (0); +#ifdef HAVE_ATOLL # define DATE_A64I(i, s) i = atoll(s) +#else +# define DATE_A64I(i, s) i = strtoll(s, NULL, 10) +#endif #endif /* {{{ arginfo */ diff --git a/ext/filter/tests/bug49184.phpt b/ext/filter/tests/bug49184.phpt new file mode 100644 index 000000000..86d35db0d --- /dev/null +++ b/ext/filter/tests/bug49184.phpt @@ -0,0 +1,22 @@ +--TEST-- +Bug #67296 (filter_input doesn't validate variables) +--XFAIL-- +See Bug #49184 +--SKIPIF-- +<?php if (!extension_loaded("filter")) die("skip needs filter ext"); ?> +--ENV-- +return <<<END +HTTP_X_FORWARDED_FOR=example.com +END; +--FILE-- +<?php + var_dump(filter_input(INPUT_SERVER, "HTTP_X_FORWARDED_FOR", FILTER_UNSAFE_RAW)); + var_dump($_SERVER["HTTP_X_FORWARDED_FOR"]); + var_dump(getenv("HTTP_X_FORWARDED_FOR")); + var_dump("done"); +?> +--EXPECT-- +string(11) "example.com" +string(11) "example.com" +string(11) "example.com" +string(4) "done" diff --git a/ext/ftp/tests/bug37799.phpt b/ext/ftp/tests/bug37799.phpt index bc9ce002a..7636081a4 100644 --- a/ext/ftp/tests/bug37799.phpt +++ b/ext/ftp/tests/bug37799.phpt @@ -18,5 +18,5 @@ var_dump(ftp_login($ftp, 'user', 'pass')); ftp_close($ftp); ?> --EXPECTF-- -Warning: ftp_login(): bogus msg in %sbug37799.php on line 8 +Warning: ftp_login(): %rdummy|bogus msg%r in %sbug37799.php on line 8 bool(false) diff --git a/ext/intl/formatter/formatter_parse.c b/ext/intl/formatter/formatter_parse.c index 6f3a3a12b..0c8704d95 100644 --- a/ext/intl/formatter/formatter_parse.c +++ b/ext/intl/formatter/formatter_parse.c @@ -73,7 +73,9 @@ PHP_FUNCTION( numfmt_parse ) } #if ICU_LOCALE_BUG && defined(LC_NUMERIC) - oldlocale = setlocale(LC_NUMERIC, "C"); + /* need to copy here since setlocale may change it later */ + oldlocale = estrdup(setlocale(LC_NUMERIC, NULL)); + setlocale(LC_NUMERIC, "C"); #endif switch(type) { @@ -100,6 +102,7 @@ PHP_FUNCTION( numfmt_parse ) } #if ICU_LOCALE_BUG && defined(LC_NUMERIC) setlocale(LC_NUMERIC, oldlocale); + efree(oldlocale); #endif if(zposition) { zval_dtor(zposition); diff --git a/ext/intl/php_intl.c b/ext/intl/php_intl.c index 65e53c8b5..ff1627a18 100644 --- a/ext/intl/php_intl.c +++ b/ext/intl/php_intl.c @@ -445,7 +445,7 @@ ZEND_BEGIN_ARG_INFO_EX( arginfo_tz_idarg_static, 0, 0, 1 ) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX( arginfo_tz_from_date_time_zone, 0, 0, 1 ) - ZEND_ARG_OBJ_INFO( 0, dateTimeZone, IntlDateTimeZone, 0 ) + ZEND_ARG_OBJ_INFO( 0, dateTimeZone, DateTimeZone, 0 ) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX( arginfo_tz_create_enumeration, 0, 0, 0 ) diff --git a/ext/intl/tests/bug14562.phpt b/ext/intl/tests/bug14562.phpt index 325626840..7cf927f7e 100644 --- a/ext/intl/tests/bug14562.phpt +++ b/ext/intl/tests/bug14562.phpt @@ -15,6 +15,7 @@ function ut_main() setlocale(LC_ALL, $de_locale); $fmt = new NumberFormatter("de", NumberFormatter::DECIMAL ); $numeric = $fmt->parse("1234,56"); + setlocale(LC_ALL, "C"); // reset for printing $res_str .= "$numeric\n"; return $res_str; } diff --git a/ext/intl/tests/bug66921.phpt b/ext/intl/tests/bug66921.phpt new file mode 100644 index 000000000..58ae9c0f8 --- /dev/null +++ b/ext/intl/tests/bug66921.phpt @@ -0,0 +1,15 @@ +--TEST-- +Bug #66921 - Wrong argument type hint for function intltz_from_date_time_zone +--SKIPIF-- +<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?> +--FILE-- +<?php +$f = new ReflectionFunction('intltz_from_date_time_zone'); +var_dump($f->getParameters()[0]->getClass()); + +?> +--EXPECTF-- +object(ReflectionClass)#%d (1) { + ["name"]=> + string(12) "DateTimeZone" +} diff --git a/ext/intl/tests/bug67052.phpt b/ext/intl/tests/bug67052.phpt new file mode 100644 index 000000000..c8363b9c7 --- /dev/null +++ b/ext/intl/tests/bug67052.phpt @@ -0,0 +1,25 @@ +--TEST-- +Bug #67052 - NumberFormatter::parse() resets LC_NUMERIC setting +--SKIPIF-- +<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?> +--FILE-- +<?php + +function ut_main() +{ + setlocale(LC_ALL, 'de_DE'); + $fmt = new NumberFormatter( 'sl_SI.UTF-8', NumberFormatter::DECIMAL); + $num = "1.234.567,891"; + $res_str = $fmt->parse($num)."\n"; + $res_str .= setlocale(LC_NUMERIC, 0); + return $res_str; +} + +include_once( 'ut_common.inc' ); +ut_run(); + +?> +--EXPECT-- +1234567,891 +de_DE + diff --git a/ext/intl/tests/collator_get_locale.phpt b/ext/intl/tests/collator_get_locale.phpt index 68440f3ee..e71a020b4 100644 --- a/ext/intl/tests/collator_get_locale.phpt +++ b/ext/intl/tests/collator_get_locale.phpt @@ -3,6 +3,8 @@ get_locale() icu <= 4.2 --SKIPIF-- <?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?> <?php if(version_compare(INTL_ICU_VERSION, '4.3', '<') != 1) print 'skip'; ?> +--INI-- +precision=6 --FILE-- <?php diff --git a/ext/mysqli/mysqli.c b/ext/mysqli/mysqli.c index b23d7e313..f13958897 100644 --- a/ext/mysqli/mysqli.c +++ b/ext/mysqli/mysqli.c @@ -715,6 +715,10 @@ PHP_MINIT_FUNCTION(mysqli) REGISTER_LONG_CONSTANT("MYSQLI_CLIENT_IGNORE_SPACE", CLIENT_IGNORE_SPACE, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("MYSQLI_CLIENT_NO_SCHEMA", CLIENT_NO_SCHEMA, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("MYSQLI_CLIENT_FOUND_ROWS", CLIENT_FOUND_ROWS, CONST_CS | CONST_PERSISTENT); +#if (MYSQL_VERSION_ID >= 50611 && defined(CLIENT_CAN_HANDLE_EXPIRED_PASSWORDS)) || defined(MYSQLI_USE_MYSQLND) + REGISTER_LONG_CONSTANT("MYSQLI_CLIENT_CAN_HANDLE_EXPIRED_PASSWORDS", CLIENT_CAN_HANDLE_EXPIRED_PASSWORDS, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("MYSQLI_OPT_CAN_HANDLE_EXPIRED_PASSWORDS", MYSQL_OPT_CAN_HANDLE_EXPIRED_PASSWORDS, CONST_CS | CONST_PERSISTENT); +#endif /* for mysqli_query */ REGISTER_LONG_CONSTANT("MYSQLI_STORE_RESULT", MYSQLI_STORE_RESULT, CONST_CS | CONST_PERSISTENT); @@ -848,9 +852,6 @@ PHP_MINIT_FUNCTION(mysqli) REGISTER_LONG_CONSTANT("MYSQLI_REFRESH_BACKUP_LOG", REFRESH_BACKUP_LOG, CONST_CS | CONST_PERSISTENT); #endif -#if (MYSQL_VERSION_ID >= 50611 && defined(CLIENT_CAN_HANDLE_EXPIRED_PASSWORDS)) || defined(MYSQLI_USE_MYSQLND) - REGISTER_LONG_CONSTANT("MYSQLI_OPT_CAN_HANDLE_EXPIRED_PASSWORDS", MYSQL_OPT_CAN_HANDLE_EXPIRED_PASSWORDS, CONST_CS | CONST_PERSISTENT); -#endif REGISTER_LONG_CONSTANT("MYSQLI_TRANS_START_WITH_CONSISTENT_SNAPSHOT", TRANS_START_WITH_CONSISTENT_SNAPSHOT, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("MYSQLI_TRANS_START_READ_WRITE", TRANS_START_READ_WRITE, CONST_CS | CONST_PERSISTENT); diff --git a/ext/mysqli/tests/mysqli_constants.phpt b/ext/mysqli/tests/mysqli_constants.phpt index bed9d5341..9bbc8bb4b 100644 --- a/ext/mysqli/tests/mysqli_constants.phpt +++ b/ext/mysqli/tests/mysqli_constants.phpt @@ -196,6 +196,7 @@ require_once('skipifconnectfailure.inc'); if (($IS_MYSQLND && version_compare(PHP_VERSION, ' 5.4.12-dev', '>=')) || (!$IS_MYSQLND && ($version > 50610))) { /* could be that MySQL/libmysql 5.6.9 had the flag already but it was no stable release */ $expected_constants["MYSQLI_OPT_CAN_HANDLE_EXPIRED_PASSWORDS"] = true; + $expected_constants["MYSQLI_CLIENT_CAN_HANDLE_EXPIRED_PASSWORDS"] = true; } $unexpected_constants = array(); diff --git a/ext/mysqlnd/mysqlnd.c b/ext/mysqlnd/mysqlnd.c index 893a144c4..5d5e77f9b 100644 --- a/ext/mysqlnd/mysqlnd.c +++ b/ext/mysqlnd/mysqlnd.c @@ -321,6 +321,7 @@ MYSQLND_METHOD(mysqlnd_conn_data, simple_command_send_request)(MYSQLND_CONN_DATA DBG_ENTER("mysqlnd_conn_data::simple_command_send_request"); DBG_INF_FMT("command=%s silent=%u", mysqlnd_command_to_text[command], silent); DBG_INF_FMT("conn->server_status=%u", conn->upsert_status->server_status); + DBG_INF_FMT("sending %u bytes", arg_len + 1); /* + 1 is for the command */ switch (CONN_GET_STATE(conn)) { case CONN_READY: @@ -448,6 +449,31 @@ mysqlnd_switch_to_ssl_if_needed( const MYSQLND_CHARSET * charset; MYSQLND_PACKET_AUTH * auth_packet; DBG_ENTER("mysqlnd_switch_to_ssl_if_needed"); + DBG_INF_FMT("client_capability_flags=%lu", mysql_flags); + DBG_INF_FMT("CLIENT_LONG_PASSWORD= %d", mysql_flags & CLIENT_LONG_PASSWORD? 1:0); + DBG_INF_FMT("CLIENT_FOUND_ROWS= %d", mysql_flags & CLIENT_FOUND_ROWS? 1:0); + DBG_INF_FMT("CLIENT_LONG_FLAG= %d", mysql_flags & CLIENT_LONG_FLAG? 1:0); + DBG_INF_FMT("CLIENT_NO_SCHEMA= %d", mysql_flags & CLIENT_NO_SCHEMA? 1:0); + DBG_INF_FMT("CLIENT_COMPRESS= %d", mysql_flags & CLIENT_COMPRESS? 1:0); + DBG_INF_FMT("CLIENT_ODBC= %d", mysql_flags & CLIENT_ODBC? 1:0); + DBG_INF_FMT("CLIENT_LOCAL_FILES= %d", mysql_flags & CLIENT_LOCAL_FILES? 1:0); + DBG_INF_FMT("CLIENT_IGNORE_SPACE= %d", mysql_flags & CLIENT_IGNORE_SPACE? 1:0); + DBG_INF_FMT("CLIENT_PROTOCOL_41= %d", mysql_flags & CLIENT_PROTOCOL_41? 1:0); + DBG_INF_FMT("CLIENT_INTERACTIVE= %d", mysql_flags & CLIENT_INTERACTIVE? 1:0); + DBG_INF_FMT("CLIENT_SSL= %d", mysql_flags & CLIENT_SSL? 1:0); + DBG_INF_FMT("CLIENT_IGNORE_SIGPIPE= %d", mysql_flags & CLIENT_IGNORE_SIGPIPE? 1:0); + DBG_INF_FMT("CLIENT_TRANSACTIONS= %d", mysql_flags & CLIENT_TRANSACTIONS? 1:0); + DBG_INF_FMT("CLIENT_RESERVED= %d", mysql_flags & CLIENT_RESERVED? 1:0); + DBG_INF_FMT("CLIENT_SECURE_CONNECTION=%d", mysql_flags & CLIENT_SECURE_CONNECTION? 1:0); + DBG_INF_FMT("CLIENT_MULTI_STATEMENTS=%d", mysql_flags & CLIENT_MULTI_STATEMENTS? 1:0); + DBG_INF_FMT("CLIENT_MULTI_RESULTS= %d", mysql_flags & CLIENT_MULTI_RESULTS? 1:0); + DBG_INF_FMT("CLIENT_PS_MULTI_RESULTS=%d", mysql_flags & CLIENT_PS_MULTI_RESULTS? 1:0); + DBG_INF_FMT("CLIENT_CONNECT_ATTRS= %d", mysql_flags & CLIENT_PLUGIN_AUTH? 1:0); + DBG_INF_FMT("CLIENT_PLUGIN_AUTH_LENENC_CLIENT_DATA= %d", mysql_flags & CLIENT_PLUGIN_AUTH_LENENC_CLIENT_DATA? 1:0); + DBG_INF_FMT("CLIENT_CAN_HANDLE_EXPIRED_PASSWORDS= %d", mysql_flags & CLIENT_CAN_HANDLE_EXPIRED_PASSWORDS? 1:0); + DBG_INF_FMT("CLIENT_SESSION_TRACK= %d", mysql_flags & CLIENT_SESSION_TRACK? 1:0); + DBG_INF_FMT("CLIENT_SSL_VERIFY_SERVER_CERT= %d", mysql_flags & CLIENT_SSL_VERIFY_SERVER_CERT? 1:0); + DBG_INF_FMT("CLIENT_REMEMBER_OPTIONS= %d", mysql_flags & CLIENT_REMEMBER_OPTIONS? 1:0); auth_packet = conn->protocol->m.get_auth_packet(conn->protocol, FALSE TSRMLS_CC); if (!auth_packet) { @@ -1863,6 +1889,7 @@ MYSQLND_METHOD(mysqlnd_conn_data, send_close)(MYSQLND_CONN_DATA * const conn TSR enum_func_status ret = PASS; MYSQLND_NET * net = conn->net; php_stream * net_stream = net->data->m.get_stream(net TSRMLS_CC); + enum mysqlnd_connection_state state; DBG_ENTER("mysqlnd_send_close"); DBG_INF_FMT("conn=%llu net->data->stream->abstract=%p", conn->thread_id, net_stream? net_stream->abstract:NULL); @@ -1873,7 +1900,9 @@ MYSQLND_METHOD(mysqlnd_conn_data, send_close)(MYSQLND_CONN_DATA * const conn TSR MYSQLND_DEC_CONN_STATISTIC(conn->stats, STAT_OPENED_PERSISTENT_CONNECTIONS); } } - switch (CONN_GET_STATE(conn)) { + state = CONN_GET_STATE(conn); + DBG_INF_FMT("state=%u", state); + switch (state) { case CONN_READY: DBG_INF("Connection clean, sending COM_QUIT"); if (net_stream) { diff --git a/ext/mysqlnd/mysqlnd_enum_n_def.h b/ext/mysqlnd/mysqlnd_enum_n_def.h index e1fc5f8f0..3212c778a 100644 --- a/ext/mysqlnd/mysqlnd_enum_n_def.h +++ b/ext/mysqlnd/mysqlnd_enum_n_def.h @@ -100,7 +100,9 @@ #define CLIENT_CONNECT_ATTRS (1UL << 20) /* Client supports connection attributes */ #define CLIENT_PLUGIN_AUTH_LENENC_CLIENT_DATA (1UL << 21) /* Enable authentication response packet to be larger than 255 bytes. */ #define CLIENT_CAN_HANDLE_EXPIRED_PASSWORDS (1UL << 22) /* Don't close the connection for a connection with expired password. */ -#define CLIENT_SSL_VERIFY_SERVER_CERT (1UL << 30) +#define CLIENT_SESSION_TRACK (1UL << 23) /* Extended OK */ +#define CLIENT_SSL_VERIFY_SERVER_CERT (1UL << 30) +#define CLIENT_REMEMBER_OPTIONS (1UL << 31) #define MYSQLND_CAPABILITIES (CLIENT_LONG_PASSWORD | CLIENT_LONG_FLAG | CLIENT_TRANSACTIONS | \ CLIENT_PROTOCOL_41 | CLIENT_SECURE_CONNECTION | \ @@ -214,23 +216,23 @@ typedef enum mysqlnd_protocol_type typedef enum mysqlnd_field_types { - MYSQL_TYPE_DECIMAL, - MYSQL_TYPE_TINY, - MYSQL_TYPE_SHORT, - MYSQL_TYPE_LONG, - MYSQL_TYPE_FLOAT, - MYSQL_TYPE_DOUBLE, - MYSQL_TYPE_NULL, - MYSQL_TYPE_TIMESTAMP, - MYSQL_TYPE_LONGLONG, - MYSQL_TYPE_INT24, - MYSQL_TYPE_DATE, - MYSQL_TYPE_TIME, - MYSQL_TYPE_DATETIME, - MYSQL_TYPE_YEAR, - MYSQL_TYPE_NEWDATE, - MYSQL_TYPE_VARCHAR, - MYSQL_TYPE_BIT, + MYSQL_TYPE_DECIMAL = 0, + MYSQL_TYPE_TINY = 1, + MYSQL_TYPE_SHORT = 2, + MYSQL_TYPE_LONG = 3, + MYSQL_TYPE_FLOAT = 4, + MYSQL_TYPE_DOUBLE = 5, + MYSQL_TYPE_NULL = 6, + MYSQL_TYPE_TIMESTAMP= 7, + MYSQL_TYPE_LONGLONG = 8, + MYSQL_TYPE_INT24 = 9, + MYSQL_TYPE_DATE = 10, + MYSQL_TYPE_TIME = 11, + MYSQL_TYPE_DATETIME = 12, + MYSQL_TYPE_YEAR = 13, + MYSQL_TYPE_NEWDATE = 14, + MYSQL_TYPE_VARCHAR = 15, + MYSQL_TYPE_BIT = 16, MYSQL_TYPE_NEWDECIMAL=246, MYSQL_TYPE_ENUM=247, MYSQL_TYPE_SET=248, @@ -322,23 +324,23 @@ typedef enum mysqlnd_server_option typedef enum mysqlnd_connection_state { CONN_ALLOCED = 0, - CONN_READY, - CONN_QUERY_SENT, - CONN_SENDING_LOAD_DATA, - CONN_FETCHING_DATA, - CONN_NEXT_RESULT_PENDING, - CONN_QUIT_SENT /* object is "destroyed" at this stage */ + CONN_READY = 1, + CONN_QUERY_SENT = 2, + CONN_SENDING_LOAD_DATA = 3, + CONN_FETCHING_DATA = 4, + CONN_NEXT_RESULT_PENDING = 5, + CONN_QUIT_SENT = 6 /* object is "destroyed" at this stage */ } enum_mysqlnd_connection_state; typedef enum mysqlnd_stmt_state { MYSQLND_STMT_INITTED = 0, - MYSQLND_STMT_PREPARED, - MYSQLND_STMT_EXECUTED, - MYSQLND_STMT_WAITING_USE_OR_STORE, - MYSQLND_STMT_USE_OR_STORE_CALLED, - MYSQLND_STMT_USER_FETCHING /* fetch_row_buff or fetch_row_unbuf */ + MYSQLND_STMT_PREPARED = 1, + MYSQLND_STMT_EXECUTED = 2, + MYSQLND_STMT_WAITING_USE_OR_STORE = 3, + MYSQLND_STMT_USE_OR_STORE_CALLED = 4, + MYSQLND_STMT_USER_FETCHING = 5/* fetch_row_buff or fetch_row_unbuf */ } enum_mysqlnd_stmt_state; @@ -596,9 +598,10 @@ enum php_mysqlnd_server_command COM_STMT_RESET = 26, COM_SET_OPTION = 27, COM_STMT_FETCH = 28, - COM_DAEMON, - COM_BINLOG_DUMP_GTID, - COM_RESET_CONNECTION, + COM_DAEMON = 29, + COM_BINLOG_DUMP_GTID = 30, + COM_RESET_CONNECTION = 31, + COM_STMT_EXECUTE_BATCH = 32, COM_END }; diff --git a/ext/mysqlnd/mysqlnd_net.c b/ext/mysqlnd/mysqlnd_net.c index fadcbd87f..a0beed8b9 100644 --- a/ext/mysqlnd/mysqlnd_net.c +++ b/ext/mysqlnd/mysqlnd_net.c @@ -99,6 +99,7 @@ MYSQLND_METHOD(mysqlnd_net, network_write_ex)(MYSQLND_NET * const net, const zen { size_t ret; DBG_ENTER("mysqlnd_net::network_write_ex"); + DBG_INF_FMT("sending %u bytes", count); ret = php_stream_write(net->data->m.get_stream(net TSRMLS_CC), (char *)buffer, count); DBG_RETURN(ret); } @@ -357,6 +358,10 @@ MYSQLND_METHOD(mysqlnd_net, send_ex)(MYSQLND_NET * const net, zend_uchar * const do { to_be_sent = MIN(left, MYSQLND_MAX_PACKET_SIZE); + DBG_INF_FMT("to_be_sent=%u", to_be_sent); + DBG_INF_FMT("packets_sent=%u", packets_sent); + DBG_INF_FMT("compressed_envelope_packet_no=%u", net->compressed_envelope_packet_no); + DBG_INF_FMT("packet_no=%u", net->packet_no); #ifdef MYSQLND_COMPRESSION_ENABLED if (net->data->compressed == TRUE) { /* here we need to compress the data and then write it, first comes the compressed header */ diff --git a/ext/odbc/php_odbc.c b/ext/odbc/php_odbc.c index 4d21b3a13..19f9fe4eb 100644 --- a/ext/odbc/php_odbc.c +++ b/ext/odbc/php_odbc.c @@ -780,6 +780,9 @@ PHP_MINIT_FUNCTION(odbc) REGISTER_LONG_CONSTANT("SQL_TYPE_DATE", SQL_TYPE_DATE, CONST_PERSISTENT | CONST_CS); REGISTER_LONG_CONSTANT("SQL_TYPE_TIME", SQL_TYPE_TIME, CONST_PERSISTENT | CONST_CS); REGISTER_LONG_CONSTANT("SQL_TYPE_TIMESTAMP", SQL_TYPE_TIMESTAMP, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("SQL_WCHAR", SQL_WCHAR, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("SQL_WVARCHAR", SQL_WVARCHAR, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("SQL_WLONGVARCHAR", SQL_WLONGVARCHAR, CONST_PERSISTENT | CONST_CS); /* * SQLSpecialColumns values @@ -943,9 +946,13 @@ int odbc_bindcols(odbc_result *result TSRMLS_DC) { RETCODE rc; int i; - SQLSMALLINT colnamelen; /* Not used */ - SQLLEN displaysize; + SQLSMALLINT colnamelen; /* Not used */ + SQLLEN displaysize; + SQLUSMALLINT colfieldid; + int charextraalloc; + colfieldid = SQL_COLUMN_DISPLAY_SIZE; + charextraalloc = 0; result->values = (odbc_result_value *) safe_emalloc(sizeof(odbc_result_value), result->numcols, 0); result->longreadlen = ODBCG(defaultlrl); @@ -966,6 +973,9 @@ int odbc_bindcols(odbc_result *result TSRMLS_DC) case SQL_VARBINARY: case SQL_LONGVARBINARY: case SQL_LONGVARCHAR: +#if defined(ODBCVER) && (ODBCVER >= 0x0300) + case SQL_WLONGVARCHAR: +#endif result->values[i].value = NULL; break; @@ -976,15 +986,27 @@ int odbc_bindcols(odbc_result *result TSRMLS_DC) 27, &result->values[i].vallen); break; #endif /* HAVE_ADABAS */ + case SQL_CHAR: + case SQL_VARCHAR: +#if defined(ODBCVER) && (ODBCVER >= 0x0300) + case SQL_WCHAR: + case SQL_WVARCHAR: + colfieldid = SQL_DESC_OCTET_LENGTH; +#else + charextraalloc = 1; +#endif default: - rc = SQLColAttributes(result->stmt, (SQLUSMALLINT)(i+1), SQL_COLUMN_DISPLAY_SIZE, - NULL, 0, NULL, &displaysize); - displaysize = displaysize <= result->longreadlen ? displaysize : - result->longreadlen; + rc = SQLColAttributes(result->stmt, (SQLUSMALLINT)(i+1), colfieldid, + NULL, 0, NULL, &displaysize); /* Workaround for Oracle ODBC Driver bug (#50162) when fetching TIMESTAMP column */ if (result->values[i].coltype == SQL_TIMESTAMP) { displaysize += 3; } + + if (charextraalloc) { + /* Since we don't know the exact # of bytes, allocate extra */ + displaysize *= 4; + } result->values[i].value = (char *)emalloc(displaysize + 1); rc = SQLBindCol(result->stmt, (SQLUSMALLINT)(i+1), SQL_C_CHAR, result->values[i].value, displaysize + 1, &result->values[i].vallen); @@ -1725,6 +1747,9 @@ static void php_odbc_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, int result_type) sql_c_type = SQL_C_BINARY; } case SQL_LONGVARCHAR: +#if defined(ODBCVER) && (ODBCVER >= 0x0300) + case SQL_WLONGVARCHAR: +#endif if (IS_SQL_LONG(result->values[i].coltype) && result->longreadlen <= 0) { Z_STRVAL_P(tmp) = STR_EMPTY_ALLOC(); break; @@ -1876,7 +1901,11 @@ PHP_FUNCTION(odbc_fetch_into) break; } if (result->binmode == 1) sql_c_type = SQL_C_BINARY; + case SQL_LONGVARCHAR: +#if defined(ODBCVER) && (ODBCVER >= 0x0300) + case SQL_WLONGVARCHAR: +#endif if (IS_SQL_LONG(result->values[i].coltype) && result->longreadlen <= 0) { Z_STRVAL_P(tmp) = STR_EMPTY_ALLOC(); break; @@ -2095,6 +2124,9 @@ PHP_FUNCTION(odbc_result) break; } case SQL_LONGVARCHAR: +#if defined(ODBCVER) && (ODBCVER >= 0x0300) + case SQL_WLONGVARCHAR: +#endif if (IS_SQL_LONG(result->values[field_ind].coltype)) { if (result->longreadlen <= 0) { break; @@ -2132,7 +2164,11 @@ PHP_FUNCTION(odbc_result) } /* Reduce fieldlen by 1 if we have char data. One day we might have binary strings... */ - if (result->values[field_ind].coltype == SQL_LONGVARCHAR) { + if ((result->values[field_ind].coltype == SQL_LONGVARCHAR) +#if defined(ODBCVER) && (ODBCVER >= 0x0300) + || (result->values[field_ind].coltype == SQL_WLONGVARCHAR) +#endif + ) { fieldsize -= 1; } /* Don't duplicate result, saves one emalloc. @@ -2248,6 +2284,9 @@ PHP_FUNCTION(odbc_result_all) } if (result->binmode <= 1) sql_c_type = SQL_C_BINARY; case SQL_LONGVARCHAR: +#if defined(ODBCVER) && (ODBCVER >= 0x0300) + case SQL_WLONGVARCHAR: +#endif if (IS_SQL_LONG(result->values[i].coltype) && result->longreadlen <= 0) { php_printf("<td>Not printable</td>"); diff --git a/ext/odbc/php_odbc_includes.h b/ext/odbc/php_odbc_includes.h index a9b0acfa0..06113d962 100644 --- a/ext/odbc/php_odbc_includes.h +++ b/ext/odbc/php_odbc_includes.h @@ -115,6 +115,7 @@ PHP_FUNCTION(solid_fetch_prev); #endif #define ODBC_TYPE "unixODBC" +#undef ODBCVER #include <sql.h> #include <sqlext.h> #define HAVE_SQL_EXTENDED_FETCH 1 @@ -284,7 +285,11 @@ int odbc_bindcols(odbc_result *result TSRMLS_DC); void odbc_sql_error(ODBC_SQL_ERROR_PARAMS); +#if defined(ODBCVER) && (ODBCVER >= 0x0300) +#define IS_SQL_LONG(x) (x == SQL_LONGVARBINARY || x == SQL_LONGVARCHAR || x == SQL_WLONGVARCHAR) +#else #define IS_SQL_LONG(x) (x == SQL_LONGVARBINARY || x == SQL_LONGVARCHAR) +#endif #define IS_SQL_BINARY(x) (x == SQL_BINARY || x == SQL_VARBINARY || x == SQL_LONGVARBINARY) #ifdef ZTS diff --git a/ext/odbc/tests/bug60616.phpt b/ext/odbc/tests/bug60616.phpt new file mode 100644 index 000000000..937049a9b --- /dev/null +++ b/ext/odbc/tests/bug60616.phpt @@ -0,0 +1,69 @@ +--TEST-- +odbc_exec(): Getting accurate unicode data from query +--SKIPIF-- +<?php include 'skipif.inc'; ?> +--FILE-- +<?php + +// Test strings +mb_internal_encoding("EUC_JP"); +$euc_jp_base64 = 'pdal6aWkpcCl676uyqo='; +$euc_jp = base64_decode($euc_jp_base64); +$ascii = 'abcdefghijklmnopqrstuvwxyz;]=#0123456789'; + +include 'config.inc'; +ini_set("odbc.defaultlrl", 4); // Set artifically low + +$conn = odbc_connect($dsn, $user, $pass); + +odbc_exec($conn, 'CREATE DATABASE odbcTEST ENCODING=\'EUC_JP\''); + +odbc_exec($conn, 'CREATE TABLE FOO (ID INT, CHAR_COL CHAR(200), VARCHAR_COL VARCHAR(200), TEXT_COL TEXT)'); + +odbc_exec($conn, "INSERT INTO FOO(ID, CHAR_COL, VARCHAR_COL, TEXT_COL) VALUES (1, '$euc_jp', '$euc_jp', '$euc_jp')"); +odbc_exec($conn, "INSERT INTO FOO(ID, CHAR_COL, VARCHAR_COL, TEXT_COL) VALUES (2, '$ascii', '$ascii', '$ascii')"); + +$res = odbc_exec($conn, 'SELECT * FROM FOO ORDER BY ID ASC'); + +while(odbc_fetch_row($res)) { + $char_col = odbc_result($res, "CHAR_COL"); + $varchar_col = odbc_result($res, "VARCHAR_COL"); + $id = odbc_result($res, "ID"); + $text_col = ""; + while (($chunk=odbc_result($res, "TEXT_COL")) !== false) { + $text_col .= $chunk; + } + + if ($id == 1) { + $euc_jp_check = $euc_jp . str_repeat(" ", (200 - mb_strlen($euc_jp))); + if (strcmp($char_col, $euc_jp_check) == 0 && strcmp($varchar_col, $euc_jp) == 0 && + strcmp($text_col, $euc_jp) == 0) { + print "EUC-JP matched\n"; + } else { + print "EUC-JP mismatched\n"; + } + } else { + $ascii_check = $ascii . str_repeat(" ", (200 - strlen($ascii))); + if (strcmp($char_col, $ascii_check) == 0 && strcmp($varchar_col, $ascii) == 0 && + strcmp($text_col, $ascii) == 0) { + print "ASCII matched\n"; + } else { + print "ASCII mismatched\n"; + } + } +} + +?> +--EXPECT-- +EUC-JP matched +ASCII matched +--CLEAN-- +<?php +include 'config.inc'; + +$conn = odbc_connect($dsn, $user, $pass); + +odbc_exec($conn, 'DROP TABLE FOO'); +odbc_exec($conn, 'DROP DATABASE odbcTEST'); + +?> diff --git a/ext/odbc/tests/odbc_columns_001.phpt b/ext/odbc/tests/odbc_columns_001.phpt index f6da78e8e..fbbc3e2e0 100644 --- a/ext/odbc/tests/odbc_columns_001.phpt +++ b/ext/odbc/tests/odbc_columns_001.phpt @@ -24,9 +24,5 @@ resource(%d) of type (odbc result) bool(false) resource(%d) of type (odbc result) bool(false) - -Warning: odbc_columns(): SQL error: Failed to fetch error message, SQL state HY000 in SQLColumns in %s on line %d +resource(%d) of type (odbc result) bool(false) - -Warning: odbc_fetch_row() expects parameter 1 to be resource, boolean given in %s on line %d -NULL diff --git a/ext/odbc/tests/odbc_free_result_001.phpt b/ext/odbc/tests/odbc_free_result_001.phpt index 4fcd5cda2..970450141 100644 --- a/ext/odbc/tests/odbc_free_result_001.phpt +++ b/ext/odbc/tests/odbc_free_result_001.phpt @@ -12,7 +12,7 @@ $conn = odbc_connect($dsn, $user, $pass); odbc_exec($conn, 'CREATE DATABASE odbcTEST'); odbc_exec($conn, 'CREATE TABLE FOO (TEST INT)'); -odbc_exec($conn, 'ALTER TABLE FOO ADD PRIMARY KEY FOO(TEST)'); +odbc_exec($conn, 'ALTER TABLE FOO ADD PRIMARY KEY (TEST)'); odbc_exec($conn, 'INSERT INTO FOO VALUES (1)'); odbc_exec($conn, 'INSERT INTO FOO VALUES (2)'); diff --git a/ext/opcache/tests/bug67215.phpt b/ext/opcache/tests/bug67215.phpt new file mode 100644 index 000000000..e9919d100 --- /dev/null +++ b/ext/opcache/tests/bug67215.phpt @@ -0,0 +1,28 @@ +--TEST-- +Bug #67215 (php-cgi work with opcache, may be segmentation fault happen) +--INI-- +opcache.enable=1 +opcache.enable_cli=1 +opcache.file_update_protection=0 +--SKIPIF-- +<?php require_once('skipif.inc'); ?> +--FILE-- +<?php + +$file_c = __DIR__ . "/bug67215.c.php"; +$file_p = __DIR__ . "/bug67215.p.php"; +file_put_contents($file_c, "<?php require \"$file_p\"; class c extends p {} ?>"); +file_put_contents($file_p, '<?php class p { protected $var = ""; } ?>'); +require $file_c; +$a = new c(); +require $file_c; +?> +--CLEAN-- +<?php +$file_c = __DIR__ . "/bug67215.c.php"; +$file_p = __DIR__ . "/bug67215.p.php"; +unlink($file_c); +unlink($file_p); +?> +--EXPECTF-- +Fatal error: Cannot redeclare class c in %sbug67215.c.php on line %d diff --git a/ext/opcache/zend_accelerator_util_funcs.c b/ext/opcache/zend_accelerator_util_funcs.c index ae33e765c..931102485 100644 --- a/ext/opcache/zend_accelerator_util_funcs.c +++ b/ext/opcache/zend_accelerator_util_funcs.c @@ -899,16 +899,11 @@ static int zend_hash_unique_copy(HashTable *target, HashTable *source, unique_co if (p->nKeyLength > 0 && p->arKey[0] == 0) { /* Mangled key */ #if ZEND_EXTENSION_API_NO >= PHP_5_3_X_API_NO - if (((zend_function*)p->pData)->common.fn_flags & ZEND_ACC_CLOSURE) { - /* update closure */ - if (zend_hash_quick_update(target, p->arKey, p->nKeyLength, p->h, p->pData, size, &t) == SUCCESS) { - if (pCopyConstructor) { - pCopyConstructor(t); - } + if (zend_hash_quick_update(target, p->arKey, p->nKeyLength, p->h, p->pData, size, &t) == SUCCESS) { + if (pCopyConstructor) { + pCopyConstructor(t); } - } else { - /* ignore and wait for runtime */ - } + } #endif } else if (!ignore_dups && zend_hash_quick_find(target, p->arKey, p->nKeyLength, p->h, &t) == SUCCESS) { *fail_data = p->pData; @@ -1046,7 +1041,6 @@ zend_op_array* zend_accel_load_script(zend_persistent_script *persistent_script, if (zend_hash_num_elements(&persistent_script->class_table) > 0) { zend_accel_class_hash_copy(CG(class_table), &persistent_script->class_table, NULL TSRMLS_CC); } - free_persistent_script(persistent_script, 0); /* free only hashes */ } #if ZEND_EXTENSION_API_NO >= PHP_5_3_X_API_NO @@ -1058,6 +1052,10 @@ zend_op_array* zend_accel_load_script(zend_persistent_script *persistent_script, } #endif + if (!from_shared_memory) { + free_persistent_script(persistent_script, 0); /* free only hashes */ + } + return op_array; } diff --git a/ext/openssl/openssl.c b/ext/openssl/openssl.c index 0d9b9564d..140d75382 100755 --- a/ext/openssl/openssl.c +++ b/ext/openssl/openssl.c @@ -841,13 +841,13 @@ static int add_oid_section(struct php_x509_request * req TSRMLS_DC) /* {{{ */ req->config_filename, req->var, req->req_config TSRMLS_CC) == FAILURE) return FAILURE #define SET_OPTIONAL_STRING_ARG(key, varname, defval) \ - if (optional_args && zend_hash_find(Z_ARRVAL_P(optional_args), key, sizeof(key), (void**)&item) == SUCCESS) \ + if (optional_args && zend_hash_find(Z_ARRVAL_P(optional_args), key, sizeof(key), (void**)&item) == SUCCESS && Z_TYPE_PP(item) == IS_STRING) \ varname = Z_STRVAL_PP(item); \ else \ varname = defval #define SET_OPTIONAL_LONG_ARG(key, varname, defval) \ - if (optional_args && zend_hash_find(Z_ARRVAL_P(optional_args), key, sizeof(key), (void**)&item) == SUCCESS) \ + if (optional_args && zend_hash_find(Z_ARRVAL_P(optional_args), key, sizeof(key), (void**)&item) == SUCCESS && Z_TYPE_PP(item) == IS_LONG) \ varname = Z_LVAL_PP(item); \ else \ varname = defval @@ -907,7 +907,8 @@ static int php_openssl_parse_config(struct php_x509_request * req, zval * option } } - if (req->priv_key_encrypt && optional_args && zend_hash_find(Z_ARRVAL_P(optional_args), "encrypt_key_cipher", sizeof("encrypt_key_cipher"), (void**)&item) == SUCCESS) { + if (req->priv_key_encrypt && optional_args && zend_hash_find(Z_ARRVAL_P(optional_args), "encrypt_key_cipher", sizeof("encrypt_key_cipher"), (void**)&item) == SUCCESS + && Z_TYPE_PP(item) == IS_LONG) { long cipher_algo = Z_LVAL_PP(item); const EVP_CIPHER* cipher = php_openssl_get_evp_cipher_from_algo(cipher_algo); if (cipher == NULL) { @@ -2455,7 +2456,7 @@ PHP_FUNCTION(openssl_pkcs12_export_to_file) } /* parse extra config from args array, promote this to an extra function */ - if (args && zend_hash_find(Z_ARRVAL_P(args), "friendly_name", sizeof("friendly_name"), (void**)&item) == SUCCESS) + if (args && zend_hash_find(Z_ARRVAL_P(args), "friendly_name", sizeof("friendly_name"), (void**)&item) == SUCCESS && Z_TYPE_PP(item) == IS_STRING) friendly_name = Z_STRVAL_PP(item); /* certpbe (default RC2-40) keypbe (default 3DES) @@ -2533,7 +2534,7 @@ PHP_FUNCTION(openssl_pkcs12_export) } /* parse extra config from args array, promote this to an extra function */ - if (args && zend_hash_find(Z_ARRVAL_P(args), "friendly_name", sizeof("friendly_name"), (void**)&item) == SUCCESS) + if (args && zend_hash_find(Z_ARRVAL_P(args), "friendly_name", sizeof("friendly_name"), (void**)&item) == SUCCESS && Z_TYPE_PP(item) == IS_STRING) friendly_name = Z_STRVAL_PP(item); if (args && zend_hash_find(Z_ARRVAL_P(args), "extracerts", sizeof("extracerts"), (void**)&item) == SUCCESS) diff --git a/ext/openssl/tests/026.phpt b/ext/openssl/tests/026.phpt new file mode 100644 index 000000000..38d626d74 --- /dev/null +++ b/ext/openssl/tests/026.phpt @@ -0,0 +1,12 @@ +--TEST-- +Options type checks +--SKIPIF-- +<?php if (!extension_loaded("openssl")) print "skip"; ?> +--FILE-- +<?php +$x = openssl_pkey_new(); +$csr = openssl_csr_new(["countryName" => "DE"], $x, ["x509_extensions" => 0xDEADBEEF]); +?> +DONE +--EXPECT-- +DONE diff --git a/ext/openssl/xp_ssl.c b/ext/openssl/xp_ssl.c index c6a91570c..ba35c8828 100644 --- a/ext/openssl/xp_ssl.c +++ b/ext/openssl/xp_ssl.c @@ -274,11 +274,12 @@ static zend_bool matches_wildcard_name(const char *subjectname, const char *cert return 1; } - if (!(wildcard = strchr(certname, '*'))) { + /* wildcard, if present, must only be present in the left-most component */ + if (!(wildcard = strchr(certname, '*')) || memchr(certname, '.', wildcard - certname)) { return 0; } - // 1) prefix, if not empty, must match subject + /* 1) prefix, if not empty, must match subject */ prefix_len = wildcard - certname; if (prefix_len && strncasecmp(subjectname, certname, prefix_len) != 0) { return 0; @@ -321,7 +322,7 @@ static zend_bool matches_san_list(X509 *peer, const char *subject_name TSRMLS_DC if (san_name_len != strlen((const char*)cert_name)) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Peer SAN entry is malformed"); } else { - is_match = strcasecmp(subject_name, (const char*)cert_name) == 0; + is_match = matches_wildcard_name(subject_name, (const char *)cert_name); } OPENSSL_free(cert_name); @@ -1164,12 +1165,14 @@ static int set_server_specific_opts(php_stream *stream, SSL_CTX *ctx TSRMLS_DC) ssl_ctx_options |= SSL_OP_SINGLE_DH_USE; } +#ifdef HAVE_ECDH if (SUCCESS == php_stream_context_get_option( stream->context, "ssl", "single_ecdh_use", &val) && zend_is_true(*val) ) { ssl_ctx_options |= SSL_OP_SINGLE_ECDH_USE; } +#endif SSL_CTX_set_options(ctx, ssl_ctx_options); diff --git a/ext/pgsql/pgsql.c b/ext/pgsql/pgsql.c index be351297d..6a433af0f 100644 --- a/ext/pgsql/pgsql.c +++ b/ext/pgsql/pgsql.c @@ -1127,7 +1127,9 @@ PHP_MINIT_FUNCTION(pgsql) REGISTER_LONG_CONSTANT("PGSQL_CONNECTION_MADE", CONNECTION_MADE, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("PGSQL_CONNECTION_AWAITING_RESPONSE", CONNECTION_AWAITING_RESPONSE, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("PGSQL_CONNECTION_AUTH_OK", CONNECTION_AUTH_OK, CONST_CS | CONST_PERSISTENT); +#ifdef CONNECTION_SSL_STARTUP REGISTER_LONG_CONSTANT("PGSQL_CONNECTION_SSL_STARTUP", CONNECTION_SSL_STARTUP, CONST_CS | CONST_PERSISTENT); +#endif REGISTER_LONG_CONSTANT("PGSQL_CONNECTION_SETENV", CONNECTION_SETENV, CONST_CS | CONST_PERSISTENT); /* For pg_connect_poll() */ REGISTER_LONG_CONSTANT("PGSQL_POLLING_FAILED", PGRES_POLLING_FAILED, CONST_CS | CONST_PERSISTENT); diff --git a/ext/phar/phar_object.c b/ext/phar/phar_object.c index 75aadfbc5..b198bc2fd 100644 --- a/ext/phar/phar_object.c +++ b/ext/phar/phar_object.c @@ -606,6 +606,7 @@ PHP_METHOD(Phar, webPhar) } if ((strlen(sapi_module.name) == sizeof("cgi-fcgi")-1 && !strncmp(sapi_module.name, "cgi-fcgi", sizeof("cgi-fcgi")-1)) + || (strlen(sapi_module.name) == sizeof("fpm-fcgi")-1 && !strncmp(sapi_module.name, "fpm-fcgi", sizeof("fpm-fcgi")-1)) || (strlen(sapi_module.name) == sizeof("cgi")-1 && !strncmp(sapi_module.name, "cgi", sizeof("cgi")-1))) { if (PG(http_globals)[TRACK_VARS_SERVER]) { diff --git a/ext/readline/readline_cli.c b/ext/readline/readline_cli.c index c2bf8764c..9c27acb19 100644 --- a/ext/readline/readline_cli.c +++ b/ext/readline/readline_cli.c @@ -99,6 +99,9 @@ static size_t readline_shell_write(const char *str, uint str_length TSRMLS_DC) / static int readline_shell_ub_write(const char *str, uint str_length TSRMLS_DC) /* {{{ */ { + /* We just store the last char here and then pass back to the + caller (sapi_cli_single_write in sapi/cli) which will actually + write due to -1 return code */ php_last_char = str[str_length-1]; return -1; } @@ -587,6 +590,7 @@ static int readline_shell_run(TSRMLS_D) /* {{{ */ char *code = emalloc(size); char *prompt = cli_get_prompt("php", '>' TSRMLS_CC); char *history_file; + int history_lines_to_write = 0; if (PG(auto_prepend_file) && PG(auto_prepend_file)[0]) { zend_file_handle *prepend_file_p; @@ -651,6 +655,7 @@ static int readline_shell_run(TSRMLS_D) /* {{{ */ if (*line) { add_history(line); + history_lines_to_write += 1; } free(line); @@ -660,6 +665,15 @@ static int readline_shell_run(TSRMLS_D) /* {{{ */ continue; } + if (history_lines_to_write) { +#if HAVE_LIBEDIT + write_history(history_file); +#else + append_history(history_lines_to_write, history_file); +#endif + history_lines_to_write = 0; + } + zend_try { zend_eval_stringl(code, pos, NULL, "php shell code" TSRMLS_CC); } zend_end_try(); @@ -667,7 +681,7 @@ static int readline_shell_run(TSRMLS_D) /* {{{ */ pos = 0; if (!pager_pipe && php_last_char != '\0' && php_last_char != '\n') { - readline_shell_write("\n", 1 TSRMLS_CC); + php_write("\n", 1 TSRMLS_CC); } if (EG(exception)) { @@ -681,7 +695,6 @@ static int readline_shell_run(TSRMLS_D) /* {{{ */ php_last_char = '\0'; } - write_history(history_file); free(history_file); efree(code); efree(prompt); diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c index 703e14113..8e5fcadef 100644 --- a/ext/reflection/php_reflection.c +++ b/ext/reflection/php_reflection.c @@ -728,12 +728,17 @@ static void _parameter_string(string *str, zend_function *fptr, struct _zend_arg if (precv && precv->opcode == ZEND_RECV_INIT && precv->op2_type != IS_UNUSED) { zval *zv, zv_copy; int use_copy; + zend_class_entry *old_scope; + string_write(str, " = ", sizeof(" = ")-1); ALLOC_ZVAL(zv); *zv = *precv->op2.zv; zval_copy_ctor(zv); INIT_PZVAL(zv); - zval_update_constant_ex(&zv, 1, fptr->common.scope TSRMLS_CC); + old_scope = EG(scope); + EG(scope) = fptr->common.scope; + zval_update_constant_ex(&zv, 1, NULL TSRMLS_CC); + EG(scope) = old_scope; if (Z_TYPE_P(zv) == IS_BOOL) { if (Z_LVAL_P(zv)) { string_write(str, "true", sizeof("true")-1); @@ -2579,6 +2584,7 @@ ZEND_METHOD(reflection_parameter, getDefaultValue) { parameter_reference *param; zend_op *precv; + zend_class_entry *old_scope; if (zend_parse_parameters_none() == FAILURE) { return; @@ -2599,7 +2605,10 @@ ZEND_METHOD(reflection_parameter, getDefaultValue) if (!IS_CONSTANT_TYPE(Z_TYPE_P(return_value))) { zval_copy_ctor(return_value); } - zval_update_constant_ex(&return_value, 0, param->fptr->common.scope TSRMLS_CC); + old_scope = EG(scope); + EG(scope) = param->fptr->common.scope; + zval_update_constant_ex(&return_value, 0, NULL TSRMLS_CC); + EG(scope) = old_scope; } /* }}} */ @@ -4299,8 +4308,8 @@ ZEND_METHOD(reflection_class, newInstanceWithoutConstructor) METHOD_NOTSTATIC(reflection_class_ptr); GET_REFLECTION_OBJECT_PTR(ce); - if (ce->create_object != NULL) { - zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, "Class %s is an internal class that cannot be instantiated without invoking its constructor", ce->name); + if (ce->create_object != NULL && ce->ce_flags & ZEND_ACC_FINAL_CLASS) { + zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, "Class %s is an internal class marked as final that cannot be instantiated without invoking its constructor", ce->name); } object_init_ex(return_value, ce); diff --git a/ext/reflection/tests/ReflectionClass_newInstanceWithoutConstructor.phpt b/ext/reflection/tests/ReflectionClass_newInstanceWithoutConstructor.phpt index 1932dbfaf..dfe3e7f8f 100644 --- a/ext/reflection/tests/ReflectionClass_newInstanceWithoutConstructor.phpt +++ b/ext/reflection/tests/ReflectionClass_newInstanceWithoutConstructor.phpt @@ -20,13 +20,18 @@ var_dump($class->newInstanceWithoutConstructor()); $class = new ReflectionClass('DateTime'); var_dump($class->newInstanceWithoutConstructor()); + +$class = new ReflectionClass('Generator'); +var_dump($class->newInstanceWithoutConstructor()); --EXPECTF-- object(Foo)#%d (0) { } object(stdClass)#%d (0) { } +object(DateTime)#%d (0) { +} -Fatal error: Uncaught exception 'ReflectionException' with message 'Class DateTime is an internal class that cannot be instantiated without invoking its constructor' in %sReflectionClass_newInstanceWithoutConstructor.php:%d +Fatal error: Uncaught exception 'ReflectionException' with message 'Class Generator is an internal class marked as final that cannot be instantiated without invoking its constructor' in %sReflectionClass_newInstanceWithoutConstructor.php:%d Stack trace: #0 %sReflectionClass_newInstanceWithoutConstructor.php(%d): ReflectionClass->newInstanceWithoutConstructor() #1 {main} diff --git a/ext/reflection/tests/bug64007.phpt b/ext/reflection/tests/bug64007.phpt index 32ec6a561..ae3ec5032 100644 --- a/ext/reflection/tests/bug64007.phpt +++ b/ext/reflection/tests/bug64007.phpt @@ -14,6 +14,6 @@ $generator = $reflection->newInstance(); var_dump($generator); ?> --EXPECTF-- -string(97) "Class Generator is an internal class that cannot be instantiated without invoking its constructor" +string(%d) "Class Generator is an internal class marked as final that cannot be instantiated without invoking its constructor" Catchable fatal error: The "Generator" class is reserved for internal use and cannot be manually instantiated in %sbug64007.php on line %d diff --git a/ext/session/session.c b/ext/session/session.c index 1d60c4018..d1a7a073a 100644 --- a/ext/session/session.c +++ b/ext/session/session.c @@ -301,7 +301,8 @@ PHPAPI char *php_session_create_id(PS_CREATE_SID_ARGS) /* {{{ */ if (zend_hash_find(&EG(symbol_table), "_SERVER", sizeof("_SERVER"), (void **) &array) == SUCCESS && Z_TYPE_PP(array) == IS_ARRAY && - zend_hash_find(Z_ARRVAL_PP(array), "REMOTE_ADDR", sizeof("REMOTE_ADDR"), (void **) &token) == SUCCESS + zend_hash_find(Z_ARRVAL_PP(array), "REMOTE_ADDR", sizeof("REMOTE_ADDR"), (void **) &token) == SUCCESS && + Z_TYPE_PP(token) == IS_STRING ) { remote_addr = Z_STRVAL_PP(token); } @@ -1444,9 +1445,16 @@ PHPAPI const ps_serializer *_php_find_ps_serializer(char *name TSRMLS_DC) /* {{{ } /* }}} */ -#define PPID2SID \ - convert_to_string((*ppid)); \ - PS(id) = estrndup(Z_STRVAL_PP(ppid), Z_STRLEN_PP(ppid)) +static void ppid2sid(zval **ppid TSRMLS_DC) { + if (Z_TYPE_PP(ppid) != IS_STRING) { + PS(id) = NULL; + PS(send_cookie) = 1; + } else { + convert_to_string((*ppid)); + PS(id) = estrndup(Z_STRVAL_PP(ppid), Z_STRLEN_PP(ppid)); + PS(send_cookie) = 0; + } +} PHPAPI void php_session_reset_id(TSRMLS_D) /* {{{ */ { @@ -1540,9 +1548,8 @@ PHPAPI void php_session_start(TSRMLS_D) /* {{{ */ Z_TYPE_PP(data) == IS_ARRAY && zend_hash_find(Z_ARRVAL_PP(data), PS(session_name), lensess + 1, (void **) &ppid) == SUCCESS ) { - PPID2SID; + ppid2sid(ppid TSRMLS_CC); PS(apply_trans_sid) = 0; - PS(send_cookie) = 0; PS(define_sid) = 0; } @@ -1551,8 +1558,7 @@ PHPAPI void php_session_start(TSRMLS_D) /* {{{ */ Z_TYPE_PP(data) == IS_ARRAY && zend_hash_find(Z_ARRVAL_PP(data), PS(session_name), lensess + 1, (void **) &ppid) == SUCCESS ) { - PPID2SID; - PS(send_cookie) = 0; + ppid2sid(ppid TSRMLS_CC); } if (!PS(use_only_cookies) && !PS(id) && @@ -1560,8 +1566,7 @@ PHPAPI void php_session_start(TSRMLS_D) /* {{{ */ Z_TYPE_PP(data) == IS_ARRAY && zend_hash_find(Z_ARRVAL_PP(data), PS(session_name), lensess + 1, (void **) &ppid) == SUCCESS ) { - PPID2SID; - PS(send_cookie) = 0; + ppid2sid(ppid TSRMLS_CC); } } diff --git a/ext/session/tests/bug66827.phpt b/ext/session/tests/bug66827.phpt new file mode 100644 index 000000000..4e1a4f7ae --- /dev/null +++ b/ext/session/tests/bug66827.phpt @@ -0,0 +1,12 @@ +--TEST-- +Bug #66827: Session raises E_NOTICE when session name variable is array. +--INI-- +--SKIPIF-- +<?php include('skipif.inc'); ?> +--FILE-- +<?php +$_COOKIE[session_name()] = array(); +session_start(); +echo 'OK'; +--EXPECTF-- +OK diff --git a/ext/soap/soap.c b/ext/soap/soap.c index 32bf5ca6f..0453dc28e 100644 --- a/ext/soap/soap.c +++ b/ext/soap/soap.c @@ -151,7 +151,9 @@ static void soap_error_handler(int error_num, const char *error_filename, const if (zend_hash_find(Z_OBJPROP_P(this_ptr),"service", sizeof("service"), (void **)&tmp) != FAILURE) { \ ss = (soapServicePtr)zend_fetch_resource(tmp TSRMLS_CC, -1, "service", NULL, 1, le_service); \ } else { \ - ss = NULL; \ + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Can not fetch service object"); \ + SOAP_SERVER_END_CODE(); \ + return; \ } \ } diff --git a/ext/spl/spl_array.c b/ext/spl/spl_array.c index 32cdfe6fb..9c49d91ca 100644 --- a/ext/spl/spl_array.c +++ b/ext/spl/spl_array.c @@ -1742,6 +1742,7 @@ SPL_METHOD(Array, unserialize) const unsigned char *p, *s; php_unserialize_data_t var_hash; zval *pmembers, *pflags = NULL; + HashTable *aht; long flags; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &buf, &buf_len) == FAILURE) { @@ -1752,6 +1753,12 @@ SPL_METHOD(Array, unserialize) return; } + aht = spl_array_get_hash_table(intern, 0 TSRMLS_CC); + if (aht->nApplyCount > 0) { + zend_error(E_WARNING, "Modification of ArrayObject during sorting is prohibited"); + return; + } + /* storage */ s = p = (const unsigned char*)buf; PHP_VAR_UNSERIALIZE_INIT(var_hash); diff --git a/ext/spl/spl_directory.c b/ext/spl/spl_directory.c index 4159d1ae3..495314abe 100644 --- a/ext/spl/spl_directory.c +++ b/ext/spl/spl_directory.c @@ -1617,7 +1617,7 @@ SPL_METHOD(GlobIterator, count) return; } - if (php_stream_is(intern->u.dir.dirp ,&php_glob_stream_ops)) { + if (intern->u.dir.dirp && php_stream_is(intern->u.dir.dirp ,&php_glob_stream_ops)) { RETURN_LONG(php_glob_stream_get_count(intern->u.dir.dirp, NULL)); } else { /* should not happen */ @@ -2098,7 +2098,7 @@ static int spl_filesystem_file_call(spl_filesystem_object *intern, zend_function zend_fcall_info fci; zend_fcall_info_cache fcic; zval z_fname; - zval * zresource_ptr = &intern->u.file.zresource, *retval; + zval * zresource_ptr = &intern->u.file.zresource, *retval = NULL; int result; int num_args = pass_num_args + (arg2 ? 2 : 1); @@ -2132,7 +2132,7 @@ static int spl_filesystem_file_call(spl_filesystem_object *intern, zend_function result = zend_call_function(&fci, &fcic TSRMLS_CC); - if (result == FAILURE) { + if (result == FAILURE || retval == NULL) { RETVAL_FALSE; } else { ZVAL_ZVAL(return_value, retval, 1, 1); @@ -2265,6 +2265,10 @@ static int spl_filesystem_file_read_line(zval * this_ptr, spl_filesystem_object static void spl_filesystem_file_rewind(zval * this_ptr, spl_filesystem_object *intern TSRMLS_DC) /* {{{ */ { + if(!intern->u.file.stream) { + zend_throw_exception_ex(spl_ce_RuntimeException, 0 TSRMLS_CC, "Object not initialized"); + return; + } if (-1 == php_stream_rewind(intern->u.file.stream)) { zend_throw_exception_ex(spl_ce_RuntimeException, 0 TSRMLS_CC, "Cannot rewind file %s", intern->file_name); } else { @@ -2397,6 +2401,11 @@ SPL_METHOD(SplFileObject, eof) return; } + if(!intern->u.file.stream) { + zend_throw_exception_ex(spl_ce_RuntimeException, 0 TSRMLS_CC, "Object not initialized"); + return; + } + RETURN_BOOL(php_stream_eof(intern->u.file.stream)); } /* }}} */ @@ -2413,6 +2422,9 @@ SPL_METHOD(SplFileObject, valid) if (SPL_HAS_FLAG(intern->flags, SPL_FILE_OBJECT_READ_AHEAD)) { RETURN_BOOL(intern->u.file.current_line || intern->u.file.current_zval); } else { + if(!intern->u.file.stream) { + RETURN_FALSE; + } RETVAL_BOOL(!php_stream_eof(intern->u.file.stream)); } } /* }}} */ @@ -2427,6 +2439,11 @@ SPL_METHOD(SplFileObject, fgets) return; } + if(!intern->u.file.stream) { + zend_throw_exception_ex(spl_ce_RuntimeException, 0 TSRMLS_CC, "Object not initialized"); + return; + } + if (spl_filesystem_file_read(intern, 0 TSRMLS_CC) == FAILURE) { RETURN_FALSE; } @@ -2443,6 +2460,11 @@ SPL_METHOD(SplFileObject, current) return; } + if(!intern->u.file.stream) { + zend_throw_exception_ex(spl_ce_RuntimeException, 0 TSRMLS_CC, "Object not initialized"); + return; + } + if (!intern->u.file.current_line && !intern->u.file.current_zval) { spl_filesystem_file_read_line(getThis(), intern, 1 TSRMLS_CC); } @@ -2585,6 +2607,12 @@ SPL_METHOD(SplFileObject, fgetcsv) int d_len = 0, e_len = 0, esc_len = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|sss", &delim, &d_len, &enclo, &e_len, &esc, &esc_len) == SUCCESS) { + + if(!intern->u.file.stream) { + zend_throw_exception_ex(spl_ce_RuntimeException, 0 TSRMLS_CC, "Object not initialized"); + return; + } + switch(ZEND_NUM_ARGS()) { case 3: @@ -2726,6 +2754,11 @@ SPL_METHOD(SplFileObject, fflush) { spl_filesystem_object *intern = (spl_filesystem_object*)zend_object_store_get_object(getThis() TSRMLS_CC); + if(!intern->u.file.stream) { + zend_throw_exception_ex(spl_ce_RuntimeException, 0 TSRMLS_CC, "Object not initialized"); + return; + } + RETURN_BOOL(!php_stream_flush(intern->u.file.stream)); } /* }}} */ @@ -2734,7 +2767,14 @@ SPL_METHOD(SplFileObject, fflush) SPL_METHOD(SplFileObject, ftell) { spl_filesystem_object *intern = (spl_filesystem_object*)zend_object_store_get_object(getThis() TSRMLS_CC); - long ret = php_stream_tell(intern->u.file.stream); + long ret; + + if(!intern->u.file.stream) { + zend_throw_exception_ex(spl_ce_RuntimeException, 0 TSRMLS_CC, "Object not initialized"); + return; + } + + ret = php_stream_tell(intern->u.file.stream); if (ret == -1) { RETURN_FALSE; @@ -2754,6 +2794,11 @@ SPL_METHOD(SplFileObject, fseek) return; } + if(!intern->u.file.stream) { + zend_throw_exception_ex(spl_ce_RuntimeException, 0 TSRMLS_CC, "Object not initialized"); + return; + } + spl_filesystem_file_free_line(intern TSRMLS_CC); RETURN_LONG(php_stream_seek(intern->u.file.stream, pos, whence)); } /* }}} */ @@ -2766,6 +2811,11 @@ SPL_METHOD(SplFileObject, fgetc) char buf[2]; int result; + if(!intern->u.file.stream) { + zend_throw_exception_ex(spl_ce_RuntimeException, 0 TSRMLS_CC, "Object not initialized"); + return; + } + spl_filesystem_file_free_line(intern TSRMLS_CC); result = php_stream_getc(intern->u.file.stream); @@ -2791,6 +2841,11 @@ SPL_METHOD(SplFileObject, fgetss) zval *arg2 = NULL; MAKE_STD_ZVAL(arg2); + if(!intern->u.file.stream) { + zend_throw_exception_ex(spl_ce_RuntimeException, 0 TSRMLS_CC, "Object not initialized"); + return; + } + if (intern->u.file.max_line_len > 0) { ZVAL_LONG(arg2, intern->u.file.max_line_len); } else { @@ -2811,6 +2866,11 @@ SPL_METHOD(SplFileObject, fpassthru) { spl_filesystem_object *intern = (spl_filesystem_object*)zend_object_store_get_object(getThis() TSRMLS_CC); + if(!intern->u.file.stream) { + zend_throw_exception_ex(spl_ce_RuntimeException, 0 TSRMLS_CC, "Object not initialized"); + return; + } + RETURN_LONG(php_stream_passthru(intern->u.file.stream)); } /* }}} */ @@ -2820,6 +2880,11 @@ SPL_METHOD(SplFileObject, fscanf) { spl_filesystem_object *intern = (spl_filesystem_object*)zend_object_store_get_object(getThis() TSRMLS_CC); + if(!intern->u.file.stream) { + zend_throw_exception_ex(spl_ce_RuntimeException, 0 TSRMLS_CC, "Object not initialized"); + return; + } + spl_filesystem_file_free_line(intern TSRMLS_CC); intern->u.file.current_line_num++; @@ -2840,6 +2905,11 @@ SPL_METHOD(SplFileObject, fwrite) return; } + if(!intern->u.file.stream) { + zend_throw_exception_ex(spl_ce_RuntimeException, 0 TSRMLS_CC, "Object not initialized"); + return; + } + if (ZEND_NUM_ARGS() > 1) { str_len = MAX(0, MIN(length, str_len)); } @@ -2859,6 +2929,11 @@ SPL_METHOD(SplFileObject, fread) return; } + if(!intern->u.file.stream) { + zend_throw_exception_ex(spl_ce_RuntimeException, 0 TSRMLS_CC, "Object not initialized"); + return; + } + if (length <= 0) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Length parameter must be greater than 0"); RETURN_FALSE; @@ -2888,6 +2963,11 @@ SPL_METHOD(SplFileObject, ftruncate) return; } + if(!intern->u.file.stream) { + zend_throw_exception_ex(spl_ce_RuntimeException, 0 TSRMLS_CC, "Object not initialized"); + return; + } + if (!php_stream_truncate_supported(intern->u.file.stream)) { zend_throw_exception_ex(spl_ce_LogicException, 0 TSRMLS_CC, "Can't truncate file %s", intern->file_name); RETURN_FALSE; @@ -2902,15 +2982,20 @@ SPL_METHOD(SplFileObject, seek) { spl_filesystem_object *intern = (spl_filesystem_object*)zend_object_store_get_object(getThis() TSRMLS_CC); long line_pos; - + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &line_pos) == FAILURE) { return; } + if(!intern->u.file.stream) { + zend_throw_exception_ex(spl_ce_RuntimeException, 0 TSRMLS_CC, "Object not initialized"); + return; + } + if (line_pos < 0) { zend_throw_exception_ex(spl_ce_LogicException, 0 TSRMLS_CC, "Can't seek file %s to negative line %ld", intern->file_name, line_pos); RETURN_FALSE; } - + spl_filesystem_file_rewind(getThis(), intern TSRMLS_CC); while(intern->u.file.current_line_num < line_pos) { diff --git a/ext/spl/spl_dllist.c b/ext/spl/spl_dllist.c index fb88f5890..c48736ec6 100644 --- a/ext/spl/spl_dllist.c +++ b/ext/spl/spl_dllist.c @@ -43,12 +43,10 @@ PHPAPI zend_class_entry *spl_ce_SplStack; #define SPL_LLIST_DELREF(elem) if(!--(elem)->rc) { \ efree(elem); \ - elem = NULL; \ } #define SPL_LLIST_CHECK_DELREF(elem) if((elem) && !--(elem)->rc) { \ efree(elem); \ - elem = NULL; \ } #define SPL_LLIST_ADDREF(elem) (elem)->rc++ @@ -916,6 +914,11 @@ SPL_METHOD(SplDoublyLinkedList, offsetUnset) llist->dtor(element TSRMLS_CC); } + if (intern->traverse_pointer == element) { + SPL_LLIST_DELREF(element); + intern->traverse_pointer = NULL; + } + zval_ptr_dtor((zval **)&element->data); element->data = NULL; diff --git a/ext/spl/spl_iterators.c b/ext/spl/spl_iterators.c index cade34efd..3ca0bda3b 100644 --- a/ext/spl/spl_iterators.c +++ b/ext/spl/spl_iterators.c @@ -139,6 +139,19 @@ static zend_object_handlers spl_handlers_dual_it; (var) = it; \ } while (0) +#define SPL_FETCH_SUB_ELEMENT(var, object, element) \ + do { \ + if(!(object)->iterators) { \ + zend_throw_exception_ex(spl_ce_LogicException, 0 TSRMLS_CC, \ + "The object is in an invalid state as the parent constructor was not called"); \ + return; \ + } \ + (var) = (object)->iterators[(object)->level].element; \ + } while (0) + +#define SPL_FETCH_SUB_ITERATOR(var, object) SPL_FETCH_SUB_ELEMENT(var, object, iterator) + + static void spl_recursive_it_dtor(zend_object_iterator *_iter TSRMLS_DC) { spl_recursive_it_iterator *iter = (spl_recursive_it_iterator*)_iter; @@ -161,7 +174,10 @@ static int spl_recursive_it_valid_ex(spl_recursive_it_object *object, zval *zthi { zend_object_iterator *sub_iter; int level = object->level; - + + if(!object->iterators) { + return FAILURE; + } while (level >=0) { sub_iter = object->iterators[level].iterator; if (sub_iter->funcs->valid(sub_iter TSRMLS_CC) == SUCCESS) { @@ -212,6 +228,8 @@ static void spl_recursive_it_move_forward_ex(spl_recursive_it_object *object, zv zend_object_iterator *sub_iter; int has_children; + SPL_FETCH_SUB_ITERATOR(iterator, object); + while (!EG(exception)) { next_step: iterator = object->iterators[object->level].iterator; @@ -375,9 +393,7 @@ static void spl_recursive_it_rewind_ex(spl_recursive_it_object *object, zval *zt { zend_object_iterator *sub_iter; - if (!object->iterators) { - php_error_docref(NULL TSRMLS_CC, E_ERROR, "The %s instance wasn't initialized properly", Z_OBJCE_P(zthis)->name); - } + SPL_FETCH_SUB_ITERATOR(sub_iter, object); while (object->level) { sub_iter = object->iterators[object->level].iterator; @@ -597,7 +613,7 @@ SPL_METHOD(RecursiveIteratorIterator, rewind) SPL_METHOD(RecursiveIteratorIterator, valid) { spl_recursive_it_object *object = (spl_recursive_it_object*)zend_object_store_get_object(getThis() TSRMLS_CC); - + if (zend_parse_parameters_none() == FAILURE) { return; } @@ -610,12 +626,14 @@ SPL_METHOD(RecursiveIteratorIterator, valid) SPL_METHOD(RecursiveIteratorIterator, key) { spl_recursive_it_object *object = (spl_recursive_it_object*)zend_object_store_get_object(getThis() TSRMLS_CC); - zend_object_iterator *iterator = object->iterators[object->level].iterator; - + zend_object_iterator *iterator; + if (zend_parse_parameters_none() == FAILURE) { return; } + SPL_FETCH_SUB_ITERATOR(iterator, object); + if (iterator->funcs->get_current_key) { iterator->funcs->get_current_key(iterator, return_value TSRMLS_CC); } else { @@ -628,13 +646,15 @@ SPL_METHOD(RecursiveIteratorIterator, key) SPL_METHOD(RecursiveIteratorIterator, current) { spl_recursive_it_object *object = (spl_recursive_it_object*)zend_object_store_get_object(getThis() TSRMLS_CC); - zend_object_iterator *iterator = object->iterators[object->level].iterator; + zend_object_iterator *iterator; zval **data; if (zend_parse_parameters_none() == FAILURE) { return; } + SPL_FETCH_SUB_ITERATOR(iterator, object); + iterator->funcs->get_current_data(iterator, &data TSRMLS_CC); if (data && *data) { RETURN_ZVAL(*data, 1, 0); @@ -673,6 +693,7 @@ SPL_METHOD(RecursiveIteratorIterator, getSubIterator) { spl_recursive_it_object *object = (spl_recursive_it_object*)zend_object_store_get_object(getThis() TSRMLS_CC); long level = object->level; + zval *zobject; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &level) == FAILURE) { return; @@ -680,6 +701,13 @@ SPL_METHOD(RecursiveIteratorIterator, getSubIterator) if (level < 0 || level > object->level) { RETURN_NULL(); } + + if(!object->iterators) { + zend_throw_exception_ex(spl_ce_LogicException, 0 TSRMLS_CC, + "The object is in an invalid state as the parent constructor was not called"); + return; + } + RETURN_ZVAL(object->iterators[level].zobject, 1, 0); } /* }}} */ @@ -688,13 +716,15 @@ SPL_METHOD(RecursiveIteratorIterator, getSubIterator) SPL_METHOD(RecursiveIteratorIterator, getInnerIterator) { spl_recursive_it_object *object = (spl_recursive_it_object*)zend_object_store_get_object(getThis() TSRMLS_CC); - long level = object->level; + zval *zobject; if (zend_parse_parameters_none() == FAILURE) { return; } - - RETURN_ZVAL(object->iterators[level].zobject, 1, 0); + + SPL_FETCH_SUB_ELEMENT(zobject, object, zobject); + + RETURN_ZVAL(zobject, 1, 0); } /* }}} */ /* {{{ proto RecursiveIterator RecursiveIteratorIterator::beginIteration() @@ -722,13 +752,19 @@ SPL_METHOD(RecursiveIteratorIterator, endIteration) SPL_METHOD(RecursiveIteratorIterator, callHasChildren) { spl_recursive_it_object *object = (spl_recursive_it_object*)zend_object_store_get_object(getThis() TSRMLS_CC); - zend_class_entry *ce = object->iterators[object->level].ce; + zend_class_entry *ce; zval *retval, *zobject; if (zend_parse_parameters_none() == FAILURE) { return; } + if (!object->iterators) { + RETURN_NULL(); + } + + SPL_FETCH_SUB_ELEMENT(ce, object, ce); + zobject = object->iterators[object->level].zobject; if (!zobject) { RETURN_FALSE; @@ -747,13 +783,15 @@ SPL_METHOD(RecursiveIteratorIterator, callHasChildren) SPL_METHOD(RecursiveIteratorIterator, callGetChildren) { spl_recursive_it_object *object = (spl_recursive_it_object*)zend_object_store_get_object(getThis() TSRMLS_CC); - zend_class_entry *ce = object->iterators[object->level].ce; + zend_class_entry *ce; zval *retval, *zobject; if (zend_parse_parameters_none() == FAILURE) { return; } + SPL_FETCH_SUB_ELEMENT(ce, object, ce); + zobject = object->iterators[object->level].zobject; if (!zobject) { return; @@ -1072,6 +1110,13 @@ SPL_METHOD(RecursiveTreeIterator, getPrefix) if (zend_parse_parameters_none() == FAILURE) { return; } + + if(!object->iterators) { + zend_throw_exception_ex(spl_ce_LogicException, 0 TSRMLS_CC, + "The object is in an invalid state as the parent constructor was not called"); + return; + } + spl_recursive_tree_iterator_get_prefix(object, return_value TSRMLS_CC); } /* }}} */ @@ -1100,6 +1145,12 @@ SPL_METHOD(RecursiveTreeIterator, getEntry) if (zend_parse_parameters_none() == FAILURE) { return; } + + if(!object->iterators) { + zend_throw_exception_ex(spl_ce_LogicException, 0 TSRMLS_CC, + "The object is in an invalid state as the parent constructor was not called"); + return; + } spl_recursive_tree_iterator_get_entry(object, return_value TSRMLS_CC); } /* }}} */ @@ -1113,6 +1164,12 @@ SPL_METHOD(RecursiveTreeIterator, getPostfix) if (zend_parse_parameters_none() == FAILURE) { return; } + + if(!object->iterators) { + zend_throw_exception_ex(spl_ce_LogicException, 0 TSRMLS_CC, + "The object is in an invalid state as the parent constructor was not called"); + return; + } spl_recursive_tree_iterator_get_postfix(object, return_value TSRMLS_CC); } /* }}} */ @@ -1130,10 +1187,17 @@ SPL_METHOD(RecursiveTreeIterator, current) return; } + if(!object->iterators) { + zend_throw_exception_ex(spl_ce_LogicException, 0 TSRMLS_CC, + "The object is in an invalid state as the parent constructor was not called"); + return; + } + if (object->flags & RTIT_BYPASS_CURRENT) { - zend_object_iterator *iterator = object->iterators[object->level].iterator; + zend_object_iterator *iterator; zval **data; + SPL_FETCH_SUB_ITERATOR(iterator, object); iterator->funcs->get_current_data(iterator, &data TSRMLS_CC); if (data && *data) { RETURN_ZVAL(*data, 1, 0); @@ -1177,7 +1241,7 @@ SPL_METHOD(RecursiveTreeIterator, current) SPL_METHOD(RecursiveTreeIterator, key) { spl_recursive_it_object *object = (spl_recursive_it_object*)zend_object_store_get_object(getThis() TSRMLS_CC); - zend_object_iterator *iterator = object->iterators[object->level].iterator; + zend_object_iterator *iterator; zval prefix, key, postfix, key_copy; char *str, *ptr; size_t str_len; @@ -1186,6 +1250,8 @@ SPL_METHOD(RecursiveTreeIterator, key) return; } + SPL_FETCH_SUB_ITERATOR(iterator, object); + if (iterator->funcs->get_current_key) { iterator->funcs->get_current_key(iterator, &key TSRMLS_CC); } else { @@ -1899,7 +1965,7 @@ SPL_METHOD(RecursiveCallbackFilterIterator, getChildren) return; } - intern = (spl_dual_it_object*)zend_object_store_get_object(getThis() TSRMLS_CC); + SPL_FETCH_AND_CHECK_DUAL_IT(intern, getThis()); zend_call_method_with_0_params(&intern->inner.zobject, intern->inner.ce, NULL, "getchildren", &retval); if (!EG(exception) && retval) { diff --git a/ext/spl/tests/bug54281.phpt b/ext/spl/tests/bug54281.phpt index d42d9e585..71792eaa2 100644 --- a/ext/spl/tests/bug54281.phpt +++ b/ext/spl/tests/bug54281.phpt @@ -12,4 +12,8 @@ foreach($it as $k=>$v) { } ?> --EXPECTF-- -Fatal error: RecursiveIteratorIterator::rewind(): The RecursiveArrayIteratorIterator instance wasn't initialized properly in %s on line %d +Fatal error: Uncaught exception 'LogicException' with message 'The object is in an invalid state as the parent constructor was not called' in %s:%d +Stack trace: +#0 %s/bug54281.php(8): RecursiveIteratorIterator->rewind() +#1 {main} + thrown in %s/bug54281.php on line 8 diff --git a/ext/spl/tests/bug67538.phpt b/ext/spl/tests/bug67538.phpt new file mode 100644 index 000000000..b6f3848c3 --- /dev/null +++ b/ext/spl/tests/bug67538.phpt @@ -0,0 +1,17 @@ +--TEST-- +Bug #67538 (SPL Iterators use-after-free) +--FILE-- +<?php +$list = new SplDoublyLinkedList(); +$list->push('a'); +$list->push('b'); + +$list->rewind(); +$list->offsetUnset(0); +$list->push('b'); +$list->offsetUnset(0); +$list->next(); +echo "okey"; +?> +--EXPECTF-- +okey diff --git a/ext/spl/tests/bug67539.phpt b/ext/spl/tests/bug67539.phpt new file mode 100644 index 000000000..8bab2a8c2 --- /dev/null +++ b/ext/spl/tests/bug67539.phpt @@ -0,0 +1,15 @@ +--TEST-- +Bug #67539 (ArrayIterator use-after-free due to object change during sorting) +--FILE-- +<?php + +$it = new ArrayIterator(array_fill(0,2,'X'), 1 ); + +function badsort($a, $b) { + $GLOBALS['it']->unserialize($GLOBALS['it']->serialize()); + return TRUE; +} + +$it->uksort('badsort'); +--EXPECTF-- +Warning: Modification of ArrayObject during sorting is prohibited in %sbug67539.php on line %d diff --git a/ext/sqlite3/sqlite3.c b/ext/sqlite3/sqlite3.c index 0c9041ebf..33c855fac 100644 --- a/ext/sqlite3/sqlite3.c +++ b/ext/sqlite3/sqlite3.c @@ -54,7 +54,7 @@ static void php_sqlite3_error(php_sqlite3_db_object *db_obj, char *format, ...) vspprintf(&message, 0, format, arg); va_end(arg); - if (db_obj->exception) { + if (db_obj && db_obj->exception) { zend_throw_exception(zend_exception_get_default(TSRMLS_C), message, 0 TSRMLS_CC); } else { php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", message); @@ -67,11 +67,17 @@ static void php_sqlite3_error(php_sqlite3_db_object *db_obj, char *format, ...) /* }}} */ #define SQLITE3_CHECK_INITIALIZED(db_obj, member, class_name) \ - if (!(member)) { \ + if (!(db_obj) || !(member)) { \ php_sqlite3_error(db_obj, "The " #class_name " object has not been correctly initialised"); \ RETURN_FALSE; \ } +#define SQLITE3_CHECK_INITIALIZED_STMT(member, class_name) \ + if (!(member)) { \ + php_error_docref(NULL TSRMLS_CC, E_WARNING, "The " #class_name " object has not been correctly initialised"); \ + RETURN_FALSE; \ + } + /* {{{ PHP_INI */ PHP_INI_BEGIN() @@ -191,12 +197,14 @@ PHP_METHOD(sqlite3, close) } if (db_obj->initialised) { - zend_llist_clean(&(db_obj->free_list)); - errcode = sqlite3_close(db_obj->db); - if (errcode != SQLITE_OK) { - php_sqlite3_error(db_obj, "Unable to close database: %d, %s", errcode, sqlite3_errmsg(db_obj->db)); - RETURN_FALSE; - } + zend_llist_clean(&(db_obj->free_list)); + if(db_obj->db) { + errcode = sqlite3_close(db_obj->db); + if (errcode != SQLITE_OK) { + php_sqlite3_error(db_obj, "Unable to close database: %d, %s", errcode, sqlite3_errmsg(db_obj->db)); + RETURN_FALSE; + } + } db_obj->initialised = 0; } @@ -1279,6 +1287,8 @@ PHP_METHOD(sqlite3stmt, paramCount) return; } + SQLITE3_CHECK_INITIALIZED_STMT(stmt_obj->stmt, SQLite3Stmt); + RETURN_LONG(sqlite3_bind_parameter_count(stmt_obj->stmt)); } /* }}} */ @@ -1295,7 +1305,9 @@ PHP_METHOD(sqlite3stmt, close) return; } - zend_llist_del_element(&(stmt_obj->db_obj->free_list), object, (int (*)(void *, void *)) php_sqlite3_compare_stmt_zval_free); + if(stmt_obj->db_obj) { + zend_llist_del_element(&(stmt_obj->db_obj->free_list), object, (int (*)(void *, void *)) php_sqlite3_compare_stmt_zval_free); + } RETURN_TRUE; } @@ -1313,6 +1325,8 @@ PHP_METHOD(sqlite3stmt, reset) return; } + SQLITE3_CHECK_INITIALIZED_STMT(stmt_obj->stmt, SQLite3Stmt); + if (sqlite3_reset(stmt_obj->stmt) != SQLITE_OK) { php_sqlite3_error(stmt_obj->db_obj, "Unable to reset statement: %s", sqlite3_errmsg(sqlite3_db_handle(stmt_obj->stmt))); RETURN_FALSE; @@ -1333,6 +1347,8 @@ PHP_METHOD(sqlite3stmt, clear) return; } + SQLITE3_CHECK_INITIALIZED_STMT(stmt_obj->stmt, SQLite3Stmt); + if (sqlite3_clear_bindings(stmt_obj->stmt) != SQLITE_OK) { php_sqlite3_error(stmt_obj->db_obj, "Unable to clear statement: %s", sqlite3_errmsg(sqlite3_db_handle(stmt_obj->stmt))); RETURN_FALSE; @@ -1354,6 +1370,8 @@ PHP_METHOD(sqlite3stmt, readOnly) return; } + SQLITE3_CHECK_INITIALIZED_STMT(stmt_obj->stmt, SQLite3Stmt); + #if SQLITE_VERSION_NUMBER >= 3007004 if (sqlite3_stmt_readonly(stmt_obj->stmt)) { RETURN_TRUE; @@ -1426,6 +1444,8 @@ PHP_METHOD(sqlite3stmt, bindParam) } } + SQLITE3_CHECK_INITIALIZED_STMT(stmt_obj->stmt, SQLite3Stmt); + Z_ADDREF_P(param.parameter); if (!register_bound_parameter_to_sqlite(¶m, stmt_obj TSRMLS_CC)) { @@ -1457,6 +1477,8 @@ PHP_METHOD(sqlite3stmt, bindValue) } } + SQLITE3_CHECK_INITIALIZED_STMT(stmt_obj->stmt, SQLite3Stmt); + Z_ADDREF_P(param.parameter); if (!register_bound_parameter_to_sqlite(¶m, stmt_obj TSRMLS_CC)) { diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c index 69e20fdd9..fed2a4f0f 100644 --- a/ext/standard/basic_functions.c +++ b/ext/standard/basic_functions.c @@ -2296,8 +2296,9 @@ ZEND_BEGIN_ARG_INFO(arginfo_lcfirst, 0) ZEND_ARG_INFO(0, str) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO(arginfo_ucwords, 0) +ZEND_BEGIN_ARG_INFO_EX(arginfo_ucwords, 0, 0, 1) ZEND_ARG_INFO(0, str) + ZEND_ARG_INFO(0, delimiters) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_strtr, 0, 0, 2) @@ -2646,7 +2647,7 @@ ZEND_BEGIN_ARG_INFO(arginfo_serialize, 0) ZEND_ARG_INFO(0, var) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_unserialize, 0, 0, 1) +ZEND_BEGIN_ARG_INFO(arginfo_unserialize, 0) ZEND_ARG_INFO(0, variable_representation) ZEND_END_ARG_INFO() diff --git a/ext/standard/credits.c b/ext/standard/credits.c index 006c2d4c1..3cb6eef72 100644 --- a/ext/standard/credits.c +++ b/ext/standard/credits.c @@ -61,10 +61,10 @@ PHPAPI void php_print_credits(int flag TSRMLS_DC) /* {{{ */ php_info_print_table_start(); php_info_print_table_colspan_header(2, "PHP Authors"); php_info_print_table_header(2, "Contribution", "Authors"); - CREDIT_LINE("Zend Scripting Language Engine", "Andi Gutmans, Zeev Suraski, Stanislav Malyshev, Marcus Boerger, Dmitry Stogov"); + CREDIT_LINE("Zend Scripting Language Engine", "Andi Gutmans, Zeev Suraski, Stanislav Malyshev, Marcus Boerger, Dmitry Stogov, Xinchen Hui, Nikita Popov"); CREDIT_LINE("Extension Module API", "Andi Gutmans, Zeev Suraski, Andrei Zmievski"); CREDIT_LINE("UNIX Build and Modularization", "Stig Bakken, Sascha Schumann, Jani Taskinen"); - CREDIT_LINE("Windows Port", "Shane Caraveo, Zeev Suraski, Wez Furlong, Pierre-Alain Joye"); + CREDIT_LINE("Windows Port", "Shane Caraveo, Zeev Suraski, Wez Furlong, Pierre-Alain Joye, Anatol Belski"); CREDIT_LINE("Server API (SAPI) Abstraction Layer", "Andi Gutmans, Shane Caraveo, Zeev Suraski"); CREDIT_LINE("Streams Abstraction Layer", "Wez Furlong, Sara Golemon"); CREDIT_LINE("PHP Data Objects Layer", "Wez Furlong, Marcus Boerger, Sterling Hughes, George Schlossnagle, Ilia Alshanetsky"); @@ -95,7 +95,7 @@ PHPAPI void php_print_credits(int flag TSRMLS_DC) /* {{{ */ if (flag & PHP_CREDITS_DOCS) { php_info_print_table_start(); php_info_print_table_colspan_header(2, "PHP Documentation"); - CREDIT_LINE("Authors", "Mehdi Achour, Friedhelm Betz, Antony Dovgal, Nuno Lopes, Hannes Magnusson, Georg Richter, Damien Seguy, Jakub Vrana"); + CREDIT_LINE("Authors", "Mehdi Achour, Friedhelm Betz, Antony Dovgal, Nuno Lopes, Hannes Magnusson, Georg Richter, Damien Seguy, Jakub Vrana, Adam Harvey, Peter Cowburn"); CREDIT_LINE("Editor", "Philip Olson"); CREDIT_LINE("User Note Maintainers", "Daniel P. Brown, Thiago Henrique Pojda"); CREDIT_LINE("Other Contributors", "Previously active authors, editors and other contributors are listed in the manual."); @@ -105,7 +105,7 @@ PHPAPI void php_print_credits(int flag TSRMLS_DC) /* {{{ */ if (flag & PHP_CREDITS_QA) { php_info_print_table_start(); php_info_print_table_header(1, "PHP Quality Assurance Team"); - php_info_print_table_row(1, "Ilia Alshanetsky, Joerg Behrens, Antony Dovgal, Stefan Esser, Moriyoshi Koizumi, Magnus Maatta, Sebastian Nohn, Derick Rethans, Melvyn Sopacua, Jani Taskinen, Pierre-Alain Joye, Dmitry Stogov, Felipe Pena, David Soria Parra"); + php_info_print_table_row(1, "Ilia Alshanetsky, Joerg Behrens, Antony Dovgal, Stefan Esser, Moriyoshi Koizumi, Magnus Maatta, Sebastian Nohn, Derick Rethans, Melvyn Sopacua, Jani Taskinen, Pierre-Alain Joye, Dmitry Stogov, Felipe Pena, David Soria Parra, Stanislav Malyshev, Julien Pauli, Stephen Zarkos, Anatol Belski, Remi Collet, Ferenc Kovacs"); php_info_print_table_end(); } @@ -115,7 +115,7 @@ PHPAPI void php_print_credits(int flag TSRMLS_DC) /* {{{ */ php_info_print_table_start(); php_info_print_table_colspan_header(2, "Websites and Infrastructure team"); /* www., wiki., windows., master., and others, I guess pecl. too? */ - CREDIT_LINE("PHP Websites Team", "Rasmus Lerdorf, Hannes Magnusson, Philip Olson, Lukas Kahwe Smith, Pierre-Alain Joye, Kalle Sommer Nielsen"); + CREDIT_LINE("PHP Websites Team", "Rasmus Lerdorf, Hannes Magnusson, Philip Olson, Lukas Kahwe Smith, Pierre-Alain Joye, Kalle Sommer Nielsen, Peter Cowburn, Adam Harvey, Ferenc Kovacs, Levi Morrison"); CREDIT_LINE("Event Maintainers", "Damien Seguy, Daniel P. Brown"); /* Mirroring */ CREDIT_LINE("Network Infrastructure", "Daniel P. Brown"); diff --git a/ext/standard/file.c b/ext/standard/file.c index e1f24abf6..10ed693f0 100644 --- a/ext/standard/file.c +++ b/ext/standard/file.c @@ -527,7 +527,7 @@ PHP_FUNCTION(file_get_contents) char *contents; zend_bool use_include_path = 0; php_stream *stream; - int len; + long len; long offset = -1; long maxlen = PHP_STREAM_COPY_ALL; zval *zcontext = NULL; @@ -559,6 +559,10 @@ PHP_FUNCTION(file_get_contents) } if ((len = php_stream_copy_to_mem(stream, &contents, maxlen, 0)) > 0) { + if (len > INT_MAX) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "content truncated from %ld to %d bytes", len, INT_MAX); + len = INT_MAX; + } RETVAL_STRINGL(contents, len, 0); } else if (len == 0) { RETVAL_EMPTY_STRING(); @@ -578,7 +582,7 @@ PHP_FUNCTION(file_put_contents) char *filename; int filename_len; zval *data; - int numbytes = 0; + long numbytes = 0; long flags = 0; zval *zcontext = NULL; php_stream_context *context = NULL; @@ -630,6 +634,10 @@ PHP_FUNCTION(file_put_contents) if (php_stream_copy_to_stream_ex(srcstream, stream, PHP_STREAM_COPY_ALL, &len) != SUCCESS) { numbytes = -1; } else { + if (len > LONG_MAX) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "content truncated from %lu to %ld bytes", (unsigned long) len, LONG_MAX); + len = LONG_MAX; + } numbytes = len; } break; @@ -645,7 +653,7 @@ PHP_FUNCTION(file_put_contents) if (Z_STRLEN_P(data)) { numbytes = php_stream_write(stream, Z_STRVAL_P(data), Z_STRLEN_P(data)); if (numbytes != Z_STRLEN_P(data)) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Only %d of %d bytes written, possibly out of free disk space", numbytes, Z_STRLEN_P(data)); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Only %ld of %d bytes written, possibly out of free disk space", numbytes, Z_STRLEN_P(data)); numbytes = -1; } } @@ -688,7 +696,7 @@ PHP_FUNCTION(file_put_contents) if (zend_std_cast_object_tostring(data, &out, IS_STRING TSRMLS_CC) == SUCCESS) { numbytes = php_stream_write(stream, Z_STRVAL(out), Z_STRLEN(out)); if (numbytes != Z_STRLEN(out)) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Only %d of %d bytes written, possibly out of free disk space", numbytes, Z_STRLEN(out)); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Only %ld of %d bytes written, possibly out of free disk space", numbytes, Z_STRLEN(out)); numbytes = -1; } zval_dtor(&out); diff --git a/ext/standard/http_fopen_wrapper.c b/ext/standard/http_fopen_wrapper.c index 1b8d505a4..1c4b17afb 100644 --- a/ext/standard/http_fopen_wrapper.c +++ b/ext/standard/http_fopen_wrapper.c @@ -120,7 +120,7 @@ php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper, char *scratch = NULL; char *tmp = NULL; char *ua_str = NULL; - zval **ua_zval = NULL, **tmpzval = NULL; + zval **ua_zval = NULL, **tmpzval = NULL, *ssl_proxy_peer_name = NULL; int scratch_len = 0; int body = 0; char location[HTTP_HEADER_BLOCK_SIZE]; @@ -226,6 +226,13 @@ php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper, if (stream && use_proxy && use_ssl) { smart_str header = {0}; + /* Set peer_name or name verification will try to use the proxy server name */ + if (!context || php_stream_context_get_option(context, "ssl", "peer_name", &tmpzval) == FAILURE) { + MAKE_STD_ZVAL(ssl_proxy_peer_name); + ZVAL_STRING(ssl_proxy_peer_name, resource->host, 1); + php_stream_context_set_option(stream->context, "ssl", "peer_name", ssl_proxy_peer_name); + } + smart_str_appendl(&header, "CONNECT ", sizeof("CONNECT ")-1); smart_str_appends(&header, resource->host); smart_str_appendc(&header, ':'); @@ -316,7 +323,7 @@ finish: /* enable SSL transport layer */ if (stream) { - if (php_stream_xport_crypto_setup(stream, STREAM_CRYPTO_METHOD_SSLv23_CLIENT, NULL TSRMLS_CC) < 0 || + if (php_stream_xport_crypto_setup(stream, STREAM_CRYPTO_METHOD_ANY_CLIENT, NULL TSRMLS_CC) < 0 || php_stream_xport_crypto_enable(stream, 1 TSRMLS_CC) < 0) { php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, "Cannot connect to HTTPS server through proxy"); php_stream_close(stream); diff --git a/ext/standard/info.c b/ext/standard/info.c index 0626a7067..1b1b8f202 100644 --- a/ext/standard/info.c +++ b/ext/standard/info.c @@ -335,11 +335,37 @@ char* php_get_windows_name() major = "Windows Server 2008 R2"; } } else if ( osvi.dwMinorVersion == 2 ) { - if( osvi.wProductType == VER_NT_WORKSTATION ) { - major = "Windows 8"; + /* could be Windows 8/Windows Server 2012, could be Windows 8.1/Windows Server 2012 R2 */ + OSVERSIONINFOEX osvi81; + DWORDLONG dwlConditionMask = 0; + int op = VER_GREATER_EQUAL; + + ZeroMemory(&osvi81, sizeof(OSVERSIONINFOEX)); + osvi81.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX); + osvi81.dwMajorVersion = 6; + osvi81.dwMinorVersion = 3; + osvi81.wServicePackMajor = 0; + + VER_SET_CONDITION(dwlConditionMask, VER_MAJORVERSION, op); + VER_SET_CONDITION(dwlConditionMask, VER_MINORVERSION, op); + VER_SET_CONDITION(dwlConditionMask, VER_SERVICEPACKMAJOR, op); + + if (VerifyVersionInfo(&osvi81, + VER_MAJORVERSION | VER_MINORVERSION | VER_SERVICEPACKMAJOR, + dwlConditionMask)) { + osvi.dwMinorVersion = 3; /* Windows 8.1/Windows Server 2012 R2 */ + if( osvi.wProductType == VER_NT_WORKSTATION ) { + major = "Windows 8.1"; + } else { + major = "Windows Server 2012 R2"; + } } else { - major = "Windows Server 2012"; - } + if( osvi.wProductType == VER_NT_WORKSTATION ) { + major = "Windows 8"; + } else { + major = "Windows Server 2012"; + } + } } else { major = "Unknown Windows version"; } diff --git a/ext/standard/php_fopen_wrapper.c b/ext/standard/php_fopen_wrapper.c index 7e21e95d1..9628c0d69 100644 --- a/ext/standard/php_fopen_wrapper.c +++ b/ext/standard/php_fopen_wrapper.c @@ -231,7 +231,7 @@ php_stream * php_stream_url_wrap_php(php_stream_wrapper *wrapper, const char *pa if ((input->body = SG(request_info).request_body)) { php_stream_rewind(input->body); } else { - input->body = php_stream_temp_create(TEMP_STREAM_DEFAULT, SAPI_POST_BLOCK_SIZE); + input->body = php_stream_temp_create_ex(TEMP_STREAM_DEFAULT, SAPI_POST_BLOCK_SIZE, PG(upload_tmp_dir)); SG(request_info).request_body = input->body; } diff --git a/ext/standard/streamsfuncs.c b/ext/standard/streamsfuncs.c index 68b4cceaa..8df4be7fa 100644 --- a/ext/standard/streamsfuncs.c +++ b/ext/standard/streamsfuncs.c @@ -409,7 +409,7 @@ PHP_FUNCTION(stream_get_contents) zval *zsrc; long maxlen = PHP_STREAM_COPY_ALL, desiredpos = -1L; - int len; + long len; char *contents = NULL; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|ll", &zsrc, &maxlen, &desiredpos) == FAILURE) { @@ -441,6 +441,10 @@ PHP_FUNCTION(stream_get_contents) len = php_stream_copy_to_mem(stream, &contents, maxlen, 0); if (contents) { + if (len > INT_MAX) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "content truncated from %ld to %d bytes", len, INT_MAX); + len = INT_MAX; + } RETVAL_STRINGL(contents, len, 0); } else { RETVAL_EMPTY_STRING(); diff --git a/ext/standard/string.c b/ext/standard/string.c index 913990665..ab8280346 100644 --- a/ext/standard/string.c +++ b/ext/standard/string.c @@ -2738,11 +2738,12 @@ PHP_FUNCTION(lcfirst) Uppercase the first character of every word in a string */ PHP_FUNCTION(ucwords) { - char *str; + char *str, *delims = " \t\r\n\f\v"; register char *r, *r_end; - int str_len; + int str_len, delims_len = 6; + char mask[256]; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &str, &str_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|s", &str, &str_len, &delims, &delims_len) == FAILURE) { return; } @@ -2750,12 +2751,14 @@ PHP_FUNCTION(ucwords) RETURN_EMPTY_STRING(); } + php_charmask((unsigned char *)delims, delims_len, mask TSRMLS_CC); + ZVAL_STRINGL(return_value, str, str_len, 1); r = Z_STRVAL_P(return_value); *r = toupper((unsigned char) *r); for (r_end = r + Z_STRLEN_P(return_value) - 1; r < r_end; ) { - if (isspace((int) *(unsigned char *)r++)) { + if (mask[(unsigned char)*r++]) { *r = toupper((unsigned char) *r); } } @@ -3101,6 +3104,10 @@ static void php_strtr_array(zval *return_value, char *str, int slen, HashTable * int patterns_len; zend_llist *allocs; + if (zend_hash_num_elements(pats) == 0) { + RETURN_STRINGL(str, slen, 1); + } + S(&text) = str; L(&text) = slen; diff --git a/ext/standard/tests/strings/bug67151.phpt b/ext/standard/tests/strings/bug67151.phpt new file mode 100644 index 000000000..1d0c02a52 --- /dev/null +++ b/ext/standard/tests/strings/bug67151.phpt @@ -0,0 +1,8 @@ +--TEST-- +Buf #67151: strtr with empty array crashes +--FILE-- +<?php +var_dump(strtr("foo", [])); +?> +--EXPECT-- +string(3) "foo" diff --git a/ext/standard/tests/strings/ucwords_error.phpt b/ext/standard/tests/strings/ucwords_error.phpt index d79e569cc..a01c688c4 100644 --- a/ext/standard/tests/strings/ucwords_error.phpt +++ b/ext/standard/tests/strings/ucwords_error.phpt @@ -18,7 +18,7 @@ echo "\n-- Testing ucwords() function with more than expected no. of arguments - $str = 'string_val'; $extra_arg = 10; -var_dump( ucwords($str, $extra_arg) ); +var_dump( ucwords($str, $extra_arg, $extra_arg) ); // check if there were any changes made to $str var_dump($str); @@ -30,12 +30,12 @@ echo "Done\n"; -- Testing ucwords() function with Zero arguments -- -Warning: ucwords() expects exactly 1 parameter, 0 given in %s on line %d +Warning: ucwords() expects at least 1 parameter, 0 given in %s on line %d NULL -- Testing ucwords() function with more than expected no. of arguments -- -Warning: ucwords() expects exactly 1 parameter, 2 given in %s on line %d +Warning: ucwords() expects at most 2 parameters, 3 given in %s on line %d NULL string(10) "string_val" Done diff --git a/ext/standard/tests/strings/ucwords_variation5.phpt b/ext/standard/tests/strings/ucwords_variation5.phpt new file mode 100644 index 000000000..985df47c4 --- /dev/null +++ b/ext/standard/tests/strings/ucwords_variation5.phpt @@ -0,0 +1,25 @@ +--TEST-- +Test ucwords() function : usage variations - custom delimiters +--FILE-- +<?php +/* Prototype : string ucwords ( string $str ) + * Description: Uppercase the first character of each word in a string + * Source code: ext/standard/string.c +*/ + +echo "*** Testing ucwords() : usage variations ***\n"; + +var_dump(ucwords('testing-dashed-words', '-')); +var_dump(ucwords('test(braced)words', '()')); +var_dump(ucwords('testing empty delimiters', '')); +var_dump(ucwords('testing ranges', 'a..e')); + +echo "Done\n"; +?> +--EXPECTF-- +*** Testing ucwords() : usage variations *** +string(%d) "Testing-Dashed-Words" +string(%d) "Test(Braced)Words" +string(%d) "Testing empty delimiters" +string(%d) "TeSting raNgeS" +Done diff --git a/ext/zlib/tests/bug65391.phpt b/ext/zlib/tests/bug65391.phpt index 439473fc5..9d9fd164f 100644 --- a/ext/zlib/tests/bug65391.phpt +++ b/ext/zlib/tests/bug65391.phpt @@ -6,6 +6,8 @@ extension_loaded("zlib") or die("skip need zlib"); ?> --GET-- dummy=1 +--INI-- +expose_php=On --FILE-- <?php header("Vary: Cookie"); diff --git a/main/SAPI.c b/main/SAPI.c index 653f58717..f9e9ccb04 100644 --- a/main/SAPI.c +++ b/main/SAPI.c @@ -279,7 +279,7 @@ SAPI_API SAPI_POST_READER_FUNC(sapi_read_standard_form_data) } - SG(request_info).request_body = php_stream_temp_create(TEMP_STREAM_DEFAULT, SAPI_POST_BLOCK_SIZE); + SG(request_info).request_body = php_stream_temp_create_ex(TEMP_STREAM_DEFAULT, SAPI_POST_BLOCK_SIZE, PG(upload_tmp_dir)); if (sapi_module.read_post) { int read_bytes; diff --git a/main/php_content_types.c b/main/php_content_types.c index bc42c8094..ca47e1528 100644 --- a/main/php_content_types.c +++ b/main/php_content_types.c @@ -64,6 +64,12 @@ SAPI_API SAPI_POST_READER_FUNC(php_default_post_reader) length = php_stream_copy_to_mem(SG(request_info).request_body, &data, PHP_STREAM_COPY_ALL, 0); php_stream_rewind(SG(request_info).request_body); + if (length > INT_MAX) { + sapi_module.sapi_error(E_WARNING, + "HTTP_RAW_POST_DATA truncated from %lu to %d bytes", + (unsigned long) length, INT_MAX); + length = INT_MAX; + } SET_VAR_STRINGL("HTTP_RAW_POST_DATA", data, length); sapi_module.sapi_error(E_DEPRECATED, diff --git a/main/php_memory_streams.h b/main/php_memory_streams.h index 3c4c3280e..229ed1902 100644 --- a/main/php_memory_streams.h +++ b/main/php_memory_streams.h @@ -36,6 +36,7 @@ #define php_stream_temp_new() php_stream_temp_create(TEMP_STREAM_DEFAULT, PHP_STREAM_MAX_MEM) #define php_stream_temp_create(mode, max_memory_usage) _php_stream_temp_create((mode), (max_memory_usage) STREAMS_CC TSRMLS_CC) +#define php_stream_temp_create_ex(mode, max_memory_usage, tmpdir) _php_stream_temp_create_ex((mode), (max_memory_usage), (tmpdir) STREAMS_CC TSRMLS_CC) #define php_stream_temp_create_rel(mode, max_memory_usage) _php_stream_temp_create((mode), (max_memory_usage) STREAMS_REL_CC TSRMLS_CC) #define php_stream_temp_open(mode, max_memory_usage, buf, length) _php_stream_temp_open((mode), (max_memory_usage), (buf), (length) STREAMS_CC TSRMLS_CC) @@ -45,6 +46,7 @@ PHPAPI php_stream *_php_stream_memory_open(int mode, char *buf, size_t length ST PHPAPI char *_php_stream_memory_get_buffer(php_stream *stream, size_t *length STREAMS_DC TSRMLS_DC); PHPAPI php_stream *_php_stream_temp_create(int mode, size_t max_memory_usage STREAMS_DC TSRMLS_DC); +PHPAPI php_stream *_php_stream_temp_create_ex(int mode, size_t max_memory_usage, const char *tmpdir STREAMS_DC TSRMLS_DC); PHPAPI php_stream *_php_stream_temp_open(int mode, size_t max_memory_usage, char *buf, size_t length STREAMS_DC TSRMLS_DC); END_EXTERN_C() diff --git a/main/php_version.h b/main/php_version.h index 46d3ee0c9..23760a460 100644 --- a/main/php_version.h +++ b/main/php_version.h @@ -3,6 +3,6 @@ #define PHP_MAJOR_VERSION 5 #define PHP_MINOR_VERSION 6 #define PHP_RELEASE_VERSION 0 -#define PHP_EXTRA_VERSION "RC2" -#define PHP_VERSION "5.6.0RC2" +#define PHP_EXTRA_VERSION "RC3" +#define PHP_VERSION "5.6.0RC3" #define PHP_VERSION_ID 50600 diff --git a/main/rfc1867.c b/main/rfc1867.c index b1011e21c..806a29287 100644 --- a/main/rfc1867.c +++ b/main/rfc1867.c @@ -36,6 +36,7 @@ #if defined(PHP_WIN32) && !defined(HAVE_ATOLL) # define atoll(s) _atoi64(s) +# define HAVE_ATOLL 1 #endif #define DEBUG_FILE_UPLOAD ZEND_DEBUG @@ -903,7 +904,11 @@ SAPI_API SAPI_POST_HANDLER_FUNC(rfc1867_post_handler) /* {{{ */ } if (!strcasecmp(param, "MAX_FILE_SIZE")) { +#ifdef HAVE_ATOLL max_file_size = atoll(value); +#else + max_file_size = strtoll(value, NULL, 10); +#endif } efree(param); diff --git a/main/streams/memory.c b/main/streams/memory.c index 854b9e272..09421ea49 100644 --- a/main/streams/memory.c +++ b/main/streams/memory.c @@ -352,6 +352,7 @@ typedef struct { size_t smax; int mode; zval* meta; + char* tmpdir; } php_stream_temp_data; @@ -369,7 +370,7 @@ static size_t php_stream_temp_write(php_stream *stream, const char *buf, size_t char *membuf = php_stream_memory_get_buffer(ts->innerstream, &memsize); if (memsize + count >= ts->smax) { - php_stream *file = php_stream_fopen_tmpfile(); + php_stream *file = php_stream_fopen_temporary_file(ts->tmpdir, "php", NULL); php_stream_write(file, membuf, memsize); php_stream_free_enclosed(ts->innerstream, PHP_STREAM_FREE_CLOSE); ts->innerstream = file; @@ -420,6 +421,10 @@ static int php_stream_temp_close(php_stream *stream, int close_handle TSRMLS_DC) zval_ptr_dtor(&ts->meta); } + if (ts->tmpdir) { + efree(ts->tmpdir); + } + efree(ts); return ret; @@ -547,8 +552,8 @@ PHPAPI php_stream_ops php_stream_temp_ops = { /* }}} */ -/* {{{ _php_stream_temp_create */ -PHPAPI php_stream *_php_stream_temp_create(int mode, size_t max_memory_usage STREAMS_DC TSRMLS_DC) +/* {{{ _php_stream_temp_create_ex */ +PHPAPI php_stream *_php_stream_temp_create_ex(int mode, size_t max_memory_usage, const char *tmpdir STREAMS_DC TSRMLS_DC) { php_stream_temp_data *self; php_stream *stream; @@ -556,7 +561,9 @@ PHPAPI php_stream *_php_stream_temp_create(int mode, size_t max_memory_usage STR self = ecalloc(1, sizeof(*self)); self->smax = max_memory_usage; self->mode = mode; - self->meta = NULL; + if (tmpdir) { + self->tmpdir = estrdup(tmpdir); + } stream = php_stream_alloc_rel(&php_stream_temp_ops, self, 0, mode & TEMP_STREAM_READONLY ? "rb" : "w+b"); stream->flags |= PHP_STREAM_FLAG_NO_BUFFER; self->innerstream = php_stream_memory_create_rel(mode); @@ -566,6 +573,12 @@ PHPAPI php_stream *_php_stream_temp_create(int mode, size_t max_memory_usage STR } /* }}} */ +/* {{{ _php_stream_temp_create */ +PHPAPI php_stream *_php_stream_temp_create(int mode, size_t max_memory_usage STREAMS_DC TSRMLS_DC) +{ + return php_stream_temp_create_ex(mode, max_memory_usage, NULL); +} +/* }}} */ /* {{{ _php_stream_temp_open */ PHPAPI php_stream *_php_stream_temp_open(int mode, size_t max_memory_usage, char *buf, size_t length STREAMS_DC TSRMLS_DC) diff --git a/main/streams/plain_wrapper.c b/main/streams/plain_wrapper.c index 5e9e5c7ac..87312b9ef 100644 --- a/main/streams/plain_wrapper.c +++ b/main/streams/plain_wrapper.c @@ -183,31 +183,20 @@ static php_stream *_php_stream_fopen_from_file_int(FILE *file, const char *mode return php_stream_alloc_rel(&php_stream_stdio_ops, self, 0, mode); } -PHPAPI php_stream *_php_stream_fopen_temporary_file(const char *dir, const char *pfx, char **opened_path STREAMS_DC TSRMLS_DC) +PHPAPI php_stream *_php_stream_fopen_temporary_file(const char *dir, const char *pfx, char **opened_path_ptr STREAMS_DC TSRMLS_DC) { - int fd = php_open_temporary_fd(dir, pfx, opened_path TSRMLS_CC); + char *opened_path = NULL; + int fd; + fd = php_open_temporary_fd(dir, pfx, &opened_path TSRMLS_CC); if (fd != -1) { - php_stream *stream = php_stream_fopen_from_fd_int_rel(fd, "r+b", NULL); - if (stream) { - return stream; - } - close(fd); - - php_error_docref(NULL TSRMLS_CC, E_WARNING, "unable to allocate stream"); - - return NULL; - } - return NULL; -} + php_stream *stream; -PHPAPI php_stream *_php_stream_fopen_tmpfile(int dummy STREAMS_DC TSRMLS_DC) -{ - char *opened_path = NULL; - int fd = php_open_temporary_fd(NULL, "php", &opened_path TSRMLS_CC); + if (opened_path_ptr) { + *opened_path_ptr = opened_path; + } - if (fd != -1) { - php_stream *stream = php_stream_fopen_from_fd_int_rel(fd, "r+b", NULL); + stream = php_stream_fopen_from_fd_int_rel(fd, "r+b", NULL); if (stream) { php_stdio_stream_data *self = (php_stdio_stream_data*)stream->abstract; stream->wrapper = &php_plain_files_wrapper; @@ -227,6 +216,11 @@ PHPAPI php_stream *_php_stream_fopen_tmpfile(int dummy STREAMS_DC TSRMLS_DC) return NULL; } +PHPAPI php_stream *_php_stream_fopen_tmpfile(int dummy STREAMS_DC TSRMLS_DC) +{ + return php_stream_fopen_temporary_file(NULL, "php", NULL); +} + PHPAPI php_stream *_php_stream_fopen_from_fd(int fd, const char *mode, const char *persistent_id STREAMS_DC TSRMLS_DC) { php_stream *stream = php_stream_fopen_from_fd_int_rel(fd, mode, persistent_id); diff --git a/pear/install-pear-nozlib.phar b/pear/install-pear-nozlib.phar index cd9a31f6f..cdd4ba1c8 100644 --- a/pear/install-pear-nozlib.phar +++ b/pear/install-pear-nozlib.phar @@ -1234,16 +1234,11 @@ if (extension_loaded('phar')) {if (isset($_SERVER) && isset($_SERVER['REQUEST_UR require_once 'phar://install-pear-nozlib.phar/index.php'; -__HALT_COMPILER();\ -2 -2 - - -v -v - - - +__HALT_COMPILER(); + + +0¤/m + /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */ /** @@ -7013,7 +7008,7 @@ class Console_Getopt } } -while (@ob_end_flush()); + /* $Id$ */ error_reporting(1803); @@ -7050,9 +7045,9 @@ if (!$a) { $force = false; $install_files = array('Archive_Tar' => 'phar://install-pear-nozlib.phar/Archive_Tar-1.3.11.tar', 'Console_Getopt' => 'phar://install-pear-nozlib.phar/Console_Getopt-1.3.1.tar', -'PEAR' => 'phar://install-pear-nozlib.phar/PEAR-1.9.4.tar', 'Structures_Graph' => 'phar://install-pear-nozlib.phar/Structures_Graph-1.0.4.tar', -'XML_Util' => 'phar://install-pear-nozlib.phar/XML_Util-1.2.1.tar', +'XML_Util' => 'phar://install-pear-nozlib.phar/XML_Util-1.2.3.tar', +'PEAR' => 'phar://install-pear-nozlib.phar/PEAR-1.9.5.tar', ); array_shift($argv); $debug = false; @@ -7062,7 +7057,7 @@ for ($i = 0; $i < sizeof($argv); $i++) { if (preg_match('/package-(.*)\.xml$/', $bn, $matches) || preg_match('/([A-Za-z0-9_:]+)-.*\.(tar|tgz)$/', $bn, $matches)) { $install_files[$matches[1]] = $arg; - } elseif ($arg == '-a' || $arg == '--cache') { + } elseif ($arg == '-a') { $cache_dir = $argv[$i+1]; $i++; } elseif ($arg == '--force') { @@ -7073,39 +7068,27 @@ for ($i = 0; $i < sizeof($argv); $i++) { } elseif ($arg == '-ds') { $suffix = $argv[$i+1]; $i++; - } elseif ($arg == '-d' || $arg == '--dir') { + } elseif ($arg == '-d') { $with_dir = $argv[$i+1]; $i++; - } elseif ($arg == '-b' || $arg == '--bin') { + } elseif ($arg == '-b') { $bin_dir = $argv[$i+1]; $i++; - } elseif ($arg == '-c' || $arg == '--config') { + } elseif ($arg == '-c') { $cfg_dir = $argv[$i+1]; $i++; - } elseif ($arg == '-w' || $arg == '--www') { + } elseif ($arg == '-w') { $www_dir = $argv[$i+1]; $i++; - } elseif ($arg == '-p' || $arg == '--php') { + } elseif ($arg == '-p') { $php_bin = $argv[$i+1]; $i++; - } elseif ($arg == '-o' || $arg == '--download') { + } elseif ($arg == '-o') { $download_dir = $argv[$i+1]; $i++; - } elseif ($arg == '-m' || $arg == '--metadata') { - $metadata_dir = $argv[$i+1]; - $i++; - } elseif ($arg == '-t' || $arg == '--temp') { + } elseif ($arg == '-t') { $temp_dir = $argv[$i+1]; $i++; - } elseif ($arg == '-A' || $arg == '--data') { - $data_dir = $argv[$i+1]; - $i++; - } elseif ($arg == '-D' || $arg == '--doc') { - $doc_dir = $argv[$i+1]; - $i++; - } elseif ($arg == '-T' || $arg == '--test') { - $test_dir = $argv[$i+1]; - $i++; } elseif ($arg == '--debug') { $debug = 1; } elseif ($arg == '--extremedebug') { @@ -7162,38 +7145,13 @@ if (!empty($temp_dir)) { $config->set('temp_dir', $temp_dir, 'default'); } -// Documentation files -if (!empty($doc_dir)) { - $config->set('doc_dir', $doc_dir, 'default'); -} - -// Data files -if (!empty($data_dir)) { - $config->set('data_dir', $data_dir, 'default'); -} - -// Unit tests -if (!empty($test_dir)) { - $config->set('test_dir', $test_dir, 'default'); -} - // User supplied a dir prefix if (!empty($with_dir)) { $ds = DIRECTORY_SEPARATOR; $config->set('php_dir', $with_dir, 'default'); - // Metadata - if (!empty($metadata_dir)) { - $config->set('metadata_dir', $metadata_dir, 'default'); - } - if (empty($doc_dir)) { - $config->set('doc_dir', $with_dir . $ds . 'doc', 'default'); - } - if (empty($data_dir)) { - $config->set('data_dir', $with_dir . $ds . 'data', 'default'); - } - if (empty($test_dir)) { - $config->set('test_dir', $with_dir . $ds . 'test', 'default'); - } + $config->set('doc_dir', $with_dir . $ds . 'doc', 'default'); + $config->set('data_dir', $with_dir . $ds . 'data', 'default'); + $config->set('test_dir', $with_dir . $ds . 'test', 'default'); if (empty($www_dir)) { $config->set('www_dir', $with_dir . $ds . 'htdocs', 'default'); } @@ -7237,7 +7195,7 @@ if (isset($suffix)) { } } -/* Print PEAR Conf (useful for debuging do NOT REMOVE) */ +/* Print PEAR Conf (useful for debugging do NOT REMOVE) */ if ($debug) { sort($keys); foreach ($keys as $key) { @@ -7256,7 +7214,7 @@ $options['upgrade'] = true; $install_root = getenv('INSTALL_ROOT'); if (!empty($install_root)) { $options['packagingroot'] = $install_root; - $reg = &new PEAR_Registry($options['packagingroot'], false, false, $metadata_dir); + $reg = &new PEAR_Registry($options['packagingroot']); } else { $reg = $config->getRegistry('default'); } @@ -7362,7 +7320,7 @@ foreach ($install_files as $package => $instfile) { * @author Gregory Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id: Guess.php 313023 2011-07-06 19:17:11Z dufuz $ + * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR * @since File available since PEAR 0.1 */ @@ -7439,7 +7397,7 @@ foreach ($install_files as $package => $instfile) { * @author Gregory Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version Release: 1.9.4 + * @version Release: 1.9.5 * @link http://pear.php.net/package/PEAR * @since Class available since Release 0.1 */ @@ -7687,7 +7645,7 @@ class OS_Guess * indent-tabs-mode: nil * c-basic-offset: 4 * End: - */package2.xml + */package.xml <package packagerversion="1.9.4" version="2.0" xmlns="http://pear.php.net/dtd/package-2.0" xmlns:tasks="http://pear.php.net/dtd/tasks-1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://pear.php.net/dtd/tasks-1.0 http://pear.php.net/dtd/tasks-1.0.xsd http://pear.php.net/dtd/package-2.0 http://pear.php.net/dtd/package-2.0.xsd"> <name>PEAR</name> <channel>pear.php.net</channel> @@ -7744,13 +7702,19 @@ class OS_Guess <name>Helgi Thormar</name> <user>dufuz</user> <email>dufuz@php.net</email> + <active>no</active> + </lead> + <lead> + <name>Christian Weiske</name> + <user>cweiske</user> + <email>cweiske@php.net</email> <active>yes</active> </lead> <developer> <name>Tias Guns</name> <user>tias</user> <email>tias@php.net</email> - <active>yes</active> + <active>no</active> </developer> <helper> <name>Tim Jackson</name> @@ -7770,11 +7734,11 @@ class OS_Guess <email>mj@php.net</email> <active>no</active> </helper> - <date>2011-07-06</date> - <time>22:11:24</time> + <date>2014-07-12</date> + <time>12:25:32</time> <version> - <release>1.9.4</release> - <api>1.9.4</api> + <release>1.9.5</release> + <api>1.9.5</api> </version> <stability> <release>stable</release> @@ -7782,243 +7746,251 @@ class OS_Guess </stability> <license uri="http://opensource.org/licenses/bsd-license.php">New BSD License</license> <notes> -Bug Fixes: -* Bug #17350: "pear install --force" doesn't uninstall files from previous pkg versions [dufuz] -* Bug #18362: A whitespace TEMP_DIR path breaks install/upgrade functionality [dufuz] -* Bug #18440: bad tmp folder path on install : Unable to create path for C:/Program/tmp [dufuz] -* Bug #18581: "config-get -c" not returning channel's configuration when using alias [dufuz] -* Bug #18639: regression: installing xdebug fails most likely due to another fix [dufuz] - -Features -* All System (the class) functions can now take in spaced paths as long as they are surrounded in quotes. - Prior to this it was possible to do that by passing all values in as an array (by product of #18362, #18440) [dufuz] +No changes since 1.9.5dev1 + +Bug fixes in 1.9.5.dev1: +* Fix bug #18343: Entities in file names decoded during packaging [cweiske] +* Fix bug #18665: pecl extensions not enabled in empty php.ini files [Louis Opter] +* Fix bug #18834: Do not truncate cache file if it is a symlink [avb] +* Fix bug #18892: Parse error in Installer.php [ashnazg] +* Fix bug #19482: fix pearcmd for include paths with trailing backslash [cweiske] +* Fix bug #19793: PHP Notice about ob_end_clean() [cweiske] +* Fix bug #20086: Invalid regexp in PEAR_Builder::build() [avb] +* Fix bug #20203: split content-type and get real mime type [Samu Voutilainen] +* Fix bug #20283: use full path for "zend_extension=..." [cweiske] +* Fix bug #20284: Reset interpreter before running --CLEAN-- section php-cgi run [Mats Lindh] +* Fix bug #20285: fix spelling mistakes [Veres Lajos] +* Fix bug #20286: Support access of static variables on objects in validator [cweiske] +* Fix bug #20321: Correctly detect name of current user during installation [cweiske] +* Fix bug: let pear run-tests fail when there are failed tests [cweiske] +* Prepare a test for bug #18056 / bug #18834 [avb] </notes> <contents> <dir name="/"> - <file md5sum="a74724b2a02b50afb0e71f78b7661a4c" name="OS/Guess.php" role="php"> + <file md5sum="a2aa07e80374c8cbc72229b5e7c28975" name="OS/Guess.php" role="php"> <tasks:replace from="@package_version@" to="version" type="package-info" /> </file> - <file md5sum="d453b69059dceb53e5a61b9881fe2336" name="PEAR/ChannelFile/Parser.php" role="php"> + <file md5sum="e891645bd254d8ae9953fc2b571c076a" name="PEAR/ChannelFile/Parser.php" role="php"> <tasks:replace from="@package_version@" to="version" type="package-info" /> </file> <file md5sum="8fd87e64002e11fd86eb2f3fbfee6599" name="PEAR/Command/Auth.xml" role="php" /> - <file md5sum="314f2756d74b4cc529e77be45847b3ac" name="PEAR/Command/Auth.php" role="php"> + <file md5sum="160fab095b97a42e16e62741a7eb0ad1" name="PEAR/Command/Auth.php" role="php"> <tasks:replace from="@package_version@" to="version" type="package-info" /> </file> <file md5sum="73602fd7f051eaf8d37452d0e3063bdb" name="PEAR/Command/Build.xml" role="php" /> - <file md5sum="aa7961eff628901fd6a08074715d18ac" name="PEAR/Command/Build.php" role="php"> + <file md5sum="ceace47b0e48e081fb47e3bb11e38fda" name="PEAR/Command/Build.php" role="php"> <tasks:replace from="@package_version@" to="version" type="package-info" /> </file> <file md5sum="6d5aab4d4308c3005b5f584c7783a031" name="PEAR/Command/Channels.xml" role="php" /> - <file md5sum="d61f91d95657304c3e7facf3f4a3ab7b" name="PEAR/Command/Channels.php" role="php"> + <file md5sum="9a67344b6adfcb21d0110e6c9aff4ee8" name="PEAR/Command/Channels.php" role="php"> <tasks:replace from="@package_version@" to="version" type="package-info" /> </file> - <file md5sum="1214f0f5edb4d7531e54b32e75c3b162" name="PEAR/Command/Common.php" role="php"> + <file md5sum="27146b078d36e65ee09ee26e152fa186" name="PEAR/Command/Common.php" role="php"> <tasks:replace from="@package_version@" to="version" type="package-info" /> </file> <file md5sum="91f189cb9423b5e87ee0abc5ea1a2be3" name="PEAR/Command/Config.xml" role="php" /> - <file md5sum="2cca5bfb4005291d3a234b9cc00e4091" name="PEAR/Command/Config.php" role="php"> + <file md5sum="0b102e84d3d993eebc3c7fe49f2c36fc" name="PEAR/Command/Config.php" role="php"> <tasks:replace from="@package_version@" to="version" type="package-info" /> </file> <file md5sum="2db0386b865d3f9a29f9126728722ece" name="PEAR/Command/Install.xml" role="php" /> - <file md5sum="32d3ee477937685cffec094424390c18" name="PEAR/Command/Install.php" role="php"> + <file md5sum="be6904cb44644f7c77724a3ef2a6fcaa" name="PEAR/Command/Install.php" role="php"> <tasks:replace from="@package_version@" to="version" type="package-info" /> </file> <file md5sum="5cb62a04c0a268f4edd64a49a3895c92" name="PEAR/Command/Mirror.xml" role="php" /> - <file md5sum="bc0b8df989565f87f1693ac7a2ce0e4b" name="PEAR/Command/Mirror.php" role="php"> + <file md5sum="2f9f9c377012970ebb7a9adf2624115c" name="PEAR/Command/Mirror.php" role="php"> <tasks:replace from="@package_version@" to="version" type="package-info" /> </file> <file md5sum="9367dcd7e4dbdde423f9c4c7d3f3a919" name="PEAR/Command/Package.xml" role="php" /> - <file md5sum="68f45817fe926173b45018e1b1dec108" name="PEAR/Command/Package.php" role="php"> + <file md5sum="278505341c63f0133608e1baf0a8e0d7" name="PEAR/Command/Package.php" role="php"> <tasks:replace from="@DATA-DIR@" to="data_dir" type="pear-config" /> <tasks:replace from="@package_version@" to="version" type="package-info" /> </file> <file md5sum="28dc842ea725d8787b9f9c3dbca5aa22" name="PEAR/Command/Pickle.xml" role="php" /> - <file md5sum="583e8d10daab8e16b2e2a9fc3498b1ac" name="PEAR/Command/Pickle.php" role="php"> + <file md5sum="0b1502a7b6c82b18eac3eb2cab196bbb" name="PEAR/Command/Pickle.php" role="php"> <tasks:replace from="@package_version@" to="version" type="package-info" /> </file> <file md5sum="49b046cfc14747f0365e02e9c3f0e6dc" name="PEAR/Command/Registry.xml" role="php" /> - <file md5sum="59629a5d63b0d5e54f49de509a1a6cf9" name="PEAR/Command/Registry.php" role="php"> + <file md5sum="fd3c0e33bc978e6509bbea0d8711f20a" name="PEAR/Command/Registry.php" role="php"> <tasks:replace from="@package_version@" to="version" type="package-info" /> </file> <file md5sum="29c02e823879b4e3e291f6b36fb339f1" name="PEAR/Command/Remote.xml" role="php" /> - <file md5sum="36c02597c5db0b5148aef6e49d3b2604" name="PEAR/Command/Remote.php" role="php"> + <file md5sum="8587edcb9bc8a6c02f66f15f9e50f4b6" name="PEAR/Command/Remote.php" role="php"> <tasks:replace from="@package_version@" to="version" type="package-info" /> </file> <file md5sum="a50c32015005e0761cc3b04679b29ed0" name="PEAR/Command/Test.xml" role="php" /> - <file md5sum="8794af46ada0364362db0e131607e6d1" name="PEAR/Command/Test.php" role="php"> + <file md5sum="4bee6a6f6c30a81688fe0fb162a0b8e1" name="PEAR/Command/Test.php" role="php"> <tasks:replace from="@package_version@" to="version" type="package-info" /> </file> - <file md5sum="2a4bfddd597fcb1d63b2a06ea4544b91" name="PEAR/Downloader/Package.php" role="php"> + <file md5sum="a0e187d571fa147a7d47fb573c800fc6" name="PEAR/Downloader/Package.php" role="php"> <tasks:replace from="@PEAR-VER@" to="version" type="package-info" /> </file> - <file md5sum="8c8ebc9143aeff5fd5803c63e1cd0070" name="PEAR/Frontend/CLI.php" role="php"> + <file md5sum="7ea1b98ead05f4ab87f5c29a98dd2668" name="PEAR/Frontend/CLI.php" role="php"> <tasks:replace from="@package_version@" to="version" type="package-info" /> </file> - <file md5sum="6a0785b8e9678b7283d56eba9aaea390" name="PEAR/Installer/Role/Common.php" role="php"> + <file md5sum="e7cc23f09da3a5824edf2af36d776c1a" name="PEAR/Installer/Role/Common.php" role="php"> <tasks:replace from="@package_version@" to="version" type="package-info" /> </file> <file md5sum="d8c62e6275e3aaa7784290912406092c" name="PEAR/Installer/Role/Cfg.xml" role="php" /> - <file md5sum="faee4c4408cf77aa73c608b54ed3a587" name="PEAR/Installer/Role/Cfg.php" role="php"> + <file md5sum="7db2651b25fc75f1f98c661de113151a" name="PEAR/Installer/Role/Cfg.php" role="php"> <tasks:replace from="@package_version@" to="version" type="package-info" /> </file> <file md5sum="89a4a2a286e842d45a98974f40a0565c" name="PEAR/Installer/Role/Data.xml" role="php" /> - <file md5sum="6273b7a0c754f7ec61a9ad0e7476ab35" name="PEAR/Installer/Role/Data.php" role="php"> + <file md5sum="2e33d055744fea9a7ca5a92bcc26f548" name="PEAR/Installer/Role/Data.php" role="php"> <tasks:replace from="@package_version@" to="version" type="package-info" /> </file> <file md5sum="b1ce0fe105251c3b75209d6518ee69ac" name="PEAR/Installer/Role/Doc.xml" role="php" /> - <file md5sum="f965a64b0fc06036ed4299ab51521874" name="PEAR/Installer/Role/Doc.php" role="php"> + <file md5sum="74ca9bea65232478649bea1ea34506b5" name="PEAR/Installer/Role/Doc.php" role="php"> <tasks:replace from="@package_version@" to="version" type="package-info" /> </file> <file md5sum="af71c0ad42d16a323afe24a4f884ef15" name="PEAR/Installer/Role/Ext.xml" role="php" /> - <file md5sum="8222eb9dc206801ebd0495720e94490f" name="PEAR/Installer/Role/Ext.php" role="php"> + <file md5sum="ae27b5854e7ead2cd779bdeb240ad1d2" name="PEAR/Installer/Role/Ext.php" role="php"> <tasks:replace from="@package_version@" to="version" type="package-info" /> </file> <file md5sum="ef88f0321d3e481c2130c95122cf76d8" name="PEAR/Installer/Role/Php.xml" role="php" /> - <file md5sum="5bb9fe55b02ec58880243234bd847e57" name="PEAR/Installer/Role/Php.php" role="php"> + <file md5sum="f0f86659fad9779e1e30045bcda61ed1" name="PEAR/Installer/Role/Php.php" role="php"> <tasks:replace from="@package_version@" to="version" type="package-info" /> </file> <file md5sum="746461dc3b48af6d24094cb0211608f2" name="PEAR/Installer/Role/Script.xml" role="php" /> - <file md5sum="769a902fe324b627357860b1b922aa1c" name="PEAR/Installer/Role/Script.php" role="php"> + <file md5sum="466117b0ea5f5bf6e908b73c990ebbc8" name="PEAR/Installer/Role/Script.php" role="php"> <tasks:replace from="@package_version@" to="version" type="package-info" /> </file> <file md5sum="e147d63f168ea156fc2be38caaa63804" name="PEAR/Installer/Role/Src.xml" role="php" /> - <file md5sum="8f38f7e74a60e90a7e1363b6f509b426" name="PEAR/Installer/Role/Src.php" role="php"> + <file md5sum="206ed934576b6c5c21b50b1ff306d12c" name="PEAR/Installer/Role/Src.php" role="php"> <tasks:replace from="@package_version@" to="version" type="package-info" /> </file> <file md5sum="a24b596ec987aa5688fc19e8ed4e97ea" name="PEAR/Installer/Role/Test.xml" role="php" /> - <file md5sum="b12694a189904c77db170d89f8aa9b61" name="PEAR/Installer/Role/Test.php" role="php"> + <file md5sum="433a4a5596adcab73403147cc6e54d25" name="PEAR/Installer/Role/Test.php" role="php"> <tasks:replace from="@package_version@" to="version" type="package-info" /> </file> <file md5sum="7641e71c5785bb33a4261ebe25ed0fd7" name="PEAR/Installer/Role/Www.xml" role="php" /> - <file md5sum="0a3b8808e8c7f26a7f2e3c115fd09fdc" name="PEAR/Installer/Role/Www.php" role="php"> + <file md5sum="ae677650efc29afd38910ea9bd59d639" name="PEAR/Installer/Role/Www.php" role="php"> <tasks:replace from="@package_version@" to="version" type="package-info" /> </file> - <file md5sum="bd136be2697af553a4ba35f7eaca7f68" name="PEAR/Installer/Role.php" role="php"> + <file md5sum="94b8312236702f8eca3be8707dc1251f" name="PEAR/Installer/Role.php" role="php"> <tasks:replace from="@package_version@" to="version" type="package-info" /> </file> - <file md5sum="7db4fa3f069fc2ed490464b1efe6d801" name="PEAR/PackageFile/Generator/v1.php" role="php"> + <file md5sum="7cce6312a90498b15b31b2e9a5ec070e" name="PEAR/PackageFile/Generator/v1.php" role="php"> <tasks:replace from="@PEAR-VER@" to="version" type="package-info" /> </file> - <file md5sum="8294267046359e521dc226ebbbed8d37" name="PEAR/PackageFile/Generator/v2.php" role="php"> + <file md5sum="b39ad66803993dd220bb816669305072" name="PEAR/PackageFile/Generator/v2.php" role="php"> <tasks:replace from="@PEAR-VER@" to="version" type="package-info" /> </file> - <file md5sum="ef7d06b95df06047a46df12187997a4f" name="PEAR/PackageFile/Parser/v1.php" role="php"> + <file md5sum="77bbb9ca7272c5c383cc89ec36325a5c" name="PEAR/PackageFile/Parser/v1.php" role="php"> <tasks:replace from="@package_version@" to="version" type="package-info" /> </file> - <file md5sum="98b457406963b0ba61d6206ee3b22615" name="PEAR/PackageFile/Parser/v2.php" role="php"> + <file md5sum="23c8f0128d415b9ac4fe4611c1abbc98" name="PEAR/PackageFile/Parser/v2.php" role="php"> <tasks:replace from="@package_version@" to="version" type="package-info" /> </file> - <file md5sum="6cb5b523de08db7641d53fbd01161806" name="PEAR/PackageFile/v2/rw.php" role="php"> + <file md5sum="48722d63a9cf28f3ebe79224eaa562bc" name="PEAR/PackageFile/v2/rw.php" role="php"> <tasks:replace from="@package_version@" to="version" type="package-info" /> </file> - <file md5sum="4bb188500dcecfca3ee085572a6f88d2" name="PEAR/PackageFile/v2/Validator.php" role="php"> + <file md5sum="5399a41a0ba63bb658b946e3b5aadc0d" name="PEAR/PackageFile/v2/Validator.php" role="php"> <tasks:replace from="@package_version@" to="version" type="package-info" /> </file> - <file md5sum="6211d1048871e00e38509001e3a0248a" name="PEAR/PackageFile/v1.php" role="php"> + <file md5sum="04edeb75c51568b85d4e4b07e6730887" name="PEAR/PackageFile/v1.php" role="php"> <tasks:replace from="@package_version@" to="version" type="package-info" /> </file> - <file md5sum="76d76e677471159a4bd4595190f849f8" name="PEAR/PackageFile/v2.php" role="php"> + <file md5sum="18a657204703eadd21d1cb1484998965" name="PEAR/PackageFile/v2.php" role="php"> <tasks:replace from="@package_version@" to="version" type="package-info" /> </file> - <file md5sum="e4a28d36a4e0e4d406034acc92f563de" name="PEAR/REST/10.php" role="php"> + <file md5sum="c707a5a762c52220196319b06d9ea287" name="PEAR/REST/10.php" role="php"> <tasks:replace from="@package_version@" to="version" type="package-info" /> </file> - <file md5sum="256b8c9bd6f2411f17054a8bb8e56fa5" name="PEAR/REST/11.php" role="php"> + <file md5sum="6ec577b69fd505a1da66f21c04a2f93a" name="PEAR/REST/11.php" role="php"> <tasks:replace from="@package_version@" to="version" type="package-info" /> </file> - <file md5sum="45b3138f8102e186da7cfdf8d2bd4150" name="PEAR/REST/13.php" role="php"> + <file md5sum="8a888a2c87a19f29a2119c0d85f70dfe" name="PEAR/REST/13.php" role="php"> <tasks:replace from="@package_version@" to="version" type="package-info" /> </file> - <file md5sum="77205d37ba0c4233ee343a78ddb6cd9d" name="PEAR/Task/Postinstallscript/rw.php" role="php"> + <file md5sum="70a0def9d2702fafc7264ddebe61371e" name="PEAR/Task/Postinstallscript/rw.php" role="php"> <tasks:replace from="@package_version@" to="version" type="package-info" /> </file> - <file md5sum="3c27b135962a1826a4e7d6b977b0b288" name="PEAR/Task/Replace/rw.php" role="php"> + <file md5sum="ab06ffd12966490c3fa611004fbb39c7" name="PEAR/Task/Replace/rw.php" role="php"> <tasks:replace from="@package_version@" to="version" type="package-info" /> </file> - <file md5sum="0441c97aa22e4c281f1974df324a5cfb" name="PEAR/Task/Unixeol/rw.php" role="php"> + <file md5sum="808fe2e996f8769a13bea7c3d8c3f44e" name="PEAR/Task/Unixeol/rw.php" role="php"> <tasks:replace from="@package_version@" to="version" type="package-info" /> </file> - <file md5sum="e9a7f560abe1db1c114b0cc7f3134a4a" name="PEAR/Task/Windowseol/rw.php" role="php"> + <file md5sum="69a14c62ea963a0133fb22dbeec0e180" name="PEAR/Task/Windowseol/rw.php" role="php"> <tasks:replace from="@package_version@" to="version" type="package-info" /> </file> - <file md5sum="53e67f33a146cf9ee2d951239ab95ba0" name="PEAR/Task/Common.php" role="php"> + <file md5sum="a52528bae4b917b48e5ad357b849b86e" name="PEAR/Task/Common.php" role="php"> <tasks:replace from="@package_version@" to="version" type="package-info" /> </file> - <file md5sum="9eed944f3f795c52caba0cb87665cd7f" name="PEAR/Task/Postinstallscript.php" role="php"> + <file md5sum="39cbcd69ee6e2dd74522db72d58cfff5" name="PEAR/Task/Postinstallscript.php" role="php"> <tasks:replace from="@package_version@" to="version" type="package-info" /> </file> - <file md5sum="b51702374ca8c34dd4e540f8848f8f57" name="PEAR/Task/Replace.php" role="php"> + <file md5sum="2e2b4a18c4075d049eb8928520318f67" name="PEAR/Task/Replace.php" role="php"> <tasks:replace from="@package_version@" to="version" type="package-info" /> </file> - <file md5sum="7a280f398b108bc030a126a10e75af7e" name="PEAR/Task/Unixeol.php" role="php"> + <file md5sum="7aa51b2bcaa180c28dba3fbeb74570ac" name="PEAR/Task/Unixeol.php" role="php"> <tasks:replace from="@package_version@" to="version" type="package-info" /> </file> - <file md5sum="c321484c304ebb4de50cd204b6a61c6d" name="PEAR/Task/Windowseol.php" role="php"> + <file md5sum="63211f45fca15875d3ea7fd8e8d9eae8" name="PEAR/Task/Windowseol.php" role="php"> <tasks:replace from="@package_version@" to="version" type="package-info" /> </file> - <file md5sum="b8d475e539a47999dd78ddc0f2831b0e" name="PEAR/Validator/PECL.php" role="php"> + <file md5sum="423fc3e5caf0a4f93632218404fffedb" name="PEAR/Validator/PECL.php" role="php"> <tasks:replace from="@package_version@" to="version" type="package-info" /> </file> - <file md5sum="598ad0a7c788a4ee154501223f607fa5" name="PEAR/Autoloader.php" role="php"> + <file md5sum="8f05c73498e74c5cef2613b92766ac49" name="PEAR/Autoloader.php" role="php"> <tasks:replace from="@package_version@" to="version" type="package-info" /> </file> - <file md5sum="3a236b984c43be942864e9a2c2f7f618" name="PEAR/Builder.php" role="php"> + <file md5sum="a6e3c5edf25f9c9561dc1fa9232ef0d6" name="PEAR/Builder.php" role="php"> <tasks:replace from="@PEAR-VER@" to="version" type="package-info" /> </file> - <file md5sum="fe1651f49d9b4e77e252c817c5ac8fb8" name="PEAR/ChannelFile.php" role="php"> + <file md5sum="5138dd27c6ba11bd26903d4bd7d2f34f" name="PEAR/ChannelFile.php" role="php"> <tasks:replace from="@package_version@" to="version" type="package-info" /> </file> - <file md5sum="8dfb2616d94dc0d54ca05d6d2a9a3d60" name="PEAR/Command.php" role="php"> + <file md5sum="3db5ed459a921a942ecb5186b3f30ce0" name="PEAR/Command.php" role="php"> <tasks:replace from="@package_version@" to="version" type="package-info" /> </file> - <file md5sum="3134df96c00615c595bc3c74c0fb605f" name="PEAR/Common.php" role="php"> + <file md5sum="4b2c08cbbaf3a0ec28d80348c80f7997" name="PEAR/Common.php" role="php"> <tasks:replace from="@package_version@" to="version" type="package-info" /> </file> - <file md5sum="ef2e1652bed814e36676d605c9a7b599" name="PEAR/Config.php" role="php"> + <file md5sum="55c32d4787a9edc11ee4961354993457" name="PEAR/Config.php" role="php"> <tasks:replace from="@package_version@" to="version" type="package-info" /> </file> - <file md5sum="708a3a44875759e005b881179b3d5ed4" name="PEAR/DependencyDB.php" role="php"> + <file md5sum="6eb3dba37202b1fc0dbdb98163f63a62" name="PEAR/DependencyDB.php" role="php"> <tasks:replace from="@package_version@" to="version" type="package-info" /> </file> - <file md5sum="0744ce601546afb988e2542b27d82aa9" name="PEAR/Dependency2.php" role="php"> + <file md5sum="170c80666eb4836c64349aeb96a64407" name="PEAR/Dependency2.php" role="php"> <tasks:replace from="@PEAR-VER@" to="version" type="package-info" /> </file> - <file md5sum="3f62de6899c2ca37c89810e3510b77b9" name="PEAR/Downloader.php" role="php"> + <file md5sum="4efbf6fab81915541302398371dcf424" name="PEAR/Downloader.php" role="php"> <tasks:replace from="@package_version@" to="version" type="package-info" /> </file> - <file md5sum="3d1ee44f11a5c927f98149041cbba536" name="PEAR/ErrorStack.php" role="php"> + <file md5sum="5e7a672375619abfeb9d847f247189b7" name="PEAR/ErrorStack.php" role="php"> <tasks:replace from="@package_version@" to="version" type="package-info" /> </file> - <file md5sum="ebea74b4b24af93a0982536ae6faeb76" name="PEAR/Exception.php" role="php"> + <file md5sum="d3518fed48c3f04e66fdc4e5694d03c1" name="PEAR/Exception.php" role="php"> <tasks:replace from="@package_version@" to="version" type="package-info" /> </file> <file md5sum="e0e4cbcec4a972fbad779d0f9d323120" name="PEAR/FixPHP5PEARWarnings.php" role="php" /> - <file md5sum="e00af62b175d4a15430be6394b09afaa" name="PEAR/Frontend.php" role="php"> + <file md5sum="54db0452c9cd5da3c3e33d42d0c7b85d" name="PEAR/Frontend.php" role="php"> <tasks:replace from="@package_version@" to="version" type="package-info" /> </file> - <file md5sum="5b77738449ea8d539883d520f0f05d2a" name="PEAR/Installer.php" role="php"> + <file md5sum="4385026134eb94616a96a1c32e05770a" name="PEAR/Installer.php" role="php"> <tasks:replace from="@package_version@" to="version" type="package-info" /> </file> - <file md5sum="60600f35203b87481eb354b9b58c05f9" name="PEAR/PackageFile.php" role="php"> + <file md5sum="9bb788f49f17576f7d31e4929d2538c5" name="PEAR/PackageFile.php" role="php"> <tasks:replace from="@PEAR-VER@" to="version" type="package-info" /> </file> - <file md5sum="5e553c0ac9530fc8757735675f0837ee" name="PEAR/Packager.php" role="php"> + <file md5sum="d6d6614d1716c5d7003c5b4c077ef80f" name="PEAR/Packager.php" role="php"> <tasks:replace from="@package_version@" to="version" type="package-info" /> </file> - <file md5sum="5ff450e917d7128af3dc5d596e02bd04" name="PEAR/Registry.php" role="php"> + <file md5sum="51dd12679f4a3d04ce6c5d7638526993" name="PEAR/Registry.php" role="php"> <tasks:replace from="@package_version@" to="version" type="package-info" /> </file> - <file md5sum="9d0e60efa1884de7d2a812e815cbd30e" name="PEAR/REST.php" role="php"> + <file md5sum="9798b333d64c37f7fea737565a175c71" name="PEAR/REST.php" role="php"> <tasks:replace from="@package_version@" to="version" type="package-info" /> </file> - <file md5sum="20315d45a87c2c9fb9992f5e27a0e354" name="PEAR/RunTest.php" role="php"> + <file md5sum="496744abe2a25f7ce348ad24bb410758" name="PEAR/RunTest.php" role="php"> <tasks:replace from="@package_version@" to="version" type="package-info" /> </file> - <file md5sum="709e306baa715e79696de0fcd7f5db6a" name="PEAR/Validate.php" role="php"> + <file md5sum="c94597a58ce447e3c9b3005820c2aa3f" name="PEAR/Validate.php" role="php"> <tasks:replace from="@package_version@" to="version" type="package-info" /> </file> - <file md5sum="496230695ea1e3f7e0eb1a1e7030383f" name="PEAR/XMLParser.php" role="php"> + <file md5sum="6081c461dfc133a431d6a76cceeb1f7d" name="PEAR/XMLParser.php" role="php"> <tasks:replace from="@package_version@" to="version" type="package-info" /> </file> <file baseinstalldir="/" md5sum="d888d06143e3cac0dae78bbb2e761366" name="scripts/pear.bat" role="script"> @@ -8060,27 +8032,27 @@ Features <tasks:replace from="@include_path@" to="php_dir" type="pear-config" /> <tasks:unixeol /> </file> - <file baseinstalldir="/" md5sum="fc547ba1ab80167d9c9cfcbb439d1537" name="scripts/pearcmd.php" role="php"> + <file baseinstalldir="/" md5sum="942cf7d10e585fdad1eca4fb6595bc89" name="scripts/pearcmd.php" role="php"> <tasks:replace from="@php_bin@" to="php_bin" type="pear-config" /> <tasks:replace from="@php_dir@" to="php_dir" type="pear-config" /> <tasks:replace from="@pear_version@" to="version" type="package-info" /> <tasks:replace from="@include_path@" to="php_dir" type="pear-config" /> </file> - <file baseinstalldir="/" md5sum="e758c3c57ace46749eb39868fe98b2ca" name="scripts/peclcmd.php" role="php"> + <file baseinstalldir="/" md5sum="7bbe2e7e7b01dca593e4199f7fb23e47" name="scripts/peclcmd.php" role="php"> <tasks:replace from="@php_bin@" to="php_bin" type="pear-config" /> <tasks:replace from="@php_dir@" to="php_dir" type="pear-config" /> <tasks:replace from="@pear_version@" to="version" type="package-info" /> <tasks:replace from="@include_path@" to="php_dir" type="pear-config" /> </file> <file md5sum="45b44486d8090de17b2a8b4211fab247" name="LICENSE" role="doc" /> - <file md5sum="8e9d494169d0dea3d7b24bae14d85aba" name="INSTALL" role="doc" /> + <file md5sum="8abe476f25fca35378019c9d12bbe757" name="INSTALL" role="doc" /> <file md5sum="4a49bc83a392934e57af45c70a589fda" name="package.dtd" role="data" /> <file md5sum="1a8f67d58009372a6cbcddd638b128cf" name="PEAR5.php" role="php" /> - <file md5sum="962bdcdbc2e4467f047b233fa45296bd" name="PEAR.php" role="php"> + <file md5sum="a188d10ae25015b4eba97cecdb9155db" name="PEAR.php" role="php"> <tasks:replace from="@package_version@" to="version" type="package-info" /> </file> - <file md5sum="b10231f9dd564ac24951758b67f6e155" name="README" role="doc" /> - <file md5sum="1d62197f092116e711e6c9b7ed0c4fe9" name="System.php" role="php"> + <file md5sum="4ebce9e0919c7d9702373a0090ab301f" name="README" role="doc" /> + <file md5sum="b3750a146f22e8c9fcad0d5373076884" name="System.php" role="php"> <tasks:replace from="@package_version@" to="version" type="package-info" /> </file> <file md5sum="acd010e3bc43c0f72df584acde7b9158" name="template.spec" role="data" /> @@ -8104,7 +8076,7 @@ Features <package> <name>Archive_Tar</name> <channel>pear.php.net</channel> - <min>1.3.7</min> + <min>1.3.11</min> </package> <package> <name>Structures_Graph</name> @@ -8122,7 +8094,7 @@ Features <name>XML_Util</name> <channel>pear.php.net</channel> <min>1.2.0</min> - <recommended>1.2.1</recommended> + <recommended>1.2.3</recommended> </package> <package> <name>PEAR_Frontend_Web</name> @@ -8580,9 +8552,98 @@ http://pear.php.net/advisory-20110228.txt their pecl package but rather in a sub directory, such as xhprof. [dufuz] </notes> </release> + <release> + <date>2011-07-06</date> + <time>15:30:00</time> + <version> + <release>1.9.4</release> + <api>1.9.4</api> + </version> + <stability> + <release>stable</release> + <api>stable</api> + </stability> + <license uri="http://opensource.org/licenses/bsd-license.php">New BSD License</license> + <notes> +Bug Fixes: +* Bug #17350: "pear install --force" doesn't uninstall files from previous pkg versions [dufuz] +* Bug #18362: A whitespace TEMP_DIR path breaks install/upgrade functionality [dufuz] +* Bug #18440: bad tmp folder path on install : Unable to create path for C:/Program/tmp [dufuz] +* Bug #18581: "config-get -c" not returning channel's configuration when using alias [dufuz] +* Bug #18639: regression: installing xdebug fails most likely due to another fix [dufuz] + +Features +* All System (the class) functions can now take in spaced paths as long as they are surrounded in quotes. + Prior to this it was possible to do that by passing all values in as an array (by product of #18362, #18440) [dufuz] + </notes> + </release> + <release> + <date>2014-06-27</date> + <time>18:17:00</time> + <version> + <release>1.9.5dev1</release> + <api>1.9.5</api> + </version> + <stability> + <release>devel</release> + <api>devel</api> + </stability> + <license uri="http://opensource.org/licenses/bsd-license.php">New BSD License</license> + <notes> +Bug fixes: +* Fix bug #18343: Entities in file names decoded during packaging [cweiske] +* Fix bug #18665: pecl extensions not enabled in empty php.ini files [Louis Opter] +* Fix bug #18834: Do not truncate cache file if it is a symlink [avb] +* Fix bug #18892: Parse error in Installer.php [ashnazg] +* Fix bug #19482: fix pearcmd for include paths with trailing backslash [cweiske] +* Fix bug #19793: PHP Notice about ob_end_clean() [cweiske] +* Fix bug #20086: Invalid regexp in PEAR_Builder::build() [avb] +* Fix bug #20203: split content-type and get real mime type [Samu Voutilainen] +* Fix bug #20283: use full path for "zend_extension=..." [cweiske] +* Fix bug #20284: Reset interpreter before running --CLEAN-- section php-cgi run [Mats Lindh] +* Fix bug #20285: fix spelling mistakes [Veres Lajos] +* Fix bug #20286: Support access of static variables on objects in validator [cweiske] +* Fix bug #20321: Correctly detect name of current user during installation [cweiske] +* Fix bug: let pear run-tests fail when there are failed tests [cweiske] +* Prepare a test for bug #18056 / bug #18834 [avb] + </notes> + </release> + <release> + <date>2014-07-12</date> + <time>14:22:23</time> + <version> + <release>1.9.5</release> + <api>1.9.5</api> + </version> + <stability> + <release>stable</release> + <api>stable</api> + </stability> + <license uri="http://opensource.org/licenses/bsd-license.php">New BSD License</license> + <notes> +No changes since 1.9.5.dev1. + +Bug fixes in 1.9.5.dev1: +* Fix bug #18343: Entities in file names decoded during packaging [cweiske] +* Fix bug #18665: pecl extensions not enabled in empty php.ini files [Louis Opter] +* Fix bug #18834: Do not truncate cache file if it is a symlink [avb] +* Fix bug #18892: Parse error in Installer.php [ashnazg] +* Fix bug #19482: fix pearcmd for include paths with trailing backslash [cweiske] +* Fix bug #19793: PHP Notice about ob_end_clean() [cweiske] +* Fix bug #20086: Invalid regexp in PEAR_Builder::build() [avb] +* Fix bug #20203: split content-type and get real mime type [Samu Voutilainen] +* Fix bug #20283: use full path for "zend_extension=..." [cweiske] +* Fix bug #20284: Reset interpreter before running --CLEAN-- section php-cgi run [Mats Lindh] +* Fix bug #20285: fix spelling mistakes [Veres Lajos] +* Fix bug #20286: Support access of static variables on objects in validator [cweiske] +* Fix bug #20321: Correctly detect name of current user during installation [cweiske] +* Fix bug: let pear run-tests fail when there are failed tests [cweiske] +* Prepare a test for bug #18056 / bug #18834 [avb] + </notes> + </release> </changelog> </package> - + /** * The OS_Guess class * @@ -8594,7 +8655,7 @@ http://pear.php.net/advisory-20110228.txt * @author Gregory Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id: Guess.php 313023 2011-07-06 19:17:11Z dufuz $ + * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR * @since File available since PEAR 0.1 */ @@ -8671,7 +8732,7 @@ http://pear.php.net/advisory-20110228.txt * @author Gregory Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version Release: 1.9.4 + * @version Release: 1.9.5 * @link http://pear.php.net/package/PEAR * @since Class available since Release 0.1 */ @@ -8919,7 +8980,7 @@ class OS_Guess * indent-tabs-mode: nil * c-basic-offset: 4 * End: - */ + */ /** * PEAR_ChannelFile_Parser for parsing channel.xml * @@ -8930,7 +8991,7 @@ class OS_Guess * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id: Parser.php 313023 2011-07-06 19:17:11Z dufuz $ + * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR * @since File available since Release 1.4.0a1 */ @@ -8947,7 +9008,7 @@ require_once 'PEAR/ChannelFile.php'; * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version Release: 1.9.4 + * @version Release: 1.9.5 * @link http://pear.php.net/package/PEAR * @since Class available since Release 1.4.0a1 */ @@ -8986,7 +9047,7 @@ class PEAR_ChannelFile_Parser extends PEAR_XMLParser $ret->setPackagefile($file, $archive); return $ret; } -} +} <login> <summary>Connects and authenticates to remote server [Deprecated in favor of channel-login]</summary> <function>doLogin</function> @@ -9015,7 +9076,7 @@ Logs out from the remote server. This command does not actually connect to the remote server, it only deletes the stored username and password from your user configuration.</doc> </logout> -</commands> +</commands> /** * PEAR_Command_Auth (login, logout commands) * @@ -9027,7 +9088,7 @@ password from your user configuration.</doc> * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id: Auth.php 313023 2011-07-06 19:17:11Z dufuz $ + * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR * @since File available since Release 0.1 * @deprecated since 1.8.0alpha1 @@ -9047,7 +9108,7 @@ require_once 'PEAR/Command/Channels.php'; * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version Release: 1.9.4 + * @version Release: 1.9.5 * @link http://pear.php.net/package/PEAR * @since Class available since Release 0.1 * @deprecated since 1.8.0alpha1 @@ -9095,7 +9156,7 @@ password from your user configuration.', { parent::PEAR_Command_Channels($ui, $config); } -} +} <build> <summary>Build an Extension From C Source</summary> <function>doBuild</function> @@ -9104,7 +9165,7 @@ password from your user configuration.', <doc>[package.xml] Builds one or more extensions contained in a package.</doc> </build> -</commands> +</commands> /** * PEAR_Command_Auth (build command) * @@ -9117,7 +9178,7 @@ Builds one or more extensions contained in a package.</doc> * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id: Build.php 313023 2011-07-06 19:17:11Z dufuz $ + * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR * @since File available since Release 0.1 */ @@ -9137,7 +9198,7 @@ require_once 'PEAR/Command/Common.php'; * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version Release: 1.9.4 + * @version Release: 1.9.5 * @link http://pear.php.net/package/PEAR * @since Class available since Release 0.1 */ @@ -9188,7 +9249,7 @@ Builds one or more extensions contained in a package.' $this->ui->outputData(rtrim($data), 'build'); } } -} +} <list-channels> <summary>List Available Channels</summary> <function>doList</function> @@ -9310,7 +9371,7 @@ the default channel is used. This command does not actually connect to the remote server, it only deletes the stored username and password from your user configuration.</doc> </channel-logout> -</commands> +</commands> // /* vim: set expandtab tabstop=4 shiftwidth=4: */ /** * PEAR_Command_Channels (list-channels, update-channels, channel-delete, channel-add, @@ -9324,7 +9385,7 @@ configuration.</doc> * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id: Channels.php 313023 2011-07-06 19:17:11Z dufuz $ + * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR * @since File available since Release 1.4.0a1 */ @@ -9344,7 +9405,7 @@ define('PEAR_COMMAND_CHANNELS_CHANNEL_EXISTS', -500); * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version Release: 1.9.4 + * @version Release: 1.9.5 * @link http://pear.php.net/package/PEAR * @since Class available since Release 1.4.0a1 */ @@ -10192,7 +10253,7 @@ configuration.', $this->config->store(); return true; } -} +} /** * PEAR_Command_Common base class * @@ -10204,7 +10265,7 @@ configuration.', * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id: Common.php 313023 2011-07-06 19:17:11Z dufuz $ + * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR * @since File available since Release 0.1 */ @@ -10223,7 +10284,7 @@ require_once 'PEAR.php'; * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version Release: 1.9.4 + * @version Release: 1.9.5 * @link http://pear.php.net/package/PEAR * @since Class available since Release 0.1 */ @@ -10464,7 +10525,7 @@ class PEAR_Command_Common extends PEAR return $this->$func($command, $options, $params); } -} +} <config-show> <summary>Show All Settings</summary> <function>doConfigShow</function> @@ -10555,7 +10616,7 @@ PEAR installation (using the --remoteconfig option of install, upgrade, and uninstall). </doc> </config-create> -</commands> +</commands> /** * PEAR_Command_Config (config-show, config-get, config-set, config-help, config-create commands) * @@ -10567,7 +10628,7 @@ and uninstall). * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id: Config.php 313024 2011-07-06 19:51:24Z dufuz $ + * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR * @since File available since Release 0.1 */ @@ -10586,7 +10647,7 @@ require_once 'PEAR/Command/Common.php'; * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version Release: 1.9.4 + * @version Release: 1.9.5 * @link http://pear.php.net/package/PEAR * @since Class available since Release 0.1 */ @@ -10968,7 +11029,7 @@ and uninstall). return false; } -} +} <install> <summary>Install Package</summary> <function>doInstall</function> @@ -11243,7 +11304,7 @@ package if needed. Run post-installation scripts in package <package>, if any exist. </doc> </run-scripts> -</commands> +</commands> /** * PEAR_Command_Install (install, upgrade, upgrade-all, uninstall, bundle, run-scripts commands) * @@ -11255,7 +11316,7 @@ Run post-installation scripts in package <package>, if any exist. * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id: Install.php 313023 2011-07-06 19:17:11Z dufuz $ + * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR * @since File available since Release 0.1 */ @@ -11275,7 +11336,7 @@ require_once 'PEAR/Command/Common.php'; * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version Release: 1.9.4 + * @version Release: 1.9.5 * @link http://pear.php.net/package/PEAR * @since Class available since Release 0.1 */ @@ -11713,7 +11774,7 @@ Run post-installation scripts in package <package>, if any exist. $ts = preg_match('/Thread Safety.+enabled/', $info) ? '_ts' : ''; $zend_extension_line = 'zend_extension' . $debug . $ts; $all = @file($filename); - if (!$all) { + if ($all === false) { return PEAR::raiseError('php.ini "' . $filename .'" could not be read'); } $zend_extensions = $extensions = array(); @@ -12013,17 +12074,24 @@ Run post-installation scripts in package <package>, if any exist. if ($param->getPackageType() == 'extsrc' || $param->getPackageType() == 'extbin') { $exttype = 'extension'; + $extpath = $pinfo[1]['basename']; } else { - ob_start(); - phpinfo(INFO_GENERAL); - $info = ob_get_contents(); - ob_end_clean(); - $debug = function_exists('leak') ? '_debug' : ''; - $ts = preg_match('/Thread Safety.+enabled/', $info) ? '_ts' : ''; + if (version_compare(PHP_VERSION, '5.3.0', '<')) { + ob_start(); + phpinfo(INFO_GENERAL); + $info = ob_get_contents(); + ob_end_clean(); + $debug = function_exists('leak') ? '_debug' : ''; + $ts = preg_match('/Thread Safety.+enabled/', $info) ? '_ts' : ''; + } else { + $debug = ''; + $ts = ''; + } $exttype = 'zend_extension' . $debug . $ts; + $extpath = $atts['installed_as']; } $extrainfo[] = 'You should add "' . $exttype . '=' . - $pinfo[1]['basename'] . '" to php.ini'; + $extpath . '" to php.ini'; } else { $extrainfo[] = 'Extension ' . $instpkg->getProvidesExtension() . ' enabled in php.ini'; @@ -12510,7 +12578,8 @@ Run post-installation scripts in package <package>, if any exist. return $ret; } -} +} + <download-all> <summary>Downloads each available package from the default channel</summary> <function>doDownloadAll</function> @@ -12527,7 +12596,7 @@ Requests a list of available packages from the default channel ({config default_ and downloads them to current working directory. Note: only packages within preferred_state ({config preferred_state}) will be downloaded</doc> </download-all> -</commands> +</commands> /** * PEAR_Command_Mirror (download-all command) * @@ -12538,7 +12607,7 @@ packages within preferred_state ({config preferred_state}) will be downloaded</d * @author Alexander Merz <alexmerz@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id: Mirror.php 313023 2011-07-06 19:17:11Z dufuz $ + * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR * @since File available since Release 1.2.0 */ @@ -12556,7 +12625,7 @@ require_once 'PEAR/Command/Common.php'; * @author Alexander Merz <alexmerz@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version Release: 1.9.4 + * @version Release: 1.9.5 * @link http://pear.php.net/package/PEAR * @since Class available since Release 1.2.0 */ @@ -12611,7 +12680,7 @@ packages within preferred_state ({config preferred_state}) will be downloaded' * @param string $command the command * @param array $options the command options before the command * @param array $params the stuff after the command name - * @return bool true if succesful + * @return bool true if successful * @throw PEAR_Error */ function doDownloadAll($command, $options, $params) @@ -12665,7 +12734,7 @@ packages within preferred_state ({config preferred_state}) will be downloaded' return true; } -} +} <package> <summary>Build Package</summary> <function>doPackage</function> @@ -12901,7 +12970,7 @@ This is not the most intelligent conversion, and should only be used for automated conversion or learning the format. </doc> </convert> -</commands> +</commands> /** * PEAR_Command_Package (package, package-validate, cvsdiff, cvstag, package-dependencies, * sign, makerpm, convert commands) @@ -12915,7 +12984,7 @@ used for automated conversion or learning the format. * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id: Package.php 313024 2011-07-06 19:51:24Z dufuz $ + * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR * @since File available since Release 0.1 */ @@ -13370,7 +13439,7 @@ used for automated conversion or learning the format. 'name' => 'modified', 'type' => 'yesno', 'default' => 'no', - 'prompt' => 'You have files in your SVN checkout (' . $path['from'] . ') that have been modified but not commited, do you still want to tag ' . $version . '?', + 'prompt' => 'You have files in your SVN checkout (' . $path['from'] . ') that have been modified but not committed, do you still want to tag ' . $version . '?', )); $answers = $this->ui->confirmDialog($params); @@ -14024,7 +14093,8 @@ used for automated conversion or learning the format. $this->ui->outputData('Wrote new version 2.0 package.xml to "' . $saved . '"'); return true; } -} +} + <pickle> <summary>Build PECL Package</summary> <function>doPackage</function> @@ -14059,7 +14129,7 @@ uses any of these features, you are best off using PEAR_PackageFileManager to generate both package.xml. </doc> </pickle> -</commands> +</commands> /** * PEAR_Command_Pickle (pickle command) * @@ -14070,7 +14140,7 @@ generate both package.xml. * @author Greg Beaver <cellog@php.net> * @copyright 2005-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id: Pickle.php 313023 2011-07-06 19:17:11Z dufuz $ + * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR * @since File available since Release 1.4.1 */ @@ -14088,7 +14158,7 @@ require_once 'PEAR/Command/Common.php'; * @author Greg Beaver <cellog@php.net> * @copyright 2005-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version Release: 1.9.4 + * @version Release: 1.9.5 * @link http://pear.php.net/package/PEAR * @since Class available since Release 1.4.1 */ @@ -14479,7 +14549,7 @@ generate both package.xml. $gen = &$pf->getDefaultGenerator(); $gen->toPackageFile('.'); } -} +} <list> <summary>List Installed Packages In The Default Channel</summary> <function>doList</function> @@ -14536,7 +14606,7 @@ Displays information about a package. The package argument may be a local package file, an URL to a package file, or the name of an installed package.</doc> </info> -</commands> +</commands> /** * PEAR_Command_Registry (list, list-files, shell-test, info commands) * @@ -14548,7 +14618,7 @@ installed package.</doc> * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id: Registry.php 313023 2011-07-06 19:17:11Z dufuz $ + * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR * @since File available since Release 0.1 */ @@ -14567,7 +14637,7 @@ require_once 'PEAR/Command/Common.php'; * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version Release: 1.9.4 + * @version Release: 1.9.5 * @link http://pear.php.net/package/PEAR * @since Class available since Release 0.1 */ @@ -15680,7 +15750,7 @@ installed package.' $data['raw'] = $obj->getArray(); // no validation needed $this->ui->outputData($data, 'package-info'); } -} +} <remote-info> <summary>Information About Remote Packages</summary> <function>doRemoteInfo</function> @@ -15788,7 +15858,7 @@ Clear the XML-RPC/REST cache. See also the cache_ttl configuration parameter. </doc> </clear-cache> -</commands> +</commands> /** * PEAR_Command_Remote (remote-info, list-upgrades, remote-list, search, list-all, download, * clear-cache commands) @@ -15801,7 +15871,7 @@ parameter. * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id: Remote.php 313023 2011-07-06 19:17:11Z dufuz $ + * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR * @since File available since Release 0.1 */ @@ -15821,7 +15891,7 @@ require_once 'PEAR/REST.php'; * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version Release: 1.9.4 + * @version Release: 1.9.5 * @link http://pear.php.net/package/PEAR * @since Class available since Release 0.1 */ @@ -16597,7 +16667,7 @@ parameter. $this->ui->outputData(rtrim($output), $command); return $num; } -} +} <run-tests> <summary>Run Regression Tests</summary> <function>doRunTests</function> @@ -16650,7 +16720,7 @@ If none is found, all .phpt tests will be tried instead.</doc> <doc>[testfile|dir ...] Run regression tests with PHP's regression testing script (run-tests.php).</doc> </run-tests> -</commands> +</commands> /** * PEAR_Command_Test (run-tests) * @@ -16663,7 +16733,7 @@ Run regression tests with PHP's regression testing script (run-tests.php).< * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id: Test.php 313023 2011-07-06 19:17:11Z dufuz $ + * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR * @since File available since Release 0.1 */ @@ -16683,7 +16753,7 @@ require_once 'PEAR/Command/Common.php'; * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version Release: 1.9.4 + * @version Release: 1.9.5 * @link http://pear.php.net/package/PEAR * @since Class available since Release 0.1 */ @@ -16984,9 +17054,9 @@ Run regression tests with PHP\'s regression testing script (run-tests.php).', } } - return true; + return count($failed) == 0; } -} +} /** * PEAR_Downloader_Package * @@ -16997,7 +17067,7 @@ Run regression tests with PHP\'s regression testing script (run-tests.php).', * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id: Package.php 313023 2011-07-06 19:17:11Z dufuz $ + * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR * @since File available since Release 1.4.0a1 */ @@ -17038,7 +17108,7 @@ define('PEAR_DOWNLOADER_PACKAGE_PHPVERSION', -1004); * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version Release: 1.9.4 + * @version Release: 1.9.5 * @link http://pear.php.net/package/PEAR * @since Class available since Release 1.4.0a1 */ @@ -18973,7 +19043,7 @@ class PEAR_Downloader_Package return $info; } -} +} /** * PEAR_Frontend_CLI * @@ -18985,7 +19055,7 @@ class PEAR_Downloader_Package * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id: CLI.php 313023 2011-07-06 19:17:11Z dufuz $ + * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR * @since File available since Release 0.1 */ @@ -19002,7 +19072,7 @@ require_once 'PEAR/Frontend.php'; * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version Release: 1.9.4 + * @version Release: 1.9.5 * @link http://pear.php.net/package/PEAR * @since Class available since Release 0.1 */ @@ -19723,7 +19793,7 @@ class PEAR_Frontend_CLI extends PEAR_Frontend { print $text; } -} +} /** * Base class for all installation roles. * @@ -19734,7 +19804,7 @@ class PEAR_Frontend_CLI extends PEAR_Frontend * @author Greg Beaver <cellog@php.net> * @copyright 1997-2006 The PHP Group * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id: Common.php 313023 2011-07-06 19:17:11Z dufuz $ + * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR * @since File available since Release 1.4.0a1 */ @@ -19749,7 +19819,7 @@ class PEAR_Frontend_CLI extends PEAR_Frontend * @author Greg Beaver <cellog@php.net> * @copyright 1997-2006 The PHP Group * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version Release: 1.9.4 + * @version Release: 1.9.5 * @link http://pear.php.net/package/PEAR * @since Class available since Release 1.4.0a1 */ @@ -19896,7 +19966,7 @@ class PEAR_Installer_Role_Common return $roleInfo['phpextension']; } } -?> +?> <releasetypes>php</releasetypes> <releasetypes>extsrc</releasetypes> <releasetypes>extbin</releasetypes> @@ -19910,7 +19980,7 @@ class PEAR_Installer_Role_Common <executable /> <phpextension /> <config_vars /> -</role> +</role> /** * PEAR_Installer_Role_Cfg * @@ -19921,7 +19991,7 @@ class PEAR_Installer_Role_Common * @author Greg Beaver <cellog@php.net> * @copyright 2007-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id: Cfg.php 313023 2011-07-06 19:17:11Z dufuz $ + * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR * @since File available since Release 1.7.0 */ @@ -19932,7 +20002,7 @@ class PEAR_Installer_Role_Common * @author Greg Beaver <cellog@php.net> * @copyright 2007-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version Release: 1.9.4 + * @version Release: 1.9.5 * @link http://pear.php.net/package/PEAR * @since Class available since Release 1.7.0 */ @@ -20015,7 +20085,7 @@ class PEAR_Installer_Role_Cfg extends PEAR_Installer_Role_Common return $test; } -} +} <releasetypes>php</releasetypes> <releasetypes>extsrc</releasetypes> <releasetypes>extbin</releasetypes> @@ -20029,7 +20099,7 @@ class PEAR_Installer_Role_Cfg extends PEAR_Installer_Role_Common <executable /> <phpextension /> <config_vars /> -</role> +</role> /** * PEAR_Installer_Role_Data * @@ -20040,7 +20110,7 @@ class PEAR_Installer_Role_Cfg extends PEAR_Installer_Role_Common * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id: Data.php 313023 2011-07-06 19:17:11Z dufuz $ + * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR * @since File available since Release 1.4.0a1 */ @@ -20051,12 +20121,12 @@ class PEAR_Installer_Role_Cfg extends PEAR_Installer_Role_Common * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version Release: 1.9.4 + * @version Release: 1.9.5 * @link http://pear.php.net/package/PEAR * @since Class available since Release 1.4.0a1 */ class PEAR_Installer_Role_Data extends PEAR_Installer_Role_Common {} -?> +?> <releasetypes>php</releasetypes> <releasetypes>extsrc</releasetypes> <releasetypes>extbin</releasetypes> @@ -20070,7 +20140,7 @@ class PEAR_Installer_Role_Data extends PEAR_Installer_Role_Common {} <executable /> <phpextension /> <config_vars /> -</role> +</role> /** * PEAR_Installer_Role_Doc * @@ -20081,7 +20151,7 @@ class PEAR_Installer_Role_Data extends PEAR_Installer_Role_Common {} * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id: Doc.php 313023 2011-07-06 19:17:11Z dufuz $ + * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR * @since File available since Release 1.4.0a1 */ @@ -20092,12 +20162,12 @@ class PEAR_Installer_Role_Data extends PEAR_Installer_Role_Common {} * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version Release: 1.9.4 + * @version Release: 1.9.5 * @link http://pear.php.net/package/PEAR * @since Class available since Release 1.4.0a1 */ class PEAR_Installer_Role_Doc extends PEAR_Installer_Role_Common {} -?> +?> <releasetypes>extbin</releasetypes> <releasetypes>zendextbin</releasetypes> <installable>1</installable> @@ -20108,7 +20178,7 @@ class PEAR_Installer_Role_Doc extends PEAR_Installer_Role_Common {} <executable /> <phpextension>1</phpextension> <config_vars /> -</role> +</role> /** * PEAR_Installer_Role_Ext * @@ -20119,7 +20189,7 @@ class PEAR_Installer_Role_Doc extends PEAR_Installer_Role_Common {} * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id: Ext.php 313023 2011-07-06 19:17:11Z dufuz $ + * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR * @since File available since Release 1.4.0a1 */ @@ -20130,12 +20200,12 @@ class PEAR_Installer_Role_Doc extends PEAR_Installer_Role_Common {} * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version Release: 1.9.4 + * @version Release: 1.9.5 * @link http://pear.php.net/package/PEAR * @since Class available since Release 1.4.0a1 */ class PEAR_Installer_Role_Ext extends PEAR_Installer_Role_Common {} -?> +?> <releasetypes>php</releasetypes> <releasetypes>extsrc</releasetypes> <releasetypes>extbin</releasetypes> @@ -20149,7 +20219,7 @@ class PEAR_Installer_Role_Ext extends PEAR_Installer_Role_Common {} <executable /> <phpextension /> <config_vars /> -</role> +</role> /** * PEAR_Installer_Role_Php * @@ -20160,7 +20230,7 @@ class PEAR_Installer_Role_Ext extends PEAR_Installer_Role_Common {} * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id: Php.php 313023 2011-07-06 19:17:11Z dufuz $ + * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR * @since File available since Release 1.4.0a1 */ @@ -20171,12 +20241,12 @@ class PEAR_Installer_Role_Ext extends PEAR_Installer_Role_Common {} * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version Release: 1.9.4 + * @version Release: 1.9.5 * @link http://pear.php.net/package/PEAR * @since Class available since Release 1.4.0a1 */ class PEAR_Installer_Role_Php extends PEAR_Installer_Role_Common {} -?> +?> <releasetypes>php</releasetypes> <releasetypes>extsrc</releasetypes> <releasetypes>extbin</releasetypes> @@ -20190,7 +20260,7 @@ class PEAR_Installer_Role_Php extends PEAR_Installer_Role_Common {} <executable>1</executable> <phpextension /> <config_vars /> -</role> +</role> /** * PEAR_Installer_Role_Script * @@ -20201,7 +20271,7 @@ class PEAR_Installer_Role_Php extends PEAR_Installer_Role_Common {} * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id: Script.php 313023 2011-07-06 19:17:11Z dufuz $ + * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR * @since File available since Release 1.4.0a1 */ @@ -20212,12 +20282,12 @@ class PEAR_Installer_Role_Php extends PEAR_Installer_Role_Common {} * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version Release: 1.9.4 + * @version Release: 1.9.5 * @link http://pear.php.net/package/PEAR * @since Class available since Release 1.4.0a1 */ class PEAR_Installer_Role_Script extends PEAR_Installer_Role_Common {} -?> +?> <releasetypes>extsrc</releasetypes> <releasetypes>zendextsrc</releasetypes> <installable>1</installable> @@ -20228,7 +20298,7 @@ class PEAR_Installer_Role_Script extends PEAR_Installer_Role_Common {} <executable /> <phpextension /> <config_vars /> -</role> +</role> /** * PEAR_Installer_Role_Src * @@ -20239,7 +20309,7 @@ class PEAR_Installer_Role_Script extends PEAR_Installer_Role_Common {} * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id: Src.php 313023 2011-07-06 19:17:11Z dufuz $ + * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR * @since File available since Release 1.4.0a1 */ @@ -20250,7 +20320,7 @@ class PEAR_Installer_Role_Script extends PEAR_Installer_Role_Common {} * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version Release: 1.9.4 + * @version Release: 1.9.5 * @link http://pear.php.net/package/PEAR * @since Class available since Release 1.4.0a1 */ @@ -20261,7 +20331,7 @@ class PEAR_Installer_Role_Src extends PEAR_Installer_Role_Common $installer->source_files++; } } -?> +?> <releasetypes>php</releasetypes> <releasetypes>extsrc</releasetypes> <releasetypes>extbin</releasetypes> @@ -20275,7 +20345,7 @@ class PEAR_Installer_Role_Src extends PEAR_Installer_Role_Common <executable /> <phpextension /> <config_vars /> -</role> +</role> /** * PEAR_Installer_Role_Test * @@ -20286,7 +20356,7 @@ class PEAR_Installer_Role_Src extends PEAR_Installer_Role_Common * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id: Test.php 313023 2011-07-06 19:17:11Z dufuz $ + * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR * @since File available since Release 1.4.0a1 */ @@ -20297,12 +20367,12 @@ class PEAR_Installer_Role_Src extends PEAR_Installer_Role_Common * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version Release: 1.9.4 + * @version Release: 1.9.5 * @link http://pear.php.net/package/PEAR * @since Class available since Release 1.4.0a1 */ class PEAR_Installer_Role_Test extends PEAR_Installer_Role_Common {} -?> +?> <releasetypes>php</releasetypes> <releasetypes>extsrc</releasetypes> <releasetypes>extbin</releasetypes> @@ -20316,7 +20386,7 @@ class PEAR_Installer_Role_Test extends PEAR_Installer_Role_Common {} <executable /> <phpextension /> <config_vars /> -</role> +</role> /** * PEAR_Installer_Role_Www * @@ -20327,7 +20397,7 @@ class PEAR_Installer_Role_Test extends PEAR_Installer_Role_Common {} * @author Greg Beaver <cellog@php.net> * @copyright 2007-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id: Www.php 313023 2011-07-06 19:17:11Z dufuz $ + * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR * @since File available since Release 1.7.0 */ @@ -20338,12 +20408,12 @@ class PEAR_Installer_Role_Test extends PEAR_Installer_Role_Common {} * @author Greg Beaver <cellog@php.net> * @copyright 2007-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version Release: 1.9.4 + * @version Release: 1.9.5 * @link http://pear.php.net/package/PEAR * @since Class available since Release 1.7.0 */ class PEAR_Installer_Role_Www extends PEAR_Installer_Role_Common {} -?> +?> /** * PEAR_Installer_Role * @@ -20354,7 +20424,7 @@ class PEAR_Installer_Role_Www extends PEAR_Installer_Role_Common {} * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id: Role.php 313023 2011-07-06 19:17:11Z dufuz $ + * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR * @since File available since Release 1.4.0a1 */ @@ -20370,7 +20440,7 @@ require_once 'PEAR/XMLParser.php'; * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version Release: 1.9.4 + * @version Release: 1.9.5 * @link http://pear.php.net/package/PEAR * @since Class available since Release 1.4.0a1 */ @@ -20618,7 +20688,7 @@ class PEAR_Installer_Role PEAR_Installer_Role::getValidRoles('****', true); return true; } -} +} /** * package.xml generation class, package.xml version 1.0 * @@ -20629,7 +20699,7 @@ class PEAR_Installer_Role * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id: v1.php 313023 2011-07-06 19:17:11Z dufuz $ + * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR * @since File available since Release 1.4.0a1 */ @@ -20649,7 +20719,7 @@ require_once 'PEAR/PackageFile/v2.php'; * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version Release: 1.9.4 + * @version Release: 1.9.5 * @link http://pear.php.net/package/PEAR * @since Class available since Release 1.4.0a1 */ @@ -20666,7 +20736,7 @@ class PEAR_PackageFile_Generator_v1 function getPackagerVersion() { - return '1.9.4'; + return '1.9.5'; } /** @@ -20820,7 +20890,7 @@ class PEAR_PackageFile_Generator_v1 ); $ret = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n"; $ret .= "<!DOCTYPE package SYSTEM \"http://pear.php.net/dtd/package-1.0\">\n"; - $ret .= "<package version=\"1.0\" packagerversion=\"1.9.4\">\n" . + $ret .= "<package version=\"1.0\" packagerversion=\"1.9.5\">\n" . " <name>$pkginfo[package]</name>"; if (isset($pkginfo['extends'])) { $ret .= "\n<extends>$pkginfo[extends]</extends>"; @@ -21901,7 +21971,7 @@ class PEAR_PackageFile_Generator_v1 return $ret; } } -?> +?> /** * package.xml generation class, package.xml version 2.0 * @@ -21913,7 +21983,7 @@ class PEAR_PackageFile_Generator_v1 * @author Stephan Schmidt (original XML_Serializer code) * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id: v2.php 313023 2011-07-06 19:17:11Z dufuz $ + * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR * @since File available since Release 1.4.0a1 */ @@ -21934,7 +22004,7 @@ require_once 'XML/Util.php'; * @author Stephan Schmidt (original XML_Serializer code) * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version Release: 1.9.4 + * @version Release: 1.9.5 * @link http://pear.php.net/package/PEAR * @since Class available since Release 1.4.0a1 */ @@ -21973,7 +22043,7 @@ http://pear.php.net/dtd/package-2.0 http://pear.php.net/dtd/package-2.0.xsd', ), // attributes of the root tag 'attributesArray' => 'attribs', // all values in this key will be treated as attributes - 'contentName' => '_content', // this value will be used directly as content, instead of creating a new tag, may only be used in conjuction with attributesArray + 'contentName' => '_content', // this value will be used directly as content, instead of creating a new tag, may only be used in conjunction with attributesArray 'beautifyFilelist' => false, 'encoding' => 'UTF-8', ); @@ -22016,7 +22086,7 @@ http://pear.php.net/dtd/package-2.0.xsd', */ function getPackagerVersion() { - return '1.9.4'; + return '1.9.5'; } /** @@ -22301,7 +22371,7 @@ http://pear.php.net/dtd/package-2.0.xsd', $this->options['beautifyFilelist'] = true; } - $arr['attribs']['packagerversion'] = '1.9.4'; + $arr['attribs']['packagerversion'] = '1.9.5'; if ($this->serialize($arr, $options)) { return $this->_serializedData . "\n"; } @@ -22793,7 +22863,8 @@ http://pear.php.net/dtd/package-2.0.xsd', } return $tag; } -} +} + /** * package.xml parsing class, package.xml version 1.0 * @@ -22804,7 +22875,7 @@ http://pear.php.net/dtd/package-2.0.xsd', * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id: v1.php 313023 2011-07-06 19:17:11Z dufuz $ + * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR * @since File available since Release 1.4.0a1 */ @@ -23251,7 +23322,7 @@ class PEAR_PackageFile_Parser_v1 // }}} } -?> +?> /** * package.xml parsing class, package.xml version 2.0 * @@ -23262,7 +23333,7 @@ class PEAR_PackageFile_Parser_v1 * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id: v2.php 313023 2011-07-06 19:17:11Z dufuz $ + * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR * @since File available since Release 1.4.0a1 */ @@ -23363,7 +23434,7 @@ class PEAR_PackageFile_Parser_v2 extends PEAR_XMLParser $ret->setPackagefile($file, $archive); return $ret; } -} +} /** * PEAR_PackageFile_v2, package.xml version 2.0, read/write version * @@ -23374,7 +23445,7 @@ class PEAR_PackageFile_Parser_v2 extends PEAR_XMLParser * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id: rw.php 313023 2011-07-06 19:17:11Z dufuz $ + * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR * @since File available since Release 1.4.0a8 */ @@ -23388,7 +23459,7 @@ require_once 'PEAR/PackageFile/v2.php'; * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version Release: 1.9.4 + * @version Release: 1.9.5 * @link http://pear.php.net/package/PEAR * @since Class available since Release 1.4.0a8 */ @@ -24966,7 +25037,7 @@ class PEAR_PackageFile_v2_rw extends PEAR_PackageFile_v2 { unset($this->_packageInfo['changelog']); } -} +} /** * PEAR_PackageFile_v2, package.xml version 2.0, read/write version * @@ -24977,7 +25048,7 @@ class PEAR_PackageFile_v2_rw extends PEAR_PackageFile_v2 * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id: Validator.php 313023 2011-07-06 19:17:11Z dufuz $ + * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR * @since File available since Release 1.4.0a8 */ @@ -24989,7 +25060,7 @@ class PEAR_PackageFile_v2_rw extends PEAR_PackageFile_v2 * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version Release: 1.9.4 + * @version Release: 1.9.5 * @link http://pear.php.net/package/PEAR * @since Class available since Release 1.4.0a8 * @access private @@ -25080,7 +25151,7 @@ class PEAR_PackageFile_v2_Validator isset($test['dependencies']['required']) && isset($test['dependencies']['required']['pearinstaller']) && isset($test['dependencies']['required']['pearinstaller']['min']) && - version_compare('1.9.4', + version_compare('1.9.5', $test['dependencies']['required']['pearinstaller']['min'], '<') ) { $this->_pearVersionTooLow($test['dependencies']['required']['pearinstaller']['min']); @@ -26318,7 +26389,7 @@ class PEAR_PackageFile_v2_Validator $this->_stack->push(__FUNCTION__, 'error', array('version' => $version), 'This package.xml requires PEAR version %version% to parse properly, we are ' . - 'version 1.9.4'); + 'version 1.9.5'); } function _invalidTagOrder($oktags, $actual, $root) @@ -26843,7 +26914,7 @@ class PEAR_PackageFile_v2_Validator $pn = $this->_pf->getPackage(); $this->_stack->push(__FUNCTION__, 'warning', array('file' => $file, 'package' => $pn), - 'in %file%: Could not process file for unkown reasons,' . + 'in %file%: Could not process file for unknown reasons,' . ' possibly a PHP parse error in %file% from %package%'); } } @@ -27013,7 +27084,7 @@ class PEAR_PackageFile_v2_Validator continue 2; case T_DOUBLE_COLON: $token = $tokens[$i - 1][0]; - if (!($token == T_WHITESPACE || $token == T_STRING || $token == T_STATIC)) { + if (!($token == T_WHITESPACE || $token == T_STRING || $token == T_STATIC || $token == T_VARIABLE)) { if (isset($this->_stack)) { $this->_stack->push(__FUNCTION__, 'warning', array('file' => $file), 'Parser error: invalid PHP found in file "%file%"'); @@ -27119,7 +27190,8 @@ class PEAR_PackageFile_v2_Validator return $providesret; } -} +} + /** * PEAR_PackageFile_v1, package.xml version 1.0 * @@ -27130,7 +27202,7 @@ class PEAR_PackageFile_v2_Validator * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id: v1.php 313023 2011-07-06 19:17:11Z dufuz $ + * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR * @since File available since Release 1.4.0a1 */ @@ -27396,7 +27468,7 @@ define('PEAR_PACKAGEFILE_ERROR_INVALID_FILENAME', 52); * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version Release: 1.9.4 + * @version Release: 1.9.5 * @link http://pear.php.net/package/PEAR * @since Class available since Release 1.4.0a1 */ @@ -28731,7 +28803,7 @@ class PEAR_PackageFile_v1 // }}} } ?> - + /** * PEAR_PackageFile_v2, package.xml version 2.0 * @@ -28742,7 +28814,7 @@ class PEAR_PackageFile_v1 * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id: v2.php 313023 2011-07-06 19:17:11Z dufuz $ + * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR * @since File available since Release 1.4.0a1 */ @@ -28756,7 +28828,7 @@ require_once 'PEAR/ErrorStack.php'; * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version Release: 1.9.4 + * @version Release: 1.9.5 * @link http://pear.php.net/package/PEAR * @since Class available since Release 1.4.0a1 */ @@ -30780,7 +30852,7 @@ class PEAR_PackageFile_v2 } } ?> - + /** * PEAR_REST_10 * @@ -30791,7 +30863,7 @@ class PEAR_PackageFile_v2 * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id: 10.php 313023 2011-07-06 19:17:11Z dufuz $ + * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR * @since File available since Release 1.4.0a12 */ @@ -30809,7 +30881,7 @@ require_once 'PEAR/REST.php'; * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version Release: 1.9.4 + * @version Release: 1.9.5 * @link http://pear.php.net/package/PEAR * @since Class available since Release 1.4.0a12 */ @@ -31650,7 +31722,7 @@ class PEAR_REST_10 return 1; } } -} +} /** * PEAR_REST_11 - implement faster list-all/remote-list command * @@ -31661,7 +31733,7 @@ class PEAR_REST_10 * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id: 11.php 313023 2011-07-06 19:17:11Z dufuz $ + * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR * @since File available since Release 1.4.3 */ @@ -31679,7 +31751,7 @@ require_once 'PEAR/REST.php'; * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version Release: 1.9.4 + * @version Release: 1.9.5 * @link http://pear.php.net/package/PEAR * @since Class available since Release 1.4.3 */ @@ -31990,7 +32062,7 @@ class PEAR_REST_11 return array_slice($states, $i + 1); } } -?> +?> /** * PEAR_REST_13 * @@ -32001,7 +32073,7 @@ class PEAR_REST_11 * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id: 13.php 313023 2011-07-06 19:17:11Z dufuz $ + * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR * @since File available since Release 1.4.0a12 */ @@ -32020,7 +32092,7 @@ require_once 'PEAR/REST/10.php'; * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version Release: 1.9.4 + * @version Release: 1.9.5 * @link http://pear.php.net/package/PEAR * @since Class available since Release 1.4.0a12 */ @@ -32288,7 +32360,7 @@ class PEAR_REST_13 extends PEAR_REST_10 return $this->_returnDownloadURL($base, $package, $release, $info, $found, $skippedphp, $channel); } -} +} /** * <tasks:postinstallscript> - read/write version * @@ -32299,7 +32371,7 @@ class PEAR_REST_13 extends PEAR_REST_10 * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id: rw.php 313023 2011-07-06 19:17:11Z dufuz $ + * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR * @since File available since Release 1.4.0a10 */ @@ -32314,7 +32386,7 @@ require_once 'PEAR/Task/Postinstallscript.php'; * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version Release: 1.9.4 + * @version Release: 1.9.5 * @link http://pear.php.net/package/PEAR * @since Class available since Release 1.4.0a10 */ @@ -32456,7 +32528,7 @@ class PEAR_Task_Postinstallscript_rw extends PEAR_Task_Postinstallscript ); } } -?> +?> /** * <tasks:replace> - read/write version * @@ -32467,7 +32539,7 @@ class PEAR_Task_Postinstallscript_rw extends PEAR_Task_Postinstallscript * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id: rw.php 313023 2011-07-06 19:17:11Z dufuz $ + * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR * @since File available since Release 1.4.0a10 */ @@ -32482,7 +32554,7 @@ require_once 'PEAR/Task/Replace.php'; * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version Release: 1.9.4 + * @version Release: 1.9.5 * @link http://pear.php.net/package/PEAR * @since Class available since Release 1.4.0a10 */ @@ -32516,7 +32588,7 @@ class PEAR_Task_Replace_rw extends PEAR_Task_Replace return $this->_params; } } -?> +?> /** * <tasks:unixeol> - read/write version * @@ -32527,7 +32599,7 @@ class PEAR_Task_Replace_rw extends PEAR_Task_Replace * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id: rw.php 313023 2011-07-06 19:17:11Z dufuz $ + * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR * @since File available since Release 1.4.0a10 */ @@ -32542,7 +32614,7 @@ require_once 'PEAR/Task/Unixeol.php'; * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version Release: 1.9.4 + * @version Release: 1.9.5 * @link http://pear.php.net/package/PEAR * @since Class available since Release 1.4.0a10 */ @@ -32571,7 +32643,7 @@ class PEAR_Task_Unixeol_rw extends PEAR_Task_Unixeol return ''; } } -?> +?> /** * <tasks:windowseol> - read/write version * @@ -32582,7 +32654,7 @@ class PEAR_Task_Unixeol_rw extends PEAR_Task_Unixeol * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id: rw.php 313023 2011-07-06 19:17:11Z dufuz $ + * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR * @since File available since Release 1.4.0a10 */ @@ -32597,7 +32669,7 @@ require_once 'PEAR/Task/Windowseol.php'; * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version Release: 1.9.4 + * @version Release: 1.9.5 * @link http://pear.php.net/package/PEAR * @since Class available since Release 1.4.0a10 */ @@ -32626,7 +32698,7 @@ class PEAR_Task_Windowseol_rw extends PEAR_Task_Windowseol return ''; } } -?> +?> /** * PEAR_Task_Common, base class for installer tasks * @@ -32637,7 +32709,7 @@ class PEAR_Task_Windowseol_rw extends PEAR_Task_Windowseol * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id: Common.php 313023 2011-07-06 19:17:11Z dufuz $ + * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR * @since File available since Release 1.4.0a1 */ @@ -32675,7 +32747,7 @@ define('PEAR_TASK_PACKAGEANDINSTALL', 3); * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version Release: 1.9.4 + * @version Release: 1.9.5 * @link http://pear.php.net/package/PEAR * @since Class available since Release 1.4.0a1 * @abstract @@ -32827,7 +32899,7 @@ class PEAR_Task_Common return PEAR::raiseError($msg, $code); } } -?> +?> /** * <tasks:postinstallscript> * @@ -32838,7 +32910,7 @@ class PEAR_Task_Common * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id: Postinstallscript.php 313023 2011-07-06 19:17:11Z dufuz $ + * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR * @since File available since Release 1.4.0a1 */ @@ -32856,7 +32928,7 @@ require_once 'PEAR/Task/Common.php'; * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version Release: 1.9.4 + * @version Release: 1.9.5 * @link http://pear.php.net/package/PEAR * @since Class available since Release 1.4.0a1 */ @@ -33149,7 +33221,7 @@ class PEAR_Task_Postinstallscript extends PEAR_Task_Common { } } -?> +?> /** * <tasks:replace> * @@ -33160,7 +33232,7 @@ class PEAR_Task_Postinstallscript extends PEAR_Task_Common * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id: Replace.php 313023 2011-07-06 19:17:11Z dufuz $ + * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR * @since File available since Release 1.4.0a1 */ @@ -33175,7 +33247,7 @@ require_once 'PEAR/Task/Common.php'; * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version Release: 1.9.4 + * @version Release: 1.9.5 * @link http://pear.php.net/package/PEAR * @since Class available since Release 1.4.0a1 */ @@ -33324,7 +33396,7 @@ class PEAR_Task_Replace extends PEAR_Task_Common return $contents; } } -?> +?> /** * <tasks:unixeol> * @@ -33335,7 +33407,7 @@ class PEAR_Task_Replace extends PEAR_Task_Common * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id: Unixeol.php 313023 2011-07-06 19:17:11Z dufuz $ + * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR * @since File available since Release 1.4.0a1 */ @@ -33350,7 +33422,7 @@ require_once 'PEAR/Task/Common.php'; * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version Release: 1.9.4 + * @version Release: 1.9.5 * @link http://pear.php.net/package/PEAR * @since Class available since Release 1.4.0a1 */ @@ -33400,7 +33472,7 @@ class PEAR_Task_Unixeol extends PEAR_Task_Common return preg_replace("/\r\n|\n\r|\r|\n/", "\n", $contents); } } -?> +?> /** * <tasks:windowseol> * @@ -33411,7 +33483,7 @@ class PEAR_Task_Unixeol extends PEAR_Task_Common * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id: Windowseol.php 313023 2011-07-06 19:17:11Z dufuz $ + * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR * @since File available since Release 1.4.0a1 */ @@ -33426,7 +33498,7 @@ require_once 'PEAR/Task/Common.php'; * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version Release: 1.9.4 + * @version Release: 1.9.5 * @link http://pear.php.net/package/PEAR * @since Class available since Release 1.4.0a1 */ @@ -33476,7 +33548,7 @@ class PEAR_Task_Windowseol extends PEAR_Task_Common return preg_replace("/\r\n|\n\r|\r|\n/", "\r\n", $contents); } } -?> +?> /** * Channel Validator for the pecl.php.net channel * @@ -33487,7 +33559,7 @@ class PEAR_Task_Windowseol extends PEAR_Task_Common * @author Greg Beaver <cellog@php.net> * @copyright 1997-2006 The PHP Group * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id: PECL.php 313023 2011-07-06 19:17:11Z dufuz $ + * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR * @since File available since Release 1.4.0a5 */ @@ -33502,7 +33574,7 @@ require_once 'PEAR/Validate.php'; * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version Release: 1.9.4 + * @version Release: 1.9.5 * @link http://pear.php.net/package/PEAR * @since Class available since Release 1.4.0a5 */ @@ -33538,7 +33610,7 @@ class PEAR_Validator_PECL extends PEAR_Validate return $ret; } } -?> +?> /** * Class auto-loader * @@ -33550,7 +33622,7 @@ class PEAR_Validator_PECL extends PEAR_Validate * @author Stig Bakken <ssb@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id: Autoloader.php 313023 2011-07-06 19:17:11Z dufuz $ + * @version CVS: $Id$ * @link http://pear.php.net/manual/en/core.ppm.php#core.ppm.pear-autoloader * @since File available since Release 0.1 * @deprecated File deprecated in Release 1.4.0a1 @@ -33585,7 +33657,7 @@ require_once "PEAR.php"; * @author Stig Bakken <ssb@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version Release: 1.9.4 + * @version Release: 1.9.5 * @link http://pear.php.net/manual/en/core.ppm.php#core.ppm.pear-autoloader * @since File available since Release 0.1 * @deprecated File deprecated in Release 1.4.0a1 @@ -33756,7 +33828,7 @@ class PEAR_Autoloader extends PEAR overload("PEAR_Autoloader"); ?> - + /** * PEAR_Builder for building PHP extensions (PECL packages) * @@ -33768,7 +33840,7 @@ overload("PEAR_Autoloader"); * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id: Builder.php 313024 2011-07-06 19:51:24Z dufuz $ + * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR * @since File available since Release 0.1 * @@ -33791,7 +33863,7 @@ require_once 'PEAR/PackageFile.php'; * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version Release: 1.9.4 + * @version Release: 1.9.5 * @link http://pear.php.net/package/PEAR * @since Class available since PHP 4.0.2 * @see http://pear.php.net/manual/en/core.ppm.pear-builder.php @@ -34000,7 +34072,7 @@ class PEAR_Builder extends PEAR_Common */ function build($descfile, $callback = null) { - if (preg_match('/(\\/|\\\\|^)([^\\/\\\\]+)?php(.+)?$/', + if (preg_match('/(\\/|\\\\|^)([^\\/\\\\]+)?php([^\\/\\\\]+)?$/', $this->config->get('php_bin'), $matches)) { if (isset($matches[2]) && strlen($matches[2]) && trim($matches[2]) != trim($this->config->get('php_prefix'))) { @@ -34133,7 +34205,7 @@ class PEAR_Builder extends PEAR_Common if (!file_exists($build_dir) || !is_dir($build_dir) || !chdir($build_dir)) { return $this->raiseError("could not chdir to $build_dir"); } - putenv('PHP_PEAR_VERSION=1.9.4'); + putenv('PHP_PEAR_VERSION=1.9.5'); foreach ($to_run as $cmd) { $err = $this->_runCommand($cmd, $callback); if (PEAR::isError($err)) { @@ -34244,7 +34316,8 @@ class PEAR_Builder extends PEAR_Common } return PEAR_Common::log($level, $msg); } -} +} + /** * PEAR_ChannelFile, the channel handling class * @@ -34255,7 +34328,7 @@ class PEAR_Builder extends PEAR_Common * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id: ChannelFile.php 313023 2011-07-06 19:17:11Z dufuz $ + * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR * @since File available since Release 1.4.0a1 */ @@ -34392,7 +34465,7 @@ $GLOBALS['_PEAR_CHANNELS_MIRROR_TYPES'] = array('server'); * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version Release: 1.9.4 + * @version Release: 1.9.5 * @link http://pear.php.net/package/PEAR * @since Class available since Release 1.4.0a1 */ @@ -35802,7 +35875,7 @@ class PEAR_ChannelFile return time(); } -} +} /** * PEAR_Command, command pattern class * @@ -35814,7 +35887,7 @@ class PEAR_ChannelFile * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id: Command.php 313023 2011-07-06 19:17:11Z dufuz $ + * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR * @since File available since Release 0.1 */ @@ -35898,7 +35971,7 @@ $GLOBALS['_PEAR_Command_objects'] = array(); * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version Release: 1.9.4 + * @version Release: 1.9.5 * @link http://pear.php.net/package/PEAR * @since Class available since Release 0.1 */ @@ -36215,7 +36288,7 @@ class PEAR_Command return false; } // }}} -} +} /** * PEAR_Common, the base class for the PEAR Installer * @@ -36228,7 +36301,7 @@ class PEAR_Command * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id: Common.php 313023 2011-07-06 19:17:11Z dufuz $ + * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR * @since File available since Release 0.1.0 * @deprecated File deprecated since Release 1.4.0a1 @@ -36335,7 +36408,7 @@ $GLOBALS['_PEAR_Common_script_phases'] = array('pre-install', 'post-install', 'p * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version Release: 1.9.4 + * @version Release: 1.9.5 * @link http://pear.php.net/package/PEAR * @since Class available since Release 1.4.0a1 * @deprecated This class will disappear, and its components will be spread @@ -37051,7 +37124,7 @@ class PEAR_Common extends PEAR } require_once 'PEAR/Config.php'; -require_once 'PEAR/PackageFile.php'; +require_once 'PEAR/PackageFile.php'; /** * PEAR_Config, customized configuration handling for the PEAR Installer * @@ -37063,7 +37136,7 @@ require_once 'PEAR/PackageFile.php'; * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id: Config.php 313023 2011-07-06 19:17:11Z dufuz $ + * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR * @since File available since Release 0.1 */ @@ -37299,7 +37372,7 @@ if (getenv('PHP_PEAR_SIG_KEYDIR')) { * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version Release: 1.9.4 + * @version Release: 1.9.5 * @link http://pear.php.net/package/PEAR * @since Class available since Release 0.1 */ @@ -39148,7 +39221,7 @@ class PEAR_Config extends PEAR } } } - + /** * PEAR_DependencyDB, advanced installed packages dependency database * @@ -39160,7 +39233,7 @@ class PEAR_Config extends PEAR * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id: DependencyDB.php 313023 2011-07-06 19:17:11Z dufuz $ + * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR * @since File available since Release 1.4.0a1 */ @@ -39180,7 +39253,7 @@ $GLOBALS['_PEAR_DEPENDENCYDB_INSTANCE'] = array(); * @author Tomas V.V.Cox <cox@idec.net.com> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version Release: 1.9.4 + * @version Release: 1.9.5 * @link http://pear.php.net/package/PEAR * @since Class available since Release 1.4.0a1 */ @@ -39916,7 +39989,7 @@ class PEAR_DependencyDB ); } } -} +} /** * PEAR_Dependency2, advanced dependency validation * @@ -39927,7 +40000,7 @@ class PEAR_DependencyDB * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id: Dependency2.php 313023 2011-07-06 19:17:11Z dufuz $ + * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR * @since File available since Release 1.4.0a1 */ @@ -39949,7 +40022,7 @@ require_once 'PEAR/Validate.php'; * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version Release: 1.9.4 + * @version Release: 1.9.5 * @link http://pear.php.net/package/PEAR * @since Class available since Release 1.4.0a1 */ @@ -40459,7 +40532,7 @@ class PEAR_Dependency2 */ function getPEARVersion() { - return '1.9.4'; + return '1.9.5'; } function validatePearinstallerDependency($dep) @@ -40525,7 +40598,7 @@ class PEAR_Dependency2 * @param boolean whether this is a required dependency * @param array a list of downloaded packages to be installed, if any * @param boolean if true, then deps on pear.php.net that fail will also check - * against pecl.php.net packages to accomodate extensions that have + * against pecl.php.net packages to accommodate extensions that have * moved to pecl.php.net from pear.php.net */ function validatePackageDependency($dep, $required, $params, $depv1 = false) @@ -41273,7 +41346,8 @@ class PEAR_Dependency2 return array(sprintf($msg, $this->_registry->parsedPackageNameToString( $this->_currentPackage, true))); } -} +} + /** * PEAR_Downloader, the PEAR Installer's download utility class * @@ -41287,7 +41361,7 @@ class PEAR_Dependency2 * @author Martin Jansen <mj@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id: Downloader.php 313024 2011-07-06 19:51:24Z dufuz $ + * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR * @since File available since Release 1.3.0 */ @@ -41314,7 +41388,7 @@ define('PEAR_INSTALLER_ERROR_NO_PREF_STATE', 2); * @author Martin Jansen <mj@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version Release: 1.9.4 + * @version Release: 1.9.5 * @link http://pear.php.net/package/PEAR * @since Class available since Release 1.3.0 */ @@ -42914,7 +42988,7 @@ class PEAR_Downloader extends PEAR_Common } $request .= $ifmodifiedsince . - "User-Agent: PEAR/1.9.4/PHP/" . PHP_VERSION . "\r\n"; + "User-Agent: PEAR/1.9.5/PHP/" . PHP_VERSION . "\r\n"; if (isset($this)) { // only pass in authentication for non-static calls $username = $config->get('username', null, $channel); @@ -43038,7 +43112,7 @@ class PEAR_Downloader extends PEAR_Common } return $dest_file; } -} +} /** * Error Stack Implementation * @@ -43063,7 +43137,7 @@ class PEAR_Downloader extends PEAR_Common * @author Greg Beaver <cellog@php.net> * @copyright 2004-2008 Greg Beaver * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id: ErrorStack.php 313023 2011-07-06 19:17:11Z dufuz $ + * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR_ErrorStack */ @@ -43172,12 +43246,12 @@ define('PEAR_ERRORSTACK_ERR_OBJTOSTRING', 2); * $local_stack = new PEAR_ErrorStack('MyPackage'); * </code> * @author Greg Beaver <cellog@php.net> - * @version 1.9.4 + * @version 1.9.5 * @package PEAR_ErrorStack * @category Debugging * @copyright 2004-2008 Greg Beaver * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id: ErrorStack.php 313023 2011-07-06 19:17:11Z dufuz $ + * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR_ErrorStack */ class PEAR_ErrorStack { @@ -44023,7 +44097,7 @@ class PEAR_ErrorStack { $stack = &PEAR_ErrorStack::singleton('PEAR_ErrorStack'); $stack->pushCallback(array('PEAR_ErrorStack', '_handleError')); ?> - + /* vim: set expandtab tabstop=4 shiftwidth=4 foldmethod=marker: */ /** * PEAR_Exception @@ -44038,7 +44112,7 @@ $stack->pushCallback(array('PEAR_ErrorStack', '_handleError')); * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id: Exception.php 313023 2011-07-06 19:17:11Z dufuz $ + * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR * @since File available since Release 1.3.3 */ @@ -44114,7 +44188,7 @@ $stack->pushCallback(array('PEAR_ErrorStack', '_handleError')); * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version Release: 1.9.4 + * @version Release: 1.9.5 * @link http://pear.php.net/package/PEAR * @since Class available since Release 1.3.3 * @@ -44411,13 +44485,13 @@ class PEAR_Exception extends Exception } return $causeMsg . $this->getTraceAsString(); } -} +} if ($skipmsg) { $a = &new $ec($code, $mode, $options, $userinfo); } else { $a = &new $ec($message, $code, $mode, $options, $userinfo); } -?> +?> /** * PEAR_Frontend, the singleton-based frontend for user input/output * @@ -44428,7 +44502,7 @@ if ($skipmsg) { * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id: Frontend.php 313023 2011-07-06 19:17:11Z dufuz $ + * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR * @since File available since Release 1.4.0a1 */ @@ -44458,7 +44532,7 @@ $GLOBALS['_PEAR_FRONTEND_SINGLETON'] = null; * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version Release: 1.9.4 + * @version Release: 1.9.5 * @link http://pear.php.net/package/PEAR * @since Class available since Release 1.4.0a1 */ @@ -44644,7 +44718,7 @@ class PEAR_Frontend extends PEAR function userDialog($command, $prompts, $types = array(), $defaults = array()) { } -} +} /** * PEAR_Installer * @@ -44658,7 +44732,7 @@ class PEAR_Frontend extends PEAR * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id: Installer.php 313024 2011-07-06 19:51:24Z dufuz $ + * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR * @since File available since Release 0.1 */ @@ -44682,7 +44756,7 @@ define('PEAR_INSTALLER_NOBINARY', -240); * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version Release: 1.9.4 + * @version Release: 1.9.5 * @link http://pear.php.net/package/PEAR * @since Class available since Release 0.1 */ @@ -45454,7 +45528,10 @@ class PEAR_Installer extends PEAR_Downloader if (!empty($res)) { $new = $this->_registry->getPackage($result[1], $result[0]); $this->file_operations[$key] = false; - $this->log(3, "file $data[0] was scheduled for removal from {$this->pkginfo->getName()} but is owned by {$new->getChannel()}/{$new->getName()}, removal has been cancelled."); + $pkginfoName = $this->pkginfo->getName(); + $newChannel = $new->getChannel(); + $newPackage = $new->getName(); + $this->log(3, "file $data[0] was scheduled for removal from $pkginfoName but is owned by $newChannel/$newPackage, removal has been cancelled."); } } } @@ -46466,7 +46543,7 @@ class PEAR_Installer extends PEAR_Downloader } // }}} -} +} /** * PEAR_PackageFile, package.xml parsing utility class * @@ -46477,7 +46554,7 @@ class PEAR_Installer extends PEAR_Downloader * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id: PackageFile.php 313024 2011-07-06 19:51:24Z dufuz $ + * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR * @since File available since Release 1.4.0a1 */ @@ -46503,7 +46580,7 @@ define('PEAR_PACKAGEFILE_ERROR_INVALID_PACKAGEVERSION', 2); * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version Release: 1.9.4 + * @version Release: 1.9.5 * @link http://pear.php.net/package/PEAR * @since Class available since Release 1.4.0a1 */ @@ -46957,7 +47034,7 @@ class PEAR_PackageFile $info = PEAR::raiseError("Cannot open '$info' for parsing"); return $info; } -} +} /** * PEAR_Packager for generating releases * @@ -46970,7 +47047,7 @@ class PEAR_PackageFile * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id: Packager.php 313023 2011-07-06 19:17:11Z dufuz $ + * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR * @since File available since Release 0.1 */ @@ -46990,7 +47067,7 @@ require_once 'System.php'; * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version Release: 1.9.4 + * @version Release: 1.9.5 * @link http://pear.php.net/package/PEAR * @since Class available since Release 0.1 */ @@ -47157,7 +47234,7 @@ class PEAR_Packager extends PEAR_Common return $dest_package; } -} +} /** * PEAR_Registry * @@ -47170,7 +47247,7 @@ class PEAR_Packager extends PEAR_Common * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id: Registry.php 313023 2011-07-06 19:17:11Z dufuz $ + * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR * @since File available since Release 0.1 */ @@ -47196,7 +47273,7 @@ define('PEAR_REGISTRY_ERROR_CHANNEL_FILE', -6); * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version Release: 1.9.4 + * @version Release: 1.9.5 * @link http://pear.php.net/package/PEAR * @since Class available since Release 1.4.0a1 */ @@ -49551,7 +49628,7 @@ class PEAR_Registry extends PEAR } return $ret; } -} +} /** * PEAR_REST * @@ -49562,7 +49639,7 @@ class PEAR_Registry extends PEAR * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id: REST.php 313023 2011-07-06 19:17:11Z dufuz $ + * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR * @since File available since Release 1.4.0a1 */ @@ -49581,7 +49658,7 @@ require_once 'PEAR/XMLParser.php'; * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version Release: 1.9.4 + * @version Release: 1.9.5 * @link http://pear.php.net/package/PEAR * @since Class available since Release 1.4.0a1 */ @@ -49682,11 +49759,13 @@ class PEAR_REST } if (isset($headers['content-type'])) { - switch ($headers['content-type']) { + $content_type = explode(";", $headers['content-type']); + $content_type = $content_type[0]; + switch ($content_type) { case 'text/xml' : case 'application/xml' : case 'text/plain' : - if ($headers['content-type'] === 'text/plain') { + if ($content_type === 'text/plain') { $check = substr($content, 0, 5); if ($check !== '<?xml') { break; @@ -49826,19 +49905,24 @@ class PEAR_REST return PEAR::raiseError("Could not write $file."); } } else { // update file - $cachefile_lstat = lstat($file); - $cachefile_fp = @fopen($file, 'wb'); + $cachefile_fp = @fopen($file, 'r+b'); // do not truncate file if (!$cachefile_fp) { return PEAR::raiseError("Could not open $file for writing."); } - $cachefile_fstat = fstat($cachefile_fp); - if ( - $cachefile_lstat['mode'] == $cachefile_fstat['mode'] && - $cachefile_lstat['ino'] == $cachefile_fstat['ino'] && - $cachefile_lstat['dev'] == $cachefile_fstat['dev'] && - $cachefile_fstat['nlink'] === 1 - ) { + if (OS_WINDOWS) { + $not_symlink = !is_link($file); // see bug #18834 + } else { + $cachefile_lstat = lstat($file); + $cachefile_fstat = fstat($cachefile_fp); + $not_symlink = $cachefile_lstat['mode'] == $cachefile_fstat['mode'] + && $cachefile_lstat['ino'] == $cachefile_fstat['ino'] + && $cachefile_lstat['dev'] == $cachefile_fstat['dev'] + && $cachefile_fstat['nlink'] === 1; + } + + if ($not_symlink) { + ftruncate($cachefile_fp, 0); // NOW truncate if (fwrite($cachefile_fp, $contents, $len) < $len) { fclose($cachefile_fp); return PEAR::raiseError("Could not write $file."); @@ -49936,7 +50020,7 @@ class PEAR_REST } $request .= $ifmodifiedsince . - "User-Agent: PEAR/1.9.4/PHP/" . PHP_VERSION . "\r\n"; + "User-Agent: PEAR/1.9.5/PHP/" . PHP_VERSION . "\r\n"; $username = $this->config->get('username', null, $channel); $password = $this->config->get('password', null, $channel); @@ -50033,7 +50117,8 @@ class PEAR_REST return $data; } -} +} + /** * PEAR_RunTest * @@ -50045,7 +50130,7 @@ class PEAR_REST * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id: RunTest.php 313024 2011-07-06 19:51:24Z dufuz $ + * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR * @since File available since Release 1.3.3 */ @@ -50073,7 +50158,7 @@ putenv("PHP_PEAR_RUNTESTS=1"); * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version Release: 1.9.4 + * @version Release: 1.9.5 * @link http://pear.php.net/package/PEAR * @since Class available since Release 1.3.3 */ @@ -50310,10 +50395,8 @@ class PEAR_RunTest */ function run($file, $ini_settings = array(), $test_number = 1) { - if (isset($this->_savephp)) { - $this->_php = $this->_savephp; - unset($this->_savephp); - } + $this->_restorePHPBinary(); + if (empty($this->_options['cgi'])) { // try to see if php-cgi is in the path $res = $this->system_with_timeout('php-cgi -v'); @@ -50375,7 +50458,7 @@ class PEAR_RunTest } return 'SKIPPED'; } - $this->_savephp = $this->_php; + $this->_savePHPBinary(); $this->_php = $this->_options['cgi']; } @@ -50529,8 +50612,6 @@ class PEAR_RunTest } chdir($cwd); // in case the test moves us around - $this->_testCleanup($section_text, $temp_clean); - /* when using CGI, strip the headers from the output */ $output = $this->_stripHeadersCGI($output); @@ -50551,6 +50632,9 @@ class PEAR_RunTest $output .= "\n====EXPECTHEADERS FAILURE====:\n$changed"; } } + + $this->_testCleanup($section_text, $temp_clean); + // Does the output match what is expected? do { if (isset($section_text['EXPECTF']) || isset($section_text['EXPECTREGEX'])) { @@ -50989,6 +51073,8 @@ $text function _testCleanup($section_text, $temp_clean) { if ($section_text['CLEAN']) { + $this->_restorePHPBinary(); + // perform test cleanup $this->save_text($temp_clean, $section_text['CLEAN']); $output = $this->system_with_timeout("$this->_php $temp_clean 2>&1"); @@ -51000,8 +51086,22 @@ $text } } } + + function _savePHPBinary() + { + $this->_savephp = $this->_php; + } + + function _restorePHPBinary() + { + if (isset($this->_savephp)) + { + $this->_php = $this->_savephp; + unset($this->_savephp); + } + } } - + /** * PEAR_Validate * @@ -51012,7 +51112,7 @@ $text * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id: Validate.php 313023 2011-07-06 19:17:11Z dufuz $ + * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR * @since File available since Release 1.4.0a1 */ @@ -51035,7 +51135,7 @@ require_once 'PEAR/Validator/PECL.php'; * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version Release: 1.9.4 + * @version Release: 1.9.5 * @link http://pear.php.net/package/PEAR * @since Class available since Release 1.4.0a1 */ @@ -51629,7 +51729,7 @@ class PEAR_Validate { return true; } -} +} /** * PEAR_XMLParser * @@ -51641,7 +51741,7 @@ class PEAR_Validate * @author Stephan Schmidt (original XML_Unserializer code) * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license New BSD License - * @version CVS: $Id: XMLParser.php 313023 2011-07-06 19:17:11Z dufuz $ + * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR * @since File available since Release 1.4.0a1 */ @@ -51654,7 +51754,7 @@ class PEAR_Validate * @author Stephan Schmidt (original XML_Unserializer code) * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license New BSD License - * @version Release: 1.9.4 + * @version Release: 1.9.5 * @link http://pear.php.net/package/PEAR * @since Class available since Release 1.4.0a1 */ @@ -51881,7 +51981,7 @@ class PEAR_XMLParser { $this->_dataStack[$this->_depth] .= $cdata; } -} +} REM ----------------------------------------------------------------------
REM PHP version 5
@@ -51991,7 +52091,7 @@ GOTO END :RUN
"%PHP_PEAR_PHP_BIN%" -C -d date.timezone=UTC -d output_buffering=1 -d safe_mode=0 -d open_basedir="" -d auto_prepend_file="" -d auto_append_file="" -d variables_order=EGPCS -d register_argc_argv="On" -d "include_path='%PHP_PEAR_INSTALL_DIR%'" -f "%PHP_PEAR_INSTALL_DIR%\pearcmd.php" -- %1 %2 %3 %4 %5 %6 %7 %8 %9
:END
-@ECHO ON +@ECHO ON REM ----------------------------------------------------------------------
REM PHP version 5
@@ -52105,7 +52205,7 @@ GOTO END :RUN
"%PHP_PEAR_PHP_BIN%" -C -d date.timezone=UTC -d memory_limit="-1" -d safe_mode=0 -d register_argc_argv="On" -d auto_prepend_file="" -d auto_append_file="" -d variables_order=EGPCS -d open_basedir="" -d output_buffering=1 -d "include_path='%PHP_PEAR_INSTALL_DIR%'" -f "%PHP_PEAR_INSTALL_DIR%\pearcmd.php" -- %1 %2 %3 %4 %5 %6 %7 %8 %9
:END
-@ECHO ON +@ECHO ON REM ----------------------------------------------------------------------
REM PHP version 5
@@ -52219,7 +52319,7 @@ GOTO END :RUN
"%PHP_PEAR_PHP_BIN%" -C -n -d date.timezone=UTC -d output_buffering=1 -d safe_mode=0 -d "include_path='%PHP_PEAR_INSTALL_DIR%'" -d register_argc_argv="On" -d variables_order=EGPCS -f "%PHP_PEAR_INSTALL_DIR%\peclcmd.php" -- %1 %2 %3 %4 %5 %6 %7 %8 %9
:END
-@ECHO ON +@ECHO ON # first find which PHP binary to use if test "x$PHP_PEAR_PHP_BIN" != "x"; then @@ -52247,7 +52347,7 @@ else fi exec $PHP -C -q $INCARG -d date.timezone=UTC -d output_buffering=1 -d variables_order=EGPCS -d open_basedir="" -d safe_mode=0 -d register_argc_argv="On" -d auto_prepend_file="" -d auto_append_file="" $INCDIR/pearcmd.php "$@" - + # first find which PHP binary to use if test "x$PHP_PEAR_PHP_BIN" != "x"; then @@ -52275,7 +52375,7 @@ else fi exec $PHP -d date.timezone=UTC -d memory_limit="-1" -C -q $INCARG -d output_buffering=1 -d open_basedir="" -d safe_mode=0 -d register_argc_argv="On" -d auto_prepend_file="" -d variables_order=EGPCS -d auto_append_file="" $INCDIR/pearcmd.php "$@" - + # first find which PHP binary to use if test "x$PHP_PEAR_PHP_BIN" != "x"; then @@ -52303,7 +52403,7 @@ else fi exec $PHP -C -n -q $INCARG -d date.timezone=UTC -d output_buffering=1 -d variables_order=EGPCS -d safe_mode=0 -d register_argc_argv="On" $INCDIR/peclcmd.php "$@" - + /** * PEAR, the PHP Extension and Application Repository * @@ -52317,11 +52417,11 @@ exec $PHP -C -n -q $INCARG -d date.timezone=UTC -d output_buffering=1 -d variabl * @author Tomas V.V.Cox <cox@idecnet.com> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id: pearcmd.php 313023 2011-07-06 19:17:11Z dufuz $ + * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR */ -ob_end_clean(); +@ob_end_clean(); if (!defined('PEAR_RUNTYPE')) { // this is defined in peclcmd.php as 'pecl' define('PEAR_RUNTYPE', 'pear'); @@ -52330,8 +52430,10 @@ define('PEAR_IGNORE_BACKTRACE', 1); /** * @nodep Gtk */ -if ('@include_path@' != '@'.'include_path'.'@') { - ini_set('include_path', '@include_path@'); +//the space is needed for windows include paths with trailing backslash +// http://pear.php.net/bugs/bug.php?id=19482 +if ('@include_path@ ' != '@'.'include_path'.'@ ') { + ini_set('include_path', trim('@include_path@ ')); $raw = false; } else { // this is a raw, uninstalled pear, either a cvs checkout, or php distro @@ -52750,7 +52852,7 @@ function error_handler($errno, $errmsg, $file, $line, $vars) { * mode: php * End: */ -// vim600:syn=php +// vim600:syn=php /** * PEAR, the PHP Extension and Application Repository * @@ -52764,15 +52866,17 @@ function error_handler($errno, $errmsg, $file, $line, $vars) { * @author Tomas V.V.Cox <cox@idecnet.com> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id: peclcmd.php 313023 2011-07-06 19:17:11Z dufuz $ + * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR */ /** * @nodep Gtk */ -if ('@include_path@' != '@'.'include_path'.'@') { - ini_set('include_path', '@include_path@'); +//the space is needed for windows include paths with trailing backslash +// http://pear.php.net/bugs/bug.php?id=19482 +if ('@include_path@ ' != '@'.'include_path'.'@ ') { + ini_set('include_path', trim('@include_path@ ')); $raw = false; } else { // this is a raw, uninstalled pear, either a cvs checkout, or php distro @@ -52791,7 +52895,7 @@ require_once 'pearcmd.php'; // vim600:syn=php ?> - + Stig Bakken <ssb@php.net>, Gregory Beaver <cellog@php.net>, Helgi Þormar Þorbjörnsson <helgi@php.net>, @@ -52818,7 +52922,7 @@ 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. - + ========================= Installing the PEAR Installer. @@ -52871,7 +52975,7 @@ related issues. Happy PHPing, we hope PEAR will be a great tool for your development work! -$Id: INSTALL 313023 2011-07-06 19:17:11Z dufuz $ +$Id$ $Id: package.dtd,v 1.38 2005-11-12 02:23:07 cellog Exp $ This is the PEAR package description, version 1.0. @@ -52974,7 +53078,7 @@ $Id: INSTALL 313023 2011-07-06 19:17:11Z dufuz $ to CDATA #REQUIRED> - + /** * This is only meant for PHP 5 to get rid of certain strict warning * that doesn't get hidden since it's in the shutdown function @@ -53006,7 +53110,7 @@ class PEAR5 return $properties[$class][$var]; } -} +} /** * PEAR, the PHP Extension and Application Repository * @@ -53022,7 +53126,7 @@ class PEAR5 * @author Greg Beaver <cellog@php.net> * @copyright 1997-2010 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id: PEAR.php 313023 2011-07-06 19:17:11Z dufuz $ + * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR * @since File available since Release 0.1 */ @@ -53086,7 +53190,7 @@ $GLOBALS['_PEAR_error_handler_stack'] = array(); * @author Greg Beaver <cellog@php.net> * @copyright 1997-2006 The PHP Group * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version Release: 1.9.4 + * @version Release: 1.9.5 * @link http://pear.php.net/package/PEAR * @see PEAR_Error * @since Class available since PHP 4.0.2 @@ -53697,7 +53801,7 @@ class PEAR } /** - * OS independant PHP extension load. Remember to take care + * OS independent PHP extension load. Remember to take care * on the correct extension name for case sensitive OSes. * * @param string $ext The extension name @@ -53796,7 +53900,7 @@ function _PEAR_call_destructors() * @author Gregory Beaver <cellog@php.net> * @copyright 1997-2006 The PHP Group * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version Release: 1.9.4 + * @version Release: 1.9.5 * @link http://pear.php.net/manual/en/core.pear.pear-error.php * @see PEAR::raiseError(), PEAR::throwError() * @since Class available since PHP 4.0.2 @@ -54069,7 +54173,7 @@ class PEAR_Error * c-basic-offset: 4 * End: */ - + ========================= What is the PEAR Installer? What is PEAR? @@ -54100,7 +54204,7 @@ prior to use. Happy PHPing, we hope PEAR will be a great tool for your development work! -$Id: README 313023 2011-07-06 19:17:11Z dufuz $ +$Id$ /** * File/Directory manipulation * @@ -54111,7 +54215,7 @@ $Id: README 313023 2011-07-06 19:17:11Z dufuz $ * @author Tomas V.V.Cox <cox@idecnet.com> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id: System.php 313024 2011-07-06 19:51:24Z dufuz $ + * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR * @since File available since Release 0.1 */ @@ -54153,7 +54257,7 @@ $GLOBALS['_System_temp_files'] = array(); * @author Tomas V.V. Cox <cox@idecnet.com> * @copyright 1997-2006 The PHP Group * @license http://opensource.org/licenses/bsd-license.php New BSD License -* @version Release: 1.9.4 +* @version Release: 1.9.5 * @link http://pear.php.net/package/PEAR * @since Class available since Release 0.1 * @static @@ -54173,6 +54277,23 @@ class System function _parseArgs($argv, $short_options, $long_options = null) { if (!is_array($argv) && $argv !== null) { + /* + // Quote all items that are a short option + $av = preg_split('/(\A| )--?[a-z0-9]+[ =]?((?<!\\\\)((,\s*)|((?<!,)\s+))?)/i', $argv, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_OFFSET_CAPTURE); + $offset = 0; + foreach ($av as $a) { + $b = trim($a[0]); + if ($b{0} == '"' || $b{0} == "'") { + continue; + } + + $escape = escapeshellarg($b); + $pos = $a[1] + $offset; + $argv = substr_replace($argv, $escape, $pos, strlen($b)); + $offset += 2; + } + */ + // Find all items, quoted or otherwise preg_match_all("/(?:[\"'])(.*?)(?:['\"])|([^\s]+)/", $argv, $av); $argv = $av[1]; @@ -54183,6 +54304,7 @@ class System $argv[$k] = trim($a) ; } } + return Console_Getopt::getopt2($argv, $short_options, $long_options); } @@ -54728,7 +54850,7 @@ class System } return $files; } -} +} Name: @rpm_package@ Version: @version@ Release: 1 @@ -54800,701 +54922,7 @@ cp -p package@package2xml@.xml %{buildroot}@rpm_xml_dir@/@package@.xml %defattr(-,root,root) %doc @doc_files@ / - -<!DOCTYPE package SYSTEM "http://pear.php.net/dtd/package-1.0"> -<package version="1.0" packagerversion="1.9.4"> - <name>PEAR</name> - <summary>PEAR Base System</summary> - <description>The PEAR package contains: - * the PEAR installer, for creating, distributing - and installing packages - * the PEAR_Exception PHP5 error handling mechanism - * the PEAR_ErrorStack advanced error handling mechanism - * the PEAR_Error error handling mechanism - * the OS_Guess class for retrieving info about the OS - where PHP is running on - * the System class for quick handling of common operations - with files and directories - * the PEAR base class - - Features in a nutshell: - * full support for channels - * pre-download dependency validation - * new package.xml 2.0 format allows tremendous flexibility while maintaining BC - * support for optional dependency groups and limited support for sub-packaging - * robust dependency support - * full dependency validation on uninstall - * remote install for hosts with only ftp access - no more problems with - restricted host installation - * full support for mirroring - * support for bundling several packages into a single tarball - * support for static dependencies on a url-based package - * support for custom file roles and installation tasks - </description> - <maintainers> - <maintainer> - <user>cellog</user> - <name>Greg Beaver</name> - <email>cellog@php.net</email> - <role>lead</role> - </maintainer> - <maintainer> - <user>pajoye</user> - <name>Pierre-Alain Joye</name> - <email>pierre@php.net</email> - <role>lead</role> - </maintainer> - <maintainer> - <user>ssb</user> - <name>Stig Bakken</name> - <email>stig@php.net</email> - <role>lead</role> - </maintainer> - <maintainer> - <user>cox</user> - <name>Tomas V.V.Cox</name> - <email>cox@idecnet.com</email> - <role>lead</role> - </maintainer> - <maintainer> - <user>dufuz</user> - <name>Helgi Thormar</name> - <email>dufuz@php.net</email> - <role>lead</role> - </maintainer> - <maintainer> - <user>tias</user> - <name>Tias Guns</name> - <email>tias@php.net</email> - <role>developer</role> - </maintainer> - <maintainer> - <user>timj</user> - <name>Tim Jackson</name> - <email>timj@php.net</email> - <role>helper</role> - </maintainer> - <maintainer> - <user>toggg</user> - <name>Bertrand Gugger</name> - <email>toggg@php.net</email> - <role>helper</role> - </maintainer> - <maintainer> - <user>mj</user> - <name>Martin Jansen</name> - <email>mj@php.net</email> - <role>helper</role> - </maintainer> - </maintainers> - <release> - <version>1.9.4</version> - <date>2011-07-06</date> - <license>New BSD License</license> - <state>stable</state> - <notes>Bug Fixes: -* Bug #17350: "pear install --force" doesn't uninstall files from previous pkg versions [dufuz] -* Bug #18362: A whitespace TEMP_DIR path breaks install/upgrade functionality [dufuz] -* Bug #18440: bad tmp folder path on install : Unable to create path for C:/Program/tmp [dufuz] -* Bug #18581: "config-get -c" not returning channel's configuration when using alias [dufuz] -* Bug #18639: regression: installing xdebug fails most likely due to another fix [dufuz] -Features -* All System (the class) functions can now take in spaced paths as long as they are surrounded in quotes. - Prior to this it was possible to do that by passing all values in as an array (by product of #18362, #18440) [dufuz] - </notes> - <deps> - <dep type="php" rel="ge" version="4.4.0"/> - <dep type="pkg" rel="ge" version="1.3.3">PEAR</dep> - <dep type="pkg" rel="ge" version="1.3.7">Archive_Tar</dep> - <dep type="pkg" rel="ge" version="1.2">Console_Getopt</dep> - <dep type="pkg" rel="ge" version="1.0.2">Structures_Graph</dep> - <dep type="pkg" rel="ge" version="0.5.0" optional="yes">PEAR_Frontend_Web</dep> - <dep type="pkg" rel="ge" version="0.4.0" optional="yes">PEAR_Frontend_Gtk</dep> - <dep type="ext" rel="has">xml</dep> - <dep type="ext" rel="has">pcre</dep> - </deps> - <provides type="class" name="OS_Guess" /> - <provides type="class" name="System" /> - <filelist> - <file role="php" name="OS/Guess.php"> - <replace from="@package_version@" to="version" type="package-info"/> - </file> - <file role="php" name="PEAR/ChannelFile/Parser.php"> - <replace from="@package_version@" to="version" type="package-info"/> - </file> - <file role="php" name="PEAR/Command/Auth.xml"/> - <file role="php" name="PEAR/Command/Auth.php"> - <replace from="@package_version@" to="version" type="package-info"/> - </file> - <file role="php" name="PEAR/Command/Build.xml"/> - <file role="php" name="PEAR/Command/Build.php"> - <replace from="@package_version@" to="version" type="package-info"/> - </file> - <file role="php" name="PEAR/Command/Channels.xml"/> - <file role="php" name="PEAR/Command/Channels.php"> - <replace from="@package_version@" to="version" type="package-info"/> - </file> - <file role="php" name="PEAR/Command/Common.php"> - <replace from="@package_version@" to="version" type="package-info"/> - </file> - <file role="php" name="PEAR/Command/Config.xml"/> - <file role="php" name="PEAR/Command/Config.php"> - <replace from="@package_version@" to="version" type="package-info"/> - </file> - <file role="php" name="PEAR/Command/Install.xml"/> - <file role="php" name="PEAR/Command/Install.php"> - <replace from="@package_version@" to="version" type="package-info"/> - </file> - <file role="php" name="PEAR/Command/Package.xml"/> - <file role="php" name="PEAR/Command/Package.php"> - <replace from="@DATA-DIR@" to="data_dir" type="pear-config"/> - <replace from="@package_version@" to="version" type="package-info"/> - </file> - <file role="php" name="PEAR/Command/Pickle.xml"/> - <file role="php" name="PEAR/Command/Pickle.php"> - <replace from="@package_version@" to="version" type="package-info"/> - </file> - <file role="php" name="PEAR/Command/Registry.xml"/> - <file role="php" name="PEAR/Command/Registry.php"> - <replace from="@package_version@" to="version" type="package-info"/> - </file> - <file role="php" name="PEAR/Command/Remote.xml"/> - <file role="php" name="PEAR/Command/Remote.php"> - <replace from="@package_version@" to="version" type="package-info"/> - </file> - <file role="php" name="PEAR/Command/Mirror.xml"/> - <file role="php" name="PEAR/Command/Mirror.php"> - <replace from="@package_version@" to="version" type="package-info"/> - </file> - <file role="php" name="PEAR/Command/Test.xml"/> - <file role="php" name="PEAR/Command/Test.php"> - <replace from="@package_version@" to="version" type="package-info"/> - </file> - <file role="php" name="PEAR/Downloader/Package.php"> - <replace from="@PEAR-VER@" to="version" type="package-info"/> - </file> - <file role="php" name="PEAR/Frontend/CLI.php"> - <replace from="@package_version@" to="version" type="package-info"/> - </file> - <file role="php" name="PEAR/Installer/Role/Common.php"> - <replace from="@package_version@" to="version" type="package-info"/> - </file> - <file role="php" name="PEAR/Installer/Role/Cfg.xml"/> - <file role="php" name="PEAR/Installer/Role/Cfg.php"> - <replace from="@package_version@" to="version" type="package-info"/> - </file> - <file role="php" name="PEAR/Installer/Role/Data.xml"/> - <file role="php" name="PEAR/Installer/Role/Data.php"> - <replace from="@package_version@" to="version" type="package-info"/> - </file> - <file role="php" name="PEAR/Installer/Role/Doc.xml"/> - <file role="php" name="PEAR/Installer/Role/Doc.php"> - <replace from="@package_version@" to="version" type="package-info"/> - </file> - <file role="php" name="PEAR/Installer/Role/Ext.xml"/> - <file role="php" name="PEAR/Installer/Role/Ext.php"> - <replace from="@package_version@" to="version" type="package-info"/> - </file> - <file role="php" name="PEAR/Installer/Role/Php.xml"/> - <file role="php" name="PEAR/Installer/Role/Php.php"> - <replace from="@package_version@" to="version" type="package-info"/> - </file> - <file role="php" name="PEAR/Installer/Role/Script.xml"/> - <file role="php" name="PEAR/Installer/Role/Script.php"> - <replace from="@package_version@" to="version" type="package-info"/> - </file> - <file role="php" name="PEAR/Installer/Role/Src.xml"/> - <file role="php" name="PEAR/Installer/Role/Src.php"> - <replace from="@package_version@" to="version" type="package-info"/> - </file> - <file role="php" name="PEAR/Installer/Role/Test.xml"/> - <file role="php" name="PEAR/Installer/Role/Test.php"> - <replace from="@package_version@" to="version" type="package-info"/> - </file> - <file role="php" name="PEAR/Installer/Role/Www.xml"/> - <file role="php" name="PEAR/Installer/Role/Www.php"> - <replace from="@package_version@" to="version" type="package-info"/> - </file> - <file role="php" name="PEAR/Installer/Role.php"> - <replace from="@package_version@" to="version" type="package-info"/> - </file> - <file role="php" name="PEAR/PackageFile/Generator/v1.php"> - <replace from="@PEAR-VER@" to="version" type="package-info"/> - </file> - <file role="php" name="PEAR/PackageFile/Generator/v2.php"> - <replace from="@PEAR-VER@" to="version" type="package-info"/> - </file> - <file role="php" name="PEAR/PackageFile/Parser/v1.php"> - <replace from="@package_version@" to="version" type="package-info"/> - </file> - <file role="php" name="PEAR/PackageFile/Parser/v2.php"> - <replace from="@package_version@" to="version" type="package-info"/> - </file> - <file role="php" name="PEAR/PackageFile/v2/rw.php"> - <replace from="@package_version@" to="version" type="package-info"/> - </file> - <file role="php" name="PEAR/PackageFile/v2/Validator.php"> - <replace from="@package_version@" to="version" type="package-info"/> - </file> - <file role="php" name="PEAR/PackageFile/v1.php"> - <replace from="@package_version@" to="version" type="package-info"/> - </file> - <file role="php" name="PEAR/PackageFile/v2.php"> - <replace from="@package_version@" to="version" type="package-info"/> - </file> - <file role="php" name="PEAR/REST/10.php"> - <replace from="@package_version@" to="version" type="package-info"/> - </file> - <file role="php" name="PEAR/REST/11.php"> - <replace from="@package_version@" to="version" type="package-info"/> - </file> - <file role="php" name="PEAR/REST/13.php"> - <replace from="@package_version@" to="version" type="package-info"/> - </file> - <file role="php" name="PEAR/Task/Postinstallscript/rw.php"> - <replace from="@package_version@" to="version" type="package-info"/> - </file> - <file role="php" name="PEAR/Task/Replace/rw.php"> - <replace from="@package_version@" to="version" type="package-info"/> - </file> - <file role="php" name="PEAR/Task/Unixeol/rw.php"> - <replace from="@package_version@" to="version" type="package-info"/> - </file> - <file role="php" name="PEAR/Task/Windowseol/rw.php"> - <replace from="@package_version@" to="version" type="package-info"/> - </file> - <file role="php" name="PEAR/Task/Common.php"> - <replace from="@package_version@" to="version" type="package-info"/> - </file> - <file role="php" name="PEAR/Task/Postinstallscript.php"> - <replace from="@package_version@" to="version" type="package-info"/> - </file> - <file role="php" name="PEAR/Task/Replace.php"> - <replace from="@package_version@" to="version" type="package-info"/> - </file> - <file role="php" name="PEAR/Task/Unixeol.php"> - <replace from="@package_version@" to="version" type="package-info"/> - </file> - <file role="php" name="PEAR/Task/Windowseol.php"> - <replace from="@package_version@" to="version" type="package-info"/> - </file> - <file role="php" name="PEAR/Validator/PECL.php"> - <replace from="@package_version@" to="version" type="package-info"/> - </file> - <file role="php" name="PEAR/Autoloader.php"> - <replace from="@package_version@" to="version" type="package-info"/> - </file> - <file role="php" name="PEAR/Builder.php"> - <replace from="@PEAR-VER@" to="version" type="package-info"/> - </file> - <file role="php" name="PEAR/ChannelFile.php"> - <replace from="@package_version@" to="version" type="package-info"/> - </file> - <file role="php" name="PEAR/Command.php"> - <replace from="@package_version@" to="version" type="package-info"/> - </file> - <file role="php" name="PEAR/Common.php"> - <replace from="@package_version@" to="version" type="package-info"/> - </file> - <file role="php" name="PEAR/Config.php"> - <replace from="@package_version@" to="version" type="package-info"/> - </file> - <file role="php" name="PEAR/DependencyDB.php"> - <replace from="@package_version@" to="version" type="package-info"/> - </file> - <file role="php" name="PEAR/Dependency2.php"> - <replace from="@PEAR-VER@" to="version" type="package-info"/> - </file> - <file role="php" name="PEAR/Downloader.php"> - <replace from="@package_version@" to="version" type="package-info"/> - </file> - <file role="php" name="PEAR/ErrorStack.php"> - <replace from="@package_version@" to="version" type="package-info"/> - </file> - <file role="php" name="PEAR/Exception.php"> - <replace from="@package_version@" to="version" type="package-info"/> - </file> - <file role="php" name="PEAR/FixPHP5PEARWarnings.php"/> - <file role="php" name="PEAR/Frontend.php"> - <replace from="@package_version@" to="version" type="package-info"/> - </file> - <file role="php" name="PEAR/Installer.php"> - <replace from="@package_version@" to="version" type="package-info"/> - </file> - <file role="php" name="PEAR/Packager.php"> - <replace from="@package_version@" to="version" type="package-info"/> - </file> - <file role="php" name="PEAR/PackageFile.php"> - <replace from="@PEAR-VER@" to="version" type="package-info"/> - </file> - <file role="php" name="PEAR/Registry.php"> - <replace from="@package_version@" to="version" type="package-info"/> - </file> - <file role="php" name="PEAR/REST.php"> - <replace from="@package_version@" to="version" type="package-info"/> - </file> - <file role="php" name="PEAR/RunTest.php"> - <replace from="@package_version@" to="version" type="package-info"/> - </file> - <file role="php" name="PEAR/Validate.php"> - <replace from="@package_version@" to="version" type="package-info"/> - </file> - <file role="php" name="PEAR/XMLParser.php"> - <replace from="@package_version@" to="version" type="package-info"/> - </file> - <file role="script" baseinstalldir="/" platform="!windows" install-as="pear" name="scripts/pear.sh"> - <replace from="@php_bin@" to="php_bin" type="pear-config"/> - <replace from="@php_dir@" to="php_dir" type="pear-config"/> - <replace from="@pear_version@" to="version" type="package-info"/> - <replace from="@include_path@" to="php_dir" type="pear-config"/> - </file> - <file role="script" baseinstalldir="/" platform="!windows" install-as="peardev" name="scripts/peardev.sh"> - <replace from="@php_bin@" to="php_bin" type="pear-config"/> - <replace from="@php_dir@" to="php_dir" type="pear-config"/> - <replace from="@pear_version@" to="version" type="package-info"/> - <replace from="@include_path@" to="php_dir" type="pear-config"/> - </file> - <file role="script" baseinstalldir="/" platform="!windows" install-as="pecl" name="scripts/pecl.sh"> - <replace from="@php_bin@" to="php_bin" type="pear-config"/> - <replace from="@php_dir@" to="php_dir" type="pear-config"/> - <replace from="@pear_version@" to="version" type="package-info"/> - <replace from="@include_path@" to="php_dir" type="pear-config"/> - </file> - <file role="script" baseinstalldir="/" platform="windows" install-as="peardev.bat" name="scripts/peardev.bat"> - <replace from="@bin_dir@" to="bin_dir" type="pear-config"/> - <replace from="@php_bin@" to="php_bin" type="pear-config"/> - <replace from="@include_path@" to="php_dir" type="pear-config"/> - </file> - <file role="script" baseinstalldir="/" platform="windows" install-as="pear.bat" name="scripts/pear.bat"> - <replace from="@bin_dir@" to="bin_dir" type="pear-config"/> - <replace from="@php_bin@" to="php_bin" type="pear-config"/> - <replace from="@include_path@" to="php_dir" type="pear-config"/> - </file> - <file role="script" baseinstalldir="/" platform="windows" install-as="pecl.bat" name="scripts/pecl.bat"> - <replace from="@bin_dir@" to="bin_dir" type="pear-config"/> - <replace from="@php_bin@" to="php_bin" type="pear-config"/> - <replace from="@include_path@" to="php_dir" type="pear-config"/> - </file> - <file role="php" baseinstalldir="/" install-as="pearcmd.php" name="scripts/pearcmd.php"> - <replace from="@php_bin@" to="php_bin" type="pear-config"/> - <replace from="@php_dir@" to="php_dir" type="pear-config"/> - <replace from="@pear_version@" to="version" type="package-info"/> - <replace from="@include_path@" to="php_dir" type="pear-config"/> - </file> - <file role="php" baseinstalldir="/" install-as="peclcmd.php" name="scripts/peclcmd.php"> - <replace from="@php_bin@" to="php_bin" type="pear-config"/> - <replace from="@php_dir@" to="php_dir" type="pear-config"/> - <replace from="@pear_version@" to="version" type="package-info"/> - <replace from="@include_path@" to="php_dir" type="pear-config"/> - </file> - <file role="doc" baseinstalldir="/" name="LICENSE"/> - <file role="doc" baseinstalldir="/" name="INSTALL"/> - <file role="data" baseinstalldir="/" name="package.dtd"/> - <file role="data" baseinstalldir="/" name="template.spec"/> - <file role="php" baseinstalldir="/" name="PEAR.php"> - <replace from="@package_version@" to="version" type="package-info"/> - </file> - <file role="php" baseinstalldir="/" name="PEAR5.php"/> - <file role="doc" baseinstalldir="/" name="README"/> - <file role="php" baseinstalldir="/" name="System.php"> - <replace from="@package_version@" to="version" type="package-info"/> - </file> - </filelist> - </release> - <changelog> - <release> - <version>1.8.0alpha1</version> - <date>2009-03-09</date> - <license>New BSD License</license> - <state>alpha</state> - <notes>* Implement Request #10373: if pref_state=stable and installed package=beta, allow up to latest beta version [dufuz] -* Implement Request #10581: login / logout should map to channel-login / channel-logout [dufuz] -* Implement Request #10825: Only display the "invalid or missing package file"-error if it makes sense [dufuz] -* Implement Request #11170: script to generate Command/[command].xml [dufuz] -* Implement Request #11176: improve channel ... has updated its protocols message [dufuz] -* Implement Request #12706: pear list -a hard to read [dufuz] -* Implement Request #11353: upgrade-all and upgrade commands to upgrade within the same stability level [dufuz] -* Implement Request #13015: Add https discovery for channel.xml [dufuz / initial patch by Martin Roos] -* Implement Request #13927: install-pear.php should have option to set www_dir [timj] -* Implement Request #14324: Make the pear install command behave similar to apt-get [dufuz] -* Implement Request #14325: make pear upgrade with no params behave like pear upgrade-all [dufuz] - - upgrade-all can be considered deprecated in favor of calling upgrade with no parameters to replicate - better what other package managers are doing. upgrade-all will still work as intended. -* Implement Request #14504: add a channel parameter support to the upgrade function [dufuz] - - Options -c ezc and --channel=ezc got added to upgrade and upgrade-all to allow for - channel specific upgrades -* Implement Request #14556: install-pear-nozlib.phar should get download_dir config and other options [cweiske] -* Implement Request #15566: Add doc.php.net as a default channel [dufuz / saltybeagle] -* Fix PHP Bug #43857: --program-suffix not always reflected everywhere [cellog] -* Fix PHP Bug #47323: strotime warnings in make install [dufuz] -* Fix Bug #13908: pear info command and maintainers inactive not mentioned [dufuz] -* Fix Bug #13926: install-pear.php does not set cfg_dir if -d option set with no -c option [timj] -* Fix Bug #13943: tests fail when php.exe path contains spaces [dufuz / jorrit] -* Fix Bug #13953: config-set/config-show with channel alias fail [cellog] -* Fix Bug #13958: When a phpt tests exit() or die() xdebug coverage is not generated, patch by izi (David Jean Louis) [izi / dufuz] -* Fix Bug #14041: Unpredictable unit test processing sequence [dufuz] -* Fix Bug #14140: Strict warning not suppressed in the shutdown function [dufuz] -* Fix Bug #14210: pear list -ia brings warnings [dufuz] -* Fix Bug #14274: PEAR packager mangles package.xml encoding, then complains about it [dufuz] -* Fix Bug #14287: cannot upgrade from stable to beta via -beta when config is set to stable [dufuz] -* Fix Bug #14300: Package files themselves can not be served over https [dufuz / initial patch by Martin Roos] -* Fix Bug #14437: openbasedir warning when loading config [dufuz] -* Fix Bug #14558: PackageFile.php creates tmp directory outside configured temp_dir [cweiske] -* Fix Bug #14947: downloadHttp() is missing Host part of the HTTP Request when using Proxy [ifeghali] -* Fix Bug #14977: PEAR/Frontend.php doesn't require_once PEAR.php [dufuz] -* Fix Bug #15750: Unreachable code in PEAR_Downloader [dufuz] -* Fix Bug #15979: Package files incorrectly removed when splitting a package into multiple pkgs [dufuz] -* Fix Bug #15914: pear upgrade installs different version if desired version not found [dufuz] -NOTE! -Functions that have been deprecated for 3+ years in PEAR_Common, please take a moment -to migrate over to one of the alternatives that have ben provided: -* PEAR_Common->downloadHttp (use PEAR_Downloader->downloadHttp instead) -* PEAR_Common->infoFromTgzFile (use PEAR_PackageFile->fromTgzFile instead) -* PEAR_Common->infoFromDescriptionFile (use PEAR_PackageFile->fromPackageFile instead) -* PEAR_Common->infoFromString (use PEAR_PackageFile->fromXmlstring instead) -* PEAR_Common->infoFromArray (use PEAR_PackageFile->fromAnyFile instead) -* PEAR_Common->xmlFromInfo (use a PEAR_PackageFile_v* object's generator instead) -* PEAR_Common->validatePackageInfo (use the validation of PEAR_PackageFile objects) -* PEAR_Common->analyzeSourceCode (use a PEAR_PackageFile_v* object instead) -* PEAR_Common->detectDependencies (use PEAR_Downloader_Package->detectDependencies instead) -* PEAR_Common->buildProvidesArray (use PEAR_PackageFile_v1->_buildProvidesArray or - PEAR_PackageFile_v2_Validator->_buildProvidesArray) -PHP 4.4 and 5.1.6 are now the minimum PHP requirements, for brave souls -pear upgrade -f PEAR will allow people with lower versions -to upgrade to this release but no guarantees will be made that it will work properly. -Support for XML RPC channels has been dropped - The only ones that used it -(pear.php.net and pecl.php.net) have used the REST interface for years now. -SOAP support also removed as it was only proof of concept. -Move codebase from the PHP License to New BSD 2 clause license - </notes> - </release> - <release> - <version>1.8.0RC1</version> - <date>2009-03-27</date> - <license>New BSD License</license> - <state>beta</state> - <notes>* Fix Bug #14331: pear cvstag only works from inside the package directory [dufuz] -* Fix Bug #16045: E_Notice: Undefined index: channel in PEAR/DependencyDB.php [dufuz] -* Implemented Request #11230: better error message when mirror not in channel.xml file [dufuz] -* Implemented Request #13150: Add support for following HTTP 302 redirects [dufuz] - </notes> - </release> - <release> - </release> - <release> - <license>New BSD License</license> - <notes>Changes since RC1: - * Fix Bug #14792: Bad md5sum for files with replaced content [dufuz] - * Fix Bug #16057:-r is limited to 4 directories in depth [dufuz] - * Fix Bug #16077: PEAR5::getStaticProperty does not return a reference to the property [dufuz] - - Remove custom XML_Util class in favor of using upstream XML_Util package as dependency - -RC1 Release Notes: - * Fix Bug #14331: pear cvstag only works from inside the package directory [dufuz] - * Fix Bug #16045: E_Notice: Undefined index: channel in PEAR/DependencyDB.php [dufuz] - - * Implemented Request #11230: better error message when mirror not in channel.xml file [dufuz] - * Implemented Request #13150: Add support for following HTTP 302 redirects [dufuz] - -Alpha1 Release Notes: - * Implement Request #10373: if pref_state=stable and installed package=beta, allow up to latest beta version [dufuz] - * Implement Request #10581: login / logout should map to channel-login / channel-logout [dufuz] - * Implement Request #10825: Only display the "invalid or missing package file"-error if it makes sense [dufuz] - * Implement Request #11170: script to generate Command/[command].xml [dufuz] - * Implement Request #11176: improve channel ... has updated its protocols message [dufuz] - * Implement Request #12706: pear list -a hard to read [dufuz] - * Implement Request #11353: upgrade-all and upgrade commands to upgrade within the same stability level [dufuz] - * Implement Request #13015: Add https discovery for channel.xml [dufuz / initial patch by Martin Roos] - * Implement Request #13927: install-pear.php should have option to set www_dir [timj] - * Implement Request #14324: Make the pear install command behave similar to apt-get [dufuz] - * Implement Request #14325: make pear upgrade with no params behave like pear upgrade-all [dufuz] - - upgrade-all can be considered deprecated in favor of calling upgrade with no parameters to replicate - better what other package managers are doing. upgrade-all will still work as intended. - * Implement Request #14504: add a channel parameter support to the upgrade function [dufuz] - - Options -c ezc and --channel=ezc got added to upgrade and upgrade-all to allow for - channel specific upgrades - * Implement Request #14556: install-pear-nozlib.phar should get download_dir config and other options [cweiske] - * Implement Request #15566: Add doc.php.net as a default channel [dufuz / saltybeagle] - - * Fix PHP Bug #43857: --program-suffix not always reflected everywhere [cellog] - * Fix PHP Bug #47323: strotime warnings in make install [dufuz] - - * Fix Bug #13908: pear info command and maintainers inactive not mentioned [dufuz] - * Fix Bug #13926: install-pear.php does not set cfg_dir if -d option set with no -c option [timj] - * Fix Bug #13943: tests fail when php.exe path contains spaces [dufuz / jorrit] - * Fix Bug #13953: config-set/config-show with channel alias fail [cellog] - * Fix Bug #13958: When a phpt tests exit() or die() xdebug coverage is not generated, patch by izi (David Jean Louis) [izi / dufuz] - * Fix Bug #14041: Unpredictable unit test processing sequence [dufuz] - * Fix Bug #14140: Strict warning not suppressed in the shutdown function [dufuz] - * Fix Bug #14210: pear list -ia brings warnings [dufuz] - * Fix Bug #14274: PEAR packager mangles package.xml encoding, then complains about it [dufuz] - * Fix Bug #14287: cannot upgrade from stable to beta via -beta when config is set to stable [dufuz] - * Fix Bug #14300: Package files themselves can not be served over https [dufuz / initial patch by Martin Roos] - * Fix Bug #14437: openbasedir warning when loading config [dufuz] - * Fix Bug #14558: PackageFile.php creates tmp directory outside configured temp_dir [cweiske] - * Fix Bug #14947: downloadHttp() is missing Host part of the HTTP Request when using Proxy [ifeghali] - * Fix Bug #14977: PEAR/Frontend.php doesn't require_once PEAR.php [dufuz] - * Fix Bug #15750: Unreachable code in PEAR_Downloader [dufuz] - * Fix Bug #15979: Package files incorrectly removed when splitting a package into multiple pkgs [dufuz] - * Fix Bug #15914: pear upgrade installs different version if desired version not found [dufuz] - - NOTE! - Functions that have been deprecated for 3+ years in PEAR_Common, please take a moment - to migrate over to one of the alternatives that have ben provided: - * PEAR_Common->downloadHttp (use PEAR_Downloader->downloadHttp instead) - * PEAR_Common->infoFromTgzFile (use PEAR_PackageFile->fromTgzFile instead) - * PEAR_Common->infoFromDescriptionFile (use PEAR_PackageFile->fromPackageFile instead) - * PEAR_Common->infoFromString (use PEAR_PackageFile->fromXmlstring instead) - * PEAR_Common->infoFromArray (use PEAR_PackageFile->fromAnyFile instead) - * PEAR_Common->xmlFromInfo (use a PEAR_PackageFile_v* object's generator instead) - * PEAR_Common->validatePackageInfo (use the validation of PEAR_PackageFile objects) - * PEAR_Common->analyzeSourceCode (use a PEAR_PackageFile_v* object instead) - * PEAR_Common->detectDependencies (use PEAR_Downloader_Package->detectDependencies instead) - * PEAR_Common->buildProvidesArray (use PEAR_PackageFile_v1->_buildProvidesArray or - PEAR_PackageFile_v2_Validator->_buildProvidesArray) - - PHP 4.4 and 5.1.6 are now the minimum PHP requirements, for brave souls - pear upgrade -f PEAR will allow people with lower versions - to upgrade to this release but no guarantees will be made that it will work properly. - - Support for XML RPC channels has been dropped - The only ones that used it - (pear.php.net and pecl.php.net) have used the REST interface for years now. - SOAP support also removed as it was only proof of concept. - - Move codebase from the PHP License to New BSD 2 clause license - </notes> - </release> - <release> - <version>1.8.1</version> - <date>2009-04-15</date> - <license>New BSD License</license> - <state>stable</state> - <notes>* Fix Bug #16099 PEAR crash on PHP4 (parse error) [dufuz] - </notes> - </release> - <release> - <version>1.9.0RC1</version> - <date>2009-08-18</date> - <license>New BSD License</license> - <state>beta</state> - <notes>* Implement Request #16213: add alias to list-channels output [dufuz] -* Implement Request #16378: pear svntag [dufuz] -* Implement Request #16386: PEAR_Config::remove() does not support specifying a channel [timj] -* Implement Request #16396: package-dependencies should allow package names [dufuz] -* Fix Bug #11181: pear requests channel.xml from main server instead from mirror [dufuz] -* Fix Bug #14493: pear install --offline doesn't print out errors [dufuz] -* Fix Bug #11348: pear package-dependencies isn't well explained [dufuz] -* Fix Bug #16108: PEAR_PackageFile_Generator_v2 PHP4 parse error when running upgrade-all [dufuz] -* Fix Bug #16113: Installing certain packages fails due incorrect encoding handling [dufuz] -* Fix Bug #16122: PEAR RunTest failed to run as expected [dufuz] -* Fix Bug #16366: compiling 5.2.10 leads to non-functioning pear [dufuz] -* Fix Bug #16387: channel-logout does not support logging out from a non-default channel [timj] -* Fix Bug #16444: Setting preferred mirror fails [dufuz] -* Fix the shutdown functions where a index might not exist and thus raise a notice [derick] - </notes> - </release> - <release> - <version>1.9.0RC2</version> - <date>2009-08-20</date> - <license>New BSD License</license> - <state>beta</state> - <notes>* REST 1.4 file was occasionally being included but REST 1.4 is not intended for this release cycle [dufuz] - </notes> - </release> - <release> - <version>1.9.0RC3</version> - <date>2009-08-21</date> - <license>New BSD License</license> - <state>beta</state> - <notes>* Improved svntag support to handle packages like PEAR it self [dufuz] - </notes> - </release> - <release> - <version>1.9.0RC4</version> - <date>2009-08-23</date> - <license>New BSD License</license> - <state>beta</state> - <notes>* Fixed a problem where the original channel could not be set as a preferred_mirror again [dufuz] -* Make sure channel aliases can't be made to start with - [dufuz] -* Output issues with pear search [dufuz] -* Fixed couple of stray notices [dufuz] - </notes> - </release> - <release> - <version>1.9.0</version> - <date>2009-09-03</date> - <license>New BSD License</license> - <state>stable</state> - <notes>* Fix Bug #16547: The phar for PEAR installer uses ereg() which is deprecated [dufuz] - </notes> - </release> - <release> - <version>1.9.1</version> - <date>2010-05-26</date> - <license>New BSD License</license> - <state>stable</state> - <notes>* svntag improvements, tag package files passed into the command and better directory checks [dufuz] -* rely on Structures_Graph minimum version instead of recommended version [saltybeagle] -* Fix Bug #12613: running go-pear.phar from C:\ fails [dufuz] -* Fix Bug #14841: Installing pear into directory with space fails [dufuz] -* Fix Bug #16644: pear.bat returns syntax error when parenthesis are in install path. [dufuz] [patch by bwaters (Bryan Waters)] -* Fix Bug #16767: Use of Depreciated HTML Attributes in the Exception class [dufuz] [patch by fuhrysteve (Stephen J. Fuhry)] -* Fix Bug #16864: "pear list-upgrades -i" issues E_WARNINGS [dufuz] [patch by rquadling (Richard Quadling)] -* Fix Bug #17220: command `pear help` outputs to stderr instead of stdout [dufuz] -* Fix Bug #17234: channel-discover adds port to HTTP Host header [dufuz] -* Fix Bug #17292: Code Coverage in PEAR_RunTest does not work with namespaces [sebastian] -* Fix Bug #17359: loadExtension() fails over missing dl() when used in multithread env [dufuz] -* Fix Bug #17378: pear info $package fails if directory with that name exists [dufuz] - </notes> - </release> - <release> - <version>1.9.2</version> - <date>2011-02-28</date> - <license>New BSD License</license> - <state>stable</state> - <notes>Important! This is a security fix release. The advisory can be found at -http://pear.php.net/advisory-20110228.txt - - Bugs: - * Fixed Bug #17463: Regression: On Windows, svntag [patch by doconnor] - * Fixed Bug #17641: pecl-list doesn't sort packages by name [dufuz] - * Fixed Bug #17781: invalid argument warning on foreach due to an empty optional dependencie [dufuz] - * Fixed Bug #17801: PEAR run-tests wrongly detects php-cgi [patch by David Jean Louis (izi)] - * Fixed Bug #17839: pear svntag does not tag package.xml file [dufuz] - * Fixed Bug #17986: PEAR Installer cannot handle files moved between packages [dufuz] - * Fixed Bug #17997: Strange output if directories are not writeable [dufuz] - * Fixed Bug #18001: PEAR/RunTest coverage fails [dufuz] - * Fixed Bug #18056 [SECURITY]: Symlink attack in PEAR install [dufuz] - * Fixed Bug #18218: "pear package" does not allow the use of late static binding [dufuz and Christer Edvartsen] - * Fixed Bug #18238: Wrong return code from "pear help" [till] - * Fixed Bug #18308: Broken error message about missing channel validator [yunosh] - - This feature is implemented as a result of #18056 - * Implemented Request #16648: Use TMPDIR for builds instead of /var/tmp [dufuz] - </notes> - </release> - <release> - <version>1.9.3</version> - <date>2011-06-04</date> - <license>New BSD License</license> - <state>stable</state> - <notes>* Fixed Bug #17744: Empty changelog causes fatal error in setChangelogentry [dufuz] -* Fixed Bug #18340: raiseErro typo [doconnor] -* Fixed Bug #18349: package.xml version not recognized when single quoted [dufuz] -* Fixed Bug #18364: date.timezone errors for sh/bat files when TZ is not set in php.ini [dufuz] -* Fixed Bug #18388: Parentheses error in REST.php line 232 [dufuz] -* Fixed Bug #18428: invalid preg_match patterns [glen] -* Fixed Bug #18486: REST/10.php does not check error condition [dufuz] -* Fixed a problem in RunTest and code coverage. Correctly register the - code coverage shutdown function in case we are inside a namespace. [sebastian] -* Fixed a bug with extensions not providing their config.m4 and co in the root directory - of their pecl package but rather in a sub directory, such as xhprof. [dufuz] - </notes> - </release> - </changelog> -</package> - + /** * PEAR, the PHP Extension and Application Repository * @@ -55510,7 +54938,7 @@ http://pear.php.net/advisory-20110228.txt * @author Greg Beaver <cellog@php.net> * @copyright 1997-2010 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id: PEAR.php 313023 2011-07-06 19:17:11Z dufuz $ + * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR * @since File available since Release 0.1 */ @@ -55574,7 +55002,7 @@ $GLOBALS['_PEAR_error_handler_stack'] = array(); * @author Greg Beaver <cellog@php.net> * @copyright 1997-2006 The PHP Group * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version Release: 1.9.4 + * @version Release: 1.9.5 * @link http://pear.php.net/package/PEAR * @see PEAR_Error * @since Class available since PHP 4.0.2 @@ -56185,7 +55613,7 @@ class PEAR } /** - * OS independant PHP extension load. Remember to take care + * OS independent PHP extension load. Remember to take care * on the correct extension name for case sensitive OSes. * * @param string $ext The extension name @@ -56284,7 +55712,7 @@ function _PEAR_call_destructors() * @author Gregory Beaver <cellog@php.net> * @copyright 1997-2006 The PHP Group * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version Release: 1.9.4 + * @version Release: 1.9.5 * @link http://pear.php.net/manual/en/core.pear.pear-error.php * @see PEAR::raiseError(), PEAR::throwError() * @since Class available since PHP 4.0.2 @@ -56559,712 +55987,6 @@ class PEAR_Error */ <?php /** - * Class auto-loader - * - * PHP versions 4 - - * - * @category pear - * @package PEAR - * @author Stig Bakken <ssb@php.net> - * @copyright 1997-2009 The Authors - * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id: Autoloader.php 313023 2011-07-06 19:17:11Z dufuz $ - * @link http://pear.php.net/manual/en/core.ppm.php#core.ppm.pear-autoloader - * @since File available since Release 0.1 - * @deprecated File deprecated in Release 1.4.0a1 - */ - -// /* vim: set expandtab tabstop=4 shiftwidth=4: */ - -if (!extension_loaded("overload")) { - // die hard without ext/overload - die("Rebuild PHP with the `overload' extension to use PEAR_Autoloader"); -} - -/** - * Include for PEAR_Error and PEAR classes - */ -require_once 'phar://install-pear-nozlib.phar/' . "PEAR.php"; - -/** - * This class is for objects where you want to separate the code for - * some methods into separate classes. This is useful if you have a - * class with not-frequently-used methods that contain lots of code - * that you would like to avoid always parsing. - * - * The PEAR_Autoloader class provides autoloading and aggregation. - * The autoloading lets you set up in which classes the separated - * methods are found. Aggregation is the technique used to import new - * methods, an instance of each class providing separated methods is - * stored and called every time the aggregated method is called. - * - * @category pear - * @package PEAR - * @author Stig Bakken <ssb@php.net> - * @copyright 1997-2009 The Authors - * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version Release: 1.9.4 - * @link http://pear.php.net/manual/en/core.ppm.php#core.ppm.pear-autoloader - * @since File available since Release 0.1 - * @deprecated File deprecated in Release 1.4.0a1 - */ -class PEAR_Autoloader extends PEAR -{ - // {{{ properties - - /** - * Map of methods and classes where they are defined - * - * @var array - * - * @access private - */ - var $_autoload_map = array(); - - /** - * Map of methods and aggregate objects - * - * @var array - * - * @access private - */ - var $_method_map = array(); - - // }}} - // {{{ addAutoload() - - /** - * Add one or more autoload entries. - * - * @param string $method which method to autoload - * - * @param string $classname (optional) which class to find the method in. - * If the $method parameter is an array, this - * parameter may be omitted (and will be ignored - * if not), and the $method parameter will be - * treated as an associative array with method - * names as keys and class names as values. - * - * @return void - * - * @access public - */ - function addAutoload($method, $classname = null) - { - if (is_array($method)) { - array_walk($method, create_function('$a,&$b', '$b = strtolower($b);')); - $this->_autoload_map = array_merge($this->_autoload_map, $method); - } else { - $this->_autoload_map[strtolower($method)] = $classname; - } - } - - // }}} - // {{{ removeAutoload() - - /** - * Remove an autoload entry. - * - * @param string $method which method to remove the autoload entry for - * - * @return bool TRUE if an entry was removed, FALSE if not - * - * @access public - */ - function removeAutoload($method) - { - $method = strtolower($method); - $ok = isset($this->_autoload_map[$method]); - unset($this->_autoload_map[$method]); - return $ok; - } - - // }}} - // {{{ addAggregateObject() - - /** - * Add an aggregate object to this object. If the specified class - * is not defined, loading it will be attempted following PEAR's - * file naming scheme. All the methods in the class will be - * aggregated, except private ones (name starting with an - * underscore) and constructors. - * - * @param string $classname what class to instantiate for the object. - * - * @return void - * - * @access public - */ - function addAggregateObject($classname) - { - $classname = strtolower($classname); - if (!class_exists($classname)) { - $include_file = preg_replace('/[^a-z0-9]/i', '_', $classname); - include_once 'phar://install-pear-nozlib.phar/' . $include_file; - } - $obj =& new $classname; - $methods = get_class_methods($classname); - foreach ($methods as $method) { - // don't import priviate methods and constructors - if ($method{0} != '_' && $method != $classname) { - $this->_method_map[$method] = $obj; - } - } - } - - // }}} - // {{{ removeAggregateObject() - - /** - * Remove an aggregate object. - * - * @param string $classname the class of the object to remove - * - * @return bool TRUE if an object was removed, FALSE if not - * - * @access public - */ - function removeAggregateObject($classname) - { - $ok = false; - $classname = strtolower($classname); - reset($this->_method_map); - while (list($method, $obj) = each($this->_method_map)) { - if (is_a($obj, $classname)) { - unset($this->_method_map[$method]); - $ok = true; - } - } - return $ok; - } - - // }}} - // {{{ __call() - - /** - * Overloaded object call handler, called each time an - * undefined/aggregated method is invoked. This method repeats - * the call in the right aggregate object and passes on the return - * value. - * - * @param string $method which method that was called - * - * @param string $args An array of the parameters passed in the - * original call - * - * @return mixed The return value from the aggregated method, or a PEAR - * error if the called method was unknown. - */ - function __call($method, $args, &$retval) - { - $method = strtolower($method); - if (empty($this->_method_map[$method]) && isset($this->_autoload_map[$method])) { - $this->addAggregateObject($this->_autoload_map[$method]); - } - if (isset($this->_method_map[$method])) { - $retval = call_user_func_array(array($this->_method_map[$method], $method), $args); - return true; - } - return false; - } - - // }}} -} - -overload("PEAR_Autoloader"); - -?> -<?php -/** - * PEAR_Builder for building PHP extensions (PECL packages) - * - * PHP versions 4 and 5 - * - * @category pear - * @package PEAR - * @author Stig Bakken <ssb@php.net> - * @author Greg Beaver <cellog@php.net> - * @copyright 1997-2009 The Authors - * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id: Builder.php 313024 2011-07-06 19:51:24Z dufuz $ - * @link http://pear.php.net/package/PEAR - * @since File available since Release 0.1 - * - * TODO: log output parameters in PECL command line - * TODO: msdev path in configuration - */ - -/** - * Needed for extending PEAR_Builder - */ -require_once 'phar://install-pear-nozlib.phar/' . 'PEAR/Common.php'; -require_once 'phar://install-pear-nozlib.phar/' . 'PEAR/PackageFile.php'; - -/** - * Class to handle building (compiling) extensions. - * - * @category pear - * @package PEAR - * @author Stig Bakken <ssb@php.net> - * @author Greg Beaver <cellog@php.net> - * @copyright 1997-2009 The Authors - * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version Release: 1.9.4 - * @link http://pear.php.net/package/PEAR - * @since Class available since PHP 4.0.2 - * @see http://pear.php.net/manual/en/core.ppm.pear-builder.php - */ -class PEAR_Builder extends PEAR_Common -{ - var $php_api_version = 0; - var $zend_module_api_no = 0; - var $zend_extension_api_no = 0; - - var $extensions_built = array(); - - /** - * @var string Used for reporting when it is not possible to pass function - * via extra parameter, e.g. log, msdevCallback - */ - var $current_callback = null; - - // used for msdev builds - var $_lastline = null; - var $_firstline = null; - - /** - * PEAR_Builder constructor. - * - * @param object $ui user interface object (instance of PEAR_Frontend_*) - * - * @access public - */ - function PEAR_Builder(&$ui) - { - parent::PEAR_Common(); - $this->setFrontendObject($ui); - } - - /** - * Build an extension from source on windows. - * requires msdev - */ - function _build_win32($descfile, $callback = null) - { - if (is_object($descfile)) { - $pkg = $descfile; - $descfile = $pkg->getPackageFile(); - } else { - $pf = &new PEAR_PackageFile($this->config, $this->debug); - $pkg = &$pf->fromPackageFile($descfile, PEAR_VALIDATE_NORMAL); - if (PEAR::isError($pkg)) { - return $pkg; - } - } - $dir = dirname($descfile); - $old_cwd = getcwd(); - - if (!file_exists($dir) || !is_dir($dir) || !chdir($dir)) { - return $this->raiseError("could not chdir to $dir"); - } - - // packages that were in a .tar have the packagefile in this directory - $vdir = $pkg->getPackage() . '-' . $pkg->getVersion(); - if (file_exists($dir) && is_dir($vdir)) { - if (!chdir($vdir)) { - return $this->raiseError("could not chdir to " . realpath($vdir)); - } - - $dir = getcwd(); - } - - $this->log(2, "building in $dir"); - - $dsp = $pkg->getPackage().'.dsp'; - if (!file_exists("$dir/$dsp")) { - return $this->raiseError("The DSP $dsp does not exist."); - } - // XXX TODO: make release build type configurable - $command = 'msdev '.$dsp.' /MAKE "'.$pkg->getPackage(). ' - Release"'; - - $err = $this->_runCommand($command, array(&$this, 'msdevCallback')); - if (PEAR::isError($err)) { - return $err; - } - - // figure out the build platform and type - $platform = 'Win32'; - $buildtype = 'Release'; - if (preg_match('/.*?'.$pkg->getPackage().'\s-\s(\w+)\s(.*?)-+/i',$this->_firstline,$matches)) { - $platform = $matches[1]; - $buildtype = $matches[2]; - } - - if (preg_match('/(.*)?\s-\s(\d+).*?(\d+)/', $this->_lastline, $matches)) { - if ($matches[2]) { - // there were errors in the build - return $this->raiseError("There were errors during compilation."); - } - $out = $matches[1]; - } else { - return $this->raiseError("Did not understand the completion status returned from msdev.exe."); - } - - // msdev doesn't tell us the output directory :/ - // open the dsp, find /out and use that directory - $dsptext = join(file($dsp),''); - - // this regex depends on the build platform and type having been - // correctly identified above. - $regex ='/.*?!IF\s+"\$\(CFG\)"\s+==\s+("'. - $pkg->getPackage().'\s-\s'. - $platform.'\s'. - $buildtype.'").*?'. - '\/out:"(.*?)"/is'; - - if ($dsptext && preg_match($regex, $dsptext, $matches)) { - // what we get back is a relative path to the output file itself. - $outfile = realpath($matches[2]); - } else { - return $this->raiseError("Could not retrieve output information from $dsp."); - } - // realpath returns false if the file doesn't exist - if ($outfile && copy($outfile, "$dir/$out")) { - $outfile = "$dir/$out"; - } - - $built_files[] = array( - 'file' => "$outfile", - 'php_api' => $this->php_api_version, - 'zend_mod_api' => $this->zend_module_api_no, - 'zend_ext_api' => $this->zend_extension_api_no, - ); - - return $built_files; - } - // }}} - - // {{{ msdevCallback() - function msdevCallback($what, $data) - { - if (!$this->_firstline) - $this->_firstline = $data; - $this->_lastline = $data; - call_user_func($this->current_callback, $what, $data); - } - - /** - * @param string - * @param string - * @param array - * @access private - */ - function _harvestInstDir($dest_prefix, $dirname, &$built_files) - { - $d = opendir($dirname); - if (!$d) - return false; - - $ret = true; - while (($ent = readdir($d)) !== false) { - if ($ent{0} == '.') - continue; - - $full = $dirname . DIRECTORY_SEPARATOR . $ent; - if (is_dir($full)) { - if (!$this->_harvestInstDir( - $dest_prefix . DIRECTORY_SEPARATOR . $ent, - $full, $built_files)) { - $ret = false; - break; - } - } else { - $dest = $dest_prefix . DIRECTORY_SEPARATOR . $ent; - $built_files[] = array( - 'file' => $full, - 'dest' => $dest, - 'php_api' => $this->php_api_version, - 'zend_mod_api' => $this->zend_module_api_no, - 'zend_ext_api' => $this->zend_extension_api_no, - ); - } - } - closedir($d); - return $ret; - } - - /** - * Build an extension from source. Runs "phpize" in the source - * directory, but compiles in a temporary directory - * (TMPDIR/pear-build-USER/PACKAGE-VERSION). - * - * @param string|PEAR_PackageFile_v* $descfile path to XML package description file, or - * a PEAR_PackageFile object - * - * @param mixed $callback callback function used to report output, - * see PEAR_Builder::_runCommand for details - * - * @return array an array of associative arrays with built files, - * format: - * array( array( 'file' => '/path/to/ext.so', - * 'php_api' => YYYYMMDD, - * 'zend_mod_api' => YYYYMMDD, - * 'zend_ext_api' => YYYYMMDD ), - * ... ) - * - * @access public - * - * @see PEAR_Builder::_runCommand - */ - function build($descfile, $callback = null) - { - if (preg_match('/(\\/|\\\\|^)([^\\/\\\\]+)?php(.+)?$/', - $this->config->get('php_bin'), $matches)) { - if (isset($matches[2]) && strlen($matches[2]) && - trim($matches[2]) != trim($this->config->get('php_prefix'))) { - $this->log(0, 'WARNING: php_bin ' . $this->config->get('php_bin') . - ' appears to have a prefix ' . $matches[2] . ', but' . - ' config variable php_prefix does not match'); - } - - if (isset($matches[3]) && strlen($matches[3]) && - trim($matches[3]) != trim($this->config->get('php_suffix'))) { - $this->log(0, 'WARNING: php_bin ' . $this->config->get('php_bin') . - ' appears to have a suffix ' . $matches[3] . ', but' . - ' config variable php_suffix does not match'); - } - } - - $this->current_callback = $callback; - if (PEAR_OS == "Windows") { - return $this->_build_win32($descfile, $callback); - } - - if (PEAR_OS != 'Unix') { - return $this->raiseError("building extensions not supported on this platform"); - } - - if (is_object($descfile)) { - $pkg = $descfile; - $descfile = $pkg->getPackageFile(); - if (is_a($pkg, 'PEAR_PackageFile_v1')) { - $dir = dirname($descfile); - } else { - $dir = $pkg->_config->get('temp_dir') . '/' . $pkg->getName(); - // automatically delete at session end - $this->addTempFile($dir); - } - } else { - $pf = &new PEAR_PackageFile($this->config); - $pkg = &$pf->fromPackageFile($descfile, PEAR_VALIDATE_NORMAL); - if (PEAR::isError($pkg)) { - return $pkg; - } - $dir = dirname($descfile); - } - - // Find config. outside of normal path - e.g. config.m4 - foreach (array_keys($pkg->getInstallationFileList()) as $item) { - if (stristr(basename($item), 'config.m4') && dirname($item) != '.') { - $dir .= DIRECTORY_SEPARATOR . dirname($item); - break; - } - } - - $old_cwd = getcwd(); - if (!file_exists($dir) || !is_dir($dir) || !chdir($dir)) { - return $this->raiseError("could not chdir to $dir"); - } - - $vdir = $pkg->getPackage() . '-' . $pkg->getVersion(); - if (is_dir($vdir)) { - chdir($vdir); - } - - $dir = getcwd(); - $this->log(2, "building in $dir"); - putenv('PATH=' . $this->config->get('bin_dir') . ':' . getenv('PATH')); - $err = $this->_runCommand($this->config->get('php_prefix') - . "phpize" . - $this->config->get('php_suffix'), - array(&$this, 'phpizeCallback')); - if (PEAR::isError($err)) { - return $err; - } - - if (!$err) { - return $this->raiseError("`phpize' failed"); - } - - // {{{ start of interactive part - $configure_command = "$dir/configure"; - $configure_options = $pkg->getConfigureOptions(); - if ($configure_options) { - foreach ($configure_options as $o) { - $default = array_key_exists('default', $o) ? $o['default'] : null; - list($r) = $this->ui->userDialog('build', - array($o['prompt']), - array('text'), - array($default)); - if (substr($o['name'], 0, 5) == 'with-' && - ($r == 'yes' || $r == 'autodetect')) { - $configure_command .= " --$o[name]"; - } else { - $configure_command .= " --$o[name]=".trim($r); - } - } - } - // }}} end of interactive part - - // FIXME make configurable - if (!$user=getenv('USER')) { - $user='defaultuser'; - } - - $tmpdir = $this->config->get('temp_dir'); - $build_basedir = System::mktemp(' -t "' . $tmpdir . '" -d "pear-build-' . $user . '"'); - $build_dir = "$build_basedir/$vdir"; - $inst_dir = "$build_basedir/install-$vdir"; - $this->log(1, "building in $build_dir"); - if (is_dir($build_dir)) { - System::rm(array('-rf', $build_dir)); - } - - if (!System::mkDir(array('-p', $build_dir))) { - return $this->raiseError("could not create build dir: $build_dir"); - } - - $this->addTempFile($build_dir); - if (!System::mkDir(array('-p', $inst_dir))) { - return $this->raiseError("could not create temporary install dir: $inst_dir"); - } - $this->addTempFile($inst_dir); - - $make_command = getenv('MAKE') ? getenv('MAKE') : 'make'; - - $to_run = array( - $configure_command, - $make_command, - "$make_command INSTALL_ROOT=\"$inst_dir\" install", - "find \"$inst_dir\" | xargs ls -dils" - ); - if (!file_exists($build_dir) || !is_dir($build_dir) || !chdir($build_dir)) { - return $this->raiseError("could not chdir to $build_dir"); - } - putenv('PHP_PEAR_VERSION=1.9.4'); - foreach ($to_run as $cmd) { - $err = $this->_runCommand($cmd, $callback); - if (PEAR::isError($err)) { - chdir($old_cwd); - return $err; - } - if (!$err) { - chdir($old_cwd); - return $this->raiseError("`$cmd' failed"); - } - } - if (!($dp = opendir("modules"))) { - chdir($old_cwd); - return $this->raiseError("no `modules' directory found"); - } - $built_files = array(); - $prefix = exec($this->config->get('php_prefix') - . "php-config" . - $this->config->get('php_suffix') . " --prefix"); - $this->_harvestInstDir($prefix, $inst_dir . DIRECTORY_SEPARATOR . $prefix, $built_files); - chdir($old_cwd); - return $built_files; - } - - /** - * Message callback function used when running the "phpize" - * program. Extracts the API numbers used. Ignores other message - * types than "cmdoutput". - * - * @param string $what the type of message - * @param mixed $data the message - * - * @return void - * - * @access public - */ - function phpizeCallback($what, $data) - { - if ($what != 'cmdoutput') { - return; - } - $this->log(1, rtrim($data)); - if (preg_match('/You should update your .aclocal.m4/', $data)) { - return; - } - $matches = array(); - if (preg_match('/^\s+(\S[^:]+):\s+(\d{8})/', $data, $matches)) { - $member = preg_replace('/[^a-z]/', '_', strtolower($matches[1])); - $apino = (int)$matches[2]; - if (isset($this->$member)) { - $this->$member = $apino; - //$msg = sprintf("%-22s : %d", $matches[1], $apino); - //$this->log(1, $msg); - } - } - } - - /** - * Run an external command, using a message callback to report - * output. The command will be run through popen and output is - * reported for every line with a "cmdoutput" message with the - * line string, including newlines, as payload. - * - * @param string $command the command to run - * - * @param mixed $callback (optional) function to use as message - * callback - * - * @return bool whether the command was successful (exit code 0 - * means success, any other means failure) - * - * @access private - */ - function _runCommand($command, $callback = null) - { - $this->log(1, "running: $command"); - $pp = popen("$command 2>&1", "r"); - if (!$pp) { - return $this->raiseError("failed to run `$command'"); - } - if ($callback && $callback[0]->debug == 1) { - $olddbg = $callback[0]->debug; - $callback[0]->debug = 2; - } - - while ($line = fgets($pp, 1024)) { - if ($callback) { - call_user_func($callback, 'cmdoutput', $line); - } else { - $this->log(2, rtrim($line)); - } - } - if ($callback && isset($olddbg)) { - $callback[0]->debug = $olddbg; - } - - $exitcode = is_resource($pp) ? pclose($pp) : -1; - return ($exitcode == 0); - } - - function log($level, $msg) - { - if ($this->current_callback) { - if ($this->debug >= $level) { - call_user_func($this->current_callback, 'output', $msg); - } - return; - } - return PEAR_Common::log($level, $msg); - } -}<?php -/** * PEAR_ChannelFile, the channel handling class * * PHP versions 4 and 5 @@ -57274,7 +55996,7 @@ class PEAR_Builder extends PEAR_Common * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id: ChannelFile.php 313023 2011-07-06 19:17:11Z dufuz $ + * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR * @since File available since Release 1.4.0a1 */ @@ -57411,7 +56133,7 @@ $GLOBALS['_PEAR_CHANNELS_MIRROR_TYPES'] = array('server'); * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version Release: 1.9.4 + * @version Release: 1.9.5 * @link http://pear.php.net/package/PEAR * @since Class available since Release 1.4.0a1 */ @@ -58832,7 +57554,7 @@ class PEAR_ChannelFile * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id: Parser.php 313023 2011-07-06 19:17:11Z dufuz $ + * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR * @since File available since Release 1.4.0a1 */ @@ -58849,7 +57571,7 @@ require_once 'phar://install-pear-nozlib.phar/' . 'PEAR/ChannelFile.php'; * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version Release: 1.9.4 + * @version Release: 1.9.5 * @link http://pear.php.net/package/PEAR * @since Class available since Release 1.4.0a1 */ @@ -58900,7 +57622,7 @@ class PEAR_ChannelFile_Parser extends PEAR_XMLParser * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id: Command.php 313023 2011-07-06 19:17:11Z dufuz $ + * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR * @since File available since Release 0.1 */ @@ -58984,7 +57706,7 @@ $GLOBALS['_PEAR_Command_objects'] = array(); * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version Release: 1.9.4 + * @version Release: 1.9.5 * @link http://pear.php.net/package/PEAR * @since Class available since Release 0.1 */ @@ -59303,1212 +58025,6 @@ class PEAR_Command // }}} }<?php /** - * PEAR_Command_Auth (login, logout commands) - * - * PHP versions 4 and 5 - * - * @category pear - * @package PEAR - * @author Stig Bakken <ssb@php.net> - * @author Greg Beaver <cellog@php.net> - * @copyright 1997-2009 The Authors - * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id: Auth.php 313023 2011-07-06 19:17:11Z dufuz $ - * @link http://pear.php.net/package/PEAR - * @since File available since Release 0.1 - * @deprecated since 1.8.0alpha1 - */ - -/** - * base class - */ -require_once 'phar://install-pear-nozlib.phar/' . 'PEAR/Command/Channels.php'; - -/** - * PEAR commands for login/logout - * - * @category pear - * @package PEAR - * @author Stig Bakken <ssb@php.net> - * @author Greg Beaver <cellog@php.net> - * @copyright 1997-2009 The Authors - * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version Release: 1.9.4 - * @link http://pear.php.net/package/PEAR - * @since Class available since Release 0.1 - * @deprecated since 1.8.0alpha1 - */ -class PEAR_Command_Auth extends PEAR_Command_Channels -{ - var $commands = array( - 'login' => array( - 'summary' => 'Connects and authenticates to remote server [Deprecated in favor of channel-login]', - 'shortcut' => 'li', - 'function' => 'doLogin', - 'options' => array(), - 'doc' => '<channel name> -WARNING: This function is deprecated in favor of using channel-login - -Log in to a remote channel server. If <channel name> is not supplied, -the default channel is used. To use remote functions in the installer -that require any kind of privileges, you need to log in first. The -username and password you enter here will be stored in your per-user -PEAR configuration (~/.pearrc on Unix-like systems). After logging -in, your username and password will be sent along in subsequent -operations on the remote server.', - ), - 'logout' => array( - 'summary' => 'Logs out from the remote server [Deprecated in favor of channel-logout]', - 'shortcut' => 'lo', - 'function' => 'doLogout', - 'options' => array(), - 'doc' => ' -WARNING: This function is deprecated in favor of using channel-logout - -Logs out from the remote server. This command does not actually -connect to the remote server, it only deletes the stored username and -password from your user configuration.', - ) - - ); - - /** - * PEAR_Command_Auth constructor. - * - * @access public - */ - function PEAR_Command_Auth(&$ui, &$config) - { - parent::PEAR_Command_Channels($ui, $config); - } -}<commands version="1.0"> - <login> - <summary>Connects and authenticates to remote server [Deprecated in favor of channel-login]</summary> - <function>doLogin</function> - <shortcut>li</shortcut> - <options /> - <doc><channel name> -WARNING: This function is deprecated in favor of using channel-login - -Log in to a remote channel server. If <channel name> is not supplied, -the default channel is used. To use remote functions in the installer -that require any kind of privileges, you need to log in first. The -username and password you enter here will be stored in your per-user -PEAR configuration (~/.pearrc on Unix-like systems). After logging -in, your username and password will be sent along in subsequent -operations on the remote server.</doc> - </login> - <logout> - <summary>Logs out from the remote server [Deprecated in favor of channel-logout]</summary> - <function>doLogout</function> - <shortcut>lo</shortcut> - <options /> - <doc> -WARNING: This function is deprecated in favor of using channel-logout - -Logs out from the remote server. This command does not actually -connect to the remote server, it only deletes the stored username and -password from your user configuration.</doc> - </logout> -</commands><?php -/** - * PEAR_Command_Auth (build command) - * - * PHP versions 4 and 5 - * - * @category pear - * @package PEAR - * @author Stig Bakken <ssb@php.net> - * @author Tomas V.V.Cox <cox@idecnet.com> - * @author Greg Beaver <cellog@php.net> - * @copyright 1997-2009 The Authors - * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id: Build.php 313023 2011-07-06 19:17:11Z dufuz $ - * @link http://pear.php.net/package/PEAR - * @since File available since Release 0.1 - */ - -/** - * base class - */ -require_once 'phar://install-pear-nozlib.phar/' . 'PEAR/Command/Common.php'; - -/** - * PEAR commands for building extensions. - * - * @category pear - * @package PEAR - * @author Stig Bakken <ssb@php.net> - * @author Tomas V.V.Cox <cox@idecnet.com> - * @author Greg Beaver <cellog@php.net> - * @copyright 1997-2009 The Authors - * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version Release: 1.9.4 - * @link http://pear.php.net/package/PEAR - * @since Class available since Release 0.1 - */ -class PEAR_Command_Build extends PEAR_Command_Common -{ - var $commands = array( - 'build' => array( - 'summary' => 'Build an Extension From C Source', - 'function' => 'doBuild', - 'shortcut' => 'b', - 'options' => array(), - 'doc' => '[package.xml] -Builds one or more extensions contained in a package.' - ), - ); - - /** - * PEAR_Command_Build constructor. - * - * @access public - */ - function PEAR_Command_Build(&$ui, &$config) - { - parent::PEAR_Command_Common($ui, $config); - } - - function doBuild($command, $options, $params) - { - require_once 'phar://install-pear-nozlib.phar/' . 'PEAR/Builder.php'; - if (sizeof($params) < 1) { - $params[0] = 'package.xml'; - } - - $builder = &new PEAR_Builder($this->ui); - $this->debug = $this->config->get('verbose'); - $err = $builder->build($params[0], array(&$this, 'buildCallback')); - if (PEAR::isError($err)) { - return $err; - } - - return true; - } - - function buildCallback($what, $data) - { - if (($what == 'cmdoutput' && $this->debug > 1) || - ($what == 'output' && $this->debug > 0)) { - $this->ui->outputData(rtrim($data), 'build'); - } - } -}<commands version="1.0"> - <build> - <summary>Build an Extension From C Source</summary> - <function>doBuild</function> - <shortcut>b</shortcut> - <options /> - <doc>[package.xml] -Builds one or more extensions contained in a package.</doc> - </build> -</commands><?php -// /* vim: set expandtab tabstop=4 shiftwidth=4: */ -/** - * PEAR_Command_Channels (list-channels, update-channels, channel-delete, channel-add, - * channel-update, channel-info, channel-alias, channel-discover commands) - * - * PHP versions 4 and 5 - * - * @category pear - * @package PEAR - * @author Stig Bakken <ssb@php.net> - * @author Greg Beaver <cellog@php.net> - * @copyright 1997-2009 The Authors - * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id: Channels.php 313023 2011-07-06 19:17:11Z dufuz $ - * @link http://pear.php.net/package/PEAR - * @since File available since Release 1.4.0a1 - */ - -/** - * base class - */ -require_once 'phar://install-pear-nozlib.phar/' . 'PEAR/Command/Common.php'; - -define('PEAR_COMMAND_CHANNELS_CHANNEL_EXISTS', -500); - -/** - * PEAR commands for managing channels. - * - * @category pear - * @package PEAR - * @author Greg Beaver <cellog@php.net> - * @copyright 1997-2009 The Authors - * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version Release: 1.9.4 - * @link http://pear.php.net/package/PEAR - * @since Class available since Release 1.4.0a1 - */ -class PEAR_Command_Channels extends PEAR_Command_Common -{ - var $commands = array( - 'list-channels' => array( - 'summary' => 'List Available Channels', - 'function' => 'doList', - 'shortcut' => 'lc', - 'options' => array(), - 'doc' => ' -List all available channels for installation. -', - ), - 'update-channels' => array( - 'summary' => 'Update the Channel List', - 'function' => 'doUpdateAll', - 'shortcut' => 'uc', - 'options' => array(), - 'doc' => ' -List all installed packages in all channels. -' - ), - 'channel-delete' => array( - 'summary' => 'Remove a Channel From the List', - 'function' => 'doDelete', - 'shortcut' => 'cde', - 'options' => array(), - 'doc' => '<channel name> -Delete a channel from the registry. You may not -remove any channel that has installed packages. -' - ), - 'channel-add' => array( - 'summary' => 'Add a Channel', - 'function' => 'doAdd', - 'shortcut' => 'ca', - 'options' => array(), - 'doc' => '<channel.xml> -Add a private channel to the channel list. Note that all -public channels should be synced using "update-channels". -Parameter may be either a local file or remote URL to a -channel.xml. -' - ), - 'channel-update' => array( - 'summary' => 'Update an Existing Channel', - 'function' => 'doUpdate', - 'shortcut' => 'cu', - 'options' => array( - 'force' => array( - 'shortopt' => 'f', - 'doc' => 'will force download of new channel.xml if an existing channel name is used', - ), - 'channel' => array( - 'shortopt' => 'c', - 'arg' => 'CHANNEL', - 'doc' => 'will force download of new channel.xml if an existing channel name is used', - ), -), - 'doc' => '[<channel.xml>|<channel name>] -Update a channel in the channel list directly. Note that all -public channels can be synced using "update-channels". -Parameter may be a local or remote channel.xml, or the name of -an existing channel. -' - ), - 'channel-info' => array( - 'summary' => 'Retrieve Information on a Channel', - 'function' => 'doInfo', - 'shortcut' => 'ci', - 'options' => array(), - 'doc' => '<package> -List the files in an installed package. -' - ), - 'channel-alias' => array( - 'summary' => 'Specify an alias to a channel name', - 'function' => 'doAlias', - 'shortcut' => 'cha', - 'options' => array(), - 'doc' => '<channel> <alias> -Specify a specific alias to use for a channel name. -The alias may not be an existing channel name or -alias. -' - ), - 'channel-discover' => array( - 'summary' => 'Initialize a Channel from its server', - 'function' => 'doDiscover', - 'shortcut' => 'di', - 'options' => array(), - 'doc' => '[<channel.xml>|<channel name>] -Initialize a channel from its server and create a local channel.xml. -If <channel name> is in the format "<username>:<password>@<channel>" then -<username> and <password> will be set as the login username/password for -<channel>. Use caution when passing the username/password in this way, as -it may allow other users on your computer to briefly view your username/ -password via the system\'s process list. -' - ), - 'channel-login' => array( - 'summary' => 'Connects and authenticates to remote channel server', - 'shortcut' => 'cli', - 'function' => 'doLogin', - 'options' => array(), - 'doc' => '<channel name> -Log in to a remote channel server. If <channel name> is not supplied, -the default channel is used. To use remote functions in the installer -that require any kind of privileges, you need to log in first. The -username and password you enter here will be stored in your per-user -PEAR configuration (~/.pearrc on Unix-like systems). After logging -in, your username and password will be sent along in subsequent -operations on the remote server.', - ), - 'channel-logout' => array( - 'summary' => 'Logs out from the remote channel server', - 'shortcut' => 'clo', - 'function' => 'doLogout', - 'options' => array(), - 'doc' => '<channel name> -Logs out from a remote channel server. If <channel name> is not supplied, -the default channel is used. This command does not actually connect to the -remote server, it only deletes the stored username and password from your user -configuration.', - ), - ); - - /** - * PEAR_Command_Registry constructor. - * - * @access public - */ - function PEAR_Command_Channels(&$ui, &$config) - { - parent::PEAR_Command_Common($ui, $config); - } - - function _sortChannels($a, $b) - { - return strnatcasecmp($a->getName(), $b->getName()); - } - - function doList($command, $options, $params) - { - $reg = &$this->config->getRegistry(); - $registered = $reg->getChannels(); - usort($registered, array(&$this, '_sortchannels')); - $i = $j = 0; - $data = array( - 'caption' => 'Registered Channels:', - 'border' => true, - 'headline' => array('Channel', 'Alias', 'Summary') - ); - foreach ($registered as $channel) { - $data['data'][] = array($channel->getName(), - $channel->getAlias(), - $channel->getSummary()); - } - - if (count($registered) === 0) { - $data = '(no registered channels)'; - } - $this->ui->outputData($data, $command); - return true; - } - - function doUpdateAll($command, $options, $params) - { - $reg = &$this->config->getRegistry(); - $channels = $reg->getChannels(); - - $success = true; - foreach ($channels as $channel) { - if ($channel->getName() != '__uri') { - PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN); - $err = $this->doUpdate('channel-update', - $options, - array($channel->getName())); - if (PEAR::isError($err)) { - $this->ui->outputData($err->getMessage(), $command); - $success = false; - } else { - $success &= $err; - } - } - } - return $success; - } - - function doInfo($command, $options, $params) - { - if (count($params) !== 1) { - return $this->raiseError("No channel specified"); - } - - $reg = &$this->config->getRegistry(); - $channel = strtolower($params[0]); - if ($reg->channelExists($channel)) { - $chan = $reg->getChannel($channel); - if (PEAR::isError($chan)) { - return $this->raiseError($chan); - } - } else { - if (strpos($channel, '://')) { - $downloader = &$this->getDownloader(); - $tmpdir = $this->config->get('temp_dir'); - PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN); - $loc = $downloader->downloadHttp($channel, $this->ui, $tmpdir); - PEAR::staticPopErrorHandling(); - if (PEAR::isError($loc)) { - return $this->raiseError('Cannot open "' . $channel . - '" (' . $loc->getMessage() . ')'); - } else { - $contents = implode('', file($loc)); - } - } else { - if (!file_exists($params[0])) { - return $this->raiseError('Unknown channel "' . $channel . '"'); - } - - $fp = fopen($params[0], 'r'); - if (!$fp) { - return $this->raiseError('Cannot open "' . $params[0] . '"'); - } - - $contents = ''; - while (!feof($fp)) { - $contents .= fread($fp, 1024); - } - fclose($fp); - } - - if (!class_exists('PEAR_ChannelFile')) { - require_once 'phar://install-pear-nozlib.phar/' . 'PEAR/ChannelFile.php'; - } - - $chan = new PEAR_ChannelFile; - $chan->fromXmlString($contents); - $chan->validate(); - if ($errs = $chan->getErrors(true)) { - foreach ($errs as $err) { - $this->ui->outputData($err['level'] . ': ' . $err['message']); - } - return $this->raiseError('Channel file "' . $params[0] . '" is not valid'); - } - } - - if (!$chan) { - return $this->raiseError('Serious error: Channel "' . $params[0] . - '" has a corrupted registry entry'); - } - - $channel = $chan->getName(); - $caption = 'Channel ' . $channel . ' Information:'; - $data1 = array( - 'caption' => $caption, - 'border' => true); - $data1['data']['server'] = array('Name and Server', $chan->getName()); - if ($chan->getAlias() != $chan->getName()) { - $data1['data']['alias'] = array('Alias', $chan->getAlias()); - } - - $data1['data']['summary'] = array('Summary', $chan->getSummary()); - $validate = $chan->getValidationPackage(); - $data1['data']['vpackage'] = array('Validation Package Name', $validate['_content']); - $data1['data']['vpackageversion'] = - array('Validation Package Version', $validate['attribs']['version']); - $d = array(); - $d['main'] = $data1; - - $data['data'] = array(); - $data['caption'] = 'Server Capabilities'; - $data['headline'] = array('Type', 'Version/REST type', 'Function Name/REST base'); - if ($chan->supportsREST()) { - if ($chan->supportsREST()) { - $funcs = $chan->getFunctions('rest'); - if (!isset($funcs[0])) { - $funcs = array($funcs); - } - foreach ($funcs as $protocol) { - $data['data'][] = array('rest', $protocol['attribs']['type'], - $protocol['_content']); - } - } - } else { - $data['data'][] = array('No supported protocols'); - } - - $d['protocols'] = $data; - $data['data'] = array(); - $mirrors = $chan->getMirrors(); - if ($mirrors) { - $data['caption'] = 'Channel ' . $channel . ' Mirrors:'; - unset($data['headline']); - foreach ($mirrors as $mirror) { - $data['data'][] = array($mirror['attribs']['host']); - $d['mirrors'] = $data; - } - - foreach ($mirrors as $i => $mirror) { - $data['data'] = array(); - $data['caption'] = 'Mirror ' . $mirror['attribs']['host'] . ' Capabilities'; - $data['headline'] = array('Type', 'Version/REST type', 'Function Name/REST base'); - if ($chan->supportsREST($mirror['attribs']['host'])) { - if ($chan->supportsREST($mirror['attribs']['host'])) { - $funcs = $chan->getFunctions('rest', $mirror['attribs']['host']); - if (!isset($funcs[0])) { - $funcs = array($funcs); - } - - foreach ($funcs as $protocol) { - $data['data'][] = array('rest', $protocol['attribs']['type'], - $protocol['_content']); - } - } - } else { - $data['data'][] = array('No supported protocols'); - } - $d['mirrorprotocols' . $i] = $data; - } - } - $this->ui->outputData($d, 'channel-info'); - } - - // }}} - - function doDelete($command, $options, $params) - { - if (count($params) !== 1) { - return $this->raiseError('channel-delete: no channel specified'); - } - - $reg = &$this->config->getRegistry(); - if (!$reg->channelExists($params[0])) { - return $this->raiseError('channel-delete: channel "' . $params[0] . '" does not exist'); - } - - $channel = $reg->channelName($params[0]); - if ($channel == 'pear.php.net') { - return $this->raiseError('Cannot delete the pear.php.net channel'); - } - - if ($channel == 'pecl.php.net') { - return $this->raiseError('Cannot delete the pecl.php.net channel'); - } - - if ($channel == 'doc.php.net') { - return $this->raiseError('Cannot delete the doc.php.net channel'); - } - - if ($channel == '__uri') { - return $this->raiseError('Cannot delete the __uri pseudo-channel'); - } - - if (PEAR::isError($err = $reg->listPackages($channel))) { - return $err; - } - - if (count($err)) { - return $this->raiseError('Channel "' . $channel . - '" has installed packages, cannot delete'); - } - - if (!$reg->deleteChannel($channel)) { - return $this->raiseError('Channel "' . $channel . '" deletion failed'); - } else { - $this->config->deleteChannel($channel); - $this->ui->outputData('Channel "' . $channel . '" deleted', $command); - } - } - - function doAdd($command, $options, $params) - { - if (count($params) !== 1) { - return $this->raiseError('channel-add: no channel file specified'); - } - - if (strpos($params[0], '://')) { - $downloader = &$this->getDownloader(); - $tmpdir = $this->config->get('temp_dir'); - if (!file_exists($tmpdir)) { - require_once 'phar://install-pear-nozlib.phar/' . 'System.php'; - PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN); - $err = System::mkdir(array('-p', $tmpdir)); - PEAR::staticPopErrorHandling(); - if (PEAR::isError($err)) { - return $this->raiseError('channel-add: temp_dir does not exist: "' . - $tmpdir . - '" - You can change this location with "pear config-set temp_dir"'); - } - } - - if (!is_writable($tmpdir)) { - return $this->raiseError('channel-add: temp_dir is not writable: "' . - $tmpdir . - '" - You can change this location with "pear config-set temp_dir"'); - } - - PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN); - $loc = $downloader->downloadHttp($params[0], $this->ui, $tmpdir, null, false); - PEAR::staticPopErrorHandling(); - if (PEAR::isError($loc)) { - return $this->raiseError('channel-add: Cannot open "' . $params[0] . - '" (' . $loc->getMessage() . ')'); - } - - list($loc, $lastmodified) = $loc; - $contents = implode('', file($loc)); - } else { - $lastmodified = $fp = false; - if (file_exists($params[0])) { - $fp = fopen($params[0], 'r'); - } - - if (!$fp) { - return $this->raiseError('channel-add: cannot open "' . $params[0] . '"'); - } - - $contents = ''; - while (!feof($fp)) { - $contents .= fread($fp, 1024); - } - fclose($fp); - } - - if (!class_exists('PEAR_ChannelFile')) { - require_once 'phar://install-pear-nozlib.phar/' . 'PEAR/ChannelFile.php'; - } - - $channel = new PEAR_ChannelFile; - PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN); - $result = $channel->fromXmlString($contents); - PEAR::staticPopErrorHandling(); - if (!$result) { - $exit = false; - if (count($errors = $channel->getErrors(true))) { - foreach ($errors as $error) { - $this->ui->outputData(ucfirst($error['level'] . ': ' . $error['message'])); - if (!$exit) { - $exit = $error['level'] == 'error' ? true : false; - } - } - if ($exit) { - return $this->raiseError('channel-add: invalid channel.xml file'); - } - } - } - - $reg = &$this->config->getRegistry(); - if ($reg->channelExists($channel->getName())) { - return $this->raiseError('channel-add: Channel "' . $channel->getName() . - '" exists, use channel-update to update entry', PEAR_COMMAND_CHANNELS_CHANNEL_EXISTS); - } - - $ret = $reg->addChannel($channel, $lastmodified); - if (PEAR::isError($ret)) { - return $ret; - } - - if (!$ret) { - return $this->raiseError('channel-add: adding Channel "' . $channel->getName() . - '" to registry failed'); - } - - $this->config->setChannels($reg->listChannels()); - $this->config->writeConfigFile(); - $this->ui->outputData('Adding Channel "' . $channel->getName() . '" succeeded', $command); - } - - function doUpdate($command, $options, $params) - { - if (count($params) !== 1) { - return $this->raiseError("No channel file specified"); - } - - $tmpdir = $this->config->get('temp_dir'); - if (!file_exists($tmpdir)) { - require_once 'phar://install-pear-nozlib.phar/' . 'System.php'; - PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN); - $err = System::mkdir(array('-p', $tmpdir)); - PEAR::staticPopErrorHandling(); - if (PEAR::isError($err)) { - return $this->raiseError('channel-add: temp_dir does not exist: "' . - $tmpdir . - '" - You can change this location with "pear config-set temp_dir"'); - } - } - - if (!is_writable($tmpdir)) { - return $this->raiseError('channel-add: temp_dir is not writable: "' . - $tmpdir . - '" - You can change this location with "pear config-set temp_dir"'); - } - - $reg = &$this->config->getRegistry(); - $lastmodified = false; - if ((!file_exists($params[0]) || is_dir($params[0])) - && $reg->channelExists(strtolower($params[0]))) { - $c = $reg->getChannel(strtolower($params[0])); - if (PEAR::isError($c)) { - return $this->raiseError($c); - } - - $this->ui->outputData("Updating channel \"$params[0]\"", $command); - $dl = &$this->getDownloader(array()); - // if force is specified, use a timestamp of "1" to force retrieval - $lastmodified = isset($options['force']) ? false : $c->lastModified(); - PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN); - $contents = $dl->downloadHttp('http://' . $c->getName() . '/channel.xml', - $this->ui, $tmpdir, null, $lastmodified); - PEAR::staticPopErrorHandling(); - if (PEAR::isError($contents)) { - // Attempt to fall back to https - $this->ui->outputData("Channel \"$params[0]\" is not responding over http://, failed with message: " . $contents->getMessage()); - $this->ui->outputData("Trying channel \"$params[0]\" over https:// instead"); - PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN); - $contents = $dl->downloadHttp('https://' . $c->getName() . '/channel.xml', - $this->ui, $tmpdir, null, $lastmodified); - PEAR::staticPopErrorHandling(); - if (PEAR::isError($contents)) { - return $this->raiseError('Cannot retrieve channel.xml for channel "' . - $c->getName() . '" (' . $contents->getMessage() . ')'); - } - } - - list($contents, $lastmodified) = $contents; - if (!$contents) { - $this->ui->outputData("Channel \"$params[0]\" is up to date"); - return; - } - - $contents = implode('', file($contents)); - if (!class_exists('PEAR_ChannelFile')) { - require_once 'phar://install-pear-nozlib.phar/' . 'PEAR/ChannelFile.php'; - } - - $channel = new PEAR_ChannelFile; - $channel->fromXmlString($contents); - if (!$channel->getErrors()) { - // security check: is the downloaded file for the channel we got it from? - if (strtolower($channel->getName()) != strtolower($c->getName())) { - if (!isset($options['force'])) { - return $this->raiseError('ERROR: downloaded channel definition file' . - ' for channel "' . $channel->getName() . '" from channel "' . - strtolower($c->getName()) . '"'); - } - - $this->ui->log(0, 'WARNING: downloaded channel definition file' . - ' for channel "' . $channel->getName() . '" from channel "' . - strtolower($c->getName()) . '"'); - } - } - } else { - if (strpos($params[0], '://')) { - $dl = &$this->getDownloader(); - PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN); - $loc = $dl->downloadHttp($params[0], - $this->ui, $tmpdir, null, $lastmodified); - PEAR::staticPopErrorHandling(); - if (PEAR::isError($loc)) { - return $this->raiseError("Cannot open " . $params[0] . - ' (' . $loc->getMessage() . ')'); - } - - list($loc, $lastmodified) = $loc; - $contents = implode('', file($loc)); - } else { - $fp = false; - if (file_exists($params[0])) { - $fp = fopen($params[0], 'r'); - } - - if (!$fp) { - return $this->raiseError("Cannot open " . $params[0]); - } - - $contents = ''; - while (!feof($fp)) { - $contents .= fread($fp, 1024); - } - fclose($fp); - } - - if (!class_exists('PEAR_ChannelFile')) { - require_once 'phar://install-pear-nozlib.phar/' . 'PEAR/ChannelFile.php'; - } - - $channel = new PEAR_ChannelFile; - $channel->fromXmlString($contents); - } - - $exit = false; - if (count($errors = $channel->getErrors(true))) { - foreach ($errors as $error) { - $this->ui->outputData(ucfirst($error['level'] . ': ' . $error['message'])); - if (!$exit) { - $exit = $error['level'] == 'error' ? true : false; - } - } - if ($exit) { - return $this->raiseError('Invalid channel.xml file'); - } - } - - if (!$reg->channelExists($channel->getName())) { - return $this->raiseError('Error: Channel "' . $channel->getName() . - '" does not exist, use channel-add to add an entry'); - } - - $ret = $reg->updateChannel($channel, $lastmodified); - if (PEAR::isError($ret)) { - return $ret; - } - - if (!$ret) { - return $this->raiseError('Updating Channel "' . $channel->getName() . - '" in registry failed'); - } - - $this->config->setChannels($reg->listChannels()); - $this->config->writeConfigFile(); - $this->ui->outputData('Update of Channel "' . $channel->getName() . '" succeeded'); - } - - function &getDownloader() - { - if (!class_exists('PEAR_Downloader')) { - require_once 'phar://install-pear-nozlib.phar/' . 'PEAR/Downloader.php'; - } - $a = new PEAR_Downloader($this->ui, array(), $this->config); - return $a; - } - - function doAlias($command, $options, $params) - { - if (count($params) === 1) { - return $this->raiseError('No channel alias specified'); - } - - if (count($params) !== 2 || (!empty($params[1]) && $params[1]{0} == '-')) { - return $this->raiseError( - 'Invalid format, correct is: channel-alias channel alias'); - } - - $reg = &$this->config->getRegistry(); - if (!$reg->channelExists($params[0], true)) { - $extra = ''; - if ($reg->isAlias($params[0])) { - $extra = ' (use "channel-alias ' . $reg->channelName($params[0]) . ' ' . - strtolower($params[1]) . '")'; - } - - return $this->raiseError('"' . $params[0] . '" is not a valid channel' . $extra); - } - - if ($reg->isAlias($params[1])) { - return $this->raiseError('Channel "' . $reg->channelName($params[1]) . '" is ' . - 'already aliased to "' . strtolower($params[1]) . '", cannot re-alias'); - } - - $chan = &$reg->getChannel($params[0]); - if (PEAR::isError($chan)) { - return $this->raiseError('Corrupt registry? Error retrieving channel "' . $params[0] . - '" information (' . $chan->getMessage() . ')'); - } - - // make it a local alias - if (!$chan->setAlias(strtolower($params[1]), true)) { - return $this->raiseError('Alias "' . strtolower($params[1]) . - '" is not a valid channel alias'); - } - - $reg->updateChannel($chan); - $this->ui->outputData('Channel "' . $chan->getName() . '" aliased successfully to "' . - strtolower($params[1]) . '"'); - } - - /** - * The channel-discover command - * - * @param string $command command name - * @param array $options option_name => value - * @param array $params list of additional parameters. - * $params[0] should contain a string with either: - * - <channel name> or - * - <username>:<password>@<channel name> - * @return null|PEAR_Error - */ - function doDiscover($command, $options, $params) - { - if (count($params) !== 1) { - return $this->raiseError("No channel server specified"); - } - - // Look for the possible input format "<username>:<password>@<channel>" - if (preg_match('/^(.+):(.+)@(.+)\\z/', $params[0], $matches)) { - $username = $matches[1]; - $password = $matches[2]; - $channel = $matches[3]; - } else { - $channel = $params[0]; - } - - $reg = &$this->config->getRegistry(); - if ($reg->channelExists($channel)) { - if (!$reg->isAlias($channel)) { - return $this->raiseError("Channel \"$channel\" is already initialized", PEAR_COMMAND_CHANNELS_CHANNEL_EXISTS); - } - - return $this->raiseError("A channel alias named \"$channel\" " . - 'already exists, aliasing channel "' . $reg->channelName($channel) - . '"'); - } - - $this->pushErrorHandling(PEAR_ERROR_RETURN); - $err = $this->doAdd($command, $options, array('http://' . $channel . '/channel.xml')); - $this->popErrorHandling(); - if (PEAR::isError($err)) { - if ($err->getCode() === PEAR_COMMAND_CHANNELS_CHANNEL_EXISTS) { - return $this->raiseError("Discovery of channel \"$channel\" failed (" . - $err->getMessage() . ')'); - } - // Attempt fetch via https - $this->ui->outputData("Discovering channel $channel over http:// failed with message: " . $err->getMessage()); - $this->ui->outputData("Trying to discover channel $channel over https:// instead"); - $this->pushErrorHandling(PEAR_ERROR_RETURN); - $err = $this->doAdd($command, $options, array('https://' . $channel . '/channel.xml')); - $this->popErrorHandling(); - if (PEAR::isError($err)) { - return $this->raiseError("Discovery of channel \"$channel\" failed (" . - $err->getMessage() . ')'); - } - } - - // Store username/password if they were given - // Arguably we should do a logintest on the channel here, but since - // that's awkward on a REST-based channel (even "pear login" doesn't - // do it for those), and XML-RPC is deprecated, it's fairly pointless. - if (isset($username)) { - $this->config->set('username', $username, 'user', $channel); - $this->config->set('password', $password, 'user', $channel); - $this->config->store(); - $this->ui->outputData("Stored login for channel \"$channel\" using username \"$username\"", $command); - } - - $this->ui->outputData("Discovery of channel \"$channel\" succeeded", $command); - } - - /** - * Execute the 'login' command. - * - * @param string $command command name - * @param array $options option_name => value - * @param array $params list of additional parameters - * - * @return bool TRUE on success or - * a PEAR error on failure - * - * @access public - */ - function doLogin($command, $options, $params) - { - $reg = &$this->config->getRegistry(); - - // If a parameter is supplied, use that as the channel to log in to - $channel = isset($params[0]) ? $params[0] : $this->config->get('default_channel'); - - $chan = $reg->getChannel($channel); - if (PEAR::isError($chan)) { - return $this->raiseError($chan); - } - - $server = $this->config->get('preferred_mirror', null, $channel); - $username = $this->config->get('username', null, $channel); - if (empty($username)) { - $username = isset($_ENV['USER']) ? $_ENV['USER'] : null; - } - $this->ui->outputData("Logging in to $server.", $command); - - list($username, $password) = $this->ui->userDialog( - $command, - array('Username', 'Password'), - array('text', 'password'), - array($username, '') - ); - $username = trim($username); - $password = trim($password); - - $ourfile = $this->config->getConfFile('user'); - if (!$ourfile) { - $ourfile = $this->config->getConfFile('system'); - } - - $this->config->set('username', $username, 'user', $channel); - $this->config->set('password', $password, 'user', $channel); - - if ($chan->supportsREST()) { - $ok = true; - } - - if ($ok !== true) { - return $this->raiseError('Login failed!'); - } - - $this->ui->outputData("Logged in.", $command); - // avoid changing any temporary settings changed with -d - $ourconfig = new PEAR_Config($ourfile, $ourfile); - $ourconfig->set('username', $username, 'user', $channel); - $ourconfig->set('password', $password, 'user', $channel); - $ourconfig->store(); - - return true; - } - - /** - * Execute the 'logout' command. - * - * @param string $command command name - * @param array $options option_name => value - * @param array $params list of additional parameters - * - * @return bool TRUE on success or - * a PEAR error on failure - * - * @access public - */ - function doLogout($command, $options, $params) - { - $reg = &$this->config->getRegistry(); - - // If a parameter is supplied, use that as the channel to log in to - $channel = isset($params[0]) ? $params[0] : $this->config->get('default_channel'); - - $chan = $reg->getChannel($channel); - if (PEAR::isError($chan)) { - return $this->raiseError($chan); - } - - $server = $this->config->get('preferred_mirror', null, $channel); - $this->ui->outputData("Logging out from $server.", $command); - $this->config->remove('username', 'user', $channel); - $this->config->remove('password', 'user', $channel); - $this->config->store(); - return true; - } -}<commands version="1.0"> - <list-channels> - <summary>List Available Channels</summary> - <function>doList</function> - <shortcut>lc</shortcut> - <options /> - <doc> -List all available channels for installation. -</doc> - </list-channels> - <update-channels> - <summary>Update the Channel List</summary> - <function>doUpdateAll</function> - <shortcut>uc</shortcut> - <options /> - <doc> -List all installed packages in all channels. -</doc> - </update-channels> - <channel-delete> - <summary>Remove a Channel From the List</summary> - <function>doDelete</function> - <shortcut>cde</shortcut> - <options /> - <doc><channel name> -Delete a channel from the registry. You may not -remove any channel that has installed packages. -</doc> - </channel-delete> - <channel-add> - <summary>Add a Channel</summary> - <function>doAdd</function> - <shortcut>ca</shortcut> - <options /> - <doc><channel.xml> -Add a private channel to the channel list. Note that all -public channels should be synced using "update-channels". -Parameter may be either a local file or remote URL to a -channel.xml. -</doc> - </channel-add> - <channel-update> - <summary>Update an Existing Channel</summary> - <function>doUpdate</function> - <shortcut>cu</shortcut> - <options> - <force> - <shortopt>f</shortopt> - <doc>will force download of new channel.xml if an existing channel name is used</doc> - </force> - <channel> - <shortopt>c</shortopt> - <doc>will force download of new channel.xml if an existing channel name is used</doc> - <arg>CHANNEL</arg> - </channel> - </options> - <doc>[<channel.xml>|<channel name>] -Update a channel in the channel list directly. Note that all -public channels can be synced using "update-channels". -Parameter may be a local or remote channel.xml, or the name of -an existing channel. -</doc> - </channel-update> - <channel-info> - <summary>Retrieve Information on a Channel</summary> - <function>doInfo</function> - <shortcut>ci</shortcut> - <options /> - <doc><package> -List the files in an installed package. -</doc> - </channel-info> - <channel-alias> - <summary>Specify an alias to a channel name</summary> - <function>doAlias</function> - <shortcut>cha</shortcut> - <options /> - <doc><channel> <alias> -Specify a specific alias to use for a channel name. -The alias may not be an existing channel name or -alias. -</doc> - </channel-alias> - <channel-discover> - <summary>Initialize a Channel from its server</summary> - <function>doDiscover</function> - <shortcut>di</shortcut> - <options /> - <doc>[<channel.xml>|<channel name>] -Initialize a channel from its server and create a local channel.xml. -If <channel name> is in the format "<username>:<password>@<channel>" then -<username> and <password> will be set as the login username/password for -<channel>. Use caution when passing the username/password in this way, as -it may allow other users on your computer to briefly view your username/ -password via the system's process list. -</doc> - </channel-discover> - <channel-login> - <summary>Connects and authenticates to remote channel server</summary> - <function>doLogin</function> - <shortcut>cli</shortcut> - <options /> - <doc><channel name> -Log in to a remote channel server. If <channel name> is not supplied, -the default channel is used. To use remote functions in the installer -that require any kind of privileges, you need to log in first. The -username and password you enter here will be stored in your per-user -PEAR configuration (~/.pearrc on Unix-like systems). After logging -in, your username and password will be sent along in subsequent -operations on the remote server.</doc> - </channel-login> - <channel-logout> - <summary>Logs out from the remote channel server</summary> - <function>doLogout</function> - <shortcut>clo</shortcut> - <options /> - <doc><channel name> -Logs out from a remote channel server. If <channel name> is not supplied, -the default channel is used. This command does not actually connect to the -remote server, it only deletes the stored username and password from your user -configuration.</doc> - </channel-logout> -</commands><?php -/** * PEAR_Command_Common base class * * PHP versions 4 and 5 @@ -60519,7 +58035,7 @@ configuration.</doc> * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id: Common.php 313023 2011-07-06 19:17:11Z dufuz $ + * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR * @since File available since Release 0.1 */ @@ -60538,7 +58054,7 @@ require_once 'phar://install-pear-nozlib.phar/' . 'PEAR.php'; * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version Release: 1.9.4 + * @version Release: 1.9.5 * @link http://pear.php.net/package/PEAR * @since Class available since Release 0.1 */ @@ -60781,510 +58297,6 @@ class PEAR_Command_Common extends PEAR } }<?php /** - * PEAR_Command_Config (config-show, config-get, config-set, config-help, config-create commands) - * - * PHP versions 4 and 5 - * - * @category pear - * @package PEAR - * @author Stig Bakken <ssb@php.net> - * @author Greg Beaver <cellog@php.net> - * @copyright 1997-2009 The Authors - * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id: Config.php 313024 2011-07-06 19:51:24Z dufuz $ - * @link http://pear.php.net/package/PEAR - * @since File available since Release 0.1 - */ - -/** - * base class - */ -require_once 'phar://install-pear-nozlib.phar/' . 'PEAR/Command/Common.php'; - -/** - * PEAR commands for managing configuration data. - * - * @category pear - * @package PEAR - * @author Stig Bakken <ssb@php.net> - * @author Greg Beaver <cellog@php.net> - * @copyright 1997-2009 The Authors - * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version Release: 1.9.4 - * @link http://pear.php.net/package/PEAR - * @since Class available since Release 0.1 - */ -class PEAR_Command_Config extends PEAR_Command_Common -{ - var $commands = array( - 'config-show' => array( - 'summary' => 'Show All Settings', - 'function' => 'doConfigShow', - 'shortcut' => 'csh', - 'options' => array( - 'channel' => array( - 'shortopt' => 'c', - 'doc' => 'show configuration variables for another channel', - 'arg' => 'CHAN', - ), -), - 'doc' => '[layer] -Displays all configuration values. An optional argument -may be used to tell which configuration layer to display. Valid -configuration layers are "user", "system" and "default". To display -configurations for different channels, set the default_channel -configuration variable and run config-show again. -', - ), - 'config-get' => array( - 'summary' => 'Show One Setting', - 'function' => 'doConfigGet', - 'shortcut' => 'cg', - 'options' => array( - 'channel' => array( - 'shortopt' => 'c', - 'doc' => 'show configuration variables for another channel', - 'arg' => 'CHAN', - ), -), - 'doc' => '<parameter> [layer] -Displays the value of one configuration parameter. The -first argument is the name of the parameter, an optional second argument -may be used to tell which configuration layer to look in. Valid configuration -layers are "user", "system" and "default". If no layer is specified, a value -will be picked from the first layer that defines the parameter, in the order -just specified. The configuration value will be retrieved for the channel -specified by the default_channel configuration variable. -', - ), - 'config-set' => array( - 'summary' => 'Change Setting', - 'function' => 'doConfigSet', - 'shortcut' => 'cs', - 'options' => array( - 'channel' => array( - 'shortopt' => 'c', - 'doc' => 'show configuration variables for another channel', - 'arg' => 'CHAN', - ), -), - 'doc' => '<parameter> <value> [layer] -Sets the value of one configuration parameter. The first argument is -the name of the parameter, the second argument is the new value. Some -parameters are subject to validation, and the command will fail with -an error message if the new value does not make sense. An optional -third argument may be used to specify in which layer to set the -configuration parameter. The default layer is "user". The -configuration value will be set for the current channel, which -is controlled by the default_channel configuration variable. -', - ), - 'config-help' => array( - 'summary' => 'Show Information About Setting', - 'function' => 'doConfigHelp', - 'shortcut' => 'ch', - 'options' => array(), - 'doc' => '[parameter] -Displays help for a configuration parameter. Without arguments it -displays help for all configuration parameters. -', - ), - 'config-create' => array( - 'summary' => 'Create a Default configuration file', - 'function' => 'doConfigCreate', - 'shortcut' => 'coc', - 'options' => array( - 'windows' => array( - 'shortopt' => 'w', - 'doc' => 'create a config file for a windows install', - ), - ), - 'doc' => '<root path> <filename> -Create a default configuration file with all directory configuration -variables set to subdirectories of <root path>, and save it as <filename>. -This is useful especially for creating a configuration file for a remote -PEAR installation (using the --remoteconfig option of install, upgrade, -and uninstall). -', - ), - ); - - /** - * PEAR_Command_Config constructor. - * - * @access public - */ - function PEAR_Command_Config(&$ui, &$config) - { - parent::PEAR_Command_Common($ui, $config); - } - - function doConfigShow($command, $options, $params) - { - $layer = null; - if (is_array($params)) { - $layer = isset($params[0]) ? $params[0] : null; - } - - // $params[0] -> the layer - if ($error = $this->_checkLayer($layer)) { - return $this->raiseError("config-show:$error"); - } - - $keys = $this->config->getKeys(); - sort($keys); - $channel = isset($options['channel']) ? $options['channel'] : - $this->config->get('default_channel'); - $reg = &$this->config->getRegistry(); - if (!$reg->channelExists($channel)) { - return $this->raiseError('Channel "' . $channel . '" does not exist'); - } - - $channel = $reg->channelName($channel); - $data = array('caption' => 'Configuration (channel ' . $channel . '):'); - foreach ($keys as $key) { - $type = $this->config->getType($key); - $value = $this->config->get($key, $layer, $channel); - if ($type == 'password' && $value) { - $value = '********'; - } - - if ($value === false) { - $value = 'false'; - } elseif ($value === true) { - $value = 'true'; - } - - $data['data'][$this->config->getGroup($key)][] = array($this->config->getPrompt($key) , $key, $value); - } - - foreach ($this->config->getLayers() as $layer) { - $data['data']['Config Files'][] = array(ucfirst($layer) . ' Configuration File', 'Filename' , $this->config->getConfFile($layer)); - } - - $this->ui->outputData($data, $command); - return true; - } - - function doConfigGet($command, $options, $params) - { - $args_cnt = is_array($params) ? count($params) : 0; - switch ($args_cnt) { - case 1: - $config_key = $params[0]; - $layer = null; - break; - case 2: - $config_key = $params[0]; - $layer = $params[1]; - if ($error = $this->_checkLayer($layer)) { - return $this->raiseError("config-get:$error"); - } - break; - case 0: - default: - return $this->raiseError("config-get expects 1 or 2 parameters"); - } - - $reg = &$this->config->getRegistry(); - $channel = isset($options['channel']) ? $options['channel'] : $this->config->get('default_channel'); - if (!$reg->channelExists($channel)) { - return $this->raiseError('Channel "' . $channel . '" does not exist'); - } - - $channel = $reg->channelName($channel); - $this->ui->outputData($this->config->get($config_key, $layer, $channel), $command); - return true; - } - - function doConfigSet($command, $options, $params) - { - // $param[0] -> a parameter to set - // $param[1] -> the value for the parameter - // $param[2] -> the layer - $failmsg = ''; - if (count($params) < 2 || count($params) > 3) { - $failmsg .= "config-set expects 2 or 3 parameters"; - return PEAR::raiseError($failmsg); - } - - if (isset($params[2]) && ($error = $this->_checkLayer($params[2]))) { - $failmsg .= $error; - return PEAR::raiseError("config-set:$failmsg"); - } - - $channel = isset($options['channel']) ? $options['channel'] : $this->config->get('default_channel'); - $reg = &$this->config->getRegistry(); - if (!$reg->channelExists($channel)) { - return $this->raiseError('Channel "' . $channel . '" does not exist'); - } - - $channel = $reg->channelName($channel); - if ($params[0] == 'default_channel' && !$reg->channelExists($params[1])) { - return $this->raiseError('Channel "' . $params[1] . '" does not exist'); - } - - if ($params[0] == 'preferred_mirror' - && ( - !$reg->mirrorExists($channel, $params[1]) && - (!$reg->channelExists($params[1]) || $channel != $params[1]) - ) - ) { - $msg = 'Channel Mirror "' . $params[1] . '" does not exist'; - $msg .= ' in your registry for channel "' . $channel . '".'; - $msg .= "\n" . 'Attempt to run "pear channel-update ' . $channel .'"'; - $msg .= ' if you believe this mirror should exist as you may'; - $msg .= ' have outdated channel information.'; - return $this->raiseError($msg); - } - - if (count($params) == 2) { - array_push($params, 'user'); - $layer = 'user'; - } else { - $layer = $params[2]; - } - - array_push($params, $channel); - if (!call_user_func_array(array(&$this->config, 'set'), $params)) { - array_pop($params); - $failmsg = "config-set (" . implode(", ", $params) . ") failed, channel $channel"; - } else { - $this->config->store($layer); - } - - if ($failmsg) { - return $this->raiseError($failmsg); - } - - $this->ui->outputData('config-set succeeded', $command); - return true; - } - - function doConfigHelp($command, $options, $params) - { - if (empty($params)) { - $params = $this->config->getKeys(); - } - - $data['caption'] = "Config help" . ((count($params) == 1) ? " for $params[0]" : ''); - $data['headline'] = array('Name', 'Type', 'Description'); - $data['border'] = true; - foreach ($params as $name) { - $type = $this->config->getType($name); - $docs = $this->config->getDocs($name); - if ($type == 'set') { - $docs = rtrim($docs) . "\nValid set: " . - implode(' ', $this->config->getSetValues($name)); - } - - $data['data'][] = array($name, $type, $docs); - } - - $this->ui->outputData($data, $command); - } - - function doConfigCreate($command, $options, $params) - { - if (count($params) != 2) { - return PEAR::raiseError('config-create: must have 2 parameters, root path and ' . - 'filename to save as'); - } - - $root = $params[0]; - // Clean up the DIRECTORY_SEPARATOR mess - $ds2 = DIRECTORY_SEPARATOR . DIRECTORY_SEPARATOR; - $root = preg_replace(array('!\\\\+!', '!/+!', "!$ds2+!"), - array('/', '/', '/'), - $root); - if ($root{0} != '/') { - if (!isset($options['windows'])) { - return PEAR::raiseError('Root directory must be an absolute path beginning ' . - 'with "/", was: "' . $root . '"'); - } - - if (!preg_match('/^[A-Za-z]:/', $root)) { - return PEAR::raiseError('Root directory must be an absolute path beginning ' . - 'with "\\" or "C:\\", was: "' . $root . '"'); - } - } - - $windows = isset($options['windows']); - if ($windows) { - $root = str_replace('/', '\\', $root); - } - - if (!file_exists($params[1]) && !@touch($params[1])) { - return PEAR::raiseError('Could not create "' . $params[1] . '"'); - } - - $params[1] = realpath($params[1]); - $config = &new PEAR_Config($params[1], '#no#system#config#', false, false); - if ($root{strlen($root) - 1} == '/') { - $root = substr($root, 0, strlen($root) - 1); - } - - $config->noRegistry(); - $config->set('php_dir', $windows ? "$root\\pear\\php" : "$root/pear/php", 'user'); - $config->set('data_dir', $windows ? "$root\\pear\\data" : "$root/pear/data"); - $config->set('www_dir', $windows ? "$root\\pear\\www" : "$root/pear/www"); - $config->set('cfg_dir', $windows ? "$root\\pear\\cfg" : "$root/pear/cfg"); - $config->set('ext_dir', $windows ? "$root\\pear\\ext" : "$root/pear/ext"); - $config->set('doc_dir', $windows ? "$root\\pear\\docs" : "$root/pear/docs"); - $config->set('test_dir', $windows ? "$root\\pear\\tests" : "$root/pear/tests"); - $config->set('cache_dir', $windows ? "$root\\pear\\cache" : "$root/pear/cache"); - $config->set('download_dir', $windows ? "$root\\pear\\download" : "$root/pear/download"); - $config->set('temp_dir', $windows ? "$root\\pear\\temp" : "$root/pear/temp"); - $config->set('bin_dir', $windows ? "$root\\pear" : "$root/pear"); - $config->writeConfigFile(); - $this->_showConfig($config); - $this->ui->outputData('Successfully created default configuration file "' . $params[1] . '"', - $command); - } - - function _showConfig(&$config) - { - $params = array('user'); - $keys = $config->getKeys(); - sort($keys); - $channel = 'pear.php.net'; - $data = array('caption' => 'Configuration (channel ' . $channel . '):'); - foreach ($keys as $key) { - $type = $config->getType($key); - $value = $config->get($key, 'user', $channel); - if ($type == 'password' && $value) { - $value = '********'; - } - - if ($value === false) { - $value = 'false'; - } elseif ($value === true) { - $value = 'true'; - } - $data['data'][$config->getGroup($key)][] = - array($config->getPrompt($key) , $key, $value); - } - - foreach ($config->getLayers() as $layer) { - $data['data']['Config Files'][] = - array(ucfirst($layer) . ' Configuration File', 'Filename' , - $config->getConfFile($layer)); - } - - $this->ui->outputData($data, 'config-show'); - return true; - } - - /** - * Checks if a layer is defined or not - * - * @param string $layer The layer to search for - * @return mixed False on no error or the error message - */ - function _checkLayer($layer = null) - { - if (!empty($layer) && $layer != 'default') { - $layers = $this->config->getLayers(); - if (!in_array($layer, $layers)) { - return " only the layers: \"" . implode('" or "', $layers) . "\" are supported"; - } - } - - return false; - } -}<commands version="1.0"> - <config-show> - <summary>Show All Settings</summary> - <function>doConfigShow</function> - <shortcut>csh</shortcut> - <options> - <channel> - <shortopt>c</shortopt> - <doc>show configuration variables for another channel</doc> - <arg>CHAN</arg> - </channel> - </options> - <doc>[layer] -Displays all configuration values. An optional argument -may be used to tell which configuration layer to display. Valid -configuration layers are "user", "system" and "default". To display -configurations for different channels, set the default_channel -configuration variable and run config-show again. -</doc> - </config-show> - <config-get> - <summary>Show One Setting</summary> - <function>doConfigGet</function> - <shortcut>cg</shortcut> - <options> - <channel> - <shortopt>c</shortopt> - <doc>show configuration variables for another channel</doc> - <arg>CHAN</arg> - </channel> - </options> - <doc><parameter> [layer] -Displays the value of one configuration parameter. The -first argument is the name of the parameter, an optional second argument -may be used to tell which configuration layer to look in. Valid configuration -layers are "user", "system" and "default". If no layer is specified, a value -will be picked from the first layer that defines the parameter, in the order -just specified. The configuration value will be retrieved for the channel -specified by the default_channel configuration variable. -</doc> - </config-get> - <config-set> - <summary>Change Setting</summary> - <function>doConfigSet</function> - <shortcut>cs</shortcut> - <options> - <channel> - <shortopt>c</shortopt> - <doc>show configuration variables for another channel</doc> - <arg>CHAN</arg> - </channel> - </options> - <doc><parameter> <value> [layer] -Sets the value of one configuration parameter. The first argument is -the name of the parameter, the second argument is the new value. Some -parameters are subject to validation, and the command will fail with -an error message if the new value does not make sense. An optional -third argument may be used to specify in which layer to set the -configuration parameter. The default layer is "user". The -configuration value will be set for the current channel, which -is controlled by the default_channel configuration variable. -</doc> - </config-set> - <config-help> - <summary>Show Information About Setting</summary> - <function>doConfigHelp</function> - <shortcut>ch</shortcut> - <options /> - <doc>[parameter] -Displays help for a configuration parameter. Without arguments it -displays help for all configuration parameters. -</doc> - </config-help> - <config-create> - <summary>Create a Default configuration file</summary> - <function>doConfigCreate</function> - <shortcut>coc</shortcut> - <options> - <windows> - <shortopt>w</shortopt> - <doc>create a config file for a windows install</doc> - </windows> - </options> - <doc><root path> <filename> -Create a default configuration file with all directory configuration -variables set to subdirectories of <root path>, and save it as <filename>. -This is useful especially for creating a configuration file for a remote -PEAR installation (using the --remoteconfig option of install, upgrade, -and uninstall). -</doc> - </config-create> -</commands><?php -/** * PEAR_Command_Install (install, upgrade, upgrade-all, uninstall, bundle, run-scripts commands) * * PHP versions 4 and 5 @@ -61295,7 +58307,7 @@ and uninstall). * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id: Install.php 313023 2011-07-06 19:17:11Z dufuz $ + * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR * @since File available since Release 0.1 */ @@ -61315,7 +58327,7 @@ require_once 'phar://install-pear-nozlib.phar/' . 'PEAR/Command/Common.php'; * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version Release: 1.9.4 + * @version Release: 1.9.5 * @link http://pear.php.net/package/PEAR * @since Class available since Release 0.1 */ @@ -61753,7 +58765,7 @@ Run post-installation scripts in package <package>, if any exist. $ts = preg_match('/Thread Safety.+enabled/', $info) ? '_ts' : ''; $zend_extension_line = 'zend_extension' . $debug . $ts; $all = @file($filename); - if (!$all) { + if ($all === false) { return PEAR::raiseError('php.ini "' . $filename .'" could not be read'); } $zend_extensions = $extensions = array(); @@ -62053,17 +59065,24 @@ Run post-installation scripts in package <package>, if any exist. if ($param->getPackageType() == 'extsrc' || $param->getPackageType() == 'extbin') { $exttype = 'extension'; + $extpath = $pinfo[1]['basename']; } else { - ob_start(); - phpinfo(INFO_GENERAL); - $info = ob_get_contents(); - ob_end_clean(); - $debug = function_exists('leak') ? '_debug' : ''; - $ts = preg_match('/Thread Safety.+enabled/', $info) ? '_ts' : ''; + if (version_compare(PHP_VERSION, '5.3.0', '<')) { + ob_start(); + phpinfo(INFO_GENERAL); + $info = ob_get_contents(); + ob_end_clean(); + $debug = function_exists('leak') ? '_debug' : ''; + $ts = preg_match('/Thread Safety.+enabled/', $info) ? '_ts' : ''; + } else { + $debug = ''; + $ts = ''; + } $exttype = 'zend_extension' . $debug . $ts; + $extpath = $atts['installed_as']; } $extrainfo[] = 'You should add "' . $exttype . '=' . - $pinfo[1]['basename'] . '" to php.ini'; + $extpath . '" to php.ini'; } else { $extrainfo[] = 'Extension ' . $instpkg->getProvidesExtension() . ' enabled in php.ini'; @@ -62550,7 +59569,8 @@ Run post-installation scripts in package <package>, if any exist. return $ret; } -}<commands version="1.0"> +} +<commands version="1.0"> <install> <summary>Install Package</summary> <function>doInstall</function> @@ -62827,4482 +59847,6 @@ Run post-installation scripts in package <package>, if any exist. </run-scripts> </commands><?php /** - * PEAR_Command_Mirror (download-all command) - * - * PHP versions 4 and 5 - * - * @category pear - * @package PEAR - * @author Alexander Merz <alexmerz@php.net> - * @copyright 1997-2009 The Authors - * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id: Mirror.php 313023 2011-07-06 19:17:11Z dufuz $ - * @link http://pear.php.net/package/PEAR - * @since File available since Release 1.2.0 - */ - -/** - * base class - */ -require_once 'phar://install-pear-nozlib.phar/' . 'PEAR/Command/Common.php'; - -/** - * PEAR commands for providing file mirrors - * - * @category pear - * @package PEAR - * @author Alexander Merz <alexmerz@php.net> - * @copyright 1997-2009 The Authors - * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version Release: 1.9.4 - * @link http://pear.php.net/package/PEAR - * @since Class available since Release 1.2.0 - */ -class PEAR_Command_Mirror extends PEAR_Command_Common -{ - var $commands = array( - 'download-all' => array( - 'summary' => 'Downloads each available package from the default channel', - 'function' => 'doDownloadAll', - 'shortcut' => 'da', - 'options' => array( - 'channel' => - array( - 'shortopt' => 'c', - 'doc' => 'specify a channel other than the default channel', - 'arg' => 'CHAN', - ), - ), - 'doc' => ' -Requests a list of available packages from the default channel ({config default_channel}) -and downloads them to current working directory. Note: only -packages within preferred_state ({config preferred_state}) will be downloaded' - ), - ); - - /** - * PEAR_Command_Mirror constructor. - * - * @access public - * @param object PEAR_Frontend a reference to an frontend - * @param object PEAR_Config a reference to the configuration data - */ - function PEAR_Command_Mirror(&$ui, &$config) - { - parent::PEAR_Command_Common($ui, $config); - } - - /** - * For unit-testing - */ - function &factory($a) - { - $a = &PEAR_Command::factory($a, $this->config); - return $a; - } - - /** - * retrieves a list of avaible Packages from master server - * and downloads them - * - * @access public - * @param string $command the command - * @param array $options the command options before the command - * @param array $params the stuff after the command name - * @return bool true if succesful - * @throw PEAR_Error - */ - function doDownloadAll($command, $options, $params) - { - $savechannel = $this->config->get('default_channel'); - $reg = &$this->config->getRegistry(); - $channel = isset($options['channel']) ? $options['channel'] : - $this->config->get('default_channel'); - if (!$reg->channelExists($channel)) { - $this->config->set('default_channel', $savechannel); - return $this->raiseError('Channel "' . $channel . '" does not exist'); - } - $this->config->set('default_channel', $channel); - - $this->ui->outputData('Using Channel ' . $this->config->get('default_channel')); - $chan = $reg->getChannel($channel); - if (PEAR::isError($chan)) { - return $this->raiseError($chan); - } - - if ($chan->supportsREST($this->config->get('preferred_mirror')) && - $base = $chan->getBaseURL('REST1.0', $this->config->get('preferred_mirror'))) { - $rest = &$this->config->getREST('1.0', array()); - $remoteInfo = array_flip($rest->listPackages($base, $channel)); - } - - if (PEAR::isError($remoteInfo)) { - return $remoteInfo; - } - - $cmd = &$this->factory("download"); - if (PEAR::isError($cmd)) { - return $cmd; - } - - $this->ui->outputData('Using Preferred State of ' . - $this->config->get('preferred_state')); - $this->ui->outputData('Gathering release information, please wait...'); - - /** - * Error handling not necessary, because already done by - * the download command - */ - PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN); - $err = $cmd->run('download', array('downloadonly' => true), array_keys($remoteInfo)); - PEAR::staticPopErrorHandling(); - $this->config->set('default_channel', $savechannel); - if (PEAR::isError($err)) { - $this->ui->outputData($err->getMessage()); - } - - return true; - } -}<commands version="1.0"> - <download-all> - <summary>Downloads each available package from the default channel</summary> - <function>doDownloadAll</function> - <shortcut>da</shortcut> - <options> - <channel> - <shortopt>c</shortopt> - <doc>specify a channel other than the default channel</doc> - <arg>CHAN</arg> - </channel> - </options> - <doc> -Requests a list of available packages from the default channel ({config default_channel}) -and downloads them to current working directory. Note: only -packages within preferred_state ({config preferred_state}) will be downloaded</doc> - </download-all> -</commands><?php -/** - * PEAR_Command_Package (package, package-validate, cvsdiff, cvstag, package-dependencies, - * sign, makerpm, convert commands) - * - * PHP versions 4 and 5 - * - * @category pear - * @package PEAR - * @author Stig Bakken <ssb@php.net> - * @author Martin Jansen <mj@php.net> - * @author Greg Beaver <cellog@php.net> - * @copyright 1997-2009 The Authors - * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id: Package.php 313024 2011-07-06 19:51:24Z dufuz $ - * @link http://pear.php.net/package/PEAR - * @since File available since Release 0.1 - */ - -/** - * base class - */ -require_once 'phar://install-pear-nozlib.phar/' . 'PEAR/Command/Common.php'; - -/** - * PEAR commands for login/logout - * - * @category pear - * @package PEAR - * @author Stig Bakken <ssb@php.net> - * @author Martin Jansen <mj@php.net> - * @author Greg Beaver <cellog@php.net> - * @copyright 1997-2009 The Authors - * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version Release: 1.10.0beta1 - * @link http://pear.php.net/package/PEAR - * @since Class available since Release 0.1 - */ - -class PEAR_Command_Package extends PEAR_Command_Common -{ - var $commands = array( - 'package' => array( - 'summary' => 'Build Package', - 'function' => 'doPackage', - 'shortcut' => 'p', - 'options' => array( - 'nocompress' => array( - 'shortopt' => 'Z', - 'doc' => 'Do not gzip the package file' - ), - 'showname' => array( - 'shortopt' => 'n', - 'doc' => 'Print the name of the packaged file.', - ), - ), - 'doc' => '[descfile] [descfile2] -Creates a PEAR package from its description file (usually called -package.xml). If a second packagefile is passed in, then -the packager will check to make sure that one is a package.xml -version 1.0, and the other is a package.xml version 2.0. The -package.xml version 1.0 will be saved as "package.xml" in the archive, -and the other as "package2.xml" in the archive" -' - ), - 'package-validate' => array( - 'summary' => 'Validate Package Consistency', - 'function' => 'doPackageValidate', - 'shortcut' => 'pv', - 'options' => array(), - 'doc' => ' -', - ), - 'cvsdiff' => array( - 'summary' => 'Run a "cvs diff" for all files in a package', - 'function' => 'doCvsDiff', - 'shortcut' => 'cd', - 'options' => array( - 'quiet' => array( - 'shortopt' => 'q', - 'doc' => 'Be quiet', - ), - 'reallyquiet' => array( - 'shortopt' => 'Q', - 'doc' => 'Be really quiet', - ), - 'date' => array( - 'shortopt' => 'D', - 'doc' => 'Diff against revision of DATE', - 'arg' => 'DATE', - ), - 'release' => array( - 'shortopt' => 'R', - 'doc' => 'Diff against tag for package release REL', - 'arg' => 'REL', - ), - 'revision' => array( - 'shortopt' => 'r', - 'doc' => 'Diff against revision REV', - 'arg' => 'REV', - ), - 'context' => array( - 'shortopt' => 'c', - 'doc' => 'Generate context diff', - ), - 'unified' => array( - 'shortopt' => 'u', - 'doc' => 'Generate unified diff', - ), - 'ignore-case' => array( - 'shortopt' => 'i', - 'doc' => 'Ignore case, consider upper- and lower-case letters equivalent', - ), - 'ignore-whitespace' => array( - 'shortopt' => 'b', - 'doc' => 'Ignore changes in amount of white space', - ), - 'ignore-blank-lines' => array( - 'shortopt' => 'B', - 'doc' => 'Ignore changes that insert or delete blank lines', - ), - 'brief' => array( - 'doc' => 'Report only whether the files differ, no details', - ), - 'dry-run' => array( - 'shortopt' => 'n', - 'doc' => 'Don\'t do anything, just pretend', - ), - ), - 'doc' => '<package.xml> -Compares all the files in a package. Without any options, this -command will compare the current code with the last checked-in code. -Using the -r or -R option you may compare the current code with that -of a specific release. -', - ), - 'svntag' => array( - 'summary' => 'Set SVN Release Tag', - 'function' => 'doSvnTag', - 'shortcut' => 'sv', - 'options' => array( - 'quiet' => array( - 'shortopt' => 'q', - 'doc' => 'Be quiet', - ), - 'slide' => array( - 'shortopt' => 'F', - 'doc' => 'Move (slide) tag if it exists', - ), - 'delete' => array( - 'shortopt' => 'd', - 'doc' => 'Remove tag', - ), - 'dry-run' => array( - 'shortopt' => 'n', - 'doc' => 'Don\'t do anything, just pretend', - ), - ), - 'doc' => '<package.xml> [files...] - Sets a SVN tag on all files in a package. Use this command after you have - packaged a distribution tarball with the "package" command to tag what - revisions of what files were in that release. If need to fix something - after running svntag once, but before the tarball is released to the public, - use the "slide" option to move the release tag. - - to include files (such as a second package.xml, or tests not included in the - release), pass them as additional parameters. - ', - ), - 'cvstag' => array( - 'summary' => 'Set CVS Release Tag', - 'function' => 'doCvsTag', - 'shortcut' => 'ct', - 'options' => array( - 'quiet' => array( - 'shortopt' => 'q', - 'doc' => 'Be quiet', - ), - 'reallyquiet' => array( - 'shortopt' => 'Q', - 'doc' => 'Be really quiet', - ), - 'slide' => array( - 'shortopt' => 'F', - 'doc' => 'Move (slide) tag if it exists', - ), - 'delete' => array( - 'shortopt' => 'd', - 'doc' => 'Remove tag', - ), - 'dry-run' => array( - 'shortopt' => 'n', - 'doc' => 'Don\'t do anything, just pretend', - ), - ), - 'doc' => '<package.xml> [files...] -Sets a CVS tag on all files in a package. Use this command after you have -packaged a distribution tarball with the "package" command to tag what -revisions of what files were in that release. If need to fix something -after running cvstag once, but before the tarball is released to the public, -use the "slide" option to move the release tag. - -to include files (such as a second package.xml, or tests not included in the -release), pass them as additional parameters. -', - ), - 'package-dependencies' => array( - 'summary' => 'Show package dependencies', - 'function' => 'doPackageDependencies', - 'shortcut' => 'pd', - 'options' => array(), - 'doc' => '<package-file> or <package.xml> or <install-package-name> -List all dependencies the package has. -Can take a tgz / tar file, package.xml or a package name of an installed package.' - ), - 'sign' => array( - 'summary' => 'Sign a package distribution file', - 'function' => 'doSign', - 'shortcut' => 'si', - 'options' => array( - 'verbose' => array( - 'shortopt' => 'v', - 'doc' => 'Display GnuPG output', - ), - ), - 'doc' => '<package-file> -Signs a package distribution (.tar or .tgz) file with GnuPG.', - ), - 'makerpm' => array( - 'summary' => 'Builds an RPM spec file from a PEAR package', - 'function' => 'doMakeRPM', - 'shortcut' => 'rpm', - 'options' => array( - 'spec-template' => array( - 'shortopt' => 't', - 'arg' => 'FILE', - 'doc' => 'Use FILE as RPM spec file template' - ), - 'rpm-pkgname' => array( - 'shortopt' => 'p', - 'arg' => 'FORMAT', - 'doc' => 'Use FORMAT as format string for RPM package name, %s is replaced -by the PEAR package name, defaults to "PEAR::%s".', - ), - ), - 'doc' => '<package-file> - -Creates an RPM .spec file for wrapping a PEAR package inside an RPM -package. Intended to be used from the SPECS directory, with the PEAR -package tarball in the SOURCES directory: - -$ pear makerpm ../SOURCES/Net_Socket-1.0.tgz -Wrote RPM spec file PEAR::Net_Geo-1.0.spec -$ rpm -bb PEAR::Net_Socket-1.0.spec -... -Wrote: /usr/src/redhat/RPMS/i386/PEAR::Net_Socket-1.0-1.i386.rpm -', - ), - 'convert' => array( - 'summary' => 'Convert a package.xml 1.0 to package.xml 2.0 format', - 'function' => 'doConvert', - 'shortcut' => 'c2', - 'options' => array( - 'flat' => array( - 'shortopt' => 'f', - 'doc' => 'do not beautify the filelist.', - ), - ), - 'doc' => '[descfile] [descfile2] -Converts a package.xml in 1.0 format into a package.xml -in 2.0 format. The new file will be named package2.xml by default, -and package.xml will be used as the old file by default. -This is not the most intelligent conversion, and should only be -used for automated conversion or learning the format. -' - ), - ); - - var $output; - - /** - * PEAR_Command_Package constructor. - * - * @access public - */ - function PEAR_Command_Package(&$ui, &$config) - { - parent::PEAR_Command_Common($ui, $config); - } - - function _displayValidationResults($err, $warn, $strict = false) - { - foreach ($err as $e) { - $this->output .= "Error: $e\n"; - } - foreach ($warn as $w) { - $this->output .= "Warning: $w\n"; - } - $this->output .= sprintf('Validation: %d error(s), %d warning(s)'."\n", - sizeof($err), sizeof($warn)); - if ($strict && count($err) > 0) { - $this->output .= "Fix these errors and try again."; - return false; - } - return true; - } - - function &getPackager() - { - if (!class_exists('PEAR_Packager')) { - require_once 'phar://install-pear-nozlib.phar/' . 'PEAR/Packager.php'; - } - $a = &new PEAR_Packager; - return $a; - } - - function &getPackageFile($config, $debug = false) - { - if (!class_exists('PEAR_Common')) { - require_once 'phar://install-pear-nozlib.phar/' . 'PEAR/Common.php'; - } - if (!class_exists('PEAR_PackageFile')) { - require_once 'phar://install-pear-nozlib.phar/' . 'PEAR/PackageFile.php'; - } - $a = &new PEAR_PackageFile($config, $debug); - $common = new PEAR_Common; - $common->ui = $this->ui; - $a->setLogger($common); - return $a; - } - - function doPackage($command, $options, $params) - { - $this->output = ''; - $pkginfofile = isset($params[0]) ? $params[0] : 'package.xml'; - $pkg2 = isset($params[1]) ? $params[1] : null; - if (!$pkg2 && !isset($params[0]) && file_exists('package2.xml')) { - $pkg2 = 'package2.xml'; - } - - $packager = &$this->getPackager(); - $compress = empty($options['nocompress']) ? true : false; - $result = $packager->package($pkginfofile, $compress, $pkg2); - if (PEAR::isError($result)) { - return $this->raiseError($result); - } - - // Don't want output, only the package file name just created - if (isset($options['showname'])) { - $this->output = $result; - } - - if ($this->output) { - $this->ui->outputData($this->output, $command); - } - - return true; - } - - function doPackageValidate($command, $options, $params) - { - $this->output = ''; - if (count($params) < 1) { - $params[0] = 'package.xml'; - } - - $obj = &$this->getPackageFile($this->config, $this->_debug); - $obj->rawReturn(); - PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN); - $info = $obj->fromTgzFile($params[0], PEAR_VALIDATE_NORMAL); - if (PEAR::isError($info)) { - $info = $obj->fromPackageFile($params[0], PEAR_VALIDATE_NORMAL); - } else { - $archive = $info->getArchiveFile(); - $tar = &new Archive_Tar($archive); - $tar->extract(dirname($info->getPackageFile())); - $info->setPackageFile(dirname($info->getPackageFile()) . DIRECTORY_SEPARATOR . - $info->getPackage() . '-' . $info->getVersion() . DIRECTORY_SEPARATOR . - basename($info->getPackageFile())); - } - - PEAR::staticPopErrorHandling(); - if (PEAR::isError($info)) { - return $this->raiseError($info); - } - - $valid = false; - if ($info->getPackagexmlVersion() == '2.0') { - if ($valid = $info->validate(PEAR_VALIDATE_NORMAL)) { - $info->flattenFileList(); - $valid = $info->validate(PEAR_VALIDATE_PACKAGING); - } - } else { - $valid = $info->validate(PEAR_VALIDATE_PACKAGING); - } - - $err = $warn = array(); - if ($errors = $info->getValidationWarnings()) { - foreach ($errors as $error) { - if ($error['level'] == 'warning') { - $warn[] = $error['message']; - } else { - $err[] = $error['message']; - } - } - } - - $this->_displayValidationResults($err, $warn); - $this->ui->outputData($this->output, $command); - return true; - } - - function doSvnTag($command, $options, $params) - { - $this->output = ''; - $_cmd = $command; - if (count($params) < 1) { - $help = $this->getHelp($command); - return $this->raiseError("$command: missing parameter: $help[0]"); - } - - $packageFile = realpath($params[0]); - $dir = dirname($packageFile); - $dir = substr($dir, strrpos($dir, DIRECTORY_SEPARATOR) + 1); - $obj = &$this->getPackageFile($this->config, $this->_debug); - $info = $obj->fromAnyFile($packageFile, PEAR_VALIDATE_NORMAL); - if (PEAR::isError($info)) { - return $this->raiseError($info); - } - - $err = $warn = array(); - if (!$info->validate()) { - foreach ($info->getValidationWarnings() as $error) { - if ($error['level'] == 'warning') { - $warn[] = $error['message']; - } else { - $err[] = $error['message']; - } - } - } - - if (!$this->_displayValidationResults($err, $warn, true)) { - $this->ui->outputData($this->output, $command); - return $this->raiseError('SVN tag failed'); - } - - $version = $info->getVersion(); - $package = $info->getName(); - $svntag = "$package-$version"; - - if (isset($options['delete'])) { - return $this->_svnRemoveTag($version, $package, $svntag, $packageFile, $options); - } - - $path = $this->_svnFindPath($packageFile); - - // Check if there are any modified files - $fp = popen('svn st --xml ' . dirname($packageFile), "r"); - $out = ''; - while ($line = fgets($fp, 1024)) { - $out .= rtrim($line)."\n"; - } - pclose($fp); - - if (!isset($options['quiet']) && strpos($out, 'item="modified"')) { - $params = array(array( - 'name' => 'modified', - 'type' => 'yesno', - 'default' => 'no', - 'prompt' => 'You have files in your SVN checkout (' . $path['from'] . ') that have been modified but not commited, do you still want to tag ' . $version . '?', - )); - $answers = $this->ui->confirmDialog($params); - - if (!in_array($answers['modified'], array('y', 'yes', 'on', '1'))) { - return true; - } - } - - if (isset($options['slide'])) { - $this->_svnRemoveTag($version, $package, $svntag, $packageFile, $options); - } - - // Check if tag already exists - $releaseTag = $path['local']['base'] . 'tags' . DIRECTORY_SEPARATOR . $svntag; - $existsCommand = 'svn ls ' . $path['base'] . 'tags/'; - - $fp = popen($existsCommand, "r"); - $out = ''; - while ($line = fgets($fp, 1024)) { - $out .= rtrim($line)."\n"; - } - pclose($fp); - - if (in_array($svntag . DIRECTORY_SEPARATOR, explode("\n", $out))) { - $this->ui->outputData($this->output, $command); - return $this->raiseError('SVN tag ' . $svntag . ' for ' . $package . ' already exists.'); - } elseif (file_exists($path['local']['base'] . 'tags') === false) { - return $this->raiseError('Can not locate the tags directory at ' . $path['local']['base'] . 'tags'); - } elseif (is_writeable($path['local']['base'] . 'tags') === false) { - return $this->raiseError('Can not write to the tag directory at ' . $path['local']['base'] . 'tags'); - } else { - $makeCommand = 'svn mkdir ' . $releaseTag; - $this->output .= "+ $makeCommand\n"; - if (empty($options['dry-run'])) { - // We need to create the tag dir. - $fp = popen($makeCommand, "r"); - $out = ''; - while ($line = fgets($fp, 1024)) { - $out .= rtrim($line)."\n"; - } - pclose($fp); - $this->output .= "$out\n"; - } - } - - $command = 'svn'; - if (isset($options['quiet'])) { - $command .= ' -q'; - } - - $command .= ' copy --parents '; - - $dir = dirname($packageFile); - $dir = substr($dir, strrpos($dir, DIRECTORY_SEPARATOR) + 1); - $files = array_keys($info->getFilelist()); - if (!in_array(basename($packageFile), $files)) { - $files[] = basename($packageFile); - } - - array_shift($params); - if (count($params)) { - // add in additional files to be tagged (package files and such) - $files = array_merge($files, $params); - } - - $commands = array(); - foreach ($files as $file) { - if (!file_exists($file)) { - $file = $dir . DIRECTORY_SEPARATOR . $file; - } - $commands[] = $command . ' ' . escapeshellarg($file) . ' ' . - escapeshellarg($releaseTag . DIRECTORY_SEPARATOR . $file); - } - - $this->output .= implode("\n", $commands) . "\n"; - if (empty($options['dry-run'])) { - foreach ($commands as $command) { - $fp = popen($command, "r"); - while ($line = fgets($fp, 1024)) { - $this->output .= rtrim($line)."\n"; - } - pclose($fp); - } - } - - $command = 'svn ci -m "Tagging the ' . $version . ' release" ' . $releaseTag . "\n"; - $this->output .= "+ $command\n"; - if (empty($options['dry-run'])) { - $fp = popen($command, "r"); - while ($line = fgets($fp, 1024)) { - $this->output .= rtrim($line)."\n"; - } - pclose($fp); - } - - $this->ui->outputData($this->output, $_cmd); - return true; - } - - function _svnFindPath($file) - { - $xml = ''; - $command = "svn info --xml $file"; - $fp = popen($command, "r"); - while ($line = fgets($fp, 1024)) { - $xml .= rtrim($line)."\n"; - } - pclose($fp); - $url_tag = strpos($xml, '<url>'); - $url = substr($xml, $url_tag + 5, strpos($xml, '</url>', $url_tag + 5) - ($url_tag + 5)); - - $path = array(); - $path['from'] = substr($url, 0, strrpos($url, '/')); - $path['base'] = substr($path['from'], 0, strrpos($path['from'], '/') + 1); - - // Figure out the local paths - see http://pear.php.net/bugs/17463 - $pos = strpos($file, DIRECTORY_SEPARATOR . 'trunk' . DIRECTORY_SEPARATOR); - if ($pos === false) { - $pos = strpos($file, DIRECTORY_SEPARATOR . 'branches' . DIRECTORY_SEPARATOR); - } - $path['local']['base'] = substr($file, 0, $pos + 1); - - return $path; - } - - function _svnRemoveTag($version, $package, $tag, $packageFile, $options) - { - $command = 'svn'; - - if (isset($options['quiet'])) { - $command .= ' -q'; - } - - $command .= ' remove'; - $command .= ' -m "Removing tag for the ' . $version . ' release."'; - - $path = $this->_svnFindPath($packageFile); - $command .= ' ' . $path['base'] . 'tags/' . $tag; - - - if ($this->config->get('verbose') > 1) { - $this->output .= "+ $command\n"; - } - - $this->output .= "+ $command\n"; - if (empty($options['dry-run'])) { - $fp = popen($command, "r"); - while ($line = fgets($fp, 1024)) { - $this->output .= rtrim($line)."\n"; - } - pclose($fp); - } - - $this->ui->outputData($this->output, $command); - return true; - } - - function doCvsTag($command, $options, $params) - { - $this->output = ''; - $_cmd = $command; - if (count($params) < 1) { - $help = $this->getHelp($command); - return $this->raiseError("$command: missing parameter: $help[0]"); - } - - $packageFile = realpath($params[0]); - $obj = &$this->getPackageFile($this->config, $this->_debug); - $info = $obj->fromAnyFile($packageFile, PEAR_VALIDATE_NORMAL); - if (PEAR::isError($info)) { - return $this->raiseError($info); - } - - $err = $warn = array(); - if (!$info->validate()) { - foreach ($info->getValidationWarnings() as $error) { - if ($error['level'] == 'warning') { - $warn[] = $error['message']; - } else { - $err[] = $error['message']; - } - } - } - - if (!$this->_displayValidationResults($err, $warn, true)) { - $this->ui->outputData($this->output, $command); - return $this->raiseError('CVS tag failed'); - } - - $version = $info->getVersion(); - $cvsversion = preg_replace('/[^a-z0-9]/i', '_', $version); - $cvstag = "RELEASE_$cvsversion"; - $files = array_keys($info->getFilelist()); - $command = 'cvs'; - if (isset($options['quiet'])) { - $command .= ' -q'; - } - - if (isset($options['reallyquiet'])) { - $command .= ' -Q'; - } - - $command .= ' tag'; - if (isset($options['slide'])) { - $command .= ' -F'; - } - - if (isset($options['delete'])) { - $command .= ' -d'; - } - - $command .= ' ' . $cvstag . ' ' . escapeshellarg($params[0]); - array_shift($params); - if (count($params)) { - // add in additional files to be tagged - $files = array_merge($files, $params); - } - - $dir = dirname($packageFile); - $dir = substr($dir, strrpos($dir, '/') + 1); - foreach ($files as $file) { - if (!file_exists($file)) { - $file = $dir . DIRECTORY_SEPARATOR . $file; - } - $command .= ' ' . escapeshellarg($file); - } - - if ($this->config->get('verbose') > 1) { - $this->output .= "+ $command\n"; - } - - $this->output .= "+ $command\n"; - if (empty($options['dry-run'])) { - $fp = popen($command, "r"); - while ($line = fgets($fp, 1024)) { - $this->output .= rtrim($line)."\n"; - } - pclose($fp); - } - - $this->ui->outputData($this->output, $_cmd); - return true; - } - - function doCvsDiff($command, $options, $params) - { - $this->output = ''; - if (sizeof($params) < 1) { - $help = $this->getHelp($command); - return $this->raiseError("$command: missing parameter: $help[0]"); - } - - $file = realpath($params[0]); - $obj = &$this->getPackageFile($this->config, $this->_debug); - $info = $obj->fromAnyFile($file, PEAR_VALIDATE_NORMAL); - if (PEAR::isError($info)) { - return $this->raiseError($info); - } - - $err = $warn = array(); - if (!$info->validate()) { - foreach ($info->getValidationWarnings() as $error) { - if ($error['level'] == 'warning') { - $warn[] = $error['message']; - } else { - $err[] = $error['message']; - } - } - } - - if (!$this->_displayValidationResults($err, $warn, true)) { - $this->ui->outputData($this->output, $command); - return $this->raiseError('CVS diff failed'); - } - - $info1 = $info->getFilelist(); - $files = $info1; - $cmd = "cvs"; - if (isset($options['quiet'])) { - $cmd .= ' -q'; - unset($options['quiet']); - } - - if (isset($options['reallyquiet'])) { - $cmd .= ' -Q'; - unset($options['reallyquiet']); - } - - if (isset($options['release'])) { - $cvsversion = preg_replace('/[^a-z0-9]/i', '_', $options['release']); - $cvstag = "RELEASE_$cvsversion"; - $options['revision'] = $cvstag; - unset($options['release']); - } - - $execute = true; - if (isset($options['dry-run'])) { - $execute = false; - unset($options['dry-run']); - } - - $cmd .= ' diff'; - // the rest of the options are passed right on to "cvs diff" - foreach ($options as $option => $optarg) { - $arg = $short = false; - if (isset($this->commands[$command]['options'][$option])) { - $arg = $this->commands[$command]['options'][$option]['arg']; - $short = $this->commands[$command]['options'][$option]['shortopt']; - } - $cmd .= $short ? " -$short" : " --$option"; - if ($arg && $optarg) { - $cmd .= ($short ? '' : '=') . escapeshellarg($optarg); - } - } - - foreach ($files as $file) { - $cmd .= ' ' . escapeshellarg($file['name']); - } - - if ($this->config->get('verbose') > 1) { - $this->output .= "+ $cmd\n"; - } - - if ($execute) { - $fp = popen($cmd, "r"); - while ($line = fgets($fp, 1024)) { - $this->output .= rtrim($line)."\n"; - } - pclose($fp); - } - - $this->ui->outputData($this->output, $command); - return true; - } - - function doPackageDependencies($command, $options, $params) - { - // $params[0] -> the PEAR package to list its information - if (count($params) !== 1) { - return $this->raiseError("bad parameter(s), try \"help $command\""); - } - - $obj = &$this->getPackageFile($this->config, $this->_debug); - if (is_file($params[0]) || strpos($params[0], '.xml') > 0) { - $info = $obj->fromAnyFile($params[0], PEAR_VALIDATE_NORMAL); - } else { - $reg = $this->config->getRegistry(); - $info = $obj->fromArray($reg->packageInfo($params[0])); - } - - if (PEAR::isError($info)) { - return $this->raiseError($info); - } - - $deps = $info->getDeps(); - if (is_array($deps)) { - if ($info->getPackagexmlVersion() == '1.0') { - $data = array( - 'caption' => 'Dependencies for pear/' . $info->getPackage(), - 'border' => true, - 'headline' => array("Required?", "Type", "Name", "Relation", "Version"), - ); - - foreach ($deps as $d) { - if (isset($d['optional'])) { - if ($d['optional'] == 'yes') { - $req = 'No'; - } else { - $req = 'Yes'; - } - } else { - $req = 'Yes'; - } - - if (isset($this->_deps_rel_trans[$d['rel']])) { - $rel = $this->_deps_rel_trans[$d['rel']]; - } else { - $rel = $d['rel']; - } - - if (isset($this->_deps_type_trans[$d['type']])) { - $type = ucfirst($this->_deps_type_trans[$d['type']]); - } else { - $type = $d['type']; - } - - if (isset($d['name'])) { - $name = $d['name']; - } else { - $name = ''; - } - - if (isset($d['version'])) { - $version = $d['version']; - } else { - $version = ''; - } - - $data['data'][] = array($req, $type, $name, $rel, $version); - } - } else { // package.xml 2.0 dependencies display - require_once 'phar://install-pear-nozlib.phar/' . 'PEAR/Dependency2.php'; - $deps = $info->getDependencies(); - $reg = &$this->config->getRegistry(); - if (is_array($deps)) { - $d = new PEAR_Dependency2($this->config, array(), ''); - $data = array( - 'caption' => 'Dependencies for ' . $info->getPackage(), - 'border' => true, - 'headline' => array("Required?", "Type", "Name", 'Versioning', 'Group'), - ); - foreach ($deps as $type => $subd) { - $req = ($type == 'required') ? 'Yes' : 'No'; - if ($type == 'group') { - $group = $subd['attribs']['name']; - } else { - $group = ''; - } - - if (!isset($subd[0])) { - $subd = array($subd); - } - - foreach ($subd as $groupa) { - foreach ($groupa as $deptype => $depinfo) { - if ($deptype == 'attribs') { - continue; - } - - if ($deptype == 'pearinstaller') { - $deptype = 'pear Installer'; - } - - if (!isset($depinfo[0])) { - $depinfo = array($depinfo); - } - - foreach ($depinfo as $inf) { - $name = ''; - if (isset($inf['channel'])) { - $alias = $reg->channelAlias($inf['channel']); - if (!$alias) { - $alias = '(channel?) ' .$inf['channel']; - } - $name = $alias . '/'; - - } - if (isset($inf['name'])) { - $name .= $inf['name']; - } elseif (isset($inf['pattern'])) { - $name .= $inf['pattern']; - } else { - $name .= ''; - } - - if (isset($inf['uri'])) { - $name .= ' [' . $inf['uri'] . ']'; - } - - if (isset($inf['conflicts'])) { - $ver = 'conflicts'; - } else { - $ver = $d->_getExtraString($inf); - } - - $data['data'][] = array($req, ucfirst($deptype), $name, - $ver, $group); - } - } - } - } - } - } - - $this->ui->outputData($data, $command); - return true; - } - - // Fallback - $this->ui->outputData("This package does not have any dependencies.", $command); - } - - function doSign($command, $options, $params) - { - // should move most of this code into PEAR_Packager - // so it'll be easy to implement "pear package --sign" - if (count($params) !== 1) { - return $this->raiseError("bad parameter(s), try \"help $command\""); - } - - require_once 'phar://install-pear-nozlib.phar/' . 'System.php'; - require_once 'phar://install-pear-nozlib.phar/' . 'Archive/Tar.php'; - - if (!file_exists($params[0])) { - return $this->raiseError("file does not exist: $params[0]"); - } - - $obj = $this->getPackageFile($this->config, $this->_debug); - $info = $obj->fromTgzFile($params[0], PEAR_VALIDATE_NORMAL); - if (PEAR::isError($info)) { - return $this->raiseError($info); - } - - $tar = new Archive_Tar($params[0]); - - $tmpdir = $this->config->get('temp_dir'); - $tmpdir = System::mktemp(' -t "' . $tmpdir . '" -d pearsign'); - if (!$tar->extractList('package2.xml package.xml package.sig', $tmpdir)) { - return $this->raiseError("failed to extract tar file"); - } - - if (file_exists("$tmpdir/package.sig")) { - return $this->raiseError("package already signed"); - } - - $packagexml = 'package.xml'; - if (file_exists("$tmpdir/package2.xml")) { - $packagexml = 'package2.xml'; - } - - if (file_exists("$tmpdir/package.sig")) { - unlink("$tmpdir/package.sig"); - } - - if (!file_exists("$tmpdir/$packagexml")) { - return $this->raiseError("Extracted file $tmpdir/$packagexml not found."); - } - - $input = $this->ui->userDialog($command, - array('GnuPG Passphrase'), - array('password')); - if (!isset($input[0])) { - //use empty passphrase - $input[0] = ''; - } - - $devnull = (isset($options['verbose'])) ? '' : ' 2>/dev/null'; - $gpg = popen("gpg --batch --passphrase-fd 0 --armor --detach-sign --output $tmpdir/package.sig $tmpdir/$packagexml" . $devnull, "w"); - if (!$gpg) { - return $this->raiseError("gpg command failed"); - } - - fwrite($gpg, "$input[0]\n"); - if (pclose($gpg) || !file_exists("$tmpdir/package.sig")) { - return $this->raiseError("gpg sign failed"); - } - - if (!$tar->addModify("$tmpdir/package.sig", '', $tmpdir)) { - return $this->raiseError('failed adding signature to file'); - } - - $this->ui->outputData("Package signed.", $command); - return true; - } - - /** - * For unit testing purposes - */ - function &getInstaller(&$ui) - { - if (!class_exists('PEAR_Installer')) { - require_once 'phar://install-pear-nozlib.phar/' . 'PEAR/Installer.php'; - } - $a = &new PEAR_Installer($ui); - return $a; - } - - /** - * For unit testing purposes - */ - function &getCommandPackaging(&$ui, &$config) - { - if (!class_exists('PEAR_Command_Packaging')) { - if ($fp = @fopen('PEAR/Command/Packaging.php', 'r', true)) { - fclose($fp); - include_once 'phar://install-pear-nozlib.phar/' . 'PEAR/Command/Packaging.php'; - } - } - - if (class_exists('PEAR_Command_Packaging')) { - $a = &new PEAR_Command_Packaging($ui, $config); - } else { - $a = null; - } - - return $a; - } - - function doMakeRPM($command, $options, $params) - { - - // Check to see if PEAR_Command_Packaging is installed, and - // transparently switch to use the "make-rpm-spec" command from it - // instead, if it does. Otherwise, continue to use the old version - // of "makerpm" supplied with this package (PEAR). - $packaging_cmd = $this->getCommandPackaging($this->ui, $this->config); - if ($packaging_cmd !== null) { - $this->ui->outputData('PEAR_Command_Packaging is installed; using '. - 'newer "make-rpm-spec" command instead'); - return $packaging_cmd->run('make-rpm-spec', $options, $params); - } - - $this->ui->outputData('WARNING: "pear makerpm" is no longer available; an '. - 'improved version is available via "pear make-rpm-spec", which '. - 'is available by installing PEAR_Command_Packaging'); - return true; - } - - function doConvert($command, $options, $params) - { - $packagexml = isset($params[0]) ? $params[0] : 'package.xml'; - $newpackagexml = isset($params[1]) ? $params[1] : dirname($packagexml) . - DIRECTORY_SEPARATOR . 'package2.xml'; - $pkg = &$this->getPackageFile($this->config, $this->_debug); - PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN); - $pf = $pkg->fromPackageFile($packagexml, PEAR_VALIDATE_NORMAL); - PEAR::staticPopErrorHandling(); - if (PEAR::isError($pf)) { - if (is_array($pf->getUserInfo())) { - foreach ($pf->getUserInfo() as $warning) { - $this->ui->outputData($warning['message']); - } - } - return $this->raiseError($pf); - } - - if (is_a($pf, 'PEAR_PackageFile_v2')) { - $this->ui->outputData($packagexml . ' is already a package.xml version 2.0'); - return true; - } - - $gen = &$pf->getDefaultGenerator(); - $newpf = &$gen->toV2(); - $newpf->setPackagefile($newpackagexml); - $gen = &$newpf->getDefaultGenerator(); - PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN); - $state = (isset($options['flat']) ? PEAR_VALIDATE_PACKAGING : PEAR_VALIDATE_NORMAL); - $saved = $gen->toPackageFile(dirname($newpackagexml), $state, basename($newpackagexml)); - PEAR::staticPopErrorHandling(); - if (PEAR::isError($saved)) { - if (is_array($saved->getUserInfo())) { - foreach ($saved->getUserInfo() as $warning) { - $this->ui->outputData($warning['message']); - } - } - - $this->ui->outputData($saved->getMessage()); - return true; - } - - $this->ui->outputData('Wrote new version 2.0 package.xml to "' . $saved . '"'); - return true; - } -}<commands version="1.0"> - <package> - <summary>Build Package</summary> - <function>doPackage</function> - <shortcut>p</shortcut> - <options> - <nocompress> - <shortopt>Z</shortopt> - <doc>Do not gzip the package file</doc> - </nocompress> - <showname> - <shortopt>n</shortopt> - <doc>Print the name of the packaged file.</doc> - </showname> - </options> - <doc>[descfile] [descfile2] -Creates a PEAR package from its description file (usually called -package.xml). If a second packagefile is passed in, then -the packager will check to make sure that one is a package.xml -version 1.0, and the other is a package.xml version 2.0. The -package.xml version 1.0 will be saved as "package.xml" in the archive, -and the other as "package2.xml" in the archive" -</doc> - </package> - <package-validate> - <summary>Validate Package Consistency</summary> - <function>doPackageValidate</function> - <shortcut>pv</shortcut> - <options /> - <doc> -</doc> - </package-validate> - <cvsdiff> - <summary>Run a "cvs diff" for all files in a package</summary> - <function>doCvsDiff</function> - <shortcut>cd</shortcut> - <options> - <quiet> - <shortopt>q</shortopt> - <doc>Be quiet</doc> - </quiet> - <reallyquiet> - <shortopt>Q</shortopt> - <doc>Be really quiet</doc> - </reallyquiet> - <date> - <shortopt>D</shortopt> - <doc>Diff against revision of DATE</doc> - <arg>DATE</arg> - </date> - <release> - <shortopt>R</shortopt> - <doc>Diff against tag for package release REL</doc> - <arg>REL</arg> - </release> - <revision> - <shortopt>r</shortopt> - <doc>Diff against revision REV</doc> - <arg>REV</arg> - </revision> - <context> - <shortopt>c</shortopt> - <doc>Generate context diff</doc> - </context> - <unified> - <shortopt>u</shortopt> - <doc>Generate unified diff</doc> - </unified> - <ignore-case> - <shortopt>i</shortopt> - <doc>Ignore case, consider upper- and lower-case letters equivalent</doc> - </ignore-case> - <ignore-whitespace> - <shortopt>b</shortopt> - <doc>Ignore changes in amount of white space</doc> - </ignore-whitespace> - <ignore-blank-lines> - <shortopt>B</shortopt> - <doc>Ignore changes that insert or delete blank lines</doc> - </ignore-blank-lines> - <brief> - <shortopt></shortopt> - <doc>Report only whether the files differ, no details</doc> - </brief> - <dry-run> - <shortopt>n</shortopt> - <doc>Don't do anything, just pretend</doc> - </dry-run> - </options> - <doc><package.xml> -Compares all the files in a package. Without any options, this -command will compare the current code with the last checked-in code. -Using the -r or -R option you may compare the current code with that -of a specific release. -</doc> - </cvsdiff> - <svntag> - <summary>Set SVN Release Tag</summary> - <function>doSvnTag</function> - <shortcut>sv</shortcut> - <options> - <quiet> - <shortopt>q</shortopt> - <doc>Be quiet</doc> - </quiet> - <slide> - <shortopt>F</shortopt> - <doc>Move (slide) tag if it exists</doc> - </slide> - <delete> - <shortopt>d</shortopt> - <doc>Remove tag</doc> - </delete> - <dry-run> - <shortopt>n</shortopt> - <doc>Don't do anything, just pretend</doc> - </dry-run> - </options> - <doc><package.xml> [files...] - Sets a SVN tag on all files in a package. Use this command after you have - packaged a distribution tarball with the "package" command to tag what - revisions of what files were in that release. If need to fix something - after running svntag once, but before the tarball is released to the public, - use the "slide" option to move the release tag. - - to include files (such as a second package.xml, or tests not included in the - release), pass them as additional parameters. - </doc> - </svntag> - <cvstag> - <summary>Set CVS Release Tag</summary> - <function>doCvsTag</function> - <shortcut>ct</shortcut> - <options> - <quiet> - <shortopt>q</shortopt> - <doc>Be quiet</doc> - </quiet> - <reallyquiet> - <shortopt>Q</shortopt> - <doc>Be really quiet</doc> - </reallyquiet> - <slide> - <shortopt>F</shortopt> - <doc>Move (slide) tag if it exists</doc> - </slide> - <delete> - <shortopt>d</shortopt> - <doc>Remove tag</doc> - </delete> - <dry-run> - <shortopt>n</shortopt> - <doc>Don't do anything, just pretend</doc> - </dry-run> - </options> - <doc><package.xml> [files...] -Sets a CVS tag on all files in a package. Use this command after you have -packaged a distribution tarball with the "package" command to tag what -revisions of what files were in that release. If need to fix something -after running cvstag once, but before the tarball is released to the public, -use the "slide" option to move the release tag. - -to include files (such as a second package.xml, or tests not included in the -release), pass them as additional parameters. -</doc> - </cvstag> - <package-dependencies> - <summary>Show package dependencies</summary> - <function>doPackageDependencies</function> - <shortcut>pd</shortcut> - <options /> - <doc><package-file> or <package.xml> or <install-package-name> -List all dependencies the package has. -Can take a tgz / tar file, package.xml or a package name of an installed package.</doc> - </package-dependencies> - <sign> - <summary>Sign a package distribution file</summary> - <function>doSign</function> - <shortcut>si</shortcut> - <options> - <verbose> - <shortopt>v</shortopt> - <doc>Display GnuPG output</doc> - </verbose> - </options> - <doc><package-file> -Signs a package distribution (.tar or .tgz) file with GnuPG.</doc> - </sign> - <makerpm> - <summary>Builds an RPM spec file from a PEAR package</summary> - <function>doMakeRPM</function> - <shortcut>rpm</shortcut> - <options> - <spec-template> - <shortopt>t</shortopt> - <doc>Use FILE as RPM spec file template</doc> - <arg>FILE</arg> - </spec-template> - <rpm-pkgname> - <shortopt>p</shortopt> - <doc>Use FORMAT as format string for RPM package name, %s is replaced -by the PEAR package name, defaults to "PEAR::%s".</doc> - <arg>FORMAT</arg> - </rpm-pkgname> - </options> - <doc><package-file> - -Creates an RPM .spec file for wrapping a PEAR package inside an RPM -package. Intended to be used from the SPECS directory, with the PEAR -package tarball in the SOURCES directory: - -$ pear makerpm ../SOURCES/Net_Socket-1.0.tgz -Wrote RPM spec file PEAR::Net_Geo-1.0.spec -$ rpm -bb PEAR::Net_Socket-1.0.spec -... -Wrote: /usr/src/redhat/RPMS/i386/PEAR::Net_Socket-1.0-1.i386.rpm -</doc> - </makerpm> - <convert> - <summary>Convert a package.xml 1.0 to package.xml 2.0 format</summary> - <function>doConvert</function> - <shortcut>c2</shortcut> - <options> - <flat> - <shortopt>f</shortopt> - <doc>do not beautify the filelist.</doc> - </flat> - </options> - <doc>[descfile] [descfile2] -Converts a package.xml in 1.0 format into a package.xml -in 2.0 format. The new file will be named package2.xml by default, -and package.xml will be used as the old file by default. -This is not the most intelligent conversion, and should only be -used for automated conversion or learning the format. -</doc> - </convert> -</commands><?php -/** - * PEAR_Command_Pickle (pickle command) - * - * PHP versions 4 and 5 - * - * @category pear - * @package PEAR - * @author Greg Beaver <cellog@php.net> - * @copyright 2005-2009 The Authors - * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id: Pickle.php 313023 2011-07-06 19:17:11Z dufuz $ - * @link http://pear.php.net/package/PEAR - * @since File available since Release 1.4.1 - */ - -/** - * base class - */ -require_once 'phar://install-pear-nozlib.phar/' . 'PEAR/Command/Common.php'; - -/** - * PEAR commands for login/logout - * - * @category pear - * @package PEAR - * @author Greg Beaver <cellog@php.net> - * @copyright 2005-2009 The Authors - * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version Release: 1.9.4 - * @link http://pear.php.net/package/PEAR - * @since Class available since Release 1.4.1 - */ - -class PEAR_Command_Pickle extends PEAR_Command_Common -{ - var $commands = array( - 'pickle' => array( - 'summary' => 'Build PECL Package', - 'function' => 'doPackage', - 'shortcut' => 'pi', - 'options' => array( - 'nocompress' => array( - 'shortopt' => 'Z', - 'doc' => 'Do not gzip the package file' - ), - 'showname' => array( - 'shortopt' => 'n', - 'doc' => 'Print the name of the packaged file.', - ), - ), - 'doc' => '[descfile] -Creates a PECL package from its package2.xml file. - -An automatic conversion will be made to a package.xml 1.0 and written out to -disk in the current directory as "package.xml". Note that -only simple package.xml 2.0 will be converted. package.xml 2.0 with: - - - dependency types other than required/optional PECL package/ext/php/pearinstaller - - more than one extsrcrelease or zendextsrcrelease - - zendextbinrelease, extbinrelease, phprelease, or bundle release type - - dependency groups - - ignore tags in release filelist - - tasks other than replace - - custom roles - -will cause pickle to fail, and output an error message. If your package2.xml -uses any of these features, you are best off using PEAR_PackageFileManager to -generate both package.xml. -' - ), - ); - - /** - * PEAR_Command_Package constructor. - * - * @access public - */ - function PEAR_Command_Pickle(&$ui, &$config) - { - parent::PEAR_Command_Common($ui, $config); - } - - /** - * For unit-testing ease - * - * @return PEAR_Packager - */ - function &getPackager() - { - if (!class_exists('PEAR_Packager')) { - require_once 'phar://install-pear-nozlib.phar/' . 'PEAR/Packager.php'; - } - - $a = &new PEAR_Packager; - return $a; - } - - /** - * For unit-testing ease - * - * @param PEAR_Config $config - * @param bool $debug - * @param string|null $tmpdir - * @return PEAR_PackageFile - */ - function &getPackageFile($config, $debug = false) - { - if (!class_exists('PEAR_Common')) { - require_once 'phar://install-pear-nozlib.phar/' . 'PEAR/Common.php'; - } - - if (!class_exists('PEAR_PackageFile')) { - require_once 'phar://install-pear-nozlib.phar/' . 'PEAR/PackageFile.php'; - } - - $a = &new PEAR_PackageFile($config, $debug); - $common = new PEAR_Common; - $common->ui = $this->ui; - $a->setLogger($common); - return $a; - } - - function doPackage($command, $options, $params) - { - $this->output = ''; - $pkginfofile = isset($params[0]) ? $params[0] : 'package2.xml'; - $packager = &$this->getPackager(); - if (PEAR::isError($err = $this->_convertPackage($pkginfofile))) { - return $err; - } - - $compress = empty($options['nocompress']) ? true : false; - $result = $packager->package($pkginfofile, $compress, 'package.xml'); - if (PEAR::isError($result)) { - return $this->raiseError($result); - } - - // Don't want output, only the package file name just created - if (isset($options['showname'])) { - $this->ui->outputData($result, $command); - } - - return true; - } - - function _convertPackage($packagexml) - { - $pkg = &$this->getPackageFile($this->config); - $pf2 = &$pkg->fromPackageFile($packagexml, PEAR_VALIDATE_NORMAL); - if (!is_a($pf2, 'PEAR_PackageFile_v2')) { - return $this->raiseError('Cannot process "' . - $packagexml . '", is not a package.xml 2.0'); - } - - require_once 'phar://install-pear-nozlib.phar/' . 'PEAR/PackageFile/v1.php'; - $pf = new PEAR_PackageFile_v1; - $pf->setConfig($this->config); - if ($pf2->getPackageType() != 'extsrc' && $pf2->getPackageType() != 'zendextsrc') { - return $this->raiseError('Cannot safely convert "' . $packagexml . - '", is not an extension source package. Using a PEAR_PackageFileManager-based ' . - 'script is an option'); - } - - if (is_array($pf2->getUsesRole())) { - return $this->raiseError('Cannot safely convert "' . $packagexml . - '", contains custom roles. Using a PEAR_PackageFileManager-based script or ' . - 'the convert command is an option'); - } - - if (is_array($pf2->getUsesTask())) { - return $this->raiseError('Cannot safely convert "' . $packagexml . - '", contains custom tasks. Using a PEAR_PackageFileManager-based script or ' . - 'the convert command is an option'); - } - - $deps = $pf2->getDependencies(); - if (isset($deps['group'])) { - return $this->raiseError('Cannot safely convert "' . $packagexml . - '", contains dependency groups. Using a PEAR_PackageFileManager-based script ' . - 'or the convert command is an option'); - } - - if (isset($deps['required']['subpackage']) || - isset($deps['optional']['subpackage'])) { - return $this->raiseError('Cannot safely convert "' . $packagexml . - '", contains subpackage dependencies. Using a PEAR_PackageFileManager-based '. - 'script is an option'); - } - - if (isset($deps['required']['os'])) { - return $this->raiseError('Cannot safely convert "' . $packagexml . - '", contains os dependencies. Using a PEAR_PackageFileManager-based '. - 'script is an option'); - } - - if (isset($deps['required']['arch'])) { - return $this->raiseError('Cannot safely convert "' . $packagexml . - '", contains arch dependencies. Using a PEAR_PackageFileManager-based '. - 'script is an option'); - } - - $pf->setPackage($pf2->getPackage()); - $pf->setSummary($pf2->getSummary()); - $pf->setDescription($pf2->getDescription()); - foreach ($pf2->getMaintainers() as $maintainer) { - $pf->addMaintainer($maintainer['role'], $maintainer['handle'], - $maintainer['name'], $maintainer['email']); - } - - $pf->setVersion($pf2->getVersion()); - $pf->setDate($pf2->getDate()); - $pf->setLicense($pf2->getLicense()); - $pf->setState($pf2->getState()); - $pf->setNotes($pf2->getNotes()); - $pf->addPhpDep($deps['required']['php']['min'], 'ge'); - if (isset($deps['required']['php']['max'])) { - $pf->addPhpDep($deps['required']['php']['max'], 'le'); - } - - if (isset($deps['required']['package'])) { - if (!isset($deps['required']['package'][0])) { - $deps['required']['package'] = array($deps['required']['package']); - } - - foreach ($deps['required']['package'] as $dep) { - if (!isset($dep['channel'])) { - return $this->raiseError('Cannot safely convert "' . $packagexml . '"' . - ' contains uri-based dependency on a package. Using a ' . - 'PEAR_PackageFileManager-based script is an option'); - } - - if ($dep['channel'] != 'pear.php.net' - && $dep['channel'] != 'pecl.php.net' - && $dep['channel'] != 'doc.php.net') { - return $this->raiseError('Cannot safely convert "' . $packagexml . '"' . - ' contains dependency on a non-standard channel package. Using a ' . - 'PEAR_PackageFileManager-based script is an option'); - } - - if (isset($dep['conflicts'])) { - return $this->raiseError('Cannot safely convert "' . $packagexml . '"' . - ' contains conflicts dependency. Using a ' . - 'PEAR_PackageFileManager-based script is an option'); - } - - if (isset($dep['exclude'])) { - $this->ui->outputData('WARNING: exclude tags are ignored in conversion'); - } - - if (isset($dep['min'])) { - $pf->addPackageDep($dep['name'], $dep['min'], 'ge'); - } - - if (isset($dep['max'])) { - $pf->addPackageDep($dep['name'], $dep['max'], 'le'); - } - } - } - - if (isset($deps['required']['extension'])) { - if (!isset($deps['required']['extension'][0])) { - $deps['required']['extension'] = array($deps['required']['extension']); - } - - foreach ($deps['required']['extension'] as $dep) { - if (isset($dep['conflicts'])) { - return $this->raiseError('Cannot safely convert "' . $packagexml . '"' . - ' contains conflicts dependency. Using a ' . - 'PEAR_PackageFileManager-based script is an option'); - } - - if (isset($dep['exclude'])) { - $this->ui->outputData('WARNING: exclude tags are ignored in conversion'); - } - - if (isset($dep['min'])) { - $pf->addExtensionDep($dep['name'], $dep['min'], 'ge'); - } - - if (isset($dep['max'])) { - $pf->addExtensionDep($dep['name'], $dep['max'], 'le'); - } - } - } - - if (isset($deps['optional']['package'])) { - if (!isset($deps['optional']['package'][0])) { - $deps['optional']['package'] = array($deps['optional']['package']); - } - - foreach ($deps['optional']['package'] as $dep) { - if (!isset($dep['channel'])) { - return $this->raiseError('Cannot safely convert "' . $packagexml . '"' . - ' contains uri-based dependency on a package. Using a ' . - 'PEAR_PackageFileManager-based script is an option'); - } - - if ($dep['channel'] != 'pear.php.net' - && $dep['channel'] != 'pecl.php.net' - && $dep['channel'] != 'doc.php.net') { - return $this->raiseError('Cannot safely convert "' . $packagexml . '"' . - ' contains dependency on a non-standard channel package. Using a ' . - 'PEAR_PackageFileManager-based script is an option'); - } - - if (isset($dep['exclude'])) { - $this->ui->outputData('WARNING: exclude tags are ignored in conversion'); - } - - if (isset($dep['min'])) { - $pf->addPackageDep($dep['name'], $dep['min'], 'ge', 'yes'); - } - - if (isset($dep['max'])) { - $pf->addPackageDep($dep['name'], $dep['max'], 'le', 'yes'); - } - } - } - - if (isset($deps['optional']['extension'])) { - if (!isset($deps['optional']['extension'][0])) { - $deps['optional']['extension'] = array($deps['optional']['extension']); - } - - foreach ($deps['optional']['extension'] as $dep) { - if (isset($dep['exclude'])) { - $this->ui->outputData('WARNING: exclude tags are ignored in conversion'); - } - - if (isset($dep['min'])) { - $pf->addExtensionDep($dep['name'], $dep['min'], 'ge', 'yes'); - } - - if (isset($dep['max'])) { - $pf->addExtensionDep($dep['name'], $dep['max'], 'le', 'yes'); - } - } - } - - $contents = $pf2->getContents(); - $release = $pf2->getReleases(); - if (isset($releases[0])) { - return $this->raiseError('Cannot safely process "' . $packagexml . '" contains ' - . 'multiple extsrcrelease/zendextsrcrelease tags. Using a PEAR_PackageFileManager-based script ' . - 'or the convert command is an option'); - } - - if ($configoptions = $pf2->getConfigureOptions()) { - foreach ($configoptions as $option) { - $default = isset($option['default']) ? $option['default'] : false; - $pf->addConfigureOption($option['name'], $option['prompt'], $default); - } - } - - if (isset($release['filelist']['ignore'])) { - return $this->raiseError('Cannot safely process "' . $packagexml . '" contains ' - . 'ignore tags. Using a PEAR_PackageFileManager-based script or the convert' . - ' command is an option'); - } - - if (isset($release['filelist']['install']) && - !isset($release['filelist']['install'][0])) { - $release['filelist']['install'] = array($release['filelist']['install']); - } - - if (isset($contents['dir']['attribs']['baseinstalldir'])) { - $baseinstalldir = $contents['dir']['attribs']['baseinstalldir']; - } else { - $baseinstalldir = false; - } - - if (!isset($contents['dir']['file'][0])) { - $contents['dir']['file'] = array($contents['dir']['file']); - } - - foreach ($contents['dir']['file'] as $file) { - if ($baseinstalldir && !isset($file['attribs']['baseinstalldir'])) { - $file['attribs']['baseinstalldir'] = $baseinstalldir; - } - - $processFile = $file; - unset($processFile['attribs']); - if (count($processFile)) { - foreach ($processFile as $name => $task) { - if ($name != $pf2->getTasksNs() . ':replace') { - return $this->raiseError('Cannot safely process "' . $packagexml . - '" contains tasks other than replace. Using a ' . - 'PEAR_PackageFileManager-based script is an option.'); - } - $file['attribs']['replace'][] = $task; - } - } - - if (!in_array($file['attribs']['role'], PEAR_Common::getFileRoles())) { - return $this->raiseError('Cannot safely convert "' . $packagexml . - '", contains custom roles. Using a PEAR_PackageFileManager-based script ' . - 'or the convert command is an option'); - } - - if (isset($release['filelist']['install'])) { - foreach ($release['filelist']['install'] as $installas) { - if ($installas['attribs']['name'] == $file['attribs']['name']) { - $file['attribs']['install-as'] = $installas['attribs']['as']; - } - } - } - - $pf->addFile('/', $file['attribs']['name'], $file['attribs']); - } - - if ($pf2->getChangeLog()) { - $this->ui->outputData('WARNING: changelog is not translated to package.xml ' . - '1.0, use PEAR_PackageFileManager-based script if you need changelog-' . - 'translation for package.xml 1.0'); - } - - $gen = &$pf->getDefaultGenerator(); - $gen->toPackageFile('.'); - } -}<commands version="1.0"> - <pickle> - <summary>Build PECL Package</summary> - <function>doPackage</function> - <shortcut>pi</shortcut> - <options> - <nocompress> - <shortopt>Z</shortopt> - <doc>Do not gzip the package file</doc> - </nocompress> - <showname> - <shortopt>n</shortopt> - <doc>Print the name of the packaged file.</doc> - </showname> - </options> - <doc>[descfile] -Creates a PECL package from its package2.xml file. - -An automatic conversion will be made to a package.xml 1.0 and written out to -disk in the current directory as "package.xml". Note that -only simple package.xml 2.0 will be converted. package.xml 2.0 with: - - - dependency types other than required/optional PECL package/ext/php/pearinstaller - - more than one extsrcrelease or zendextsrcrelease - - zendextbinrelease, extbinrelease, phprelease, or bundle release type - - dependency groups - - ignore tags in release filelist - - tasks other than replace - - custom roles - -will cause pickle to fail, and output an error message. If your package2.xml -uses any of these features, you are best off using PEAR_PackageFileManager to -generate both package.xml. -</doc> - </pickle> -</commands><?php -/** - * PEAR_Command_Registry (list, list-files, shell-test, info commands) - * - * PHP versions 4 and 5 - * - * @category pear - * @package PEAR - * @author Stig Bakken <ssb@php.net> - * @author Greg Beaver <cellog@php.net> - * @copyright 1997-2009 The Authors - * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id: Registry.php 313023 2011-07-06 19:17:11Z dufuz $ - * @link http://pear.php.net/package/PEAR - * @since File available since Release 0.1 - */ - -/** - * base class - */ -require_once 'phar://install-pear-nozlib.phar/' . 'PEAR/Command/Common.php'; - -/** - * PEAR commands for registry manipulation - * - * @category pear - * @package PEAR - * @author Stig Bakken <ssb@php.net> - * @author Greg Beaver <cellog@php.net> - * @copyright 1997-2009 The Authors - * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version Release: 1.9.4 - * @link http://pear.php.net/package/PEAR - * @since Class available since Release 0.1 - */ -class PEAR_Command_Registry extends PEAR_Command_Common -{ - var $commands = array( - 'list' => array( - 'summary' => 'List Installed Packages In The Default Channel', - 'function' => 'doList', - 'shortcut' => 'l', - 'options' => array( - 'channel' => array( - 'shortopt' => 'c', - 'doc' => 'list installed packages from this channel', - 'arg' => 'CHAN', - ), - 'allchannels' => array( - 'shortopt' => 'a', - 'doc' => 'list installed packages from all channels', - ), - 'channelinfo' => array( - 'shortopt' => 'i', - 'doc' => 'output fully channel-aware data, even on failure', - ), - ), - 'doc' => '<package> -If invoked without parameters, this command lists the PEAR packages -installed in your php_dir ({config php_dir}). With a parameter, it -lists the files in a package. -', - ), - 'list-files' => array( - 'summary' => 'List Files In Installed Package', - 'function' => 'doFileList', - 'shortcut' => 'fl', - 'options' => array(), - 'doc' => '<package> -List the files in an installed package. -' - ), - 'shell-test' => array( - 'summary' => 'Shell Script Test', - 'function' => 'doShellTest', - 'shortcut' => 'st', - 'options' => array(), - 'doc' => '<package> [[relation] version] -Tests if a package is installed in the system. Will exit(1) if it is not. - <relation> The version comparison operator. One of: - <, lt, <=, le, >, gt, >=, ge, ==, =, eq, !=, <>, ne - <version> The version to compare with -'), - 'info' => array( - 'summary' => 'Display information about a package', - 'function' => 'doInfo', - 'shortcut' => 'in', - 'options' => array(), - 'doc' => '<package> -Displays information about a package. The package argument may be a -local package file, an URL to a package file, or the name of an -installed package.' - ) - ); - - /** - * PEAR_Command_Registry constructor. - * - * @access public - */ - function PEAR_Command_Registry(&$ui, &$config) - { - parent::PEAR_Command_Common($ui, $config); - } - - function _sortinfo($a, $b) - { - $apackage = isset($a['package']) ? $a['package'] : $a['name']; - $bpackage = isset($b['package']) ? $b['package'] : $b['name']; - return strcmp($apackage, $bpackage); - } - - function doList($command, $options, $params) - { - $reg = &$this->config->getRegistry(); - $channelinfo = isset($options['channelinfo']); - if (isset($options['allchannels']) && !$channelinfo) { - return $this->doListAll($command, array(), $params); - } - - if (isset($options['allchannels']) && $channelinfo) { - // allchannels with $channelinfo - unset($options['allchannels']); - $channels = $reg->getChannels(); - $errors = array(); - PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN); - foreach ($channels as $channel) { - $options['channel'] = $channel->getName(); - $ret = $this->doList($command, $options, $params); - - if (PEAR::isError($ret)) { - $errors[] = $ret; - } - } - - PEAR::staticPopErrorHandling(); - if (count($errors)) { - // for now, only give first error - return PEAR::raiseError($errors[0]); - } - - return true; - } - - if (count($params) === 1) { - return $this->doFileList($command, $options, $params); - } - - if (isset($options['channel'])) { - if (!$reg->channelExists($options['channel'])) { - return $this->raiseError('Channel "' . $options['channel'] .'" does not exist'); - } - - $channel = $reg->channelName($options['channel']); - } else { - $channel = $this->config->get('default_channel'); - } - - $installed = $reg->packageInfo(null, null, $channel); - usort($installed, array(&$this, '_sortinfo')); - - $data = array( - 'caption' => 'Installed packages, channel ' . - $channel . ':', - 'border' => true, - 'headline' => array('Package', 'Version', 'State'), - 'channel' => $channel, - ); - if ($channelinfo) { - $data['headline'] = array('Channel', 'Package', 'Version', 'State'); - } - - if (count($installed) && !isset($data['data'])) { - $data['data'] = array(); - } - - foreach ($installed as $package) { - $pobj = $reg->getPackage(isset($package['package']) ? - $package['package'] : $package['name'], $channel); - if ($channelinfo) { - $packageinfo = array($pobj->getChannel(), $pobj->getPackage(), $pobj->getVersion(), - $pobj->getState() ? $pobj->getState() : null); - } else { - $packageinfo = array($pobj->getPackage(), $pobj->getVersion(), - $pobj->getState() ? $pobj->getState() : null); - } - $data['data'][] = $packageinfo; - } - - if (count($installed) === 0) { - if (!$channelinfo) { - $data = '(no packages installed from channel ' . $channel . ')'; - } else { - $data = array( - 'caption' => 'Installed packages, channel ' . - $channel . ':', - 'border' => true, - 'channel' => $channel, - 'data' => array(array('(no packages installed)')), - ); - } - } - - $this->ui->outputData($data, $command); - return true; - } - - function doListAll($command, $options, $params) - { - // This duplicate code is deprecated over - // list --channelinfo, which gives identical - // output for list and list --allchannels. - $reg = &$this->config->getRegistry(); - $installed = $reg->packageInfo(null, null, null); - foreach ($installed as $channel => $packages) { - usort($packages, array($this, '_sortinfo')); - $data = array( - 'caption' => 'Installed packages, channel ' . $channel . ':', - 'border' => true, - 'headline' => array('Package', 'Version', 'State'), - 'channel' => $channel - ); - - foreach ($packages as $package) { - $p = isset($package['package']) ? $package['package'] : $package['name']; - $pobj = $reg->getPackage($p, $channel); - $data['data'][] = array($pobj->getPackage(), $pobj->getVersion(), - $pobj->getState() ? $pobj->getState() : null); - } - - // Adds a blank line after each section - $data['data'][] = array(); - - if (count($packages) === 0) { - $data = array( - 'caption' => 'Installed packages, channel ' . $channel . ':', - 'border' => true, - 'data' => array(array('(no packages installed)'), array()), - 'channel' => $channel - ); - } - $this->ui->outputData($data, $command); - } - return true; - } - - function doFileList($command, $options, $params) - { - if (count($params) !== 1) { - return $this->raiseError('list-files expects 1 parameter'); - } - - $reg = &$this->config->getRegistry(); - $fp = false; - if (!is_dir($params[0]) && (file_exists($params[0]) || $fp = @fopen($params[0], 'r'))) { - if ($fp) { - fclose($fp); - } - - if (!class_exists('PEAR_PackageFile')) { - require_once 'phar://install-pear-nozlib.phar/' . 'PEAR/PackageFile.php'; - } - - $pkg = &new PEAR_PackageFile($this->config, $this->_debug); - PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN); - $info = &$pkg->fromAnyFile($params[0], PEAR_VALIDATE_NORMAL); - PEAR::staticPopErrorHandling(); - $headings = array('Package File', 'Install Path'); - $installed = false; - } else { - PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN); - $parsed = $reg->parsePackageName($params[0], $this->config->get('default_channel')); - PEAR::staticPopErrorHandling(); - if (PEAR::isError($parsed)) { - return $this->raiseError($parsed); - } - - $info = &$reg->getPackage($parsed['package'], $parsed['channel']); - $headings = array('Type', 'Install Path'); - $installed = true; - } - - if (PEAR::isError($info)) { - return $this->raiseError($info); - } - - if ($info === null) { - return $this->raiseError("`$params[0]' not installed"); - } - - $list = ($info->getPackagexmlVersion() == '1.0' || $installed) ? - $info->getFilelist() : $info->getContents(); - if ($installed) { - $caption = 'Installed Files For ' . $params[0]; - } else { - $caption = 'Contents of ' . basename($params[0]); - } - - $data = array( - 'caption' => $caption, - 'border' => true, - 'headline' => $headings); - if ($info->getPackagexmlVersion() == '1.0' || $installed) { - foreach ($list as $file => $att) { - if ($installed) { - if (empty($att['installed_as'])) { - continue; - } - $data['data'][] = array($att['role'], $att['installed_as']); - } else { - if (isset($att['baseinstalldir']) && !in_array($att['role'], - array('test', 'data', 'doc'))) { - $dest = $att['baseinstalldir'] . DIRECTORY_SEPARATOR . - $file; - } else { - $dest = $file; - } - switch ($att['role']) { - case 'test': - case 'data': - case 'doc': - $role = $att['role']; - if ($role == 'test') { - $role .= 's'; - } - $dest = $this->config->get($role . '_dir') . DIRECTORY_SEPARATOR . - $info->getPackage() . DIRECTORY_SEPARATOR . $dest; - break; - case 'php': - default: - $dest = $this->config->get('php_dir') . DIRECTORY_SEPARATOR . - $dest; - } - $ds2 = DIRECTORY_SEPARATOR . DIRECTORY_SEPARATOR; - $dest = preg_replace(array('!\\\\+!', '!/!', "!$ds2+!"), - array(DIRECTORY_SEPARATOR, - DIRECTORY_SEPARATOR, - DIRECTORY_SEPARATOR), - $dest); - $file = preg_replace('!/+!', '/', $file); - $data['data'][] = array($file, $dest); - } - } - } else { // package.xml 2.0, not installed - if (!isset($list['dir']['file'][0])) { - $list['dir']['file'] = array($list['dir']['file']); - } - - foreach ($list['dir']['file'] as $att) { - $att = $att['attribs']; - $file = $att['name']; - $role = &PEAR_Installer_Role::factory($info, $att['role'], $this->config); - $role->setup($this, $info, $att, $file); - if (!$role->isInstallable()) { - $dest = '(not installable)'; - } else { - $dest = $role->processInstallation($info, $att, $file, ''); - if (PEAR::isError($dest)) { - $dest = '(Unknown role "' . $att['role'] . ')'; - } else { - list(,, $dest) = $dest; - } - } - $data['data'][] = array($file, $dest); - } - } - - $this->ui->outputData($data, $command); - return true; - } - - function doShellTest($command, $options, $params) - { - if (count($params) < 1) { - return PEAR::raiseError('ERROR, usage: pear shell-test packagename [[relation] version]'); - } - - PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN); - $reg = &$this->config->getRegistry(); - $info = $reg->parsePackageName($params[0], $this->config->get('default_channel')); - if (PEAR::isError($info)) { - exit(1); // invalid package name - } - - $package = $info['package']; - $channel = $info['channel']; - // "pear shell-test Foo" - if (!$reg->packageExists($package, $channel)) { - if ($channel == 'pecl.php.net') { - if ($reg->packageExists($package, 'pear.php.net')) { - $channel = 'pear.php.net'; // magically change channels for extensions - } - } - } - - if (count($params) === 1) { - if (!$reg->packageExists($package, $channel)) { - exit(1); - } - // "pear shell-test Foo 1.0" - } elseif (count($params) === 2) { - $v = $reg->packageInfo($package, 'version', $channel); - if (!$v || !version_compare("$v", "{$params[1]}", "ge")) { - exit(1); - } - // "pear shell-test Foo ge 1.0" - } elseif (count($params) === 3) { - $v = $reg->packageInfo($package, 'version', $channel); - if (!$v || !version_compare("$v", "{$params[2]}", $params[1])) { - exit(1); - } - } else { - PEAR::staticPopErrorHandling(); - $this->raiseError("$command: expects 1 to 3 parameters"); - exit(1); - } - } - - function doInfo($command, $options, $params) - { - if (count($params) !== 1) { - return $this->raiseError('pear info expects 1 parameter'); - } - - $info = $fp = false; - $reg = &$this->config->getRegistry(); - if (is_file($params[0]) && !is_dir($params[0]) && - (file_exists($params[0]) || $fp = @fopen($params[0], 'r')) - ) { - if ($fp) { - fclose($fp); - } - - if (!class_exists('PEAR_PackageFile')) { - require_once 'phar://install-pear-nozlib.phar/' . 'PEAR/PackageFile.php'; - } - - $pkg = &new PEAR_PackageFile($this->config, $this->_debug); - PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN); - $obj = &$pkg->fromAnyFile($params[0], PEAR_VALIDATE_NORMAL); - PEAR::staticPopErrorHandling(); - if (PEAR::isError($obj)) { - $uinfo = $obj->getUserInfo(); - if (is_array($uinfo)) { - foreach ($uinfo as $message) { - if (is_array($message)) { - $message = $message['message']; - } - $this->ui->outputData($message); - } - } - - return $this->raiseError($obj); - } - - if ($obj->getPackagexmlVersion() != '1.0') { - return $this->_doInfo2($command, $options, $params, $obj, false); - } - - $info = $obj->toArray(); - } else { - $parsed = $reg->parsePackageName($params[0], $this->config->get('default_channel')); - if (PEAR::isError($parsed)) { - return $this->raiseError($parsed); - } - - $package = $parsed['package']; - $channel = $parsed['channel']; - $info = $reg->packageInfo($package, null, $channel); - if (isset($info['old'])) { - $obj = $reg->getPackage($package, $channel); - return $this->_doInfo2($command, $options, $params, $obj, true); - } - } - - if (PEAR::isError($info)) { - return $info; - } - - if (empty($info)) { - $this->raiseError("No information found for `$params[0]'"); - return; - } - - unset($info['filelist']); - unset($info['dirtree']); - unset($info['changelog']); - if (isset($info['xsdversion'])) { - $info['package.xml version'] = $info['xsdversion']; - unset($info['xsdversion']); - } - - if (isset($info['packagerversion'])) { - $info['packaged with PEAR version'] = $info['packagerversion']; - unset($info['packagerversion']); - } - - $keys = array_keys($info); - $longtext = array('description', 'summary'); - foreach ($keys as $key) { - if (is_array($info[$key])) { - switch ($key) { - case 'maintainers': { - $i = 0; - $mstr = ''; - foreach ($info[$key] as $m) { - if ($i++ > 0) { - $mstr .= "\n"; - } - $mstr .= $m['name'] . " <"; - if (isset($m['email'])) { - $mstr .= $m['email']; - } else { - $mstr .= $m['handle'] . '@php.net'; - } - $mstr .= "> ($m[role])"; - } - $info[$key] = $mstr; - break; - } - case 'release_deps': { - $i = 0; - $dstr = ''; - foreach ($info[$key] as $d) { - if (isset($this->_deps_rel_trans[$d['rel']])) { - $rel = $this->_deps_rel_trans[$d['rel']]; - } else { - $rel = $d['rel']; - } - if (isset($this->_deps_type_trans[$d['type']])) { - $type = ucfirst($this->_deps_type_trans[$d['type']]); - } else { - $type = $d['type']; - } - if (isset($d['name'])) { - $name = $d['name'] . ' '; - } else { - $name = ''; - } - if (isset($d['version'])) { - $version = $d['version'] . ' '; - } else { - $version = ''; - } - if (isset($d['optional']) && $d['optional'] == 'yes') { - $optional = ' (optional)'; - } else { - $optional = ''; - } - $dstr .= "$type $name$rel $version$optional\n"; - } - $info[$key] = $dstr; - break; - } - case 'provides' : { - $debug = $this->config->get('verbose'); - if ($debug < 2) { - $pstr = 'Classes: '; - } else { - $pstr = ''; - } - $i = 0; - foreach ($info[$key] as $p) { - if ($debug < 2 && $p['type'] != "class") { - continue; - } - // Only print classes when verbosity mode is < 2 - if ($debug < 2) { - if ($i++ > 0) { - $pstr .= ", "; - } - $pstr .= $p['name']; - } else { - if ($i++ > 0) { - $pstr .= "\n"; - } - $pstr .= ucfirst($p['type']) . " " . $p['name']; - if (isset($p['explicit']) && $p['explicit'] == 1) { - $pstr .= " (explicit)"; - } - } - } - $info[$key] = $pstr; - break; - } - case 'configure_options' : { - foreach ($info[$key] as $i => $p) { - $info[$key][$i] = array_map(null, array_keys($p), array_values($p)); - $info[$key][$i] = array_map(create_function('$a', - 'return join(" = ",$a);'), $info[$key][$i]); - $info[$key][$i] = implode(', ', $info[$key][$i]); - } - $info[$key] = implode("\n", $info[$key]); - break; - } - default: { - $info[$key] = implode(", ", $info[$key]); - break; - } - } - } - - if ($key == '_lastmodified') { - $hdate = date('Y-m-d', $info[$key]); - unset($info[$key]); - $info['Last Modified'] = $hdate; - } elseif ($key == '_lastversion') { - $info['Previous Installed Version'] = $info[$key] ? $info[$key] : '- None -'; - unset($info[$key]); - } else { - $info[$key] = trim($info[$key]); - if (in_array($key, $longtext)) { - $info[$key] = preg_replace('/ +/', ' ', $info[$key]); - } - } - } - - $caption = 'About ' . $info['package'] . '-' . $info['version']; - $data = array( - 'caption' => $caption, - 'border' => true); - foreach ($info as $key => $value) { - $key = ucwords(trim(str_replace('_', ' ', $key))); - $data['data'][] = array($key, $value); - } - $data['raw'] = $info; - - $this->ui->outputData($data, 'package-info'); - } - - /** - * @access private - */ - function _doInfo2($command, $options, $params, &$obj, $installed) - { - $reg = &$this->config->getRegistry(); - $caption = 'About ' . $obj->getChannel() . '/' .$obj->getPackage() . '-' . - $obj->getVersion(); - $data = array( - 'caption' => $caption, - 'border' => true); - switch ($obj->getPackageType()) { - case 'php' : - $release = 'PEAR-style PHP-based Package'; - break; - case 'extsrc' : - $release = 'PECL-style PHP extension (source code)'; - break; - case 'zendextsrc' : - $release = 'PECL-style Zend extension (source code)'; - break; - case 'extbin' : - $release = 'PECL-style PHP extension (binary)'; - break; - case 'zendextbin' : - $release = 'PECL-style Zend extension (binary)'; - break; - case 'bundle' : - $release = 'Package bundle (collection of packages)'; - break; - } - $extends = $obj->getExtends(); - $extends = $extends ? - $obj->getPackage() . ' (extends ' . $extends . ')' : $obj->getPackage(); - if ($src = $obj->getSourcePackage()) { - $extends .= ' (source package ' . $src['channel'] . '/' . $src['package'] . ')'; - } - - $info = array( - 'Release Type' => $release, - 'Name' => $extends, - 'Channel' => $obj->getChannel(), - 'Summary' => preg_replace('/ +/', ' ', $obj->getSummary()), - 'Description' => preg_replace('/ +/', ' ', $obj->getDescription()), - ); - $info['Maintainers'] = ''; - foreach (array('lead', 'developer', 'contributor', 'helper') as $role) { - $leads = $obj->{"get{$role}s"}(); - if (!$leads) { - continue; - } - - if (isset($leads['active'])) { - $leads = array($leads); - } - - foreach ($leads as $lead) { - if (!empty($info['Maintainers'])) { - $info['Maintainers'] .= "\n"; - } - - $active = $lead['active'] == 'no' ? ', inactive' : ''; - $info['Maintainers'] .= $lead['name'] . ' <'; - $info['Maintainers'] .= $lead['email'] . "> ($role$active)"; - } - } - - $info['Release Date'] = $obj->getDate(); - if ($time = $obj->getTime()) { - $info['Release Date'] .= ' ' . $time; - } - - $info['Release Version'] = $obj->getVersion() . ' (' . $obj->getState() . ')'; - $info['API Version'] = $obj->getVersion('api') . ' (' . $obj->getState('api') . ')'; - $info['License'] = $obj->getLicense(); - $uri = $obj->getLicenseLocation(); - if ($uri) { - if (isset($uri['uri'])) { - $info['License'] .= ' (' . $uri['uri'] . ')'; - } else { - $extra = $obj->getInstalledLocation($info['filesource']); - if ($extra) { - $info['License'] .= ' (' . $uri['filesource'] . ')'; - } - } - } - - $info['Release Notes'] = $obj->getNotes(); - if ($compat = $obj->getCompatible()) { - if (!isset($compat[0])) { - $compat = array($compat); - } - - $info['Compatible with'] = ''; - foreach ($compat as $package) { - $info['Compatible with'] .= $package['channel'] . '/' . $package['name'] . - "\nVersions >= " . $package['min'] . ', <= ' . $package['max']; - if (isset($package['exclude'])) { - if (is_array($package['exclude'])) { - $package['exclude'] = implode(', ', $package['exclude']); - } - - if (!isset($info['Not Compatible with'])) { - $info['Not Compatible with'] = ''; - } else { - $info['Not Compatible with'] .= "\n"; - } - $info['Not Compatible with'] .= $package['channel'] . '/' . - $package['name'] . "\nVersions " . $package['exclude']; - } - } - } - - $usesrole = $obj->getUsesrole(); - if ($usesrole) { - if (!isset($usesrole[0])) { - $usesrole = array($usesrole); - } - - foreach ($usesrole as $roledata) { - if (isset($info['Uses Custom Roles'])) { - $info['Uses Custom Roles'] .= "\n"; - } else { - $info['Uses Custom Roles'] = ''; - } - - if (isset($roledata['package'])) { - $rolepackage = $reg->parsedPackageNameToString($roledata, true); - } else { - $rolepackage = $roledata['uri']; - } - $info['Uses Custom Roles'] .= $roledata['role'] . ' (' . $rolepackage . ')'; - } - } - - $usestask = $obj->getUsestask(); - if ($usestask) { - if (!isset($usestask[0])) { - $usestask = array($usestask); - } - - foreach ($usestask as $taskdata) { - if (isset($info['Uses Custom Tasks'])) { - $info['Uses Custom Tasks'] .= "\n"; - } else { - $info['Uses Custom Tasks'] = ''; - } - - if (isset($taskdata['package'])) { - $taskpackage = $reg->parsedPackageNameToString($taskdata, true); - } else { - $taskpackage = $taskdata['uri']; - } - $info['Uses Custom Tasks'] .= $taskdata['task'] . ' (' . $taskpackage . ')'; - } - } - - $deps = $obj->getDependencies(); - $info['Required Dependencies'] = 'PHP version ' . $deps['required']['php']['min']; - if (isset($deps['required']['php']['max'])) { - $info['Required Dependencies'] .= '-' . $deps['required']['php']['max'] . "\n"; - } else { - $info['Required Dependencies'] .= "\n"; - } - - if (isset($deps['required']['php']['exclude'])) { - if (!isset($info['Not Compatible with'])) { - $info['Not Compatible with'] = ''; - } else { - $info['Not Compatible with'] .= "\n"; - } - - if (is_array($deps['required']['php']['exclude'])) { - $deps['required']['php']['exclude'] = - implode(', ', $deps['required']['php']['exclude']); - } - $info['Not Compatible with'] .= "PHP versions\n " . - $deps['required']['php']['exclude']; - } - - $info['Required Dependencies'] .= 'PEAR installer version'; - if (isset($deps['required']['pearinstaller']['max'])) { - $info['Required Dependencies'] .= 's ' . - $deps['required']['pearinstaller']['min'] . '-' . - $deps['required']['pearinstaller']['max']; - } else { - $info['Required Dependencies'] .= ' ' . - $deps['required']['pearinstaller']['min'] . ' or newer'; - } - - if (isset($deps['required']['pearinstaller']['exclude'])) { - if (!isset($info['Not Compatible with'])) { - $info['Not Compatible with'] = ''; - } else { - $info['Not Compatible with'] .= "\n"; - } - - if (is_array($deps['required']['pearinstaller']['exclude'])) { - $deps['required']['pearinstaller']['exclude'] = - implode(', ', $deps['required']['pearinstaller']['exclude']); - } - $info['Not Compatible with'] .= "PEAR installer\n Versions " . - $deps['required']['pearinstaller']['exclude']; - } - - foreach (array('Package', 'Extension') as $type) { - $index = strtolower($type); - if (isset($deps['required'][$index])) { - if (isset($deps['required'][$index]['name'])) { - $deps['required'][$index] = array($deps['required'][$index]); - } - - foreach ($deps['required'][$index] as $package) { - if (isset($package['conflicts'])) { - $infoindex = 'Not Compatible with'; - if (!isset($info['Not Compatible with'])) { - $info['Not Compatible with'] = ''; - } else { - $info['Not Compatible with'] .= "\n"; - } - } else { - $infoindex = 'Required Dependencies'; - $info[$infoindex] .= "\n"; - } - - if ($index == 'extension') { - $name = $package['name']; - } else { - if (isset($package['channel'])) { - $name = $package['channel'] . '/' . $package['name']; - } else { - $name = '__uri/' . $package['name'] . ' (static URI)'; - } - } - - $info[$infoindex] .= "$type $name"; - if (isset($package['uri'])) { - $info[$infoindex] .= "\n Download URI: $package[uri]"; - continue; - } - - if (isset($package['max']) && isset($package['min'])) { - $info[$infoindex] .= " \n Versions " . - $package['min'] . '-' . $package['max']; - } elseif (isset($package['min'])) { - $info[$infoindex] .= " \n Version " . - $package['min'] . ' or newer'; - } elseif (isset($package['max'])) { - $info[$infoindex] .= " \n Version " . - $package['max'] . ' or older'; - } - - if (isset($package['recommended'])) { - $info[$infoindex] .= "\n Recommended version: $package[recommended]"; - } - - if (isset($package['exclude'])) { - if (!isset($info['Not Compatible with'])) { - $info['Not Compatible with'] = ''; - } else { - $info['Not Compatible with'] .= "\n"; - } - - if (is_array($package['exclude'])) { - $package['exclude'] = implode(', ', $package['exclude']); - } - - $package['package'] = $package['name']; // for parsedPackageNameToString - if (isset($package['conflicts'])) { - $info['Not Compatible with'] .= '=> except '; - } - $info['Not Compatible with'] .= 'Package ' . - $reg->parsedPackageNameToString($package, true); - $info['Not Compatible with'] .= "\n Versions " . $package['exclude']; - } - } - } - } - - if (isset($deps['required']['os'])) { - if (isset($deps['required']['os']['name'])) { - $dep['required']['os']['name'] = array($dep['required']['os']['name']); - } - - foreach ($dep['required']['os'] as $os) { - if (isset($os['conflicts']) && $os['conflicts'] == 'yes') { - if (!isset($info['Not Compatible with'])) { - $info['Not Compatible with'] = ''; - } else { - $info['Not Compatible with'] .= "\n"; - } - $info['Not Compatible with'] .= "$os[name] Operating System"; - } else { - $info['Required Dependencies'] .= "\n"; - $info['Required Dependencies'] .= "$os[name] Operating System"; - } - } - } - - if (isset($deps['required']['arch'])) { - if (isset($deps['required']['arch']['pattern'])) { - $dep['required']['arch']['pattern'] = array($dep['required']['os']['pattern']); - } - - foreach ($dep['required']['arch'] as $os) { - if (isset($os['conflicts']) && $os['conflicts'] == 'yes') { - if (!isset($info['Not Compatible with'])) { - $info['Not Compatible with'] = ''; - } else { - $info['Not Compatible with'] .= "\n"; - } - $info['Not Compatible with'] .= "OS/Arch matching pattern '/$os[pattern]/'"; - } else { - $info['Required Dependencies'] .= "\n"; - $info['Required Dependencies'] .= "OS/Arch matching pattern '/$os[pattern]/'"; - } - } - } - - if (isset($deps['optional'])) { - foreach (array('Package', 'Extension') as $type) { - $index = strtolower($type); - if (isset($deps['optional'][$index])) { - if (isset($deps['optional'][$index]['name'])) { - $deps['optional'][$index] = array($deps['optional'][$index]); - } - - foreach ($deps['optional'][$index] as $package) { - if (isset($package['conflicts']) && $package['conflicts'] == 'yes') { - $infoindex = 'Not Compatible with'; - if (!isset($info['Not Compatible with'])) { - $info['Not Compatible with'] = ''; - } else { - $info['Not Compatible with'] .= "\n"; - } - } else { - $infoindex = 'Optional Dependencies'; - if (!isset($info['Optional Dependencies'])) { - $info['Optional Dependencies'] = ''; - } else { - $info['Optional Dependencies'] .= "\n"; - } - } - - if ($index == 'extension') { - $name = $package['name']; - } else { - if (isset($package['channel'])) { - $name = $package['channel'] . '/' . $package['name']; - } else { - $name = '__uri/' . $package['name'] . ' (static URI)'; - } - } - - $info[$infoindex] .= "$type $name"; - if (isset($package['uri'])) { - $info[$infoindex] .= "\n Download URI: $package[uri]"; - continue; - } - - if ($infoindex == 'Not Compatible with') { - // conflicts is only used to say that all versions conflict - continue; - } - - if (isset($package['max']) && isset($package['min'])) { - $info[$infoindex] .= " \n Versions " . - $package['min'] . '-' . $package['max']; - } elseif (isset($package['min'])) { - $info[$infoindex] .= " \n Version " . - $package['min'] . ' or newer'; - } elseif (isset($package['max'])) { - $info[$infoindex] .= " \n Version " . - $package['min'] . ' or older'; - } - - if (isset($package['recommended'])) { - $info[$infoindex] .= "\n Recommended version: $package[recommended]"; - } - - if (isset($package['exclude'])) { - if (!isset($info['Not Compatible with'])) { - $info['Not Compatible with'] = ''; - } else { - $info['Not Compatible with'] .= "\n"; - } - - if (is_array($package['exclude'])) { - $package['exclude'] = implode(', ', $package['exclude']); - } - - $info['Not Compatible with'] .= "Package $package\n Versions " . - $package['exclude']; - } - } - } - } - } - - if (isset($deps['group'])) { - if (!isset($deps['group'][0])) { - $deps['group'] = array($deps['group']); - } - - foreach ($deps['group'] as $group) { - $info['Dependency Group ' . $group['attribs']['name']] = $group['attribs']['hint']; - $groupindex = $group['attribs']['name'] . ' Contents'; - $info[$groupindex] = ''; - foreach (array('Package', 'Extension') as $type) { - $index = strtolower($type); - if (isset($group[$index])) { - if (isset($group[$index]['name'])) { - $group[$index] = array($group[$index]); - } - - foreach ($group[$index] as $package) { - if (!empty($info[$groupindex])) { - $info[$groupindex] .= "\n"; - } - - if ($index == 'extension') { - $name = $package['name']; - } else { - if (isset($package['channel'])) { - $name = $package['channel'] . '/' . $package['name']; - } else { - $name = '__uri/' . $package['name'] . ' (static URI)'; - } - } - - if (isset($package['uri'])) { - if (isset($package['conflicts']) && $package['conflicts'] == 'yes') { - $info[$groupindex] .= "Not Compatible with $type $name"; - } else { - $info[$groupindex] .= "$type $name"; - } - - $info[$groupindex] .= "\n Download URI: $package[uri]"; - continue; - } - - if (isset($package['conflicts']) && $package['conflicts'] == 'yes') { - $info[$groupindex] .= "Not Compatible with $type $name"; - continue; - } - - $info[$groupindex] .= "$type $name"; - if (isset($package['max']) && isset($package['min'])) { - $info[$groupindex] .= " \n Versions " . - $package['min'] . '-' . $package['max']; - } elseif (isset($package['min'])) { - $info[$groupindex] .= " \n Version " . - $package['min'] . ' or newer'; - } elseif (isset($package['max'])) { - $info[$groupindex] .= " \n Version " . - $package['min'] . ' or older'; - } - - if (isset($package['recommended'])) { - $info[$groupindex] .= "\n Recommended version: $package[recommended]"; - } - - if (isset($package['exclude'])) { - if (!isset($info['Not Compatible with'])) { - $info['Not Compatible with'] = ''; - } else { - $info[$groupindex] .= "Not Compatible with\n"; - } - - if (is_array($package['exclude'])) { - $package['exclude'] = implode(', ', $package['exclude']); - } - $info[$groupindex] .= " Package $package\n Versions " . - $package['exclude']; - } - } - } - } - } - } - - if ($obj->getPackageType() == 'bundle') { - $info['Bundled Packages'] = ''; - foreach ($obj->getBundledPackages() as $package) { - if (!empty($info['Bundled Packages'])) { - $info['Bundled Packages'] .= "\n"; - } - - if (isset($package['uri'])) { - $info['Bundled Packages'] .= '__uri/' . $package['name']; - $info['Bundled Packages'] .= "\n (URI: $package[uri]"; - } else { - $info['Bundled Packages'] .= $package['channel'] . '/' . $package['name']; - } - } - } - - $info['package.xml version'] = '2.0'; - if ($installed) { - if ($obj->getLastModified()) { - $info['Last Modified'] = date('Y-m-d H:i', $obj->getLastModified()); - } - - $v = $obj->getLastInstalledVersion(); - $info['Previous Installed Version'] = $v ? $v : '- None -'; - } - - foreach ($info as $key => $value) { - $data['data'][] = array($key, $value); - } - - $data['raw'] = $obj->getArray(); // no validation needed - $this->ui->outputData($data, 'package-info'); - } -}<commands version="1.0"> - <list> - <summary>List Installed Packages In The Default Channel</summary> - <function>doList</function> - <shortcut>l</shortcut> - <options> - <channel> - <shortopt>c</shortopt> - <doc>list installed packages from this channel</doc> - <arg>CHAN</arg> - </channel> - <allchannels> - <shortopt>a</shortopt> - <doc>list installed packages from all channels</doc> - </allchannels> - <channelinfo> - <shortopt>i</shortopt> - <doc>output fully channel-aware data, even on failure</doc> - </channelinfo> - </options> - <doc><package> -If invoked without parameters, this command lists the PEAR packages -installed in your php_dir ({config php_dir}). With a parameter, it -lists the files in a package. -</doc> - </list> - <list-files> - <summary>List Files In Installed Package</summary> - <function>doFileList</function> - <shortcut>fl</shortcut> - <options /> - <doc><package> -List the files in an installed package. -</doc> - </list-files> - <shell-test> - <summary>Shell Script Test</summary> - <function>doShellTest</function> - <shortcut>st</shortcut> - <options /> - <doc><package> [[relation] version] -Tests if a package is installed in the system. Will exit(1) if it is not. - <relation> The version comparison operator. One of: - <, lt, <=, le, >, gt, >=, ge, ==, =, eq, !=, <>, ne - <version> The version to compare with -</doc> - </shell-test> - <info> - <summary>Display information about a package</summary> - <function>doInfo</function> - <shortcut>in</shortcut> - <options /> - <doc><package> -Displays information about a package. The package argument may be a -local package file, an URL to a package file, or the name of an -installed package.</doc> - </info> -</commands><?php -/** - * PEAR_Command_Remote (remote-info, list-upgrades, remote-list, search, list-all, download, - * clear-cache commands) - * - * PHP versions 4 and 5 - * - * @category pear - * @package PEAR - * @author Stig Bakken <ssb@php.net> - * @author Greg Beaver <cellog@php.net> - * @copyright 1997-2009 The Authors - * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id: Remote.php 313023 2011-07-06 19:17:11Z dufuz $ - * @link http://pear.php.net/package/PEAR - * @since File available since Release 0.1 - */ - -/** - * base class - */ -require_once 'phar://install-pear-nozlib.phar/' . 'PEAR/Command/Common.php'; -require_once 'phar://install-pear-nozlib.phar/' . 'PEAR/REST.php'; - -/** - * PEAR commands for remote server querying - * - * @category pear - * @package PEAR - * @author Stig Bakken <ssb@php.net> - * @author Greg Beaver <cellog@php.net> - * @copyright 1997-2009 The Authors - * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version Release: 1.9.4 - * @link http://pear.php.net/package/PEAR - * @since Class available since Release 0.1 - */ -class PEAR_Command_Remote extends PEAR_Command_Common -{ - var $commands = array( - 'remote-info' => array( - 'summary' => 'Information About Remote Packages', - 'function' => 'doRemoteInfo', - 'shortcut' => 'ri', - 'options' => array(), - 'doc' => '<package> -Get details on a package from the server.', - ), - 'list-upgrades' => array( - 'summary' => 'List Available Upgrades', - 'function' => 'doListUpgrades', - 'shortcut' => 'lu', - 'options' => array( - 'channelinfo' => array( - 'shortopt' => 'i', - 'doc' => 'output fully channel-aware data, even on failure', - ), - ), - 'doc' => '[preferred_state] -List releases on the server of packages you have installed where -a newer version is available with the same release state (stable etc.) -or the state passed as the second parameter.' - ), - 'remote-list' => array( - 'summary' => 'List Remote Packages', - 'function' => 'doRemoteList', - 'shortcut' => 'rl', - 'options' => array( - 'channel' => - array( - 'shortopt' => 'c', - 'doc' => 'specify a channel other than the default channel', - 'arg' => 'CHAN', - ) - ), - 'doc' => ' -Lists the packages available on the configured server along with the -latest stable release of each package.', - ), - 'search' => array( - 'summary' => 'Search remote package database', - 'function' => 'doSearch', - 'shortcut' => 'sp', - 'options' => array( - 'channel' => - array( - 'shortopt' => 'c', - 'doc' => 'specify a channel other than the default channel', - 'arg' => 'CHAN', - ), - 'allchannels' => array( - 'shortopt' => 'a', - 'doc' => 'search packages from all known channels', - ), - 'channelinfo' => array( - 'shortopt' => 'i', - 'doc' => 'output fully channel-aware data, even on failure', - ), - ), - 'doc' => '[packagename] [packageinfo] -Lists all packages which match the search parameters. The first -parameter is a fragment of a packagename. The default channel -will be used unless explicitly overridden. The second parameter -will be used to match any portion of the summary/description', - ), - 'list-all' => array( - 'summary' => 'List All Packages', - 'function' => 'doListAll', - 'shortcut' => 'la', - 'options' => array( - 'channel' => - array( - 'shortopt' => 'c', - 'doc' => 'specify a channel other than the default channel', - 'arg' => 'CHAN', - ), - 'channelinfo' => array( - 'shortopt' => 'i', - 'doc' => 'output fully channel-aware data, even on failure', - ), - ), - 'doc' => ' -Lists the packages available on the configured server along with the -latest stable release of each package.', - ), - 'download' => array( - 'summary' => 'Download Package', - 'function' => 'doDownload', - 'shortcut' => 'd', - 'options' => array( - 'nocompress' => array( - 'shortopt' => 'Z', - 'doc' => 'download an uncompressed (.tar) file', - ), - ), - 'doc' => '<package>... -Download package tarballs. The files will be named as suggested by the -server, for example if you download the DB package and the latest stable -version of DB is 1.6.5, the downloaded file will be DB-1.6.5.tgz.', - ), - 'clear-cache' => array( - 'summary' => 'Clear Web Services Cache', - 'function' => 'doClearCache', - 'shortcut' => 'cc', - 'options' => array(), - 'doc' => ' -Clear the REST cache. See also the cache_ttl configuration -parameter. -', - ), - ); - - /** - * PEAR_Command_Remote constructor. - * - * @access public - */ - function PEAR_Command_Remote(&$ui, &$config) - { - parent::PEAR_Command_Common($ui, $config); - } - - function _checkChannelForStatus($channel, $chan) - { - if (PEAR::isError($chan)) { - $this->raiseError($chan); - } - if (!is_a($chan, 'PEAR_ChannelFile')) { - return $this->raiseError('Internal corruption error: invalid channel "' . - $channel . '"'); - } - $rest = new PEAR_REST($this->config); - PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN); - $mirror = $this->config->get('preferred_mirror', null, - $channel); - $a = $rest->downloadHttp('http://' . $channel . - '/channel.xml', $chan->lastModified()); - PEAR::staticPopErrorHandling(); - if (!PEAR::isError($a) && $a) { - $this->ui->outputData('WARNING: channel "' . $channel . '" has ' . - 'updated its protocols, use "' . PEAR_RUNTYPE . ' channel-update ' . $channel . - '" to update'); - } - } - - function doRemoteInfo($command, $options, $params) - { - if (sizeof($params) != 1) { - return $this->raiseError("$command expects one param: the remote package name"); - } - $savechannel = $channel = $this->config->get('default_channel'); - $reg = &$this->config->getRegistry(); - $package = $params[0]; - $parsed = $reg->parsePackageName($package, $channel); - if (PEAR::isError($parsed)) { - return $this->raiseError('Invalid package name "' . $package . '"'); - } - - $channel = $parsed['channel']; - $this->config->set('default_channel', $channel); - $chan = $reg->getChannel($channel); - if (PEAR::isError($e = $this->_checkChannelForStatus($channel, $chan))) { - return $e; - } - - $mirror = $this->config->get('preferred_mirror'); - if ($chan->supportsREST($mirror) && $base = $chan->getBaseURL('REST1.0', $mirror)) { - $rest = &$this->config->getREST('1.0', array()); - $info = $rest->packageInfo($base, $parsed['package'], $channel); - } - - if (!isset($info)) { - return $this->raiseError('No supported protocol was found'); - } - - if (PEAR::isError($info)) { - $this->config->set('default_channel', $savechannel); - return $this->raiseError($info); - } - - if (!isset($info['name'])) { - return $this->raiseError('No remote package "' . $package . '" was found'); - } - - $installed = $reg->packageInfo($info['name'], null, $channel); - $info['installed'] = $installed['version'] ? $installed['version'] : '- no -'; - if (is_array($info['installed'])) { - $info['installed'] = $info['installed']['release']; - } - - $this->ui->outputData($info, $command); - $this->config->set('default_channel', $savechannel); - - return true; - } - - function doRemoteList($command, $options, $params) - { - $savechannel = $channel = $this->config->get('default_channel'); - $reg = &$this->config->getRegistry(); - if (isset($options['channel'])) { - $channel = $options['channel']; - if (!$reg->channelExists($channel)) { - return $this->raiseError('Channel "' . $channel . '" does not exist'); - } - - $this->config->set('default_channel', $channel); - } - - $chan = $reg->getChannel($channel); - if (PEAR::isError($e = $this->_checkChannelForStatus($channel, $chan))) { - return $e; - } - - $list_options = false; - if ($this->config->get('preferred_state') == 'stable') { - $list_options = true; - } - - $available = array(); - if ($chan->supportsREST($this->config->get('preferred_mirror')) && - $base = $chan->getBaseURL('REST1.1', $this->config->get('preferred_mirror')) - ) { - // use faster list-all if available - $rest = &$this->config->getREST('1.1', array()); - $available = $rest->listAll($base, $list_options, true, false, false, $chan->getName()); - } elseif ($chan->supportsREST($this->config->get('preferred_mirror')) && - $base = $chan->getBaseURL('REST1.0', $this->config->get('preferred_mirror'))) { - $rest = &$this->config->getREST('1.0', array()); - $available = $rest->listAll($base, $list_options, true, false, false, $chan->getName()); - } - - if (PEAR::isError($available)) { - $this->config->set('default_channel', $savechannel); - return $this->raiseError($available); - } - - $i = $j = 0; - $data = array( - 'caption' => 'Channel ' . $channel . ' Available packages:', - 'border' => true, - 'headline' => array('Package', 'Version'), - 'channel' => $channel - ); - - if (count($available) == 0) { - $data = '(no packages available yet)'; - } else { - foreach ($available as $name => $info) { - $version = (isset($info['stable']) && $info['stable']) ? $info['stable'] : '-n/a-'; - $data['data'][] = array($name, $version); - } - } - $this->ui->outputData($data, $command); - $this->config->set('default_channel', $savechannel); - return true; - } - - function doListAll($command, $options, $params) - { - $savechannel = $channel = $this->config->get('default_channel'); - $reg = &$this->config->getRegistry(); - if (isset($options['channel'])) { - $channel = $options['channel']; - if (!$reg->channelExists($channel)) { - return $this->raiseError("Channel \"$channel\" does not exist"); - } - - $this->config->set('default_channel', $channel); - } - - $list_options = false; - if ($this->config->get('preferred_state') == 'stable') { - $list_options = true; - } - - $chan = $reg->getChannel($channel); - if (PEAR::isError($e = $this->_checkChannelForStatus($channel, $chan))) { - return $e; - } - - if ($chan->supportsREST($this->config->get('preferred_mirror')) && - $base = $chan->getBaseURL('REST1.1', $this->config->get('preferred_mirror'))) { - // use faster list-all if available - $rest = &$this->config->getREST('1.1', array()); - $available = $rest->listAll($base, $list_options, false, false, false, $chan->getName()); - } elseif ($chan->supportsREST($this->config->get('preferred_mirror')) && - $base = $chan->getBaseURL('REST1.0', $this->config->get('preferred_mirror'))) { - $rest = &$this->config->getREST('1.0', array()); - $available = $rest->listAll($base, $list_options, false, false, false, $chan->getName()); - } - - if (PEAR::isError($available)) { - $this->config->set('default_channel', $savechannel); - return $this->raiseError('The package list could not be fetched from the remote server. Please try again. (Debug info: "' . $available->getMessage() . '")'); - } - - $data = array( - 'caption' => 'All packages [Channel ' . $channel . ']:', - 'border' => true, - 'headline' => array('Package', 'Latest', 'Local'), - 'channel' => $channel, - ); - - if (isset($options['channelinfo'])) { - // add full channelinfo - $data['caption'] = 'Channel ' . $channel . ' All packages:'; - $data['headline'] = array('Channel', 'Package', 'Latest', 'Local', - 'Description', 'Dependencies'); - } - $local_pkgs = $reg->listPackages($channel); - - foreach ($available as $name => $info) { - $installed = $reg->packageInfo($name, null, $channel); - if (is_array($installed['version'])) { - $installed['version'] = $installed['version']['release']; - } - $desc = $info['summary']; - if (isset($params[$name])) { - $desc .= "\n\n".$info['description']; - } - if (isset($options['mode'])) - { - if ($options['mode'] == 'installed' && !isset($installed['version'])) { - continue; - } - if ($options['mode'] == 'notinstalled' && isset($installed['version'])) { - continue; - } - if ($options['mode'] == 'upgrades' - && (!isset($installed['version']) || version_compare($installed['version'], - $info['stable'], '>='))) { - continue; - } - } - $pos = array_search(strtolower($name), $local_pkgs); - if ($pos !== false) { - unset($local_pkgs[$pos]); - } - - if (isset($info['stable']) && !$info['stable']) { - $info['stable'] = null; - } - - if (isset($options['channelinfo'])) { - // add full channelinfo - if ($info['stable'] === $info['unstable']) { - $state = $info['state']; - } else { - $state = 'stable'; - } - $latest = $info['stable'].' ('.$state.')'; - $local = ''; - if (isset($installed['version'])) { - $inst_state = $reg->packageInfo($name, 'release_state', $channel); - $local = $installed['version'].' ('.$inst_state.')'; - } - - $packageinfo = array( - $channel, - $name, - $latest, - $local, - isset($desc) ? $desc : null, - isset($info['deps']) ? $info['deps'] : null, - ); - } else { - $packageinfo = array( - $reg->channelAlias($channel) . '/' . $name, - isset($info['stable']) ? $info['stable'] : null, - isset($installed['version']) ? $installed['version'] : null, - isset($desc) ? $desc : null, - isset($info['deps']) ? $info['deps'] : null, - ); - } - $data['data'][$info['category']][] = $packageinfo; - } - - if (isset($options['mode']) && in_array($options['mode'], array('notinstalled', 'upgrades'))) { - $this->config->set('default_channel', $savechannel); - $this->ui->outputData($data, $command); - return true; - } - - foreach ($local_pkgs as $name) { - $info = &$reg->getPackage($name, $channel); - $data['data']['Local'][] = array( - $reg->channelAlias($channel) . '/' . $info->getPackage(), - '', - $info->getVersion(), - $info->getSummary(), - $info->getDeps() - ); - } - - $this->config->set('default_channel', $savechannel); - $this->ui->outputData($data, $command); - return true; - } - - function doSearch($command, $options, $params) - { - if ((!isset($params[0]) || empty($params[0])) - && (!isset($params[1]) || empty($params[1]))) - { - return $this->raiseError('no valid search string supplied'); - } - - $channelinfo = isset($options['channelinfo']); - $reg = &$this->config->getRegistry(); - if (isset($options['allchannels'])) { - // search all channels - unset($options['allchannels']); - $channels = $reg->getChannels(); - $errors = array(); - PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN); - foreach ($channels as $channel) { - if ($channel->getName() != '__uri') { - $options['channel'] = $channel->getName(); - $ret = $this->doSearch($command, $options, $params); - if (PEAR::isError($ret)) { - $errors[] = $ret; - } - } - } - - PEAR::staticPopErrorHandling(); - if (count($errors) !== 0) { - // for now, only give first error - return PEAR::raiseError($errors[0]); - } - - return true; - } - - $savechannel = $channel = $this->config->get('default_channel'); - $package = strtolower($params[0]); - $summary = isset($params[1]) ? $params[1] : false; - if (isset($options['channel'])) { - $reg = &$this->config->getRegistry(); - $channel = $options['channel']; - if (!$reg->channelExists($channel)) { - return $this->raiseError('Channel "' . $channel . '" does not exist'); - } - - $this->config->set('default_channel', $channel); - } - - $chan = $reg->getChannel($channel); - if (PEAR::isError($e = $this->_checkChannelForStatus($channel, $chan))) { - return $e; - } - - if ($chan->supportsREST($this->config->get('preferred_mirror')) && - $base = $chan->getBaseURL('REST1.0', $this->config->get('preferred_mirror'))) { - $rest = &$this->config->getREST('1.0', array()); - $available = $rest->listAll($base, false, false, $package, $summary, $chan->getName()); - } - - if (PEAR::isError($available)) { - $this->config->set('default_channel', $savechannel); - return $this->raiseError($available); - } - - if (!$available && !$channelinfo) { - // clean exit when not found, no error ! - $data = 'no packages found that match pattern "' . $package . '", for channel '.$channel.'.'; - $this->ui->outputData($data); - $this->config->set('default_channel', $channel); - return true; - } - - if ($channelinfo) { - $data = array( - 'caption' => 'Matched packages, channel ' . $channel . ':', - 'border' => true, - 'headline' => array('Channel', 'Package', 'Stable/(Latest)', 'Local'), - 'channel' => $channel - ); - } else { - $data = array( - 'caption' => 'Matched packages, channel ' . $channel . ':', - 'border' => true, - 'headline' => array('Package', 'Stable/(Latest)', 'Local'), - 'channel' => $channel - ); - } - - if (!$available && $channelinfo) { - unset($data['headline']); - $data['data'] = 'No packages found that match pattern "' . $package . '".'; - $available = array(); - } - - foreach ($available as $name => $info) { - $installed = $reg->packageInfo($name, null, $channel); - $desc = $info['summary']; - if (isset($params[$name])) - $desc .= "\n\n".$info['description']; - - if (!isset($info['stable']) || !$info['stable']) { - $version_remote = 'none'; - } else { - if ($info['unstable']) { - $version_remote = $info['unstable']; - } else { - $version_remote = $info['stable']; - } - $version_remote .= ' ('.$info['state'].')'; - } - $version = is_array($installed['version']) ? $installed['version']['release'] : - $installed['version']; - if ($channelinfo) { - $packageinfo = array( - $channel, - $name, - $version_remote, - $version, - $desc, - ); - } else { - $packageinfo = array( - $name, - $version_remote, - $version, - $desc, - ); - } - $data['data'][$info['category']][] = $packageinfo; - } - - $this->ui->outputData($data, $command); - $this->config->set('default_channel', $channel); - return true; - } - - function &getDownloader($options) - { - if (!class_exists('PEAR_Downloader')) { - require_once 'phar://install-pear-nozlib.phar/' . 'PEAR/Downloader.php'; - } - $a = &new PEAR_Downloader($this->ui, $options, $this->config); - return $a; - } - - function doDownload($command, $options, $params) - { - // make certain that dependencies are ignored - $options['downloadonly'] = 1; - - // eliminate error messages for preferred_state-related errors - /* TODO: Should be an option, but until now download does respect - prefered state */ - /* $options['ignorepreferred_state'] = 1; */ - // eliminate error messages for preferred_state-related errors - - $downloader = &$this->getDownloader($options); - PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN); - $e = $downloader->setDownloadDir(getcwd()); - PEAR::staticPopErrorHandling(); - if (PEAR::isError($e)) { - return $this->raiseError('Current directory is not writeable, cannot download'); - } - - $errors = array(); - $downloaded = array(); - $err = $downloader->download($params); - if (PEAR::isError($err)) { - return $err; - } - - $errors = $downloader->getErrorMsgs(); - if (count($errors)) { - foreach ($errors as $error) { - if ($error !== null) { - $this->ui->outputData($error); - } - } - - return $this->raiseError("$command failed"); - } - - $downloaded = $downloader->getDownloadedPackages(); - foreach ($downloaded as $pkg) { - $this->ui->outputData("File $pkg[file] downloaded", $command); - } - - return true; - } - - function downloadCallback($msg, $params = null) - { - if ($msg == 'done') { - $this->bytes_downloaded = $params; - } - } - - function doListUpgrades($command, $options, $params) - { - require_once 'phar://install-pear-nozlib.phar/' . 'PEAR/Common.php'; - if (isset($params[0]) && !is_array(PEAR_Common::betterStates($params[0]))) { - return $this->raiseError($params[0] . ' is not a valid state (stable/beta/alpha/devel/etc.) try "pear help list-upgrades"'); - } - - $savechannel = $channel = $this->config->get('default_channel'); - $reg = &$this->config->getRegistry(); - foreach ($reg->listChannels() as $channel) { - $inst = array_flip($reg->listPackages($channel)); - if (!count($inst)) { - continue; - } - - if ($channel == '__uri') { - continue; - } - - $this->config->set('default_channel', $channel); - $state = empty($params[0]) ? $this->config->get('preferred_state') : $params[0]; - - $caption = $channel . ' Available Upgrades'; - $chan = $reg->getChannel($channel); - if (PEAR::isError($e = $this->_checkChannelForStatus($channel, $chan))) { - return $e; - } - - $latest = array(); - $base2 = false; - $preferred_mirror = $this->config->get('preferred_mirror'); - if ($chan->supportsREST($preferred_mirror) && - ( - //($base2 = $chan->getBaseURL('REST1.4', $preferred_mirror)) || - ($base = $chan->getBaseURL('REST1.0', $preferred_mirror)) - ) - - ) { - if ($base2) { - $rest = &$this->config->getREST('1.4', array()); - $base = $base2; - } else { - $rest = &$this->config->getREST('1.0', array()); - } - - if (empty($state) || $state == 'any') { - $state = false; - } else { - $caption .= ' (' . implode(', ', PEAR_Common::betterStates($state, true)) . ')'; - } - - PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN); - $latest = $rest->listLatestUpgrades($base, $state, $inst, $channel, $reg); - PEAR::staticPopErrorHandling(); - } - - if (PEAR::isError($latest)) { - $this->ui->outputData($latest->getMessage()); - continue; - } - - $caption .= ':'; - if (PEAR::isError($latest)) { - $this->config->set('default_channel', $savechannel); - return $latest; - } - - $data = array( - 'caption' => $caption, - 'border' => 1, - 'headline' => array('Channel', 'Package', 'Local', 'Remote', 'Size'), - 'channel' => $channel - ); - - foreach ((array)$latest as $pkg => $info) { - $package = strtolower($pkg); - if (!isset($inst[$package])) { - // skip packages we don't have installed - continue; - } - - extract($info); - $inst_version = $reg->packageInfo($package, 'version', $channel); - $inst_state = $reg->packageInfo($package, 'release_state', $channel); - if (version_compare("$version", "$inst_version", "le")) { - // installed version is up-to-date - continue; - } - - if ($filesize >= 20480) { - $filesize += 1024 - ($filesize % 1024); - $fs = sprintf("%dkB", $filesize / 1024); - } elseif ($filesize > 0) { - $filesize += 103 - ($filesize % 103); - $fs = sprintf("%.1fkB", $filesize / 1024.0); - } else { - $fs = " -"; // XXX center instead - } - - $data['data'][] = array($channel, $pkg, "$inst_version ($inst_state)", "$version ($state)", $fs); - } - - if (isset($options['channelinfo'])) { - if (empty($data['data'])) { - unset($data['headline']); - if (count($inst) == 0) { - $data['data'] = '(no packages installed)'; - } else { - $data['data'] = '(no upgrades available)'; - } - } - $this->ui->outputData($data, $command); - } else { - if (empty($data['data'])) { - $this->ui->outputData('Channel ' . $channel . ': No upgrades available'); - } else { - $this->ui->outputData($data, $command); - } - } - } - - $this->config->set('default_channel', $savechannel); - return true; - } - - function doClearCache($command, $options, $params) - { - $cache_dir = $this->config->get('cache_dir'); - $verbose = $this->config->get('verbose'); - $output = ''; - if (!file_exists($cache_dir) || !is_dir($cache_dir)) { - return $this->raiseError("$cache_dir does not exist or is not a directory"); - } - - if (!($dp = @opendir($cache_dir))) { - return $this->raiseError("opendir($cache_dir) failed: $php_errormsg"); - } - - if ($verbose >= 1) { - $output .= "reading directory $cache_dir\n"; - } - - $num = 0; - while ($ent = readdir($dp)) { - if (preg_match('/rest.cache(file|id)\\z/', $ent)) { - $path = $cache_dir . DIRECTORY_SEPARATOR . $ent; - if (file_exists($path)) { - $ok = @unlink($path); - } else { - $ok = false; - $php_errormsg = ''; - } - - if ($ok) { - if ($verbose >= 2) { - $output .= "deleted $path\n"; - } - $num++; - } elseif ($verbose >= 1) { - $output .= "failed to delete $path $php_errormsg\n"; - } - } - } - - closedir($dp); - if ($verbose >= 1) { - $output .= "$num cache entries cleared\n"; - } - - $this->ui->outputData(rtrim($output), $command); - return $num; - } -}<commands version="1.0"> - <remote-info> - <summary>Information About Remote Packages</summary> - <function>doRemoteInfo</function> - <shortcut>ri</shortcut> - <options /> - <doc><package> -Get details on a package from the server.</doc> - </remote-info> - <list-upgrades> - <summary>List Available Upgrades</summary> - <function>doListUpgrades</function> - <shortcut>lu</shortcut> - <options> - <channelinfo> - <shortopt>i</shortopt> - <doc>output fully channel-aware data, even on failure</doc> - </channelinfo> - </options> - <doc>[preferred_state] -List releases on the server of packages you have installed where -a newer version is available with the same release state (stable etc.) -or the state passed as the second parameter.</doc> - </list-upgrades> - <remote-list> - <summary>List Remote Packages</summary> - <function>doRemoteList</function> - <shortcut>rl</shortcut> - <options> - <channel> - <shortopt>c</shortopt> - <doc>specify a channel other than the default channel</doc> - <arg>CHAN</arg> - </channel> - </options> - <doc> -Lists the packages available on the configured server along with the -latest stable release of each package.</doc> - </remote-list> - <search> - <summary>Search remote package database</summary> - <function>doSearch</function> - <shortcut>sp</shortcut> - <options> - <channel> - <shortopt>c</shortopt> - <doc>specify a channel other than the default channel</doc> - <arg>CHAN</arg> - </channel> - <allchannels> - <shortopt>a</shortopt> - <doc>search packages from all known channels</doc> - </allchannels> - <channelinfo> - <shortopt>i</shortopt> - <doc>output fully channel-aware data, even on failure</doc> - </channelinfo> - </options> - <doc>[packagename] [packageinfo] -Lists all packages which match the search parameters. The first -parameter is a fragment of a packagename. The default channel -will be used unless explicitly overridden. The second parameter -will be used to match any portion of the summary/description</doc> - </search> - <list-all> - <summary>List All Packages</summary> - <function>doListAll</function> - <shortcut>la</shortcut> - <options> - <channel> - <shortopt>c</shortopt> - <doc>specify a channel other than the default channel</doc> - <arg>CHAN</arg> - </channel> - <channelinfo> - <shortopt>i</shortopt> - <doc>output fully channel-aware data, even on failure</doc> - </channelinfo> - </options> - <doc> -Lists the packages available on the configured server along with the -latest stable release of each package.</doc> - </list-all> - <download> - <summary>Download Package</summary> - <function>doDownload</function> - <shortcut>d</shortcut> - <options> - <nocompress> - <shortopt>Z</shortopt> - <doc>download an uncompressed (.tar) file</doc> - </nocompress> - </options> - <doc><package>... -Download package tarballs. The files will be named as suggested by the -server, for example if you download the DB package and the latest stable -version of DB is 1.6.5, the downloaded file will be DB-1.6.5.tgz.</doc> - </download> - <clear-cache> - <summary>Clear Web Services Cache</summary> - <function>doClearCache</function> - <shortcut>cc</shortcut> - <options /> - <doc> -Clear the XML-RPC/REST cache. See also the cache_ttl configuration -parameter. -</doc> - </clear-cache> -</commands><?php -/** - * PEAR_Command_Test (run-tests) - * - * PHP versions 4 and 5 - * - * @category pear - * @package PEAR - * @author Stig Bakken <ssb@php.net> - * @author Martin Jansen <mj@php.net> - * @author Greg Beaver <cellog@php.net> - * @copyright 1997-2009 The Authors - * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id: Test.php 313023 2011-07-06 19:17:11Z dufuz $ - * @link http://pear.php.net/package/PEAR - * @since File available since Release 0.1 - */ - -/** - * base class - */ -require_once 'phar://install-pear-nozlib.phar/' . 'PEAR/Command/Common.php'; - -/** - * PEAR commands for login/logout - * - * @category pear - * @package PEAR - * @author Stig Bakken <ssb@php.net> - * @author Martin Jansen <mj@php.net> - * @author Greg Beaver <cellog@php.net> - * @copyright 1997-2009 The Authors - * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version Release: 1.9.4 - * @link http://pear.php.net/package/PEAR - * @since Class available since Release 0.1 - */ - -class PEAR_Command_Test extends PEAR_Command_Common -{ - var $commands = array( - 'run-tests' => array( - 'summary' => 'Run Regression Tests', - 'function' => 'doRunTests', - 'shortcut' => 'rt', - 'options' => array( - 'recur' => array( - 'shortopt' => 'r', - 'doc' => 'Run tests in child directories, recursively. 4 dirs deep maximum', - ), - 'ini' => array( - 'shortopt' => 'i', - 'doc' => 'actual string of settings to pass to php in format " -d setting=blah"', - 'arg' => 'SETTINGS' - ), - 'realtimelog' => array( - 'shortopt' => 'l', - 'doc' => 'Log test runs/results as they are run', - ), - 'quiet' => array( - 'shortopt' => 'q', - 'doc' => 'Only display detail for failed tests', - ), - 'simple' => array( - 'shortopt' => 's', - 'doc' => 'Display simple output for all tests', - ), - 'package' => array( - 'shortopt' => 'p', - 'doc' => 'Treat parameters as installed packages from which to run tests', - ), - 'phpunit' => array( - 'shortopt' => 'u', - 'doc' => 'Search parameters for AllTests.php, and use that to run phpunit-based tests -If none is found, all .phpt tests will be tried instead.', - ), - 'tapoutput' => array( - 'shortopt' => 't', - 'doc' => 'Output run-tests.log in TAP-compliant format', - ), - 'cgi' => array( - 'shortopt' => 'c', - 'doc' => 'CGI php executable (needed for tests with POST/GET section)', - 'arg' => 'PHPCGI', - ), - 'coverage' => array( - 'shortopt' => 'x', - 'doc' => 'Generate a code coverage report (requires Xdebug 2.0.0+)', - ), - ), - 'doc' => '[testfile|dir ...] -Run regression tests with PHP\'s regression testing script (run-tests.php).', - ), - ); - - var $output; - - /** - * PEAR_Command_Test constructor. - * - * @access public - */ - function PEAR_Command_Test(&$ui, &$config) - { - parent::PEAR_Command_Common($ui, $config); - } - - function doRunTests($command, $options, $params) - { - if (isset($options['phpunit']) && isset($options['tapoutput'])) { - return $this->raiseError('ERROR: cannot use both --phpunit and --tapoutput at the same time'); - } - - require_once 'phar://install-pear-nozlib.phar/' . 'PEAR/Common.php'; - require_once 'phar://install-pear-nozlib.phar/' . 'System.php'; - $log = new PEAR_Common; - $log->ui = &$this->ui; // slightly hacky, but it will work - $tests = array(); - $depth = isset($options['recur']) ? 14 : 1; - - if (!count($params)) { - $params[] = '.'; - } - - if (isset($options['package'])) { - $oldparams = $params; - $params = array(); - $reg = &$this->config->getRegistry(); - foreach ($oldparams as $param) { - $pname = $reg->parsePackageName($param, $this->config->get('default_channel')); - if (PEAR::isError($pname)) { - return $this->raiseError($pname); - } - - $package = &$reg->getPackage($pname['package'], $pname['channel']); - if (!$package) { - return PEAR::raiseError('Unknown package "' . - $reg->parsedPackageNameToString($pname) . '"'); - } - - $filelist = $package->getFilelist(); - foreach ($filelist as $name => $atts) { - if (isset($atts['role']) && $atts['role'] != 'test') { - continue; - } - - if (isset($options['phpunit']) && preg_match('/AllTests\.php\\z/i', $name)) { - $params[] = $atts['installed_as']; - continue; - } elseif (!preg_match('/\.phpt\\z/', $name)) { - continue; - } - $params[] = $atts['installed_as']; - } - } - } - - foreach ($params as $p) { - if (is_dir($p)) { - if (isset($options['phpunit'])) { - $dir = System::find(array($p, '-type', 'f', - '-maxdepth', $depth, - '-name', 'AllTests.php')); - if (count($dir)) { - foreach ($dir as $p) { - $p = realpath($p); - if (!count($tests) || - (count($tests) && strlen($p) < strlen($tests[0]))) { - // this is in a higher-level directory, use this one instead. - $tests = array($p); - } - } - } - continue; - } - - $args = array($p, '-type', 'f', '-name', '*.phpt'); - } else { - if (isset($options['phpunit'])) { - if (preg_match('/AllTests\.php\\z/i', $p)) { - $p = realpath($p); - if (!count($tests) || - (count($tests) && strlen($p) < strlen($tests[0]))) { - // this is in a higher-level directory, use this one instead. - $tests = array($p); - } - } - continue; - } - - if (file_exists($p) && preg_match('/\.phpt$/', $p)) { - $tests[] = $p; - continue; - } - - if (!preg_match('/\.phpt\\z/', $p)) { - $p .= '.phpt'; - } - - $args = array(dirname($p), '-type', 'f', '-name', $p); - } - - if (!isset($options['recur'])) { - $args[] = '-maxdepth'; - $args[] = 1; - } - - $dir = System::find($args); - $tests = array_merge($tests, $dir); - } - - $ini_settings = ''; - if (isset($options['ini'])) { - $ini_settings .= $options['ini']; - } - - if (isset($_ENV['TEST_PHP_INCLUDE_PATH'])) { - $ini_settings .= " -d include_path={$_ENV['TEST_PHP_INCLUDE_PATH']}"; - } - - if ($ini_settings) { - $this->ui->outputData('Using INI settings: "' . $ini_settings . '"'); - } - - $skipped = $passed = $failed = array(); - $tests_count = count($tests); - $this->ui->outputData('Running ' . $tests_count . ' tests', $command); - $start = time(); - if (isset($options['realtimelog']) && file_exists('run-tests.log')) { - unlink('run-tests.log'); - } - - if (isset($options['tapoutput'])) { - $tap = '1..' . $tests_count . "\n"; - } - - require_once 'phar://install-pear-nozlib.phar/' . 'PEAR/RunTest.php'; - $run = new PEAR_RunTest($log, $options); - $run->tests_count = $tests_count; - - if (isset($options['coverage']) && extension_loaded('xdebug')){ - $run->xdebug_loaded = true; - } else { - $run->xdebug_loaded = false; - } - - $j = $i = 1; - foreach ($tests as $t) { - if (isset($options['realtimelog'])) { - $fp = @fopen('run-tests.log', 'a'); - if ($fp) { - fwrite($fp, "Running test [$i / $tests_count] $t..."); - fclose($fp); - } - } - PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN); - if (isset($options['phpunit'])) { - $result = $run->runPHPUnit($t, $ini_settings); - } else { - $result = $run->run($t, $ini_settings, $j); - } - PEAR::staticPopErrorHandling(); - if (PEAR::isError($result)) { - $this->ui->log($result->getMessage()); - continue; - } - - if (isset($options['tapoutput'])) { - $tap .= $result[0] . ' ' . $i . $result[1] . "\n"; - continue; - } - - if (isset($options['realtimelog'])) { - $fp = @fopen('run-tests.log', 'a'); - if ($fp) { - fwrite($fp, "$result\n"); - fclose($fp); - } - } - - if ($result == 'FAILED') { - $failed[] = $t; - } - if ($result == 'PASSED') { - $passed[] = $t; - } - if ($result == 'SKIPPED') { - $skipped[] = $t; - } - - $j++; - } - - $total = date('i:s', time() - $start); - if (isset($options['tapoutput'])) { - $fp = @fopen('run-tests.log', 'w'); - if ($fp) { - fwrite($fp, $tap, strlen($tap)); - fclose($fp); - $this->ui->outputData('wrote TAP-format log to "' .realpath('run-tests.log') . - '"', $command); - } - } else { - if (count($failed)) { - $output = "TOTAL TIME: $total\n"; - $output .= count($passed) . " PASSED TESTS\n"; - $output .= count($skipped) . " SKIPPED TESTS\n"; - $output .= count($failed) . " FAILED TESTS:\n"; - foreach ($failed as $failure) { - $output .= $failure . "\n"; - } - - $mode = isset($options['realtimelog']) ? 'a' : 'w'; - $fp = @fopen('run-tests.log', $mode); - - if ($fp) { - fwrite($fp, $output, strlen($output)); - fclose($fp); - $this->ui->outputData('wrote log to "' . realpath('run-tests.log') . '"', $command); - } - } elseif (file_exists('run-tests.log') && !is_dir('run-tests.log')) { - @unlink('run-tests.log'); - } - } - $this->ui->outputData('TOTAL TIME: ' . $total); - $this->ui->outputData(count($passed) . ' PASSED TESTS', $command); - $this->ui->outputData(count($skipped) . ' SKIPPED TESTS', $command); - if (count($failed)) { - $this->ui->outputData(count($failed) . ' FAILED TESTS:', $command); - foreach ($failed as $failure) { - $this->ui->outputData($failure, $command); - } - } - - return true; - } -}<commands version="1.0"> - <run-tests> - <summary>Run Regression Tests</summary> - <function>doRunTests</function> - <shortcut>rt</shortcut> - <options> - <recur> - <shortopt>r</shortopt> - <doc>Run tests in child directories, recursively. 4 dirs deep maximum</doc> - </recur> - <ini> - <shortopt>i</shortopt> - <doc>actual string of settings to pass to php in format " -d setting=blah"</doc> - <arg>SETTINGS</arg> - </ini> - <realtimelog> - <shortopt>l</shortopt> - <doc>Log test runs/results as they are run</doc> - </realtimelog> - <quiet> - <shortopt>q</shortopt> - <doc>Only display detail for failed tests</doc> - </quiet> - <simple> - <shortopt>s</shortopt> - <doc>Display simple output for all tests</doc> - </simple> - <package> - <shortopt>p</shortopt> - <doc>Treat parameters as installed packages from which to run tests</doc> - </package> - <phpunit> - <shortopt>u</shortopt> - <doc>Search parameters for AllTests.php, and use that to run phpunit-based tests -If none is found, all .phpt tests will be tried instead.</doc> - </phpunit> - <tapoutput> - <shortopt>t</shortopt> - <doc>Output run-tests.log in TAP-compliant format</doc> - </tapoutput> - <cgi> - <shortopt>c</shortopt> - <doc>CGI php executable (needed for tests with POST/GET section)</doc> - <arg>PHPCGI</arg> - </cgi> - <coverage> - <shortopt>x</shortopt> - <doc>Generate a code coverage report (requires Xdebug 2.0.0+)</doc> - </coverage> - </options> - <doc>[testfile|dir ...] -Run regression tests with PHP's regression testing script (run-tests.php).</doc> - </run-tests> -</commands><?php -/** * PEAR_Common, the base class for the PEAR Installer * * PHP versions 4 and 5 @@ -67314,7 +59858,7 @@ Run regression tests with PHP's regression testing script (run-tests.php).< * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id: Common.php 313023 2011-07-06 19:17:11Z dufuz $ + * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR * @since File available since Release 0.1.0 * @deprecated File deprecated since Release 1.4.0a1 @@ -67421,7 +59965,7 @@ $GLOBALS['_PEAR_Common_script_phases'] = array('pre-install', 'post-install', 'p * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version Release: 1.9.4 + * @version Release: 1.9.5 * @link http://pear.php.net/package/PEAR * @since Class available since Release 1.4.0a1 * @deprecated This class will disappear, and its components will be spread @@ -68149,7 +60693,7 @@ require_once 'phar://install-pear-nozlib.phar/' . 'PEAR/PackageFile.php';<?php * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id: Config.php 313023 2011-07-06 19:17:11Z dufuz $ + * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR * @since File available since Release 0.1 */ @@ -68385,7 +60929,7 @@ if (getenv('PHP_PEAR_SIG_KEYDIR')) { * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version Release: 1.9.4 + * @version Release: 1.9.5 * @link http://pear.php.net/package/PEAR * @since Class available since Release 0.1 */ @@ -70245,7 +62789,7 @@ class PEAR_Config extends PEAR * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id: Dependency2.php 313023 2011-07-06 19:17:11Z dufuz $ + * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR * @since File available since Release 1.4.0a1 */ @@ -70267,7 +62811,7 @@ require_once 'phar://install-pear-nozlib.phar/' . 'PEAR/Validate.php'; * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version Release: 1.9.4 + * @version Release: 1.9.5 * @link http://pear.php.net/package/PEAR * @since Class available since Release 1.4.0a1 */ @@ -70777,7 +63321,7 @@ class PEAR_Dependency2 */ function getPEARVersion() { - return '1.9.4'; + return '1.9.5'; } function validatePearinstallerDependency($dep) @@ -70843,7 +63387,7 @@ class PEAR_Dependency2 * @param boolean whether this is a required dependency * @param array a list of downloaded packages to be installed, if any * @param boolean if true, then deps on pear.php.net that fail will also check - * against pecl.php.net packages to accomodate extensions that have + * against pecl.php.net packages to accommodate extensions that have * moved to pecl.php.net from pear.php.net */ function validatePackageDependency($dep, $required, $params, $depv1 = false) @@ -71591,7 +64135,8 @@ class PEAR_Dependency2 return array(sprintf($msg, $this->_registry->parsedPackageNameToString( $this->_currentPackage, true))); } -}<?php +} +<?php /** * PEAR_DependencyDB, advanced installed packages dependency database * @@ -71603,7 +64148,7 @@ class PEAR_Dependency2 * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id: DependencyDB.php 313023 2011-07-06 19:17:11Z dufuz $ + * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR * @since File available since Release 1.4.0a1 */ @@ -71623,7 +64168,7 @@ $GLOBALS['_PEAR_DEPENDENCYDB_INSTANCE'] = array(); * @author Tomas V.V.Cox <cox@idec.net.com> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version Release: 1.9.4 + * @version Release: 1.9.5 * @link http://pear.php.net/package/PEAR * @since Class available since Release 1.4.0a1 */ @@ -72373,7 +64918,7 @@ class PEAR_DependencyDB * @author Martin Jansen <mj@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id: Downloader.php 313024 2011-07-06 19:51:24Z dufuz $ + * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR * @since File available since Release 1.3.0 */ @@ -72400,7 +64945,7 @@ define('PEAR_INSTALLER_ERROR_NO_PREF_STATE', 2); * @author Martin Jansen <mj@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version Release: 1.9.4 + * @version Release: 1.9.5 * @link http://pear.php.net/package/PEAR * @since Class available since Release 1.3.0 */ @@ -74000,7 +66545,7 @@ class PEAR_Downloader extends PEAR_Common } $request .= $ifmodifiedsince . - "User-Agent: PEAR/1.9.4/PHP/" . PHP_VERSION . "\r\n"; + "User-Agent: PEAR/1.9.5/PHP/" . PHP_VERSION . "\r\n"; if (isset($this)) { // only pass in authentication for non-static calls $username = $config->get('username', null, $channel); @@ -74135,7 +66680,7 @@ class PEAR_Downloader extends PEAR_Common * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id: Package.php 313023 2011-07-06 19:17:11Z dufuz $ + * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR * @since File available since Release 1.4.0a1 */ @@ -74176,7 +66721,7 @@ define('PEAR_DOWNLOADER_PACKAGE_PHPVERSION', -1004); * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version Release: 1.9.4 + * @version Release: 1.9.5 * @link http://pear.php.net/package/PEAR * @since Class available since Release 1.4.0a1 */ @@ -76136,7 +68681,7 @@ class PEAR_Downloader_Package * @author Greg Beaver <cellog@php.net> * @copyright 2004-2008 Greg Beaver * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id: ErrorStack.php 313023 2011-07-06 19:17:11Z dufuz $ + * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR_ErrorStack */ @@ -76245,12 +68790,12 @@ define('PEAR_ERRORSTACK_ERR_OBJTOSTRING', 2); * $local_stack = new PEAR_ErrorStack('MyPackage'); * </code> * @author Greg Beaver <cellog@php.net> - * @version 1.9.4 + * @version 1.9.5 * @package PEAR_ErrorStack * @category Debugging * @copyright 2004-2008 Greg Beaver * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id: ErrorStack.php 313023 2011-07-06 19:17:11Z dufuz $ + * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR_ErrorStack */ class PEAR_ErrorStack { @@ -77097,400 +69642,6 @@ $stack = &PEAR_ErrorStack::singleton('PEAR_ErrorStack'); $stack->pushCallback(array('PEAR_ErrorStack', '_handleError')); ?> <?php -/* vim: set expandtab tabstop=4 shiftwidth=4 foldmethod=marker: */ -/** - * PEAR_Exception - * - * PHP versions 4 and 5 - * - * @category pear - * @package PEAR - * @author Tomas V. V. Cox <cox@idecnet.com> - * @author Hans Lellelid <hans@velum.net> - * @author Bertrand Mansion <bmansion@mamasam.com> - * @author Greg Beaver <cellog@php.net> - * @copyright 1997-2009 The Authors - * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id: Exception.php 313023 2011-07-06 19:17:11Z dufuz $ - * @link http://pear.php.net/package/PEAR - * @since File available since Release 1.3.3 - */ - - -/** - * Base PEAR_Exception Class - * - * 1) Features: - * - * - Nestable exceptions (throw new PEAR_Exception($msg, $prev_exception)) - * - Definable triggers, shot when exceptions occur - * - Pretty and informative error messages - * - Added more context info available (like class, method or cause) - * - cause can be a PEAR_Exception or an array of mixed - * PEAR_Exceptions/PEAR_ErrorStack warnings - * - callbacks for specific exception classes and their children - * - * 2) Ideas: - * - * - Maybe a way to define a 'template' for the output - * - * 3) Inherited properties from PHP Exception Class: - * - * protected $message - * protected $code - * protected $line - * protected $file - * private $trace - * - * 4) Inherited methods from PHP Exception Class: - * - * __clone - * __construct - * getMessage - * getCode - * getFile - * getLine - * getTraceSafe - * getTraceSafeAsString - * __toString - * - * 5) Usage example - * - * <code> - * require_once 'PEAR/Exception.php'; - * - * class Test { - * function foo() { - * throw new PEAR_Exception('Error Message', ERROR_CODE); - * } - * } - * - * function myLogger($pear_exception) { - * echo $pear_exception->getMessage(); - * } - * // each time a exception is thrown the 'myLogger' will be called - * // (its use is completely optional) - * PEAR_Exception::addObserver('myLogger'); - * $test = new Test; - * try { - * $test->foo(); - * } catch (PEAR_Exception $e) { - * print $e; - * } - * </code> - * - * @category pear - * @package PEAR - * @author Tomas V.V.Cox <cox@idecnet.com> - * @author Hans Lellelid <hans@velum.net> - * @author Bertrand Mansion <bmansion@mamasam.com> - * @author Greg Beaver <cellog@php.net> - * @copyright 1997-2009 The Authors - * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version Release: 1.9.4 - * @link http://pear.php.net/package/PEAR - * @since Class available since Release 1.3.3 - * - */ -class PEAR_Exception extends Exception -{ - const OBSERVER_PRINT = -2; - const OBSERVER_TRIGGER = -4; - const OBSERVER_DIE = -8; - protected $cause; - private static $_observers = array(); - private static $_uniqueid = 0; - private $_trace; - - /** - * Supported signatures: - * - PEAR_Exception(string $message); - * - PEAR_Exception(string $message, int $code); - * - PEAR_Exception(string $message, Exception $cause); - * - PEAR_Exception(string $message, Exception $cause, int $code); - * - PEAR_Exception(string $message, PEAR_Error $cause); - * - PEAR_Exception(string $message, PEAR_Error $cause, int $code); - * - PEAR_Exception(string $message, array $causes); - * - PEAR_Exception(string $message, array $causes, int $code); - * @param string exception message - * @param int|Exception|PEAR_Error|array|null exception cause - * @param int|null exception code or null - */ - public function __construct($message, $p2 = null, $p3 = null) - { - if (is_int($p2)) { - $code = $p2; - $this->cause = null; - } elseif (is_object($p2) || is_array($p2)) { - // using is_object allows both Exception and PEAR_Error - if (is_object($p2) && !($p2 instanceof Exception)) { - if (!class_exists('PEAR_Error') || !($p2 instanceof PEAR_Error)) { - throw new PEAR_Exception('exception cause must be Exception, ' . - 'array, or PEAR_Error'); - } - } - $code = $p3; - if (is_array($p2) && isset($p2['message'])) { - // fix potential problem of passing in a single warning - $p2 = array($p2); - } - $this->cause = $p2; - } else { - $code = null; - $this->cause = null; - } - parent::__construct($message, $code); - $this->signal(); - } - - /** - * @param mixed $callback - A valid php callback, see php func is_callable() - * - A PEAR_Exception::OBSERVER_* constant - * - An array(const PEAR_Exception::OBSERVER_*, - * mixed $options) - * @param string $label The name of the observer. Use this if you want - * to remove it later with removeObserver() - */ - public static function addObserver($callback, $label = 'default') - { - self::$_observers[$label] = $callback; - } - - public static function removeObserver($label = 'default') - { - unset(self::$_observers[$label]); - } - - /** - * @return int unique identifier for an observer - */ - public static function getUniqueId() - { - return self::$_uniqueid++; - } - - private function signal() - { - foreach (self::$_observers as $func) { - if (is_callable($func)) { - call_user_func($func, $this); - continue; - } - settype($func, 'array'); - switch ($func[0]) { - case self::OBSERVER_PRINT : - $f = (isset($func[1])) ? $func[1] : '%s'; - printf($f, $this->getMessage()); - break; - case self::OBSERVER_TRIGGER : - $f = (isset($func[1])) ? $func[1] : E_USER_NOTICE; - trigger_error($this->getMessage(), $f); - break; - case self::OBSERVER_DIE : - $f = (isset($func[1])) ? $func[1] : '%s'; - die(printf($f, $this->getMessage())); - break; - default: - trigger_error('invalid observer type', E_USER_WARNING); - } - } - } - - /** - * Return specific error information that can be used for more detailed - * error messages or translation. - * - * This method may be overridden in child exception classes in order - * to add functionality not present in PEAR_Exception and is a placeholder - * to define API - * - * The returned array must be an associative array of parameter => value like so: - * <pre> - * array('name' => $name, 'context' => array(...)) - * </pre> - * @return array - */ - public function getErrorData() - { - return array(); - } - - /** - * Returns the exception that caused this exception to be thrown - * @access public - * @return Exception|array The context of the exception - */ - public function getCause() - { - return $this->cause; - } - - /** - * Function must be public to call on caused exceptions - * @param array - */ - public function getCauseMessage(&$causes) - { - $trace = $this->getTraceSafe(); - $cause = array('class' => get_class($this), - 'message' => $this->message, - 'file' => 'unknown', - 'line' => 'unknown'); - if (isset($trace[0])) { - if (isset($trace[0]['file'])) { - $cause['file'] = $trace[0]['file']; - $cause['line'] = $trace[0]['line']; - } - } - $causes[] = $cause; - if ($this->cause instanceof PEAR_Exception) { - $this->cause->getCauseMessage($causes); - } elseif ($this->cause instanceof Exception) { - $causes[] = array('class' => get_class($this->cause), - 'message' => $this->cause->getMessage(), - 'file' => $this->cause->getFile(), - 'line' => $this->cause->getLine()); - } elseif (class_exists('PEAR_Error') && $this->cause instanceof PEAR_Error) { - $causes[] = array('class' => get_class($this->cause), - 'message' => $this->cause->getMessage(), - 'file' => 'unknown', - 'line' => 'unknown'); - } elseif (is_array($this->cause)) { - foreach ($this->cause as $cause) { - if ($cause instanceof PEAR_Exception) { - $cause->getCauseMessage($causes); - } elseif ($cause instanceof Exception) { - $causes[] = array('class' => get_class($cause), - 'message' => $cause->getMessage(), - 'file' => $cause->getFile(), - 'line' => $cause->getLine()); - } elseif (class_exists('PEAR_Error') && $cause instanceof PEAR_Error) { - $causes[] = array('class' => get_class($cause), - 'message' => $cause->getMessage(), - 'file' => 'unknown', - 'line' => 'unknown'); - } elseif (is_array($cause) && isset($cause['message'])) { - // PEAR_ErrorStack warning - $causes[] = array( - 'class' => $cause['package'], - 'message' => $cause['message'], - 'file' => isset($cause['context']['file']) ? - $cause['context']['file'] : - 'unknown', - 'line' => isset($cause['context']['line']) ? - $cause['context']['line'] : - 'unknown', - ); - } - } - } - } - - public function getTraceSafe() - { - if (!isset($this->_trace)) { - $this->_trace = $this->getTrace(); - if (empty($this->_trace)) { - $backtrace = debug_backtrace(); - $this->_trace = array($backtrace[count($backtrace)-1]); - } - } - return $this->_trace; - } - - public function getErrorClass() - { - $trace = $this->getTraceSafe(); - return $trace[0]['class']; - } - - public function getErrorMethod() - { - $trace = $this->getTraceSafe(); - return $trace[0]['function']; - } - - public function __toString() - { - if (isset($_SERVER['REQUEST_URI'])) { - return $this->toHtml(); - } - return $this->toText(); - } - - public function toHtml() - { - $trace = $this->getTraceSafe(); - $causes = array(); - $this->getCauseMessage($causes); - $html = '<table style="border: 1px" cellspacing="0">' . "\n"; - foreach ($causes as $i => $cause) { - $html .= '<tr><td colspan="3" style="background: #ff9999">' - . str_repeat('-', $i) . ' <b>' . $cause['class'] . '</b>: ' - . htmlspecialchars($cause['message']) . ' in <b>' . $cause['file'] . '</b> ' - . 'on line <b>' . $cause['line'] . '</b>' - . "</td></tr>\n"; - } - $html .= '<tr><td colspan="3" style="background-color: #aaaaaa; text-align: center; font-weight: bold;">Exception trace</td></tr>' . "\n" - . '<tr><td style="text-align: center; background: #cccccc; width:20px; font-weight: bold;">#</td>' - . '<td style="text-align: center; background: #cccccc; font-weight: bold;">Function</td>' - . '<td style="text-align: center; background: #cccccc; font-weight: bold;">Location</td></tr>' . "\n"; - - foreach ($trace as $k => $v) { - $html .= '<tr><td style="text-align: center;">' . $k . '</td>' - . '<td>'; - if (!empty($v['class'])) { - $html .= $v['class'] . $v['type']; - } - $html .= $v['function']; - $args = array(); - if (!empty($v['args'])) { - foreach ($v['args'] as $arg) { - if (is_null($arg)) $args[] = 'null'; - elseif (is_array($arg)) $args[] = 'Array'; - elseif (is_object($arg)) $args[] = 'Object('.get_class($arg).')'; - elseif (is_bool($arg)) $args[] = $arg ? 'true' : 'false'; - elseif (is_int($arg) || is_double($arg)) $args[] = $arg; - else { - $arg = (string)$arg; - $str = htmlspecialchars(substr($arg, 0, 16)); - if (strlen($arg) > 16) $str .= '…'; - $args[] = "'" . $str . "'"; - } - } - } - $html .= '(' . implode(', ',$args) . ')' - . '</td>' - . '<td>' . (isset($v['file']) ? $v['file'] : 'unknown') - . ':' . (isset($v['line']) ? $v['line'] : 'unknown') - . '</td></tr>' . "\n"; - } - $html .= '<tr><td style="text-align: center;">' . ($k+1) . '</td>' - . '<td>{main}</td>' - . '<td> </td></tr>' . "\n" - . '</table>'; - return $html; - } - - public function toText() - { - $causes = array(); - $this->getCauseMessage($causes); - $causeMsg = ''; - foreach ($causes as $i => $cause) { - $causeMsg .= str_repeat(' ', $i) . $cause['class'] . ': ' - . $cause['message'] . ' in ' . $cause['file'] - . ' on line ' . $cause['line'] . "\n"; - } - return $causeMsg . $this->getTraceAsString(); - } -}<?php -if ($skipmsg) { - $a = &new $ec($code, $mode, $options, $userinfo); -} else { - $a = &new $ec($message, $code, $mode, $options, $userinfo); -} -?><?php /** * PEAR_Frontend, the singleton-based frontend for user input/output * @@ -77501,7 +69652,7 @@ if ($skipmsg) { * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id: Frontend.php 313023 2011-07-06 19:17:11Z dufuz $ + * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR * @since File available since Release 1.4.0a1 */ @@ -77531,7 +69682,7 @@ $GLOBALS['_PEAR_FRONTEND_SINGLETON'] = null; * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version Release: 1.9.4 + * @version Release: 1.9.5 * @link http://pear.php.net/package/PEAR * @since Class available since Release 1.4.0a1 */ @@ -77729,7 +69880,7 @@ class PEAR_Frontend extends PEAR * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id: CLI.php 313023 2011-07-06 19:17:11Z dufuz $ + * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR * @since File available since Release 0.1 */ @@ -77746,7 +69897,7 @@ require_once 'phar://install-pear-nozlib.phar/' . 'PEAR/Frontend.php'; * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version Release: 1.9.4 + * @version Release: 1.9.5 * @link http://pear.php.net/package/PEAR * @since Class available since Release 0.1 */ @@ -78481,7 +70632,7 @@ class PEAR_Frontend_CLI extends PEAR_Frontend * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id: Installer.php 313024 2011-07-06 19:51:24Z dufuz $ + * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR * @since File available since Release 0.1 */ @@ -78505,7 +70656,7 @@ define('PEAR_INSTALLER_NOBINARY', -240); * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version Release: 1.9.4 + * @version Release: 1.9.5 * @link http://pear.php.net/package/PEAR * @since Class available since Release 0.1 */ @@ -79277,7 +71428,10 @@ class PEAR_Installer extends PEAR_Downloader if (!empty($res)) { $new = $this->_registry->getPackage($result[1], $result[0]); $this->file_operations[$key] = false; - $this->log(3, "file $data[0] was scheduled for removal from {$this->pkginfo->getName()} but is owned by {$new->getChannel()}/{$new->getName()}, removal has been cancelled."); + $pkginfoName = $this->pkginfo->getName(); + $newChannel = $new->getChannel(); + $newPackage = $new->getName(); + $this->log(3, "file $data[0] was scheduled for removal from $pkginfoName but is owned by $newChannel/$newPackage, removal has been cancelled."); } } } @@ -80300,7 +72454,7 @@ class PEAR_Installer extends PEAR_Downloader * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id: Role.php 313023 2011-07-06 19:17:11Z dufuz $ + * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR * @since File available since Release 1.4.0a1 */ @@ -80316,7 +72470,7 @@ require_once 'phar://install-pear-nozlib.phar/' . 'PEAR/XMLParser.php'; * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version Release: 1.9.4 + * @version Release: 1.9.5 * @link http://pear.php.net/package/PEAR * @since Class available since Release 1.4.0a1 */ @@ -80566,125 +72720,6 @@ class PEAR_Installer_Role } }<?php /** - * PEAR_Installer_Role_Cfg - * - * PHP versions 4 and 5 - * - * @category pear - * @package PEAR - * @author Greg Beaver <cellog@php.net> - * @copyright 2007-2009 The Authors - * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id: Cfg.php 313023 2011-07-06 19:17:11Z dufuz $ - * @link http://pear.php.net/package/PEAR - * @since File available since Release 1.7.0 - */ - -/** - * @category pear - * @package PEAR - * @author Greg Beaver <cellog@php.net> - * @copyright 2007-2009 The Authors - * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version Release: 1.9.4 - * @link http://pear.php.net/package/PEAR - * @since Class available since Release 1.7.0 - */ -class PEAR_Installer_Role_Cfg extends PEAR_Installer_Role_Common -{ - /** - * @var PEAR_Installer - */ - var $installer; - - /** - * the md5 of the original file - * - * @var unknown_type - */ - var $md5 = null; - - /** - * Do any unusual setup here - * @param PEAR_Installer - * @param PEAR_PackageFile_v2 - * @param array file attributes - * @param string file name - */ - function setup(&$installer, $pkg, $atts, $file) - { - $this->installer = &$installer; - $reg = &$this->installer->config->getRegistry(); - $package = $reg->getPackage($pkg->getPackage(), $pkg->getChannel()); - if ($package) { - $filelist = $package->getFilelist(); - if (isset($filelist[$file]) && isset($filelist[$file]['md5sum'])) { - $this->md5 = $filelist[$file]['md5sum']; - } - } - } - - function processInstallation($pkg, $atts, $file, $tmp_path, $layer = null) - { - $test = parent::processInstallation($pkg, $atts, $file, $tmp_path, $layer); - if (@file_exists($test[2]) && @file_exists($test[3])) { - $md5 = md5_file($test[2]); - // configuration has already been installed, check for mods - if ($md5 !== $this->md5 && $md5 !== md5_file($test[3])) { - // configuration has been modified, so save our version as - // configfile-version - $old = $test[2]; - $test[2] .= '.new-' . $pkg->getVersion(); - // backup original and re-install it - PEAR::pushErrorHandling(PEAR_ERROR_RETURN); - $tmpcfg = $this->config->get('temp_dir'); - $newloc = System::mkdir(array('-p', $tmpcfg)); - if (!$newloc) { - // try temp_dir - $newloc = System::mktemp(array('-d')); - if (!$newloc || PEAR::isError($newloc)) { - PEAR::popErrorHandling(); - return PEAR::raiseError('Could not save existing configuration file '. - $old . ', unable to install. Please set temp_dir ' . - 'configuration variable to a writeable location and try again'); - } - } else { - $newloc = $tmpcfg; - } - - $temp_file = $newloc . DIRECTORY_SEPARATOR . uniqid('savefile'); - if (!@copy($old, $temp_file)) { - PEAR::popErrorHandling(); - return PEAR::raiseError('Could not save existing configuration file '. - $old . ', unable to install. Please set temp_dir ' . - 'configuration variable to a writeable location and try again'); - } - - PEAR::popErrorHandling(); - $this->installer->log(0, "WARNING: configuration file $old is being installed as $test[2], you should manually merge in changes to the existing configuration file"); - $this->installer->addFileOperation('rename', array($temp_file, $old, false)); - $this->installer->addFileOperation('delete', array($temp_file)); - } - } - - return $test; - } -}<role version="1.0"> - <releasetypes>php</releasetypes> - <releasetypes>extsrc</releasetypes> - <releasetypes>extbin</releasetypes> - <releasetypes>zendextsrc</releasetypes> - <releasetypes>zendextbin</releasetypes> - <installable>1</installable> - <locationconfig>cfg_dir</locationconfig> - <honorsbaseinstall /> - <unusualbaseinstall>1</unusualbaseinstall> - <phpfile /> - <executable /> - <phpextension /> - <config_vars /> -</role><?php -/** * Base class for all installation roles. * * PHP versions 4 and 5 @@ -80694,7 +72729,7 @@ class PEAR_Installer_Role_Cfg extends PEAR_Installer_Role_Common * @author Greg Beaver <cellog@php.net> * @copyright 1997-2006 The PHP Group * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id: Common.php 313023 2011-07-06 19:17:11Z dufuz $ + * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR * @since File available since Release 1.4.0a1 */ @@ -80709,7 +72744,7 @@ class PEAR_Installer_Role_Cfg extends PEAR_Installer_Role_Common * @author Greg Beaver <cellog@php.net> * @copyright 1997-2006 The PHP Group * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version Release: 1.9.4 + * @version Release: 1.9.5 * @link http://pear.php.net/package/PEAR * @since Class available since Release 1.4.0a1 */ @@ -80867,7 +72902,7 @@ class PEAR_Installer_Role_Common * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id: Data.php 313023 2011-07-06 19:17:11Z dufuz $ + * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR * @since File available since Release 1.4.0a1 */ @@ -80878,7 +72913,7 @@ class PEAR_Installer_Role_Common * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version Release: 1.9.4 + * @version Release: 1.9.5 * @link http://pear.php.net/package/PEAR * @since Class available since Release 1.4.0a1 */ @@ -80908,7 +72943,7 @@ class PEAR_Installer_Role_Data extends PEAR_Installer_Role_Common {} * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id: Doc.php 313023 2011-07-06 19:17:11Z dufuz $ + * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR * @since File available since Release 1.4.0a1 */ @@ -80919,7 +72954,7 @@ class PEAR_Installer_Role_Data extends PEAR_Installer_Role_Common {} * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version Release: 1.9.4 + * @version Release: 1.9.5 * @link http://pear.php.net/package/PEAR * @since Class available since Release 1.4.0a1 */ @@ -80940,44 +72975,6 @@ class PEAR_Installer_Role_Doc extends PEAR_Installer_Role_Common {} <config_vars /> </role><?php /** - * PEAR_Installer_Role_Ext - * - * PHP versions 4 and 5 - * - * @category pear - * @package PEAR - * @author Greg Beaver <cellog@php.net> - * @copyright 1997-2009 The Authors - * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id: Ext.php 313023 2011-07-06 19:17:11Z dufuz $ - * @link http://pear.php.net/package/PEAR - * @since File available since Release 1.4.0a1 - */ - -/** - * @category pear - * @package PEAR - * @author Greg Beaver <cellog@php.net> - * @copyright 1997-2009 The Authors - * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version Release: 1.9.4 - * @link http://pear.php.net/package/PEAR - * @since Class available since Release 1.4.0a1 - */ -class PEAR_Installer_Role_Ext extends PEAR_Installer_Role_Common {} -?><role version="1.0"> - <releasetypes>extbin</releasetypes> - <releasetypes>zendextbin</releasetypes> - <installable>1</installable> - <locationconfig>ext_dir</locationconfig> - <honorsbaseinstall>1</honorsbaseinstall> - <unusualbaseinstall /> - <phpfile /> - <executable /> - <phpextension>1</phpextension> - <config_vars /> -</role><?php -/** * PEAR_Installer_Role_Php * * PHP versions 4 and 5 @@ -80987,7 +72984,7 @@ class PEAR_Installer_Role_Ext extends PEAR_Installer_Role_Common {} * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id: Php.php 313023 2011-07-06 19:17:11Z dufuz $ + * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR * @since File available since Release 1.4.0a1 */ @@ -80998,7 +72995,7 @@ class PEAR_Installer_Role_Ext extends PEAR_Installer_Role_Common {} * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version Release: 1.9.4 + * @version Release: 1.9.5 * @link http://pear.php.net/package/PEAR * @since Class available since Release 1.4.0a1 */ @@ -81028,7 +73025,7 @@ class PEAR_Installer_Role_Php extends PEAR_Installer_Role_Common {} * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id: Script.php 313023 2011-07-06 19:17:11Z dufuz $ + * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR * @since File available since Release 1.4.0a1 */ @@ -81039,7 +73036,7 @@ class PEAR_Installer_Role_Php extends PEAR_Installer_Role_Common {} * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version Release: 1.9.4 + * @version Release: 1.9.5 * @link http://pear.php.net/package/PEAR * @since Class available since Release 1.4.0a1 */ @@ -81060,50 +73057,6 @@ class PEAR_Installer_Role_Script extends PEAR_Installer_Role_Common {} <config_vars /> </role><?php /** - * PEAR_Installer_Role_Src - * - * PHP versions 4 and 5 - * - * @category pear - * @package PEAR - * @author Greg Beaver <cellog@php.net> - * @copyright 1997-2009 The Authors - * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id: Src.php 313023 2011-07-06 19:17:11Z dufuz $ - * @link http://pear.php.net/package/PEAR - * @since File available since Release 1.4.0a1 - */ - -/** - * @category pear - * @package PEAR - * @author Greg Beaver <cellog@php.net> - * @copyright 1997-2009 The Authors - * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version Release: 1.9.4 - * @link http://pear.php.net/package/PEAR - * @since Class available since Release 1.4.0a1 - */ -class PEAR_Installer_Role_Src extends PEAR_Installer_Role_Common -{ - function setup(&$installer, $pkg, $atts, $file) - { - $installer->source_files++; - } -} -?><role version="1.0"> - <releasetypes>extsrc</releasetypes> - <releasetypes>zendextsrc</releasetypes> - <installable>1</installable> - <locationconfig>temp_dir</locationconfig> - <honorsbaseinstall /> - <unusualbaseinstall /> - <phpfile /> - <executable /> - <phpextension /> - <config_vars /> -</role><?php -/** * PEAR_Installer_Role_Test * * PHP versions 4 and 5 @@ -81113,7 +73066,7 @@ class PEAR_Installer_Role_Src extends PEAR_Installer_Role_Common * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id: Test.php 313023 2011-07-06 19:17:11Z dufuz $ + * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR * @since File available since Release 1.4.0a1 */ @@ -81124,7 +73077,7 @@ class PEAR_Installer_Role_Src extends PEAR_Installer_Role_Common * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version Release: 1.9.4 + * @version Release: 1.9.5 * @link http://pear.php.net/package/PEAR * @since Class available since Release 1.4.0a1 */ @@ -81145,47 +73098,6 @@ class PEAR_Installer_Role_Test extends PEAR_Installer_Role_Common {} <config_vars /> </role><?php /** - * PEAR_Installer_Role_Www - * - * PHP versions 4 and 5 - * - * @category pear - * @package PEAR - * @author Greg Beaver <cellog@php.net> - * @copyright 2007-2009 The Authors - * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id: Www.php 313023 2011-07-06 19:17:11Z dufuz $ - * @link http://pear.php.net/package/PEAR - * @since File available since Release 1.7.0 - */ - -/** - * @category pear - * @package PEAR - * @author Greg Beaver <cellog@php.net> - * @copyright 2007-2009 The Authors - * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version Release: 1.9.4 - * @link http://pear.php.net/package/PEAR - * @since Class available since Release 1.7.0 - */ -class PEAR_Installer_Role_Www extends PEAR_Installer_Role_Common {} -?><role version="1.0"> - <releasetypes>php</releasetypes> - <releasetypes>extsrc</releasetypes> - <releasetypes>extbin</releasetypes> - <releasetypes>zendextsrc</releasetypes> - <releasetypes>zendextbin</releasetypes> - <installable>1</installable> - <locationconfig>www_dir</locationconfig> - <honorsbaseinstall>1</honorsbaseinstall> - <unusualbaseinstall /> - <phpfile /> - <executable /> - <phpextension /> - <config_vars /> -</role><?php -/** * PEAR_PackageFile, package.xml parsing utility class * * PHP versions 4 and 5 @@ -81195,7 +73107,7 @@ class PEAR_Installer_Role_Www extends PEAR_Installer_Role_Common {} * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id: PackageFile.php 313024 2011-07-06 19:51:24Z dufuz $ + * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR * @since File available since Release 1.4.0a1 */ @@ -81221,7 +73133,7 @@ define('PEAR_PACKAGEFILE_ERROR_INVALID_PACKAGEVERSION', 2); * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version Release: 1.9.4 + * @version Release: 1.9.5 * @link http://pear.php.net/package/PEAR * @since Class available since Release 1.4.0a1 */ @@ -81686,7 +73598,7 @@ class PEAR_PackageFile * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id: v1.php 313023 2011-07-06 19:17:11Z dufuz $ + * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR * @since File available since Release 1.4.0a1 */ @@ -81706,7 +73618,7 @@ require_once 'phar://install-pear-nozlib.phar/' . 'PEAR/PackageFile/v2.php'; * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version Release: 1.9.4 + * @version Release: 1.9.5 * @link http://pear.php.net/package/PEAR * @since Class available since Release 1.4.0a1 */ @@ -81723,7 +73635,7 @@ class PEAR_PackageFile_Generator_v1 function getPackagerVersion() { - return '1.9.4'; + return '1.9.5'; } /** @@ -81877,7 +73789,7 @@ class PEAR_PackageFile_Generator_v1 ); $ret = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n"; $ret .= "<!DOCTYPE package SYSTEM \"http://pear.php.net/dtd/package-1.0\">\n"; - $ret .= "<package version=\"1.0\" packagerversion=\"1.9.4\">\n" . + $ret .= "<package version=\"1.0\" packagerversion=\"1.9.5\">\n" . " <name>$pkginfo[package]</name>"; if (isset($pkginfo['extends'])) { $ret .= "\n<extends>$pkginfo[extends]</extends>"; @@ -82970,7 +74882,7 @@ class PEAR_PackageFile_Generator_v1 * @author Stephan Schmidt (original XML_Serializer code) * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id: v2.php 313023 2011-07-06 19:17:11Z dufuz $ + * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR * @since File available since Release 1.4.0a1 */ @@ -82991,7 +74903,7 @@ require_once 'phar://install-pear-nozlib.phar/' . 'XML/Util.php'; * @author Stephan Schmidt (original XML_Serializer code) * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version Release: 1.9.4 + * @version Release: 1.9.5 * @link http://pear.php.net/package/PEAR * @since Class available since Release 1.4.0a1 */ @@ -83030,7 +74942,7 @@ http://pear.php.net/dtd/package-2.0 http://pear.php.net/dtd/package-2.0.xsd', ), // attributes of the root tag 'attributesArray' => 'attribs', // all values in this key will be treated as attributes - 'contentName' => '_content', // this value will be used directly as content, instead of creating a new tag, may only be used in conjuction with attributesArray + 'contentName' => '_content', // this value will be used directly as content, instead of creating a new tag, may only be used in conjunction with attributesArray 'beautifyFilelist' => false, 'encoding' => 'UTF-8', ); @@ -83073,7 +74985,7 @@ http://pear.php.net/dtd/package-2.0.xsd', */ function getPackagerVersion() { - return '1.9.4'; + return '1.9.5'; } /** @@ -83358,7 +75270,7 @@ http://pear.php.net/dtd/package-2.0.xsd', $this->options['beautifyFilelist'] = true; } - $arr['attribs']['packagerversion'] = '1.9.4'; + $arr['attribs']['packagerversion'] = '1.9.5'; if ($this->serialize($arr, $options)) { return $this->_serializedData . "\n"; } @@ -83850,7 +75762,8 @@ http://pear.php.net/dtd/package-2.0.xsd', } return $tag; } -}<?php +} +<?php /** * package.xml parsing class, package.xml version 1.0 * @@ -83861,7 +75774,7 @@ http://pear.php.net/dtd/package-2.0.xsd', * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id: v1.php 313023 2011-07-06 19:17:11Z dufuz $ + * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR * @since File available since Release 1.4.0a1 */ @@ -83876,7 +75789,7 @@ require_once 'phar://install-pear-nozlib.phar/' . 'PEAR/PackageFile/v1.php'; * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version Release: 1.10.0beta1 + * @version Release: 1.9.5 * @link http://pear.php.net/package/PEAR * @since Class available since Release 1.4.0a1 */ @@ -84319,7 +76232,7 @@ class PEAR_PackageFile_Parser_v1 * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id: v2.php 313023 2011-07-06 19:17:11Z dufuz $ + * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR * @since File available since Release 1.4.0a1 */ @@ -84335,7 +76248,7 @@ require_once 'phar://install-pear-nozlib.phar/' . 'PEAR/PackageFile/v2.php'; * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version Release: 1.10.0beta1 + * @version Release: 1.9.5 * @link http://pear.php.net/package/PEAR * @since Class available since Release 1.4.0a1 */ @@ -84431,7 +76344,7 @@ class PEAR_PackageFile_Parser_v2 extends PEAR_XMLParser * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id: v1.php 313023 2011-07-06 19:17:11Z dufuz $ + * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR * @since File available since Release 1.4.0a1 */ @@ -84697,7 +76610,7 @@ define('PEAR_PACKAGEFILE_ERROR_INVALID_FILENAME', 52); * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version Release: 1.9.4 + * @version Release: 1.9.5 * @link http://pear.php.net/package/PEAR * @since Class available since Release 1.4.0a1 */ @@ -86043,7 +77956,7 @@ class PEAR_PackageFile_v1 * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id: v2.php 313023 2011-07-06 19:17:11Z dufuz $ + * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR * @since File available since Release 1.4.0a1 */ @@ -86057,7 +77970,7 @@ require_once 'phar://install-pear-nozlib.phar/' . 'PEAR/ErrorStack.php'; * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version Release: 1.9.4 + * @version Release: 1.9.5 * @link http://pear.php.net/package/PEAR * @since Class available since Release 1.4.0a1 */ @@ -88092,1610 +80005,7 @@ class PEAR_PackageFile_v2 * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id: rw.php 313023 2011-07-06 19:17:11Z dufuz $ - * @link http://pear.php.net/package/PEAR - * @since File available since Release 1.4.0a8 - */ -/** - * For base class - */ -require_once 'phar://install-pear-nozlib.phar/' . 'PEAR/PackageFile/v2.php'; -/** - * @category pear - * @package PEAR - * @author Greg Beaver <cellog@php.net> - * @copyright 1997-2009 The Authors - * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version Release: 1.9.4 - * @link http://pear.php.net/package/PEAR - * @since Class available since Release 1.4.0a8 - */ -class PEAR_PackageFile_v2_rw extends PEAR_PackageFile_v2 -{ - /** - * @param string Extension name - * @return bool success of operation - */ - function setProvidesExtension($extension) - { - if (in_array($this->getPackageType(), - array('extsrc', 'extbin', 'zendextsrc', 'zendextbin'))) { - if (!isset($this->_packageInfo['providesextension'])) { - // ensure that the channel tag is set up in the right location - $this->_packageInfo = $this->_insertBefore($this->_packageInfo, - array('usesrole', 'usestask', 'srcpackage', 'srcuri', 'phprelease', - 'extsrcrelease', 'extbinrelease', 'zendextsrcrelease', 'zendextbinrelease', - 'bundle', 'changelog'), - $extension, 'providesextension'); - } - $this->_packageInfo['providesextension'] = $extension; - return true; - } - return false; - } - - function setPackage($package) - { - $this->_isValid = 0; - if (!isset($this->_packageInfo['attribs'])) { - $this->_packageInfo = array_merge(array('attribs' => array( - 'version' => '2.0', - 'xmlns' => 'http://pear.php.net/dtd/package-2.0', - 'xmlns:tasks' => 'http://pear.php.net/dtd/tasks-1.0', - 'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance', - 'xsi:schemaLocation' => 'http://pear.php.net/dtd/tasks-1.0 - http://pear.php.net/dtd/tasks-1.0.xsd - http://pear.php.net/dtd/package-2.0 - http://pear.php.net/dtd/package-2.0.xsd', - )), $this->_packageInfo); - } - if (!isset($this->_packageInfo['name'])) { - return $this->_packageInfo = array_merge(array('name' => $package), - $this->_packageInfo); - } - $this->_packageInfo['name'] = $package; - } - - /** - * set this as a package.xml version 2.1 - * @access private - */ - function _setPackageVersion2_1() - { - $info = array( - 'version' => '2.1', - 'xmlns' => 'http://pear.php.net/dtd/package-2.1', - 'xmlns:tasks' => 'http://pear.php.net/dtd/tasks-1.0', - 'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance', - 'xsi:schemaLocation' => 'http://pear.php.net/dtd/tasks-1.0 - http://pear.php.net/dtd/tasks-1.0.xsd - http://pear.php.net/dtd/package-2.1 - http://pear.php.net/dtd/package-2.1.xsd', - ); - if (!isset($this->_packageInfo['attribs'])) { - $this->_packageInfo = array_merge(array('attribs' => $info), $this->_packageInfo); - } else { - $this->_packageInfo['attribs'] = $info; - } - } - - function setUri($uri) - { - unset($this->_packageInfo['channel']); - $this->_isValid = 0; - if (!isset($this->_packageInfo['uri'])) { - // ensure that the uri tag is set up in the right location - $this->_packageInfo = $this->_insertBefore($this->_packageInfo, - array('extends', 'summary', 'description', 'lead', - 'developer', 'contributor', 'helper', 'date', 'time', 'version', - 'stability', 'license', 'notes', 'contents', 'compatible', - 'dependencies', 'providesextension', 'usesrole', 'usestask', 'srcpackage', 'srcuri', - 'phprelease', 'extsrcrelease', 'zendextsrcrelease', 'zendextbinrelease', - 'extbinrelease', 'bundle', 'changelog'), $uri, 'uri'); - } - $this->_packageInfo['uri'] = $uri; - } - - function setChannel($channel) - { - unset($this->_packageInfo['uri']); - $this->_isValid = 0; - if (!isset($this->_packageInfo['channel'])) { - // ensure that the channel tag is set up in the right location - $this->_packageInfo = $this->_insertBefore($this->_packageInfo, - array('extends', 'summary', 'description', 'lead', - 'developer', 'contributor', 'helper', 'date', 'time', 'version', - 'stability', 'license', 'notes', 'contents', 'compatible', - 'dependencies', 'providesextension', 'usesrole', 'usestask', 'srcpackage', 'srcuri', - 'phprelease', 'extsrcrelease', 'zendextsrcrelease', 'zendextbinrelease', - 'extbinrelease', 'bundle', 'changelog'), $channel, 'channel'); - } - $this->_packageInfo['channel'] = $channel; - } - - function setExtends($extends) - { - $this->_isValid = 0; - if (!isset($this->_packageInfo['extends'])) { - // ensure that the extends tag is set up in the right location - $this->_packageInfo = $this->_insertBefore($this->_packageInfo, - array('summary', 'description', 'lead', - 'developer', 'contributor', 'helper', 'date', 'time', 'version', - 'stability', 'license', 'notes', 'contents', 'compatible', - 'dependencies', 'providesextension', 'usesrole', 'usestask', 'srcpackage', 'srcuri', - 'phprelease', 'extsrcrelease', 'zendextsrcrelease', 'zendextbinrelease', - 'extbinrelease', 'bundle', 'changelog'), $extends, 'extends'); - } - $this->_packageInfo['extends'] = $extends; - } - - function setSummary($summary) - { - $this->_isValid = 0; - if (!isset($this->_packageInfo['summary'])) { - // ensure that the summary tag is set up in the right location - $this->_packageInfo = $this->_insertBefore($this->_packageInfo, - array('description', 'lead', - 'developer', 'contributor', 'helper', 'date', 'time', 'version', - 'stability', 'license', 'notes', 'contents', 'compatible', - 'dependencies', 'providesextension', 'usesrole', 'usestask', 'srcpackage', 'srcuri', - 'phprelease', 'extsrcrelease', 'zendextsrcrelease', 'zendextbinrelease', - 'extbinrelease', 'bundle', 'changelog'), $summary, 'summary'); - } - $this->_packageInfo['summary'] = $summary; - } - - function setDescription($desc) - { - $this->_isValid = 0; - if (!isset($this->_packageInfo['description'])) { - // ensure that the description tag is set up in the right location - $this->_packageInfo = $this->_insertBefore($this->_packageInfo, - array('lead', - 'developer', 'contributor', 'helper', 'date', 'time', 'version', - 'stability', 'license', 'notes', 'contents', 'compatible', - 'dependencies', 'providesextension', 'usesrole', 'usestask', 'srcpackage', 'srcuri', - 'phprelease', 'extsrcrelease', 'zendextsrcrelease', 'zendextbinrelease', - 'extbinrelease', 'bundle', 'changelog'), $desc, 'description'); - } - $this->_packageInfo['description'] = $desc; - } - - /** - * Adds a new maintainer - no checking of duplicates is performed, use - * updatemaintainer for that purpose. - */ - function addMaintainer($role, $handle, $name, $email, $active = 'yes') - { - if (!in_array($role, array('lead', 'developer', 'contributor', 'helper'))) { - return false; - } - if (isset($this->_packageInfo[$role])) { - if (!isset($this->_packageInfo[$role][0])) { - $this->_packageInfo[$role] = array($this->_packageInfo[$role]); - } - $this->_packageInfo[$role][] = - array( - 'name' => $name, - 'user' => $handle, - 'email' => $email, - 'active' => $active, - ); - } else { - $testarr = array('lead', - 'developer', 'contributor', 'helper', 'date', 'time', 'version', - 'stability', 'license', 'notes', 'contents', 'compatible', - 'dependencies', 'providesextension', 'usesrole', 'usestask', - 'srcpackage', 'srcuri', 'phprelease', 'extsrcrelease', - 'extbinrelease', 'zendextsrcrelease', 'zendextbinrelease', 'bundle', 'changelog'); - foreach (array('lead', 'developer', 'contributor', 'helper') as $testrole) { - array_shift($testarr); - if ($role == $testrole) { - break; - } - } - if (!isset($this->_packageInfo[$role])) { - // ensure that the extends tag is set up in the right location - $this->_packageInfo = $this->_insertBefore($this->_packageInfo, $testarr, - array(), $role); - } - $this->_packageInfo[$role] = - array( - 'name' => $name, - 'user' => $handle, - 'email' => $email, - 'active' => $active, - ); - } - $this->_isValid = 0; - } - - function updateMaintainer($newrole, $handle, $name, $email, $active = 'yes') - { - $found = false; - foreach (array('lead', 'developer', 'contributor', 'helper') as $role) { - if (!isset($this->_packageInfo[$role])) { - continue; - } - $info = $this->_packageInfo[$role]; - if (!isset($info[0])) { - if ($info['user'] == $handle) { - $found = true; - break; - } - } - foreach ($info as $i => $maintainer) { - if ($maintainer['user'] == $handle) { - $found = $i; - break 2; - } - } - } - if ($found === false) { - return $this->addMaintainer($newrole, $handle, $name, $email, $active); - } - if ($found !== false) { - if ($found === true) { - unset($this->_packageInfo[$role]); - } else { - unset($this->_packageInfo[$role][$found]); - $this->_packageInfo[$role] = array_values($this->_packageInfo[$role]); - } - } - $this->addMaintainer($newrole, $handle, $name, $email, $active); - $this->_isValid = 0; - } - - function deleteMaintainer($handle) - { - $found = false; - foreach (array('lead', 'developer', 'contributor', 'helper') as $role) { - if (!isset($this->_packageInfo[$role])) { - continue; - } - if (!isset($this->_packageInfo[$role][0])) { - $this->_packageInfo[$role] = array($this->_packageInfo[$role]); - } - foreach ($this->_packageInfo[$role] as $i => $maintainer) { - if ($maintainer['user'] == $handle) { - $found = $i; - break; - } - } - if ($found !== false) { - unset($this->_packageInfo[$role][$found]); - if (!count($this->_packageInfo[$role]) && $role == 'lead') { - $this->_isValid = 0; - } - if (!count($this->_packageInfo[$role])) { - unset($this->_packageInfo[$role]); - return true; - } - $this->_packageInfo[$role] = - array_values($this->_packageInfo[$role]); - if (count($this->_packageInfo[$role]) == 1) { - $this->_packageInfo[$role] = $this->_packageInfo[$role][0]; - } - return true; - } - if (count($this->_packageInfo[$role]) == 1) { - $this->_packageInfo[$role] = $this->_packageInfo[$role][0]; - } - } - return false; - } - - function setReleaseVersion($version) - { - if (isset($this->_packageInfo['version']) && - isset($this->_packageInfo['version']['release'])) { - unset($this->_packageInfo['version']['release']); - } - $this->_packageInfo = $this->_mergeTag($this->_packageInfo, $version, array( - 'version' => array('stability', 'license', 'notes', 'contents', 'compatible', - 'dependencies', 'providesextension', 'usesrole', 'usestask', 'srcpackage', 'srcuri', - 'phprelease', 'extsrcrelease', 'zendextsrcrelease', 'zendextbinrelease', - 'extbinrelease', 'bundle', 'changelog'), - 'release' => array('api'))); - $this->_isValid = 0; - } - - function setAPIVersion($version) - { - if (isset($this->_packageInfo['version']) && - isset($this->_packageInfo['version']['api'])) { - unset($this->_packageInfo['version']['api']); - } - $this->_packageInfo = $this->_mergeTag($this->_packageInfo, $version, array( - 'version' => array('stability', 'license', 'notes', 'contents', 'compatible', - 'dependencies', 'providesextension', 'usesrole', 'usestask', 'srcpackage', 'srcuri', - 'phprelease', 'extsrcrelease', 'zendextsrcrelease', 'zendextbinrelease', - 'extbinrelease', 'bundle', 'changelog'), - 'api' => array())); - $this->_isValid = 0; - } - - /** - * snapshot|devel|alpha|beta|stable - */ - function setReleaseStability($state) - { - if (isset($this->_packageInfo['stability']) && - isset($this->_packageInfo['stability']['release'])) { - unset($this->_packageInfo['stability']['release']); - } - $this->_packageInfo = $this->_mergeTag($this->_packageInfo, $state, array( - 'stability' => array('license', 'notes', 'contents', 'compatible', - 'dependencies', 'providesextension', 'usesrole', 'usestask', 'srcpackage', 'srcuri', - 'phprelease', 'extsrcrelease', 'zendextsrcrelease', 'zendextbinrelease', - 'extbinrelease', 'bundle', 'changelog'), - 'release' => array('api'))); - $this->_isValid = 0; - } - - /** - * @param devel|alpha|beta|stable - */ - function setAPIStability($state) - { - if (isset($this->_packageInfo['stability']) && - isset($this->_packageInfo['stability']['api'])) { - unset($this->_packageInfo['stability']['api']); - } - $this->_packageInfo = $this->_mergeTag($this->_packageInfo, $state, array( - 'stability' => array('license', 'notes', 'contents', 'compatible', - 'dependencies', 'providesextension', 'usesrole', 'usestask', 'srcpackage', 'srcuri', - 'phprelease', 'extsrcrelease', 'zendextsrcrelease', 'zendextbinrelease', - 'extbinrelease', 'bundle', 'changelog'), - 'api' => array())); - $this->_isValid = 0; - } - - function setLicense($license, $uri = false, $filesource = false) - { - if (!isset($this->_packageInfo['license'])) { - // ensure that the license tag is set up in the right location - $this->_packageInfo = $this->_insertBefore($this->_packageInfo, - array('notes', 'contents', 'compatible', - 'dependencies', 'providesextension', 'usesrole', 'usestask', 'srcpackage', 'srcuri', - 'phprelease', 'extsrcrelease', 'zendextsrcrelease', 'zendextbinrelease', - 'extbinrelease', 'bundle', 'changelog'), 0, 'license'); - } - if ($uri || $filesource) { - $attribs = array(); - if ($uri) { - $attribs['uri'] = $uri; - } - $uri = true; // for test below - if ($filesource) { - $attribs['filesource'] = $filesource; - } - } - $license = $uri ? array('attribs' => $attribs, '_content' => $license) : $license; - $this->_packageInfo['license'] = $license; - $this->_isValid = 0; - } - - function setNotes($notes) - { - $this->_isValid = 0; - if (!isset($this->_packageInfo['notes'])) { - // ensure that the notes tag is set up in the right location - $this->_packageInfo = $this->_insertBefore($this->_packageInfo, - array('contents', 'compatible', - 'dependencies', 'providesextension', 'usesrole', 'usestask', 'srcpackage', 'srcuri', - 'phprelease', 'extsrcrelease', 'zendextsrcrelease', 'zendextbinrelease', - 'extbinrelease', 'bundle', 'changelog'), $notes, 'notes'); - } - $this->_packageInfo['notes'] = $notes; - } - - /** - * This is only used at install-time, after all serialization - * is over. - * @param string file name - * @param string installed path - */ - function setInstalledAs($file, $path) - { - if ($path) { - return $this->_packageInfo['filelist'][$file]['installed_as'] = $path; - } - unset($this->_packageInfo['filelist'][$file]['installed_as']); - } - - /** - * This is only used at install-time, after all serialization - * is over. - */ - function installedFile($file, $atts) - { - if (isset($this->_packageInfo['filelist'][$file])) { - $this->_packageInfo['filelist'][$file] = - array_merge($this->_packageInfo['filelist'][$file], $atts['attribs']); - } else { - $this->_packageInfo['filelist'][$file] = $atts['attribs']; - } - } - - /** - * Reset the listing of package contents - * @param string base installation dir for the whole package, if any - */ - function clearContents($baseinstall = false) - { - $this->_filesValid = false; - $this->_isValid = 0; - if (!isset($this->_packageInfo['contents'])) { - $this->_packageInfo = $this->_insertBefore($this->_packageInfo, - array('compatible', - 'dependencies', 'providesextension', 'usesrole', 'usestask', - 'srcpackage', 'srcuri', 'phprelease', 'extsrcrelease', - 'extbinrelease', 'zendextsrcrelease', 'zendextbinrelease', - 'bundle', 'changelog'), array(), 'contents'); - } - if ($this->getPackageType() != 'bundle') { - $this->_packageInfo['contents'] = - array('dir' => array('attribs' => array('name' => '/'))); - if ($baseinstall) { - $this->_packageInfo['contents']['dir']['attribs']['baseinstalldir'] = $baseinstall; - } - } else { - $this->_packageInfo['contents'] = array('bundledpackage' => array()); - } - } - - /** - * @param string relative path of the bundled package. - */ - function addBundledPackage($path) - { - if ($this->getPackageType() != 'bundle') { - return false; - } - $this->_filesValid = false; - $this->_isValid = 0; - $this->_packageInfo = $this->_mergeTag($this->_packageInfo, $path, array( - 'contents' => array('compatible', 'dependencies', 'providesextension', - 'usesrole', 'usestask', 'srcpackage', 'srcuri', 'phprelease', - 'extsrcrelease', 'extbinrelease', 'zendextsrcrelease', 'zendextbinrelease', - 'bundle', 'changelog'), - 'bundledpackage' => array())); - } - - /** - * @param string file name - * @param PEAR_Task_Common a read/write task - */ - function addTaskToFile($filename, $task) - { - if (!method_exists($task, 'getXml')) { - return false; - } - if (!method_exists($task, 'getName')) { - return false; - } - if (!method_exists($task, 'validate')) { - return false; - } - if (!$task->validate()) { - return false; - } - if (!isset($this->_packageInfo['contents']['dir']['file'])) { - return false; - } - $this->getTasksNs(); // discover the tasks namespace if not done already - $files = $this->_packageInfo['contents']['dir']['file']; - if (!isset($files[0])) { - $files = array($files); - $ind = false; - } else { - $ind = true; - } - foreach ($files as $i => $file) { - if (isset($file['attribs'])) { - if ($file['attribs']['name'] == $filename) { - if ($ind) { - $t = isset($this->_packageInfo['contents']['dir']['file'][$i] - ['attribs'][$this->_tasksNs . - ':' . $task->getName()]) ? - $this->_packageInfo['contents']['dir']['file'][$i] - ['attribs'][$this->_tasksNs . - ':' . $task->getName()] : false; - if ($t && !isset($t[0])) { - $this->_packageInfo['contents']['dir']['file'][$i] - [$this->_tasksNs . ':' . $task->getName()] = array($t); - } - $this->_packageInfo['contents']['dir']['file'][$i][$this->_tasksNs . - ':' . $task->getName()][] = $task->getXml(); - } else { - $t = isset($this->_packageInfo['contents']['dir']['file'] - ['attribs'][$this->_tasksNs . - ':' . $task->getName()]) ? $this->_packageInfo['contents']['dir']['file'] - ['attribs'][$this->_tasksNs . - ':' . $task->getName()] : false; - if ($t && !isset($t[0])) { - $this->_packageInfo['contents']['dir']['file'] - [$this->_tasksNs . ':' . $task->getName()] = array($t); - } - $this->_packageInfo['contents']['dir']['file'][$this->_tasksNs . - ':' . $task->getName()][] = $task->getXml(); - } - return true; - } - } - } - return false; - } - - /** - * @param string path to the file - * @param string filename - * @param array extra attributes - */ - function addFile($dir, $file, $attrs) - { - if ($this->getPackageType() == 'bundle') { - return false; - } - $this->_filesValid = false; - $this->_isValid = 0; - $dir = preg_replace(array('!\\\\+!', '!/+!'), array('/', '/'), $dir); - if ($dir == '/' || $dir == '') { - $dir = ''; - } else { - $dir .= '/'; - } - $attrs['name'] = $dir . $file; - if (!isset($this->_packageInfo['contents'])) { - // ensure that the contents tag is set up - $this->_packageInfo = $this->_insertBefore($this->_packageInfo, - array('compatible', 'dependencies', 'providesextension', 'usesrole', 'usestask', - 'srcpackage', 'srcuri', 'phprelease', 'extsrcrelease', - 'extbinrelease', 'zendextsrcrelease', 'zendextbinrelease', - 'bundle', 'changelog'), array(), 'contents'); - } - if (isset($this->_packageInfo['contents']['dir']['file'])) { - if (!isset($this->_packageInfo['contents']['dir']['file'][0])) { - $this->_packageInfo['contents']['dir']['file'] = - array($this->_packageInfo['contents']['dir']['file']); - } - $this->_packageInfo['contents']['dir']['file'][]['attribs'] = $attrs; - } else { - $this->_packageInfo['contents']['dir']['file']['attribs'] = $attrs; - } - } - - /** - * @param string Dependent package name - * @param string Dependent package's channel name - * @param string minimum version of specified package that this release is guaranteed to be - * compatible with - * @param string maximum version of specified package that this release is guaranteed to be - * compatible with - * @param string versions of specified package that this release is not compatible with - */ - function addCompatiblePackage($name, $channel, $min, $max, $exclude = false) - { - $this->_isValid = 0; - $set = array( - 'name' => $name, - 'channel' => $channel, - 'min' => $min, - 'max' => $max, - ); - if ($exclude) { - $set['exclude'] = $exclude; - } - $this->_isValid = 0; - $this->_packageInfo = $this->_mergeTag($this->_packageInfo, $set, array( - 'compatible' => array('dependencies', 'providesextension', 'usesrole', 'usestask', - 'srcpackage', 'srcuri', 'phprelease', 'extsrcrelease', 'extbinrelease', - 'zendextsrcrelease', 'zendextbinrelease', 'bundle', 'changelog') - )); - } - - /** - * Removes the <usesrole> tag entirely - */ - function resetUsesrole() - { - if (isset($this->_packageInfo['usesrole'])) { - unset($this->_packageInfo['usesrole']); - } - } - - /** - * @param string - * @param string package name or uri - * @param string channel name if non-uri - */ - function addUsesrole($role, $packageOrUri, $channel = false) { - $set = array('role' => $role); - if ($channel) { - $set['package'] = $packageOrUri; - $set['channel'] = $channel; - } else { - $set['uri'] = $packageOrUri; - } - $this->_isValid = 0; - $this->_packageInfo = $this->_mergeTag($this->_packageInfo, $set, array( - 'usesrole' => array('usestask', 'srcpackage', 'srcuri', - 'phprelease', 'extsrcrelease', 'extbinrelease', - 'zendextsrcrelease', 'zendextbinrelease', 'bundle', 'changelog') - )); - } - - /** - * Removes the <usestask> tag entirely - */ - function resetUsestask() - { - if (isset($this->_packageInfo['usestask'])) { - unset($this->_packageInfo['usestask']); - } - } - - - /** - * @param string - * @param string package name or uri - * @param string channel name if non-uri - */ - function addUsestask($task, $packageOrUri, $channel = false) { - $set = array('task' => $task); - if ($channel) { - $set['package'] = $packageOrUri; - $set['channel'] = $channel; - } else { - $set['uri'] = $packageOrUri; - } - $this->_isValid = 0; - $this->_packageInfo = $this->_mergeTag($this->_packageInfo, $set, array( - 'usestask' => array('srcpackage', 'srcuri', - 'phprelease', 'extsrcrelease', 'extbinrelease', - 'zendextsrcrelease', 'zendextbinrelease', 'bundle', 'changelog') - )); - } - - /** - * Remove all compatible tags - */ - function clearCompatible() - { - unset($this->_packageInfo['compatible']); - } - - /** - * Reset dependencies prior to adding new ones - */ - function clearDeps() - { - if (!isset($this->_packageInfo['dependencies'])) { - $this->_packageInfo = $this->_mergeTag($this->_packageInfo, array(), - array( - 'dependencies' => array('providesextension', 'usesrole', 'usestask', - 'srcpackage', 'srcuri', 'phprelease', 'extsrcrelease', 'extbinrelease', - 'zendextsrcrelease', 'zendextbinrelease', 'bundle', 'changelog'))); - } - $this->_packageInfo['dependencies'] = array(); - } - - /** - * @param string minimum PHP version allowed - * @param string maximum PHP version allowed - * @param array $exclude incompatible PHP versions - */ - function setPhpDep($min, $max = false, $exclude = false) - { - $this->_isValid = 0; - $dep = - array( - 'min' => $min, - ); - if ($max) { - $dep['max'] = $max; - } - if ($exclude) { - if (count($exclude) == 1) { - $exclude = $exclude[0]; - } - $dep['exclude'] = $exclude; - } - if (isset($this->_packageInfo['dependencies']['required']['php'])) { - $this->_stack->push(__FUNCTION__, 'warning', array('dep' => - $this->_packageInfo['dependencies']['required']['php']), - 'warning: PHP dependency already exists, overwriting'); - unset($this->_packageInfo['dependencies']['required']['php']); - } - $this->_packageInfo = $this->_mergeTag($this->_packageInfo, $dep, - array( - 'dependencies' => array('providesextension', 'usesrole', 'usestask', - 'srcpackage', 'srcuri', 'phprelease', 'extsrcrelease', 'extbinrelease', - 'zendextsrcrelease', 'zendextbinrelease', 'bundle', 'changelog'), - 'required' => array('optional', 'group'), - 'php' => array('pearinstaller', 'package', 'subpackage', 'extension', 'os', 'arch') - )); - return true; - } - - /** - * @param string minimum allowed PEAR installer version - * @param string maximum allowed PEAR installer version - * @param string recommended PEAR installer version - * @param array incompatible version of the PEAR installer - */ - function setPearinstallerDep($min, $max = false, $recommended = false, $exclude = false) - { - $this->_isValid = 0; - $dep = - array( - 'min' => $min, - ); - if ($max) { - $dep['max'] = $max; - } - if ($recommended) { - $dep['recommended'] = $recommended; - } - if ($exclude) { - if (count($exclude) == 1) { - $exclude = $exclude[0]; - } - $dep['exclude'] = $exclude; - } - if (isset($this->_packageInfo['dependencies']['required']['pearinstaller'])) { - $this->_stack->push(__FUNCTION__, 'warning', array('dep' => - $this->_packageInfo['dependencies']['required']['pearinstaller']), - 'warning: PEAR Installer dependency already exists, overwriting'); - unset($this->_packageInfo['dependencies']['required']['pearinstaller']); - } - $this->_packageInfo = $this->_mergeTag($this->_packageInfo, $dep, - array( - 'dependencies' => array('providesextension', 'usesrole', 'usestask', - 'srcpackage', 'srcuri', 'phprelease', 'extsrcrelease', 'extbinrelease', - 'zendextsrcrelease', 'zendextbinrelease', 'bundle', 'changelog'), - 'required' => array('optional', 'group'), - 'pearinstaller' => array('package', 'subpackage', 'extension', 'os', 'arch') - )); - } - - /** - * Mark a package as conflicting with this package - * @param string package name - * @param string package channel - * @param string extension this package provides, if any - * @param string|false minimum version required - * @param string|false maximum version allowed - * @param array|false versions to exclude from installation - */ - function addConflictingPackageDepWithChannel($name, $channel, - $providesextension = false, $min = false, $max = false, $exclude = false) - { - $this->_isValid = 0; - $dep = $this->_constructDep($name, $channel, false, $min, $max, false, - $exclude, $providesextension, false, true); - $this->_packageInfo = $this->_mergeTag($this->_packageInfo, $dep, - array( - 'dependencies' => array('providesextension', 'usesrole', 'usestask', - 'srcpackage', 'srcuri', 'phprelease', 'extsrcrelease', 'extbinrelease', - 'zendextsrcrelease', 'zendextbinrelease', 'bundle', 'changelog'), - 'required' => array('optional', 'group'), - 'package' => array('subpackage', 'extension', 'os', 'arch') - )); - } - - /** - * Mark a package as conflicting with this package - * @param string package name - * @param string package channel - * @param string extension this package provides, if any - */ - function addConflictingPackageDepWithUri($name, $uri, $providesextension = false) - { - $this->_isValid = 0; - $dep = - array( - 'name' => $name, - 'uri' => $uri, - 'conflicts' => '', - ); - if ($providesextension) { - $dep['providesextension'] = $providesextension; - } - $this->_packageInfo = $this->_mergeTag($this->_packageInfo, $dep, - array( - 'dependencies' => array('providesextension', 'usesrole', 'usestask', - 'srcpackage', 'srcuri', 'phprelease', 'extsrcrelease', 'extbinrelease', - 'zendextsrcrelease', 'zendextbinrelease', 'bundle', 'changelog'), - 'required' => array('optional', 'group'), - 'package' => array('subpackage', 'extension', 'os', 'arch') - )); - } - - function addDependencyGroup($name, $hint) - { - $this->_isValid = 0; - $this->_packageInfo = $this->_mergeTag($this->_packageInfo, - array('attribs' => array('name' => $name, 'hint' => $hint)), - array( - 'dependencies' => array('providesextension', 'usesrole', 'usestask', - 'srcpackage', 'srcuri', 'phprelease', 'extsrcrelease', 'extbinrelease', - 'zendextsrcrelease', 'zendextbinrelease', 'bundle', 'changelog'), - 'group' => array(), - )); - } - - /** - * @param string package name - * @param string|false channel name, false if this is a uri - * @param string|false uri name, false if this is a channel - * @param string|false minimum version required - * @param string|false maximum version allowed - * @param string|false recommended installation version - * @param array|false versions to exclude from installation - * @param string extension this package provides, if any - * @param bool if true, tells the installer to ignore the default optional dependency group - * when installing this package - * @param bool if true, tells the installer to negate this dependency (conflicts) - * @return array - * @access private - */ - function _constructDep($name, $channel, $uri, $min, $max, $recommended, $exclude, - $providesextension = false, $nodefault = false, - $conflicts = false) - { - $dep = - array( - 'name' => $name, - ); - if ($channel) { - $dep['channel'] = $channel; - } elseif ($uri) { - $dep['uri'] = $uri; - } - if ($min) { - $dep['min'] = $min; - } - if ($max) { - $dep['max'] = $max; - } - if ($recommended) { - $dep['recommended'] = $recommended; - } - if ($exclude) { - if (is_array($exclude) && count($exclude) == 1) { - $exclude = $exclude[0]; - } - $dep['exclude'] = $exclude; - } - if ($conflicts) { - $dep['conflicts'] = ''; - } - if ($nodefault) { - $dep['nodefault'] = ''; - } - if ($providesextension) { - $dep['providesextension'] = $providesextension; - } - return $dep; - } - - /** - * @param package|subpackage - * @param string group name - * @param string package name - * @param string package channel - * @param string minimum version - * @param string maximum version - * @param string recommended version - * @param array|false optional excluded versions - * @param string extension this package provides, if any - * @param bool if true, tells the installer to ignore the default optional dependency group - * when installing this package - * @return bool false if the dependency group has not been initialized with - * {@link addDependencyGroup()}, or a subpackage is added with - * a providesextension - */ - function addGroupPackageDepWithChannel($type, $groupname, $name, $channel, $min = false, - $max = false, $recommended = false, $exclude = false, - $providesextension = false, $nodefault = false) - { - if ($type == 'subpackage' && $providesextension) { - return false; // subpackages must be php packages - } - $dep = $this->_constructDep($name, $channel, false, $min, $max, $recommended, $exclude, - $providesextension, $nodefault); - return $this->_addGroupDependency($type, $dep, $groupname); - } - - /** - * @param package|subpackage - * @param string group name - * @param string package name - * @param string package uri - * @param string extension this package provides, if any - * @param bool if true, tells the installer to ignore the default optional dependency group - * when installing this package - * @return bool false if the dependency group has not been initialized with - * {@link addDependencyGroup()} - */ - function addGroupPackageDepWithURI($type, $groupname, $name, $uri, $providesextension = false, - $nodefault = false) - { - if ($type == 'subpackage' && $providesextension) { - return false; // subpackages must be php packages - } - $dep = $this->_constructDep($name, false, $uri, false, false, false, false, - $providesextension, $nodefault); - return $this->_addGroupDependency($type, $dep, $groupname); - } - - /** - * @param string group name (must be pre-existing) - * @param string extension name - * @param string minimum version allowed - * @param string maximum version allowed - * @param string recommended version - * @param array incompatible versions - */ - function addGroupExtensionDep($groupname, $name, $min = false, $max = false, - $recommended = false, $exclude = false) - { - $this->_isValid = 0; - $dep = $this->_constructDep($name, false, false, $min, $max, $recommended, $exclude); - return $this->_addGroupDependency('extension', $dep, $groupname); - } - - /** - * @param package|subpackage|extension - * @param array dependency contents - * @param string name of the dependency group to add this to - * @return boolean - * @access private - */ - function _addGroupDependency($type, $dep, $groupname) - { - $arr = array('subpackage', 'extension'); - if ($type != 'package') { - array_shift($arr); - } - if ($type == 'extension') { - array_shift($arr); - } - if (!isset($this->_packageInfo['dependencies']['group'])) { - return false; - } else { - if (!isset($this->_packageInfo['dependencies']['group'][0])) { - if ($this->_packageInfo['dependencies']['group']['attribs']['name'] == $groupname) { - $this->_packageInfo['dependencies']['group'] = $this->_mergeTag( - $this->_packageInfo['dependencies']['group'], $dep, - array( - $type => $arr - )); - $this->_isValid = 0; - return true; - } else { - return false; - } - } else { - foreach ($this->_packageInfo['dependencies']['group'] as $i => $group) { - if ($group['attribs']['name'] == $groupname) { - $this->_packageInfo['dependencies']['group'][$i] = $this->_mergeTag( - $this->_packageInfo['dependencies']['group'][$i], $dep, - array( - $type => $arr - )); - $this->_isValid = 0; - return true; - } - } - return false; - } - } - } - - /** - * @param optional|required - * @param string package name - * @param string package channel - * @param string minimum version - * @param string maximum version - * @param string recommended version - * @param string extension this package provides, if any - * @param bool if true, tells the installer to ignore the default optional dependency group - * when installing this package - * @param array|false optional excluded versions - */ - function addPackageDepWithChannel($type, $name, $channel, $min = false, $max = false, - $recommended = false, $exclude = false, - $providesextension = false, $nodefault = false) - { - if (!in_array($type, array('optional', 'required'), true)) { - $type = 'required'; - } - $this->_isValid = 0; - $arr = array('optional', 'group'); - if ($type != 'required') { - array_shift($arr); - } - $dep = $this->_constructDep($name, $channel, false, $min, $max, $recommended, $exclude, - $providesextension, $nodefault); - $this->_packageInfo = $this->_mergeTag($this->_packageInfo, $dep, - array( - 'dependencies' => array('providesextension', 'usesrole', 'usestask', - 'srcpackage', 'srcuri', 'phprelease', 'extsrcrelease', 'extbinrelease', - 'zendextsrcrelease', 'zendextbinrelease', 'bundle', 'changelog'), - $type => $arr, - 'package' => array('subpackage', 'extension', 'os', 'arch') - )); - } - - /** - * @param optional|required - * @param string name of the package - * @param string uri of the package - * @param string extension this package provides, if any - * @param bool if true, tells the installer to ignore the default optional dependency group - * when installing this package - */ - function addPackageDepWithUri($type, $name, $uri, $providesextension = false, - $nodefault = false) - { - $this->_isValid = 0; - $arr = array('optional', 'group'); - if ($type != 'required') { - array_shift($arr); - } - $dep = $this->_constructDep($name, false, $uri, false, false, false, false, - $providesextension, $nodefault); - $this->_packageInfo = $this->_mergeTag($this->_packageInfo, $dep, - array( - 'dependencies' => array('providesextension', 'usesrole', 'usestask', - 'srcpackage', 'srcuri', 'phprelease', 'extsrcrelease', 'extbinrelease', - 'zendextsrcrelease', 'zendextbinrelease', 'bundle', 'changelog'), - $type => $arr, - 'package' => array('subpackage', 'extension', 'os', 'arch') - )); - } - - /** - * @param optional|required optional, required - * @param string package name - * @param string package channel - * @param string minimum version - * @param string maximum version - * @param string recommended version - * @param array incompatible versions - * @param bool if true, tells the installer to ignore the default optional dependency group - * when installing this package - */ - function addSubpackageDepWithChannel($type, $name, $channel, $min = false, $max = false, - $recommended = false, $exclude = false, - $nodefault = false) - { - $this->_isValid = 0; - $arr = array('optional', 'group'); - if ($type != 'required') { - array_shift($arr); - } - $dep = $this->_constructDep($name, $channel, false, $min, $max, $recommended, $exclude, - $nodefault); - $this->_packageInfo = $this->_mergeTag($this->_packageInfo, $dep, - array( - 'dependencies' => array('providesextension', 'usesrole', 'usestask', - 'srcpackage', 'srcuri', 'phprelease', 'extsrcrelease', 'extbinrelease', - 'zendextsrcrelease', 'zendextbinrelease', 'bundle', 'changelog'), - $type => $arr, - 'subpackage' => array('extension', 'os', 'arch') - )); - } - - /** - * @param optional|required optional, required - * @param string package name - * @param string package uri for download - * @param bool if true, tells the installer to ignore the default optional dependency group - * when installing this package - */ - function addSubpackageDepWithUri($type, $name, $uri, $nodefault = false) - { - $this->_isValid = 0; - $arr = array('optional', 'group'); - if ($type != 'required') { - array_shift($arr); - } - $dep = $this->_constructDep($name, false, $uri, false, false, false, false, $nodefault); - $this->_packageInfo = $this->_mergeTag($this->_packageInfo, $dep, - array( - 'dependencies' => array('providesextension', 'usesrole', 'usestask', - 'srcpackage', 'srcuri', 'phprelease', 'extsrcrelease', 'extbinrelease', - 'zendextsrcrelease', 'zendextbinrelease', 'bundle', 'changelog'), - $type => $arr, - 'subpackage' => array('extension', 'os', 'arch') - )); - } - - /** - * @param optional|required optional, required - * @param string extension name - * @param string minimum version - * @param string maximum version - * @param string recommended version - * @param array incompatible versions - */ - function addExtensionDep($type, $name, $min = false, $max = false, $recommended = false, - $exclude = false) - { - $this->_isValid = 0; - $arr = array('optional', 'group'); - if ($type != 'required') { - array_shift($arr); - } - $dep = $this->_constructDep($name, false, false, $min, $max, $recommended, $exclude); - $this->_packageInfo = $this->_mergeTag($this->_packageInfo, $dep, - array( - 'dependencies' => array('providesextension', 'usesrole', 'usestask', - 'srcpackage', 'srcuri', 'phprelease', 'extsrcrelease', 'extbinrelease', - 'zendextsrcrelease', 'zendextbinrelease', 'bundle', 'changelog'), - $type => $arr, - 'extension' => array('os', 'arch') - )); - } - - /** - * @param string Operating system name - * @param boolean true if this package cannot be installed on this OS - */ - function addOsDep($name, $conflicts = false) - { - $this->_isValid = 0; - $dep = array('name' => $name); - if ($conflicts) { - $dep['conflicts'] = ''; - } - $this->_packageInfo = $this->_mergeTag($this->_packageInfo, $dep, - array( - 'dependencies' => array('providesextension', 'usesrole', 'usestask', - 'srcpackage', 'srcuri', 'phprelease', 'extsrcrelease', 'extbinrelease', - 'zendextsrcrelease', 'zendextbinrelease', 'bundle', 'changelog'), - 'required' => array('optional', 'group'), - 'os' => array('arch') - )); - } - - /** - * @param string Architecture matching pattern - * @param boolean true if this package cannot be installed on this architecture - */ - function addArchDep($pattern, $conflicts = false) - { - $this->_isValid = 0; - $dep = array('pattern' => $pattern); - if ($conflicts) { - $dep['conflicts'] = ''; - } - $this->_packageInfo = $this->_mergeTag($this->_packageInfo, $dep, - array( - 'dependencies' => array('providesextension', 'usesrole', 'usestask', - 'srcpackage', 'srcuri', 'phprelease', 'extsrcrelease', 'extbinrelease', - 'zendextsrcrelease', 'zendextbinrelease', 'bundle', 'changelog'), - 'required' => array('optional', 'group'), - 'arch' => array() - )); - } - - /** - * Set the kind of package, and erase all release tags - * - * - a php package is a PEAR-style package - * - an extbin package is a PECL-style extension binary - * - an extsrc package is a PECL-style source for a binary - * - an zendextbin package is a PECL-style zend extension binary - * - an zendextsrc package is a PECL-style source for a zend extension binary - * - a bundle package is a collection of other pre-packaged packages - * @param php|extbin|extsrc|zendextsrc|zendextbin|bundle - * @return bool success - */ - function setPackageType($type) - { - $this->_isValid = 0; - if (!in_array($type, array('php', 'extbin', 'extsrc', 'zendextsrc', - 'zendextbin', 'bundle'))) { - return false; - } - - if (in_array($type, array('zendextsrc', 'zendextbin'))) { - $this->_setPackageVersion2_1(); - } - - if ($type != 'bundle') { - $type .= 'release'; - } - - foreach (array('phprelease', 'extbinrelease', 'extsrcrelease', - 'zendextsrcrelease', 'zendextbinrelease', 'bundle') as $test) { - unset($this->_packageInfo[$test]); - } - - if (!isset($this->_packageInfo[$type])) { - // ensure that the release tag is set up - $this->_packageInfo = $this->_insertBefore($this->_packageInfo, array('changelog'), - array(), $type); - } - - $this->_packageInfo[$type] = array(); - return true; - } - - /** - * @return bool true if package type is set up - */ - function addRelease() - { - if ($type = $this->getPackageType()) { - if ($type != 'bundle') { - $type .= 'release'; - } - $this->_packageInfo = $this->_mergeTag($this->_packageInfo, array(), - array($type => array('changelog'))); - return true; - } - return false; - } - - /** - * Get the current release tag in order to add to it - * @param bool returns only releases that have installcondition if true - * @return array|null - */ - function &_getCurrentRelease($strict = true) - { - if ($p = $this->getPackageType()) { - if ($strict) { - if ($p == 'extsrc' || $p == 'zendextsrc') { - $a = null; - return $a; - } - } - if ($p != 'bundle') { - $p .= 'release'; - } - if (isset($this->_packageInfo[$p][0])) { - return $this->_packageInfo[$p][count($this->_packageInfo[$p]) - 1]; - } else { - return $this->_packageInfo[$p]; - } - } else { - $a = null; - return $a; - } - } - - /** - * Add a file to the current release that should be installed under a different name - * @param string <contents> path to file - * @param string name the file should be installed as - */ - function addInstallAs($path, $as) - { - $r = &$this->_getCurrentRelease(); - if ($r === null) { - return false; - } - $this->_isValid = 0; - $r = $this->_mergeTag($r, array('attribs' => array('name' => $path, 'as' => $as)), - array( - 'filelist' => array(), - 'install' => array('ignore') - )); - } - - /** - * Add a file to the current release that should be ignored - * @param string <contents> path to file - * @return bool success of operation - */ - function addIgnore($path) - { - $r = &$this->_getCurrentRelease(); - if ($r === null) { - return false; - } - $this->_isValid = 0; - $r = $this->_mergeTag($r, array('attribs' => array('name' => $path)), - array( - 'filelist' => array(), - 'ignore' => array() - )); - } - - /** - * Add an extension binary package for this extension source code release - * - * Note that the package must be from the same channel as the extension source package - * @param string - */ - function addBinarypackage($package) - { - if ($this->getPackageType() != 'extsrc' && $this->getPackageType() != 'zendextsrc') { - return false; - } - $r = &$this->_getCurrentRelease(false); - if ($r === null) { - return false; - } - $this->_isValid = 0; - $r = $this->_mergeTag($r, $package, - array( - 'binarypackage' => array('filelist'), - )); - } - - /** - * Add a configureoption to an extension source package - * @param string - * @param string - * @param string - */ - function addConfigureOption($name, $prompt, $default = null) - { - if ($this->getPackageType() != 'extsrc' && $this->getPackageType() != 'zendextsrc') { - return false; - } - - $r = &$this->_getCurrentRelease(false); - if ($r === null) { - return false; - } - - $opt = array('attribs' => array('name' => $name, 'prompt' => $prompt)); - if ($default !== null) { - $opt['attribs']['default'] = $default; - } - - $this->_isValid = 0; - $r = $this->_mergeTag($r, $opt, - array( - 'configureoption' => array('binarypackage', 'filelist'), - )); - } - - /** - * Set an installation condition based on php version for the current release set - * @param string minimum version - * @param string maximum version - * @param false|array incompatible versions of PHP - */ - function setPhpInstallCondition($min, $max, $exclude = false) - { - $r = &$this->_getCurrentRelease(); - if ($r === null) { - return false; - } - $this->_isValid = 0; - if (isset($r['installconditions']['php'])) { - unset($r['installconditions']['php']); - } - $dep = array('min' => $min, 'max' => $max); - if ($exclude) { - if (is_array($exclude) && count($exclude) == 1) { - $exclude = $exclude[0]; - } - $dep['exclude'] = $exclude; - } - if ($this->getPackageType() == 'extsrc' || $this->getPackageType() == 'zendextsrc') { - $r = $this->_mergeTag($r, $dep, - array( - 'installconditions' => array('configureoption', 'binarypackage', - 'filelist'), - 'php' => array('extension', 'os', 'arch') - )); - } else { - $r = $this->_mergeTag($r, $dep, - array( - 'installconditions' => array('filelist'), - 'php' => array('extension', 'os', 'arch') - )); - } - } - - /** - * @param optional|required optional, required - * @param string extension name - * @param string minimum version - * @param string maximum version - * @param string recommended version - * @param array incompatible versions - */ - function addExtensionInstallCondition($name, $min = false, $max = false, $recommended = false, - $exclude = false) - { - $r = &$this->_getCurrentRelease(); - if ($r === null) { - return false; - } - $this->_isValid = 0; - $dep = $this->_constructDep($name, false, false, $min, $max, $recommended, $exclude); - if ($this->getPackageType() == 'extsrc' || $this->getPackageType() == 'zendextsrc') { - $r = $this->_mergeTag($r, $dep, - array( - 'installconditions' => array('configureoption', 'binarypackage', - 'filelist'), - 'extension' => array('os', 'arch') - )); - } else { - $r = $this->_mergeTag($r, $dep, - array( - 'installconditions' => array('filelist'), - 'extension' => array('os', 'arch') - )); - } - } - - /** - * Set an installation condition based on operating system for the current release set - * @param string OS name - * @param bool whether this OS is incompatible with the current release - */ - function setOsInstallCondition($name, $conflicts = false) - { - $r = &$this->_getCurrentRelease(); - if ($r === null) { - return false; - } - $this->_isValid = 0; - if (isset($r['installconditions']['os'])) { - unset($r['installconditions']['os']); - } - $dep = array('name' => $name); - if ($conflicts) { - $dep['conflicts'] = ''; - } - if ($this->getPackageType() == 'extsrc' || $this->getPackageType() == 'zendextsrc') { - $r = $this->_mergeTag($r, $dep, - array( - 'installconditions' => array('configureoption', 'binarypackage', - 'filelist'), - 'os' => array('arch') - )); - } else { - $r = $this->_mergeTag($r, $dep, - array( - 'installconditions' => array('filelist'), - 'os' => array('arch') - )); - } - } - - /** - * Set an installation condition based on architecture for the current release set - * @param string architecture pattern - * @param bool whether this arch is incompatible with the current release - */ - function setArchInstallCondition($pattern, $conflicts = false) - { - $r = &$this->_getCurrentRelease(); - if ($r === null) { - return false; - } - $this->_isValid = 0; - if (isset($r['installconditions']['arch'])) { - unset($r['installconditions']['arch']); - } - $dep = array('pattern' => $pattern); - if ($conflicts) { - $dep['conflicts'] = ''; - } - if ($this->getPackageType() == 'extsrc' || $this->getPackageType() == 'zendextsrc') { - $r = $this->_mergeTag($r, $dep, - array( - 'installconditions' => array('configureoption', 'binarypackage', - 'filelist'), - 'arch' => array() - )); - } else { - $r = $this->_mergeTag($r, $dep, - array( - 'installconditions' => array('filelist'), - 'arch' => array() - )); - } - } - - /** - * For extension binary releases, this is used to specify either the - * static URI to a source package, or the package name and channel of the extsrc/zendextsrc - * package it is based on. - * @param string Package name, or full URI to source package (extsrc/zendextsrc type) - */ - function setSourcePackage($packageOrUri) - { - $this->_isValid = 0; - if (isset($this->_packageInfo['channel'])) { - $this->_packageInfo = $this->_insertBefore($this->_packageInfo, array('phprelease', - 'extsrcrelease', 'extbinrelease', 'zendextsrcrelease', 'zendextbinrelease', - 'bundle', 'changelog'), - $packageOrUri, 'srcpackage'); - } else { - $this->_packageInfo = $this->_insertBefore($this->_packageInfo, array('phprelease', - 'extsrcrelease', 'extbinrelease', 'zendextsrcrelease', 'zendextbinrelease', - 'bundle', 'changelog'), $packageOrUri, 'srcuri'); - } - } - - /** - * Generate a valid change log entry from the current package.xml - * @param string|false - */ - function generateChangeLogEntry($notes = false) - { - return array( - 'version' => - array( - 'release' => $this->getVersion('release'), - 'api' => $this->getVersion('api'), - ), - 'stability' => - $this->getStability(), - 'date' => $this->getDate(), - 'license' => $this->getLicense(true), - 'notes' => $notes ? $notes : $this->getNotes() - ); - } - - /** - * @param string release version to set change log notes for - * @param array output of {@link generateChangeLogEntry()} - */ - function setChangelogEntry($releaseversion, $contents) - { - if (!isset($this->_packageInfo['changelog'])) { - $this->_packageInfo['changelog']['release'] = $contents; - return; - } - if (!isset($this->_packageInfo['changelog']['release'][0])) { - if ($this->_packageInfo['changelog']['release']['version']['release'] == $releaseversion) { - $this->_packageInfo['changelog']['release'] = array( - $this->_packageInfo['changelog']['release']); - } else { - $this->_packageInfo['changelog']['release'] = array( - $this->_packageInfo['changelog']['release']); - return $this->_packageInfo['changelog']['release'][] = $contents; - } - } - foreach($this->_packageInfo['changelog']['release'] as $index => $changelog) { - if (isset($changelog['version']) && - strnatcasecmp($changelog['version']['release'], $releaseversion) == 0) { - $curlog = $index; - } - } - if (isset($curlog)) { - $this->_packageInfo['changelog']['release'][$curlog] = $contents; - } else { - $this->_packageInfo['changelog']['release'][] = $contents; - } - } - - /** - * Remove the changelog entirely - */ - function clearChangeLog() - { - unset($this->_packageInfo['changelog']); - } -}<?php -/** - * PEAR_PackageFile_v2, package.xml version 2.0, read/write version - * - * PHP versions 4 and 5 - * - * @category pear - * @package PEAR - * @author Greg Beaver <cellog@php.net> - * @copyright 1997-2009 The Authors - * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id: Validator.php 313023 2011-07-06 19:17:11Z dufuz $ + * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR * @since File available since Release 1.4.0a8 */ @@ -89707,7 +80017,7 @@ class PEAR_PackageFile_v2_rw extends PEAR_PackageFile_v2 * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version Release: 1.9.4 + * @version Release: 1.9.5 * @link http://pear.php.net/package/PEAR * @since Class available since Release 1.4.0a8 * @access private @@ -89798,7 +80108,7 @@ class PEAR_PackageFile_v2_Validator isset($test['dependencies']['required']) && isset($test['dependencies']['required']['pearinstaller']) && isset($test['dependencies']['required']['pearinstaller']['min']) && - version_compare('1.9.4', + version_compare('1.9.5', $test['dependencies']['required']['pearinstaller']['min'], '<') ) { $this->_pearVersionTooLow($test['dependencies']['required']['pearinstaller']['min']); @@ -91036,7 +81346,7 @@ class PEAR_PackageFile_v2_Validator $this->_stack->push(__FUNCTION__, 'error', array('version' => $version), 'This package.xml requires PEAR version %version% to parse properly, we are ' . - 'version 1.9.4'); + 'version 1.9.5'); } function _invalidTagOrder($oktags, $actual, $root) @@ -91561,7 +81871,7 @@ class PEAR_PackageFile_v2_Validator $pn = $this->_pf->getPackage(); $this->_stack->push(__FUNCTION__, 'warning', array('file' => $file, 'package' => $pn), - 'in %file%: Could not process file for unkown reasons,' . + 'in %file%: Could not process file for unknown reasons,' . ' possibly a PHP parse error in %file% from %package%'); } } @@ -91731,7 +82041,7 @@ class PEAR_PackageFile_v2_Validator continue 2; case T_DOUBLE_COLON: $token = $tokens[$i - 1][0]; - if (!($token == T_WHITESPACE || $token == T_STRING || $token == T_STATIC)) { + if (!($token == T_WHITESPACE || $token == T_STRING || $token == T_STATIC || $token == T_VARIABLE)) { if (isset($this->_stack)) { $this->_stack->push(__FUNCTION__, 'warning', array('file' => $file), 'Parser error: invalid PHP found in file "%file%"'); @@ -91837,207 +82147,8 @@ class PEAR_PackageFile_v2_Validator return $providesret; } -}<?php -/** - * PEAR_Packager for generating releases - * - * PHP versions 4 and 5 - * - * @category pear - * @package PEAR - * @author Stig Bakken <ssb@php.net> - * @author Tomas V. V. Cox <cox@idecnet.com> - * @author Greg Beaver <cellog@php.net> - * @copyright 1997-2009 The Authors - * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id: Packager.php 313023 2011-07-06 19:17:11Z dufuz $ - * @link http://pear.php.net/package/PEAR - * @since File available since Release 0.1 - */ - -/** - * base class - */ -require_once 'phar://install-pear-nozlib.phar/' . 'PEAR/Common.php'; -require_once 'phar://install-pear-nozlib.phar/' . 'PEAR/PackageFile.php'; -require_once 'phar://install-pear-nozlib.phar/' . 'System.php'; - -/** - * Administration class used to make a PEAR release tarball. - * - * @category pear - * @package PEAR - * @author Greg Beaver <cellog@php.net> - * @copyright 1997-2009 The Authors - * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version Release: 1.9.4 - * @link http://pear.php.net/package/PEAR - * @since Class available since Release 0.1 - */ -class PEAR_Packager extends PEAR_Common -{ - /** - * @var PEAR_Registry - */ - var $_registry; - - function package($pkgfile = null, $compress = true, $pkg2 = null) - { - // {{{ validate supplied package.xml file - if (empty($pkgfile)) { - $pkgfile = 'package.xml'; - } - - PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN); - $pkg = &new PEAR_PackageFile($this->config, $this->debug); - $pf = &$pkg->fromPackageFile($pkgfile, PEAR_VALIDATE_NORMAL); - $main = &$pf; - PEAR::staticPopErrorHandling(); - if (PEAR::isError($pf)) { - if (is_array($pf->getUserInfo())) { - foreach ($pf->getUserInfo() as $error) { - $this->log(0, 'Error: ' . $error['message']); - } - } - - $this->log(0, $pf->getMessage()); - return $this->raiseError("Cannot package, errors in package file"); - } - - foreach ($pf->getValidationWarnings() as $warning) { - $this->log(1, 'Warning: ' . $warning['message']); - } - - // }}} - if ($pkg2) { - $this->log(0, 'Attempting to process the second package file'); - PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN); - $pf2 = &$pkg->fromPackageFile($pkg2, PEAR_VALIDATE_NORMAL); - PEAR::staticPopErrorHandling(); - if (PEAR::isError($pf2)) { - if (is_array($pf2->getUserInfo())) { - foreach ($pf2->getUserInfo() as $error) { - $this->log(0, 'Error: ' . $error['message']); - } - } - $this->log(0, $pf2->getMessage()); - return $this->raiseError("Cannot package, errors in second package file"); - } - - foreach ($pf2->getValidationWarnings() as $warning) { - $this->log(1, 'Warning: ' . $warning['message']); - } - - if ($pf2->getPackagexmlVersion() == '2.0' || - $pf2->getPackagexmlVersion() == '2.1' - ) { - $main = &$pf2; - $other = &$pf; - } else { - $main = &$pf; - $other = &$pf2; - } - - if ($main->getPackagexmlVersion() != '2.0' && - $main->getPackagexmlVersion() != '2.1') { - return PEAR::raiseError('Error: cannot package two package.xml version 1.0, can ' . - 'only package together a package.xml 1.0 and package.xml 2.0'); - } - - if ($other->getPackagexmlVersion() != '1.0') { - return PEAR::raiseError('Error: cannot package two package.xml version 2.0, can ' . - 'only package together a package.xml 1.0 and package.xml 2.0'); - } - } - - $main->setLogger($this); - if (!$main->validate(PEAR_VALIDATE_PACKAGING)) { - foreach ($main->getValidationWarnings() as $warning) { - $this->log(0, 'Error: ' . $warning['message']); - } - return $this->raiseError("Cannot package, errors in package"); - } - - foreach ($main->getValidationWarnings() as $warning) { - $this->log(1, 'Warning: ' . $warning['message']); - } - - if ($pkg2) { - $other->setLogger($this); - $a = false; - if (!$other->validate(PEAR_VALIDATE_NORMAL) || $a = !$main->isEquivalent($other)) { - foreach ($other->getValidationWarnings() as $warning) { - $this->log(0, 'Error: ' . $warning['message']); - } - - foreach ($main->getValidationWarnings() as $warning) { - $this->log(0, 'Error: ' . $warning['message']); - } - - if ($a) { - return $this->raiseError('The two package.xml files are not equivalent!'); - } - - return $this->raiseError("Cannot package, errors in package"); - } - - foreach ($other->getValidationWarnings() as $warning) { - $this->log(1, 'Warning: ' . $warning['message']); - } - - $gen = &$main->getDefaultGenerator(); - $tgzfile = $gen->toTgz2($this, $other, $compress); - if (PEAR::isError($tgzfile)) { - return $tgzfile; - } - - $dest_package = basename($tgzfile); - $pkgdir = dirname($pkgfile); - - // TAR the Package ------------------------------------------- - $this->log(1, "Package $dest_package done"); - if (file_exists("$pkgdir/CVS/Root")) { - $cvsversion = preg_replace('/[^a-z0-9]/i', '_', $pf->getVersion()); - $cvstag = "RELEASE_$cvsversion"; - $this->log(1, 'Tag the released code with "pear cvstag ' . - $main->getPackageFile() . '"'); - $this->log(1, "(or set the CVS tag $cvstag by hand)"); - } elseif (file_exists("$pkgdir/.svn")) { - $svnversion = preg_replace('/[^a-z0-9]/i', '.', $pf->getVersion()); - $svntag = $pf->getName() . "-$svnversion"; - $this->log(1, 'Tag the released code with "pear svntag ' . - $main->getPackageFile() . '"'); - $this->log(1, "(or set the SVN tag $svntag by hand)"); - } - } else { // this branch is executed for single packagefile packaging - $gen = &$pf->getDefaultGenerator(); - $tgzfile = $gen->toTgz($this, $compress); - if (PEAR::isError($tgzfile)) { - $this->log(0, $tgzfile->getMessage()); - return $this->raiseError("Cannot package, errors in package"); - } - - $dest_package = basename($tgzfile); - $pkgdir = dirname($pkgfile); - - // TAR the Package ------------------------------------------- - $this->log(1, "Package $dest_package done"); - if (file_exists("$pkgdir/CVS/Root")) { - $cvsversion = preg_replace('/[^a-z0-9]/i', '_', $pf->getVersion()); - $cvstag = "RELEASE_$cvsversion"; - $this->log(1, "Tag the released code with `pear cvstag $pkgfile'"); - $this->log(1, "(or set the CVS tag $cvstag by hand)"); - } elseif (file_exists("$pkgdir/.svn")) { - $svnversion = preg_replace('/[^a-z0-9]/i', '.', $pf->getVersion()); - $svntag = $pf->getName() . "-$svnversion"; - $this->log(1, "Tag the released code with `pear svntag $pkgfile'"); - $this->log(1, "(or set the SVN tag $svntag by hand)"); - } - } - - return $dest_package; - } -}<?php +} +<?php /** * PEAR_Registry * @@ -92050,7 +82161,7 @@ class PEAR_Packager extends PEAR_Common * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id: Registry.php 313023 2011-07-06 19:17:11Z dufuz $ + * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR * @since File available since Release 0.1 */ @@ -92076,7 +82187,7 @@ define('PEAR_REGISTRY_ERROR_CHANNEL_FILE', -6); * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version Release: 1.9.4 + * @version Release: 1.9.5 * @link http://pear.php.net/package/PEAR * @since Class available since Release 1.4.0a1 */ @@ -94442,7 +84553,7 @@ class PEAR_Registry extends PEAR * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id: REST.php 313023 2011-07-06 19:17:11Z dufuz $ + * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR * @since File available since Release 1.4.0a1 */ @@ -94461,7 +84572,7 @@ require_once 'phar://install-pear-nozlib.phar/' . 'PEAR/XMLParser.php'; * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version Release: 1.9.4 + * @version Release: 1.9.5 * @link http://pear.php.net/package/PEAR * @since Class available since Release 1.4.0a1 */ @@ -94562,11 +84673,13 @@ class PEAR_REST } if (isset($headers['content-type'])) { - switch ($headers['content-type']) { + $content_type = explode(";", $headers['content-type']); + $content_type = $content_type[0]; + switch ($content_type) { case 'text/xml' : case 'application/xml' : case 'text/plain' : - if ($headers['content-type'] === 'text/plain') { + if ($content_type === 'text/plain') { $check = substr($content, 0, 5); if ($check !== '<?xml') { break; @@ -94706,19 +84819,24 @@ class PEAR_REST return PEAR::raiseError("Could not write $file."); } } else { // update file - $cachefile_lstat = lstat($file); - $cachefile_fp = @fopen($file, 'wb'); + $cachefile_fp = @fopen($file, 'r+b'); // do not truncate file if (!$cachefile_fp) { return PEAR::raiseError("Could not open $file for writing."); } - $cachefile_fstat = fstat($cachefile_fp); - if ( - $cachefile_lstat['mode'] == $cachefile_fstat['mode'] && - $cachefile_lstat['ino'] == $cachefile_fstat['ino'] && - $cachefile_lstat['dev'] == $cachefile_fstat['dev'] && - $cachefile_fstat['nlink'] === 1 - ) { + if (OS_WINDOWS) { + $not_symlink = !is_link($file); // see bug #18834 + } else { + $cachefile_lstat = lstat($file); + $cachefile_fstat = fstat($cachefile_fp); + $not_symlink = $cachefile_lstat['mode'] == $cachefile_fstat['mode'] + && $cachefile_lstat['ino'] == $cachefile_fstat['ino'] + && $cachefile_lstat['dev'] == $cachefile_fstat['dev'] + && $cachefile_fstat['nlink'] === 1; + } + + if ($not_symlink) { + ftruncate($cachefile_fp, 0); // NOW truncate if (fwrite($cachefile_fp, $contents, $len) < $len) { fclose($cachefile_fp); return PEAR::raiseError("Could not write $file."); @@ -94816,7 +84934,7 @@ class PEAR_REST } $request .= $ifmodifiedsince . - "User-Agent: PEAR/1.9.4/PHP/" . PHP_VERSION . "\r\n"; + "User-Agent: PEAR/1.9.5/PHP/" . PHP_VERSION . "\r\n"; $username = $this->config->get('username', null, $channel); $password = $this->config->get('password', null, $channel); @@ -94913,7 +85031,8 @@ class PEAR_REST return $data; } -}<?php +} +<?php /** * PEAR_REST_10 * @@ -94924,7 +85043,7 @@ class PEAR_REST * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id: 10.php 313023 2011-07-06 19:17:11Z dufuz $ + * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR * @since File available since Release 1.4.0a12 */ @@ -94942,7 +85061,7 @@ require_once 'phar://install-pear-nozlib.phar/' . 'PEAR/REST.php'; * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version Release: 1.9.4 + * @version Release: 1.9.5 * @link http://pear.php.net/package/PEAR * @since Class available since Release 1.4.0a12 */ @@ -95784,1612 +85903,6 @@ class PEAR_REST_10 } } }<?php -/** - * PEAR_REST_11 - implement faster list-all/remote-list command - * - * PHP versions 4 and 5 - * - * @category pear - * @package PEAR - * @author Greg Beaver <cellog@php.net> - * @copyright 1997-2009 The Authors - * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id: 11.php 313023 2011-07-06 19:17:11Z dufuz $ - * @link http://pear.php.net/package/PEAR - * @since File available since Release 1.4.3 - */ - -/** - * For downloading REST xml/txt files - */ -require_once 'phar://install-pear-nozlib.phar/' . 'PEAR/REST.php'; - -/** - * Implement REST 1.1 - * - * @category pear - * @package PEAR - * @author Greg Beaver <cellog@php.net> - * @copyright 1997-2009 The Authors - * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version Release: 1.9.4 - * @link http://pear.php.net/package/PEAR - * @since Class available since Release 1.4.3 - */ -class PEAR_REST_11 -{ - /** - * @var PEAR_REST - */ - var $_rest; - - function PEAR_REST_11($config, $options = array()) - { - $this->_rest = &new PEAR_REST($config, $options); - } - - function listAll($base, $dostable, $basic = true, $searchpackage = false, $searchsummary = false, $channel = false) - { - $categorylist = $this->_rest->retrieveData($base . 'c/categories.xml', false, false, $channel); - if (PEAR::isError($categorylist)) { - return $categorylist; - } - - $ret = array(); - if (!is_array($categorylist['c']) || !isset($categorylist['c'][0])) { - $categorylist['c'] = array($categorylist['c']); - } - - PEAR::pushErrorHandling(PEAR_ERROR_RETURN); - - foreach ($categorylist['c'] as $progress => $category) { - $category = $category['_content']; - $packagesinfo = $this->_rest->retrieveData($base . - 'c/' . urlencode($category) . '/packagesinfo.xml', false, false, $channel); - - if (PEAR::isError($packagesinfo)) { - continue; - } - - if (!is_array($packagesinfo) || !isset($packagesinfo['pi'])) { - continue; - } - - if (!is_array($packagesinfo['pi']) || !isset($packagesinfo['pi'][0])) { - $packagesinfo['pi'] = array($packagesinfo['pi']); - } - - foreach ($packagesinfo['pi'] as $packageinfo) { - if (empty($packageinfo)) { - continue; - } - - $info = $packageinfo['p']; - $package = $info['n']; - $releases = isset($packageinfo['a']) ? $packageinfo['a'] : false; - unset($latest); - unset($unstable); - unset($stable); - unset($state); - - if ($releases) { - if (!isset($releases['r'][0])) { - $releases['r'] = array($releases['r']); - } - - foreach ($releases['r'] as $release) { - if (!isset($latest)) { - if ($dostable && $release['s'] == 'stable') { - $latest = $release['v']; - $state = 'stable'; - } - if (!$dostable) { - $latest = $release['v']; - $state = $release['s']; - } - } - - if (!isset($stable) && $release['s'] == 'stable') { - $stable = $release['v']; - if (!isset($unstable)) { - $unstable = $stable; - } - } - - if (!isset($unstable) && $release['s'] != 'stable') { - $unstable = $release['v']; - $state = $release['s']; - } - - if (isset($latest) && !isset($state)) { - $state = $release['s']; - } - - if (isset($latest) && isset($stable) && isset($unstable)) { - break; - } - } - } - - if ($basic) { // remote-list command - if (!isset($latest)) { - $latest = false; - } - - if ($dostable) { - // $state is not set if there are no releases - if (isset($state) && $state == 'stable') { - $ret[$package] = array('stable' => $latest); - } else { - $ret[$package] = array('stable' => '-n/a-'); - } - } else { - $ret[$package] = array('stable' => $latest); - } - - continue; - } - - // list-all command - if (!isset($unstable)) { - $unstable = false; - $state = 'stable'; - if (isset($stable)) { - $latest = $unstable = $stable; - } - } else { - $latest = $unstable; - } - - if (!isset($latest)) { - $latest = false; - } - - $deps = array(); - if ($latest && isset($packageinfo['deps'])) { - if (!is_array($packageinfo['deps']) || - !isset($packageinfo['deps'][0]) - ) { - $packageinfo['deps'] = array($packageinfo['deps']); - } - - $d = false; - foreach ($packageinfo['deps'] as $dep) { - if ($dep['v'] == $latest) { - $d = unserialize($dep['d']); - } - } - - if ($d) { - if (isset($d['required'])) { - if (!class_exists('PEAR_PackageFile_v2')) { - require_once 'phar://install-pear-nozlib.phar/' . 'PEAR/PackageFile/v2.php'; - } - - if (!isset($pf)) { - $pf = new PEAR_PackageFile_v2; - } - - $pf->setDeps($d); - $tdeps = $pf->getDeps(); - } else { - $tdeps = $d; - } - - foreach ($tdeps as $dep) { - if ($dep['type'] !== 'pkg') { - continue; - } - - $deps[] = $dep; - } - } - } - - $info = array( - 'stable' => $latest, - 'summary' => $info['s'], - 'description' => $info['d'], - 'deps' => $deps, - 'category' => $info['ca']['_content'], - 'unstable' => $unstable, - 'state' => $state - ); - $ret[$package] = $info; - } - } - - PEAR::popErrorHandling(); - return $ret; - } - - /** - * List all categories of a REST server - * - * @param string $base base URL of the server - * @return array of categorynames - */ - function listCategories($base, $channel = false) - { - $categorylist = $this->_rest->retrieveData($base . 'c/categories.xml', false, false, $channel); - if (PEAR::isError($categorylist)) { - return $categorylist; - } - - if (!is_array($categorylist) || !isset($categorylist['c'])) { - return array(); - } - - if (isset($categorylist['c']['_content'])) { - // only 1 category - $categorylist['c'] = array($categorylist['c']); - } - - return $categorylist['c']; - } - - /** - * List packages in a category of a REST server - * - * @param string $base base URL of the server - * @param string $category name of the category - * @param boolean $info also download full package info - * @return array of packagenames - */ - function listCategory($base, $category, $info = false, $channel = false) - { - if ($info == false) { - $url = '%s'.'c/%s/packages.xml'; - } else { - $url = '%s'.'c/%s/packagesinfo.xml'; - } - $url = sprintf($url, - $base, - urlencode($category)); - - // gives '404 Not Found' error when category doesn't exist - $packagelist = $this->_rest->retrieveData($url, false, false, $channel); - if (PEAR::isError($packagelist)) { - return $packagelist; - } - if (!is_array($packagelist)) { - return array(); - } - - if ($info == false) { - if (!isset($packagelist['p'])) { - return array(); - } - if (!is_array($packagelist['p']) || - !isset($packagelist['p'][0])) { // only 1 pkg - $packagelist = array($packagelist['p']); - } else { - $packagelist = $packagelist['p']; - } - return $packagelist; - } - - // info == true - if (!isset($packagelist['pi'])) { - return array(); - } - - if (!is_array($packagelist['pi']) || - !isset($packagelist['pi'][0])) { // only 1 pkg - $packagelist_pre = array($packagelist['pi']); - } else { - $packagelist_pre = $packagelist['pi']; - } - - $packagelist = array(); - foreach ($packagelist_pre as $i => $item) { - // compatibility with r/<latest.txt>.xml - if (isset($item['a']['r'][0])) { - // multiple releases - $item['p']['v'] = $item['a']['r'][0]['v']; - $item['p']['st'] = $item['a']['r'][0]['s']; - } elseif (isset($item['a'])) { - // first and only release - $item['p']['v'] = $item['a']['r']['v']; - $item['p']['st'] = $item['a']['r']['s']; - } - - $packagelist[$i] = array('attribs' => $item['p']['r'], - '_content' => $item['p']['n'], - 'info' => $item['p']); - } - - return $packagelist; - } - - /** - * Return an array containing all of the states that are more stable than - * or equal to the passed in state - * - * @param string Release state - * @param boolean Determines whether to include $state in the list - * @return false|array False if $state is not a valid release state - */ - function betterStates($state, $include = false) - { - static $states = array('snapshot', 'devel', 'alpha', 'beta', 'stable'); - $i = array_search($state, $states); - if ($i === false) { - return false; - } - if ($include) { - $i--; - } - return array_slice($states, $i + 1); - } -} -?><?php -/** - * PEAR_REST_13 - * - * PHP versions 4 and 5 - * - * @category pear - * @package PEAR - * @author Greg Beaver <cellog@php.net> - * @copyright 1997-2009 The Authors - * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id: 13.php 313023 2011-07-06 19:17:11Z dufuz $ - * @link http://pear.php.net/package/PEAR - * @since File available since Release 1.4.0a12 - */ - -/** - * For downloading REST xml/txt files - */ -require_once 'phar://install-pear-nozlib.phar/' . 'PEAR/REST.php'; -require_once 'phar://install-pear-nozlib.phar/' . 'PEAR/REST/10.php'; - -/** - * Implement REST 1.3 - * - * @category pear - * @package PEAR - * @author Greg Beaver <cellog@php.net> - * @copyright 1997-2009 The Authors - * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version Release: 1.9.4 - * @link http://pear.php.net/package/PEAR - * @since Class available since Release 1.4.0a12 - */ -class PEAR_REST_13 extends PEAR_REST_10 -{ - /** - * Retrieve information about a remote package to be downloaded from a REST server - * - * This is smart enough to resolve the minimum PHP version dependency prior to download - * @param string $base The uri to prepend to all REST calls - * @param array $packageinfo an array of format: - * <pre> - * array( - * 'package' => 'packagename', - * 'channel' => 'channelname', - * ['state' => 'alpha' (or valid state),] - * -or- - * ['version' => '1.whatever'] - * </pre> - * @param string $prefstate Current preferred_state config variable value - * @param bool $installed the installed version of this package to compare against - * @return array|false|PEAR_Error see {@link _returnDownloadURL()} - */ - function getDownloadURL($base, $packageinfo, $prefstate, $installed, $channel = false) - { - $states = $this->betterStates($prefstate, true); - if (!$states) { - return PEAR::raiseError('"' . $prefstate . '" is not a valid state'); - } - - $channel = $packageinfo['channel']; - $package = $packageinfo['package']; - $state = isset($packageinfo['state']) ? $packageinfo['state'] : null; - $version = isset($packageinfo['version']) ? $packageinfo['version'] : null; - $restFile = $base . 'r/' . strtolower($package) . '/allreleases2.xml'; - - $info = $this->_rest->retrieveData($restFile, false, false, $channel); - if (PEAR::isError($info)) { - return PEAR::raiseError('No releases available for package "' . - $channel . '/' . $package . '"'); - } - - if (!isset($info['r'])) { - return false; - } - - $release = $found = false; - if (!is_array($info['r']) || !isset($info['r'][0])) { - $info['r'] = array($info['r']); - } - - $skippedphp = false; - foreach ($info['r'] as $release) { - if (!isset($this->_rest->_options['force']) && ($installed && - version_compare($release['v'], $installed, '<'))) { - continue; - } - - if (isset($state)) { - // try our preferred state first - if ($release['s'] == $state) { - if (!isset($version) && version_compare($release['m'], phpversion(), '>')) { - // skip releases that require a PHP version newer than our PHP version - $skippedphp = $release; - continue; - } - $found = true; - break; - } - - // see if there is something newer and more stable - // bug #7221 - if (in_array($release['s'], $this->betterStates($state), true)) { - if (!isset($version) && version_compare($release['m'], phpversion(), '>')) { - // skip releases that require a PHP version newer than our PHP version - $skippedphp = $release; - continue; - } - $found = true; - break; - } - } elseif (isset($version)) { - if ($release['v'] == $version) { - if (!isset($this->_rest->_options['force']) && - !isset($version) && - version_compare($release['m'], phpversion(), '>')) { - // skip releases that require a PHP version newer than our PHP version - $skippedphp = $release; - continue; - } - $found = true; - break; - } - } else { - if (in_array($release['s'], $states)) { - if (version_compare($release['m'], phpversion(), '>')) { - // skip releases that require a PHP version newer than our PHP version - $skippedphp = $release; - continue; - } - $found = true; - break; - } - } - } - - if (!$found && $skippedphp) { - $found = null; - } - - return $this->_returnDownloadURL($base, $package, $release, $info, $found, $skippedphp, $channel); - } - - function getDepDownloadURL($base, $xsdversion, $dependency, $deppackage, - $prefstate = 'stable', $installed = false, $channel = false) - { - $states = $this->betterStates($prefstate, true); - if (!$states) { - return PEAR::raiseError('"' . $prefstate . '" is not a valid state'); - } - - $channel = $dependency['channel']; - $package = $dependency['name']; - $state = isset($dependency['state']) ? $dependency['state'] : null; - $version = isset($dependency['version']) ? $dependency['version'] : null; - $restFile = $base . 'r/' . strtolower($package) .'/allreleases2.xml'; - - $info = $this->_rest->retrieveData($restFile, false, false, $channel); - if (PEAR::isError($info)) { - return PEAR::raiseError('Package "' . $deppackage['channel'] . '/' . $deppackage['package'] - . '" dependency "' . $channel . '/' . $package . '" has no releases'); - } - - if (!is_array($info) || !isset($info['r'])) { - return false; - } - - $exclude = array(); - $min = $max = $recommended = false; - if ($xsdversion == '1.0') { - $pinfo['package'] = $dependency['name']; - $pinfo['channel'] = 'pear.php.net'; // this is always true - don't change this - switch ($dependency['rel']) { - case 'ge' : - $min = $dependency['version']; - break; - case 'gt' : - $min = $dependency['version']; - $exclude = array($dependency['version']); - break; - case 'eq' : - $recommended = $dependency['version']; - break; - case 'lt' : - $max = $dependency['version']; - $exclude = array($dependency['version']); - break; - case 'le' : - $max = $dependency['version']; - break; - case 'ne' : - $exclude = array($dependency['version']); - break; - } - } else { - $pinfo['package'] = $dependency['name']; - $min = isset($dependency['min']) ? $dependency['min'] : false; - $max = isset($dependency['max']) ? $dependency['max'] : false; - $recommended = isset($dependency['recommended']) ? - $dependency['recommended'] : false; - if (isset($dependency['exclude'])) { - if (!isset($dependency['exclude'][0])) { - $exclude = array($dependency['exclude']); - } - } - } - - $skippedphp = $found = $release = false; - if (!is_array($info['r']) || !isset($info['r'][0])) { - $info['r'] = array($info['r']); - } - - foreach ($info['r'] as $release) { - if (!isset($this->_rest->_options['force']) && ($installed && - version_compare($release['v'], $installed, '<'))) { - continue; - } - - if (in_array($release['v'], $exclude)) { // skip excluded versions - continue; - } - - // allow newer releases to say "I'm OK with the dependent package" - if ($xsdversion == '2.0' && isset($release['co'])) { - if (!is_array($release['co']) || !isset($release['co'][0])) { - $release['co'] = array($release['co']); - } - - foreach ($release['co'] as $entry) { - if (isset($entry['x']) && !is_array($entry['x'])) { - $entry['x'] = array($entry['x']); - } elseif (!isset($entry['x'])) { - $entry['x'] = array(); - } - - if ($entry['c'] == $deppackage['channel'] && - strtolower($entry['p']) == strtolower($deppackage['package']) && - version_compare($deppackage['version'], $entry['min'], '>=') && - version_compare($deppackage['version'], $entry['max'], '<=') && - !in_array($release['v'], $entry['x'])) { - if (version_compare($release['m'], phpversion(), '>')) { - // skip dependency releases that require a PHP version - // newer than our PHP version - $skippedphp = $release; - continue; - } - - $recommended = $release['v']; - break; - } - } - } - - if ($recommended) { - if ($release['v'] != $recommended) { // if we want a specific - // version, then skip all others - continue; - } - - if (!in_array($release['s'], $states)) { - // the stability is too low, but we must return the - // recommended version if possible - return $this->_returnDownloadURL($base, $package, $release, $info, true, false, $channel); - } - } - - if ($min && version_compare($release['v'], $min, 'lt')) { // skip too old versions - continue; - } - - if ($max && version_compare($release['v'], $max, 'gt')) { // skip too new versions - continue; - } - - if ($installed && version_compare($release['v'], $installed, '<')) { - continue; - } - - if (in_array($release['s'], $states)) { // if in the preferred state... - if (version_compare($release['m'], phpversion(), '>')) { - // skip dependency releases that require a PHP version - // newer than our PHP version - $skippedphp = $release; - continue; - } - - $found = true; // ... then use it - break; - } - } - - if (!$found && $skippedphp) { - $found = null; - } - - return $this->_returnDownloadURL($base, $package, $release, $info, $found, $skippedphp, $channel); - } -}<?php -/** - * PEAR_RunTest - * - * PHP versions 4 and 5 - * - * @category pear - * @package PEAR - * @author Tomas V.V.Cox <cox@idecnet.com> - * @author Greg Beaver <cellog@php.net> - * @copyright 1997-2009 The Authors - * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id: RunTest.php 313024 2011-07-06 19:51:24Z dufuz $ - * @link http://pear.php.net/package/PEAR - * @since File available since Release 1.3.3 - */ - -/** - * for error handling - */ -require_once 'phar://install-pear-nozlib.phar/' . 'PEAR.php'; -require_once 'phar://install-pear-nozlib.phar/' . 'PEAR/Config.php'; - -define('DETAILED', 1); -putenv("PHP_PEAR_RUNTESTS=1"); - -/** - * Simplified version of PHP's test suite - * - * Try it with: - * - * $ php -r 'include "../PEAR/RunTest.php"; $t=new PEAR_RunTest; $o=$t->run("./pear_system.phpt");print_r($o);' - * - * - * @category pear - * @package PEAR - * @author Tomas V.V.Cox <cox@idecnet.com> - * @author Greg Beaver <cellog@php.net> - * @copyright 1997-2009 The Authors - * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version Release: 1.9.4 - * @link http://pear.php.net/package/PEAR - * @since Class available since Release 1.3.3 - */ -class PEAR_RunTest -{ - var $_headers = array(); - var $_logger; - var $_options; - var $_php; - var $tests_count; - var $xdebug_loaded; - /** - * Saved value of php executable, used to reset $_php when we - * have a test that uses cgi - * - * @var unknown_type - */ - var $_savephp; - var $ini_overwrites = array( - 'output_handler=', - 'open_basedir=', - 'safe_mode=0', - 'disable_functions=', - 'output_buffering=Off', - 'display_errors=1', - 'log_errors=0', - 'html_errors=0', - 'track_errors=1', - 'report_memleaks=0', - 'report_zend_debug=0', - 'docref_root=', - 'docref_ext=.html', - 'error_prepend_string=', - 'error_append_string=', - 'auto_prepend_file=', - 'auto_append_file=', - 'magic_quotes_runtime=0', - 'xdebug.default_enable=0', - 'allow_url_fopen=1', - ); - - /** - * An object that supports the PEAR_Common->log() signature, or null - * @param PEAR_Common|null - */ - function PEAR_RunTest($logger = null, $options = array()) - { - if (!defined('E_DEPRECATED')) { - define('E_DEPRECATED', 0); - } - if (!defined('E_STRICT')) { - define('E_STRICT', 0); - } - $this->ini_overwrites[] = 'error_reporting=' . (E_ALL & ~(E_DEPRECATED | E_STRICT)); - if (is_null($logger)) { - require_once 'phar://install-pear-nozlib.phar/' . 'PEAR/Common.php'; - $logger = new PEAR_Common; - } - $this->_logger = $logger; - $this->_options = $options; - - $conf = &PEAR_Config::singleton(); - $this->_php = $conf->get('php_bin'); - } - - /** - * Taken from php-src/run-tests.php - * - * @param string $commandline command name - * @param array $env - * @param string $stdin standard input to pass to the command - * @return unknown - */ - function system_with_timeout($commandline, $env = null, $stdin = null) - { - $data = ''; - if (version_compare(phpversion(), '5.0.0', '<')) { - $proc = proc_open($commandline, array( - 0 => array('pipe', 'r'), - 1 => array('pipe', 'w'), - 2 => array('pipe', 'w') - ), $pipes); - } else { - $proc = proc_open($commandline, array( - 0 => array('pipe', 'r'), - 1 => array('pipe', 'w'), - 2 => array('pipe', 'w') - ), $pipes, null, $env, array('suppress_errors' => true)); - } - - if (!$proc) { - return false; - } - - if (is_string($stdin)) { - fwrite($pipes[0], $stdin); - } - fclose($pipes[0]); - - while (true) { - /* hide errors from interrupted syscalls */ - $r = $pipes; - $e = $w = null; - $n = @stream_select($r, $w, $e, 60); - - if ($n === 0) { - /* timed out */ - $data .= "\n ** ERROR: process timed out **\n"; - proc_terminate($proc); - return array(1234567890, $data); - } else if ($n > 0) { - $line = fread($pipes[1], 8192); - if (strlen($line) == 0) { - /* EOF */ - break; - } - $data .= $line; - } - } - if (function_exists('proc_get_status')) { - $stat = proc_get_status($proc); - if ($stat['signaled']) { - $data .= "\nTermsig=".$stat['stopsig']; - } - } - $code = proc_close($proc); - if (function_exists('proc_get_status')) { - $code = $stat['exitcode']; - } - return array($code, $data); - } - - /** - * Turns a PHP INI string into an array - * - * Turns -d "include_path=/foo/bar" into this: - * array( - * 'include_path' => array( - * 'operator' => '-d', - * 'value' => '/foo/bar', - * ) - * ) - * Works both with quotes and without - * - * @param string an PHP INI string, -d "include_path=/foo/bar" - * @return array - */ - function iniString2array($ini_string) - { - if (!$ini_string) { - return array(); - } - $split = preg_split('/[\s]|=/', $ini_string, -1, PREG_SPLIT_NO_EMPTY); - $key = $split[1][0] == '"' ? substr($split[1], 1) : $split[1]; - $value = $split[2][strlen($split[2]) - 1] == '"' ? substr($split[2], 0, -1) : $split[2]; - // FIXME review if this is really the struct to go with - $array = array($key => array('operator' => $split[0], 'value' => $value)); - return $array; - } - - function settings2array($settings, $ini_settings) - { - foreach ($settings as $setting) { - if (strpos($setting, '=') !== false) { - $setting = explode('=', $setting, 2); - $name = trim(strtolower($setting[0])); - $value = trim($setting[1]); - $ini_settings[$name] = $value; - } - } - return $ini_settings; - } - - function settings2params($ini_settings) - { - $settings = ''; - foreach ($ini_settings as $name => $value) { - if (is_array($value)) { - $operator = $value['operator']; - $value = $value['value']; - } else { - $operator = '-d'; - } - $value = addslashes($value); - $settings .= " $operator \"$name=$value\""; - } - return $settings; - } - - function _preparePhpBin($php, $file, $ini_settings) - { - $file = escapeshellarg($file); - // This was fixed in php 5.3 and is not needed after that - if (OS_WINDOWS && version_compare(PHP_VERSION, '5.3', '<')) { - $cmd = '"'.escapeshellarg($php).' '.$ini_settings.' -f ' . $file .'"'; - } else { - $cmd = $php . $ini_settings . ' -f ' . $file; - } - - return $cmd; - } - - function runPHPUnit($file, $ini_settings = '') - { - if (!file_exists($file) && file_exists(getcwd() . DIRECTORY_SEPARATOR . $file)) { - $file = realpath(getcwd() . DIRECTORY_SEPARATOR . $file); - } elseif (file_exists($file)) { - $file = realpath($file); - } - - $cmd = $this->_preparePhpBin($this->_php, $file, $ini_settings); - if (isset($this->_logger)) { - $this->_logger->log(2, 'Running command "' . $cmd . '"'); - } - - $savedir = getcwd(); // in case the test moves us around - chdir(dirname($file)); - echo `$cmd`; - chdir($savedir); - return 'PASSED'; // we have no way of knowing this information so assume passing - } - - /** - * Runs an individual test case. - * - * @param string The filename of the test - * @param array|string INI settings to be applied to the test run - * @param integer Number what the current running test is of the - * whole test suite being runned. - * - * @return string|object Returns PASSED, WARNED, FAILED depending on how the - * test came out. - * PEAR Error when the tester it self fails - */ - function run($file, $ini_settings = array(), $test_number = 1) - { - if (isset($this->_savephp)) { - $this->_php = $this->_savephp; - unset($this->_savephp); - } - if (empty($this->_options['cgi'])) { - // try to see if php-cgi is in the path - $res = $this->system_with_timeout('php-cgi -v'); - if (false !== $res && !(is_array($res) && in_array($res[0], array(-1, 127)))) { - $this->_options['cgi'] = 'php-cgi'; - } - } - if (1 < $len = strlen($this->tests_count)) { - $test_number = str_pad($test_number, $len, ' ', STR_PAD_LEFT); - $test_nr = "[$test_number/$this->tests_count] "; - } else { - $test_nr = ''; - } - - $file = realpath($file); - $section_text = $this->_readFile($file); - if (PEAR::isError($section_text)) { - return $section_text; - } - - if (isset($section_text['POST_RAW']) && isset($section_text['UPLOAD'])) { - return PEAR::raiseError("Cannot contain both POST_RAW and UPLOAD in test file: $file"); - } - - $cwd = getcwd(); - - $pass_options = ''; - if (!empty($this->_options['ini'])) { - $pass_options = $this->_options['ini']; - } - - if (is_string($ini_settings)) { - $ini_settings = $this->iniString2array($ini_settings); - } - - $ini_settings = $this->settings2array($this->ini_overwrites, $ini_settings); - if ($section_text['INI']) { - if (strpos($section_text['INI'], '{PWD}') !== false) { - $section_text['INI'] = str_replace('{PWD}', dirname($file), $section_text['INI']); - } - $ini = preg_split( "/[\n\r]+/", $section_text['INI']); - $ini_settings = $this->settings2array($ini, $ini_settings); - } - $ini_settings = $this->settings2params($ini_settings); - $shortname = str_replace($cwd . DIRECTORY_SEPARATOR, '', $file); - - $tested = trim($section_text['TEST']); - $tested.= !isset($this->_options['simple']) ? "[$shortname]" : ' '; - - if (!empty($section_text['POST']) || !empty($section_text['POST_RAW']) || - !empty($section_text['UPLOAD']) || !empty($section_text['GET']) || - !empty($section_text['COOKIE']) || !empty($section_text['EXPECTHEADERS'])) { - if (empty($this->_options['cgi'])) { - if (!isset($this->_options['quiet'])) { - $this->_logger->log(0, "SKIP $test_nr$tested (reason: --cgi option needed for this test, type 'pear help run-tests')"); - } - if (isset($this->_options['tapoutput'])) { - return array('ok', ' # skip --cgi option needed for this test, "pear help run-tests" for info'); - } - return 'SKIPPED'; - } - $this->_savephp = $this->_php; - $this->_php = $this->_options['cgi']; - } - - $temp_dir = realpath(dirname($file)); - $main_file_name = basename($file, 'phpt'); - $diff_filename = $temp_dir . DIRECTORY_SEPARATOR . $main_file_name.'diff'; - $log_filename = $temp_dir . DIRECTORY_SEPARATOR . $main_file_name.'log'; - $exp_filename = $temp_dir . DIRECTORY_SEPARATOR . $main_file_name.'exp'; - $output_filename = $temp_dir . DIRECTORY_SEPARATOR . $main_file_name.'out'; - $memcheck_filename = $temp_dir . DIRECTORY_SEPARATOR . $main_file_name.'mem'; - $temp_file = $temp_dir . DIRECTORY_SEPARATOR . $main_file_name.'php'; - $temp_skipif = $temp_dir . DIRECTORY_SEPARATOR . $main_file_name.'skip.php'; - $temp_clean = $temp_dir . DIRECTORY_SEPARATOR . $main_file_name.'clean.php'; - $tmp_post = $temp_dir . DIRECTORY_SEPARATOR . uniqid('phpt.'); - - // unlink old test results - $this->_cleanupOldFiles($file); - - // Check if test should be skipped. - $res = $this->_runSkipIf($section_text, $temp_skipif, $tested, $ini_settings); - if (count($res) != 2) { - return $res; - } - $info = $res['info']; - $warn = $res['warn']; - - // We've satisfied the preconditions - run the test! - if (isset($this->_options['coverage']) && $this->xdebug_loaded) { - $xdebug_file = $temp_dir . DIRECTORY_SEPARATOR . $main_file_name . 'xdebug'; - $text = "\n" . 'function coverage_shutdown() {' . - "\n" . ' $xdebug = var_export(xdebug_get_code_coverage(), true);'; - if (!function_exists('file_put_contents')) { - $text .= "\n" . ' $fh = fopen(\'' . $xdebug_file . '\', "wb");' . - "\n" . ' if ($fh !== false) {' . - "\n" . ' fwrite($fh, $xdebug);' . - "\n" . ' fclose($fh);' . - "\n" . ' }'; - } else { - $text .= "\n" . ' file_put_contents(\'' . $xdebug_file . '\', $xdebug);'; - } - - // Workaround for http://pear.php.net/bugs/bug.php?id=17292 - $lines = explode("\n", $section_text['FILE']); - $numLines = count($lines); - $namespace = ''; - $coverage_shutdown = 'coverage_shutdown'; - - if ( - substr($lines[0], 0, 2) == '<?' || - substr($lines[0], 0, 5) == '<?php' - ) { - unset($lines[0]); - } - - - for ($i = 0; $i < $numLines; $i++) { - if (isset($lines[$i]) && substr($lines[$i], 0, 9) == 'namespace') { - $namespace = substr($lines[$i], 10, -1); - $coverage_shutdown = $namespace . '\\coverage_shutdown'; - $namespace = "namespace " . $namespace . ";\n"; - - unset($lines[$i]); - break; - } - } - - $text .= "\n xdebug_stop_code_coverage();" . - "\n" . '} // end coverage_shutdown()' . - "\n\n" . 'register_shutdown_function("' . $coverage_shutdown . '");'; - $text .= "\n" . 'xdebug_start_code_coverage(XDEBUG_CC_UNUSED | XDEBUG_CC_DEAD_CODE);' . "\n"; - - $this->save_text($temp_file, "<?php\n" . $namespace . $text . "\n" . implode("\n", $lines)); - } else { - $this->save_text($temp_file, $section_text['FILE']); - } - - $args = $section_text['ARGS'] ? ' -- '.$section_text['ARGS'] : ''; - $cmd = $this->_preparePhpBin($this->_php, $temp_file, $ini_settings); - $cmd.= "$args 2>&1"; - if (isset($this->_logger)) { - $this->_logger->log(2, 'Running command "' . $cmd . '"'); - } - - // Reset environment from any previous test. - $env = $this->_resetEnv($section_text, $temp_file); - - $section_text = $this->_processUpload($section_text, $file); - if (PEAR::isError($section_text)) { - return $section_text; - } - - if (array_key_exists('POST_RAW', $section_text) && !empty($section_text['POST_RAW'])) { - $post = trim($section_text['POST_RAW']); - $raw_lines = explode("\n", $post); - - $request = ''; - $started = false; - foreach ($raw_lines as $i => $line) { - if (empty($env['CONTENT_TYPE']) && - preg_match('/^Content-Type:(.*)/i', $line, $res)) { - $env['CONTENT_TYPE'] = trim(str_replace("\r", '', $res[1])); - continue; - } - if ($started) { - $request .= "\n"; - } - $started = true; - $request .= $line; - } - - $env['CONTENT_LENGTH'] = strlen($request); - $env['REQUEST_METHOD'] = 'POST'; - - $this->save_text($tmp_post, $request); - $cmd = "$this->_php$pass_options$ini_settings \"$temp_file\" 2>&1 < $tmp_post"; - } elseif (array_key_exists('POST', $section_text) && !empty($section_text['POST'])) { - $post = trim($section_text['POST']); - $this->save_text($tmp_post, $post); - $content_length = strlen($post); - - $env['REQUEST_METHOD'] = 'POST'; - $env['CONTENT_TYPE'] = 'application/x-www-form-urlencoded'; - $env['CONTENT_LENGTH'] = $content_length; - - $cmd = "$this->_php$pass_options$ini_settings \"$temp_file\" 2>&1 < $tmp_post"; - } else { - $env['REQUEST_METHOD'] = 'GET'; - $env['CONTENT_TYPE'] = ''; - $env['CONTENT_LENGTH'] = ''; - } - - if (OS_WINDOWS && isset($section_text['RETURNS'])) { - ob_start(); - system($cmd, $return_value); - $out = ob_get_contents(); - ob_end_clean(); - $section_text['RETURNS'] = (int) trim($section_text['RETURNS']); - $returnfail = ($return_value != $section_text['RETURNS']); - } else { - $returnfail = false; - $stdin = isset($section_text['STDIN']) ? $section_text['STDIN'] : null; - $out = $this->system_with_timeout($cmd, $env, $stdin); - $return_value = $out[0]; - $out = $out[1]; - } - - $output = preg_replace('/\r\n/', "\n", trim($out)); - - if (isset($tmp_post) && realpath($tmp_post) && file_exists($tmp_post)) { - @unlink(realpath($tmp_post)); - } - chdir($cwd); // in case the test moves us around - - $this->_testCleanup($section_text, $temp_clean); - - /* when using CGI, strip the headers from the output */ - $output = $this->_stripHeadersCGI($output); - - if (isset($section_text['EXPECTHEADERS'])) { - $testheaders = $this->_processHeaders($section_text['EXPECTHEADERS']); - $missing = array_diff_assoc($testheaders, $this->_headers); - $changed = ''; - foreach ($missing as $header => $value) { - if (isset($this->_headers[$header])) { - $changed .= "-$header: $value\n+$header: "; - $changed .= $this->_headers[$header]; - } else { - $changed .= "-$header: $value\n"; - } - } - if ($missing) { - // tack on failed headers to output: - $output .= "\n====EXPECTHEADERS FAILURE====:\n$changed"; - } - } - // Does the output match what is expected? - do { - if (isset($section_text['EXPECTF']) || isset($section_text['EXPECTREGEX'])) { - if (isset($section_text['EXPECTF'])) { - $wanted = trim($section_text['EXPECTF']); - } else { - $wanted = trim($section_text['EXPECTREGEX']); - } - $wanted_re = preg_replace('/\r\n/', "\n", $wanted); - if (isset($section_text['EXPECTF'])) { - $wanted_re = preg_quote($wanted_re, '/'); - // Stick to basics - $wanted_re = str_replace("%s", ".+?", $wanted_re); //not greedy - $wanted_re = str_replace("%i", "[+\-]?[0-9]+", $wanted_re); - $wanted_re = str_replace("%d", "[0-9]+", $wanted_re); - $wanted_re = str_replace("%x", "[0-9a-fA-F]+", $wanted_re); - $wanted_re = str_replace("%f", "[+\-]?\.?[0-9]+\.?[0-9]*(E-?[0-9]+)?", $wanted_re); - $wanted_re = str_replace("%c", ".", $wanted_re); - // %f allows two points "-.0.0" but that is the best *simple* expression - } - - /* DEBUG YOUR REGEX HERE - var_dump($wanted_re); - print(str_repeat('=', 80) . "\n"); - var_dump($output); - */ - if (!$returnfail && preg_match("/^$wanted_re\$/s", $output)) { - if (file_exists($temp_file)) { - unlink($temp_file); - } - if (array_key_exists('FAIL', $section_text)) { - break; - } - if (!isset($this->_options['quiet'])) { - $this->_logger->log(0, "PASS $test_nr$tested$info"); - } - if (isset($this->_options['tapoutput'])) { - return array('ok', ' - ' . $tested); - } - return 'PASSED'; - } - } else { - if (isset($section_text['EXPECTFILE'])) { - $f = $temp_dir . '/' . trim($section_text['EXPECTFILE']); - if (!($fp = @fopen($f, 'rb'))) { - return PEAR::raiseError('--EXPECTFILE-- section file ' . - $f . ' not found'); - } - fclose($fp); - $section_text['EXPECT'] = file_get_contents($f); - } - - if (isset($section_text['EXPECT'])) { - $wanted = preg_replace('/\r\n/', "\n", trim($section_text['EXPECT'])); - } else { - $wanted = ''; - } - - // compare and leave on success - if (!$returnfail && 0 == strcmp($output, $wanted)) { - if (file_exists($temp_file)) { - unlink($temp_file); - } - if (array_key_exists('FAIL', $section_text)) { - break; - } - if (!isset($this->_options['quiet'])) { - $this->_logger->log(0, "PASS $test_nr$tested$info"); - } - if (isset($this->_options['tapoutput'])) { - return array('ok', ' - ' . $tested); - } - return 'PASSED'; - } - } - } while (false); - - if (array_key_exists('FAIL', $section_text)) { - // we expect a particular failure - // this is only used for testing PEAR_RunTest - $expectf = isset($section_text['EXPECTF']) ? $wanted_re : null; - $faildiff = $this->generate_diff($wanted, $output, null, $expectf); - $faildiff = preg_replace('/\r/', '', $faildiff); - $wanted = preg_replace('/\r/', '', trim($section_text['FAIL'])); - if ($faildiff == $wanted) { - if (!isset($this->_options['quiet'])) { - $this->_logger->log(0, "PASS $test_nr$tested$info"); - } - if (isset($this->_options['tapoutput'])) { - return array('ok', ' - ' . $tested); - } - return 'PASSED'; - } - unset($section_text['EXPECTF']); - $output = $faildiff; - if (isset($section_text['RETURNS'])) { - return PEAR::raiseError('Cannot have both RETURNS and FAIL in the same test: ' . - $file); - } - } - - // Test failed so we need to report details. - $txt = $warn ? 'WARN ' : 'FAIL '; - $this->_logger->log(0, $txt . $test_nr . $tested . $info); - - // write .exp - $res = $this->_writeLog($exp_filename, $wanted); - if (PEAR::isError($res)) { - return $res; - } - - // write .out - $res = $this->_writeLog($output_filename, $output); - if (PEAR::isError($res)) { - return $res; - } - - // write .diff - $returns = isset($section_text['RETURNS']) ? - array(trim($section_text['RETURNS']), $return_value) : null; - $expectf = isset($section_text['EXPECTF']) ? $wanted_re : null; - $data = $this->generate_diff($wanted, $output, $returns, $expectf); - $res = $this->_writeLog($diff_filename, $data); - if (PEAR::isError($res)) { - return $res; - } - - // write .log - $data = " ----- EXPECTED OUTPUT -$wanted ----- ACTUAL OUTPUT -$output ----- FAILED -"; - - if ($returnfail) { - $data .= " ----- EXPECTED RETURN -$section_text[RETURNS] ----- ACTUAL RETURN -$return_value -"; - } - - $res = $this->_writeLog($log_filename, $data); - if (PEAR::isError($res)) { - return $res; - } - - if (isset($this->_options['tapoutput'])) { - $wanted = explode("\n", $wanted); - $wanted = "# Expected output:\n#\n#" . implode("\n#", $wanted); - $output = explode("\n", $output); - $output = "#\n#\n# Actual output:\n#\n#" . implode("\n#", $output); - return array($wanted . $output . 'not ok', ' - ' . $tested); - } - return $warn ? 'WARNED' : 'FAILED'; - } - - function generate_diff($wanted, $output, $rvalue, $wanted_re) - { - $w = explode("\n", $wanted); - $o = explode("\n", $output); - $wr = explode("\n", $wanted_re); - $w1 = array_diff_assoc($w, $o); - $o1 = array_diff_assoc($o, $w); - $o2 = $w2 = array(); - foreach ($w1 as $idx => $val) { - if (!$wanted_re || !isset($wr[$idx]) || !isset($o1[$idx]) || - !preg_match('/^' . $wr[$idx] . '\\z/', $o1[$idx])) { - $w2[sprintf("%03d<", $idx)] = sprintf("%03d- ", $idx + 1) . $val; - } - } - foreach ($o1 as $idx => $val) { - if (!$wanted_re || !isset($wr[$idx]) || - !preg_match('/^' . $wr[$idx] . '\\z/', $val)) { - $o2[sprintf("%03d>", $idx)] = sprintf("%03d+ ", $idx + 1) . $val; - } - } - $diff = array_merge($w2, $o2); - ksort($diff); - $extra = $rvalue ? "##EXPECTED: $rvalue[0]\r\n##RETURNED: $rvalue[1]" : ''; - return implode("\r\n", $diff) . $extra; - } - - // Write the given text to a temporary file, and return the filename. - function save_text($filename, $text) - { - if (!$fp = fopen($filename, 'w')) { - return PEAR::raiseError("Cannot open file '" . $filename . "' (save_text)"); - } - fwrite($fp, $text); - fclose($fp); - if (1 < DETAILED) echo " -FILE $filename {{{ -$text -}}} -"; - } - - function _cleanupOldFiles($file) - { - $temp_dir = realpath(dirname($file)); - $mainFileName = basename($file, 'phpt'); - $diff_filename = $temp_dir . DIRECTORY_SEPARATOR . $mainFileName.'diff'; - $log_filename = $temp_dir . DIRECTORY_SEPARATOR . $mainFileName.'log'; - $exp_filename = $temp_dir . DIRECTORY_SEPARATOR . $mainFileName.'exp'; - $output_filename = $temp_dir . DIRECTORY_SEPARATOR . $mainFileName.'out'; - $memcheck_filename = $temp_dir . DIRECTORY_SEPARATOR . $mainFileName.'mem'; - $temp_file = $temp_dir . DIRECTORY_SEPARATOR . $mainFileName.'php'; - $temp_skipif = $temp_dir . DIRECTORY_SEPARATOR . $mainFileName.'skip.php'; - $temp_clean = $temp_dir . DIRECTORY_SEPARATOR . $mainFileName.'clean.php'; - $tmp_post = $temp_dir . DIRECTORY_SEPARATOR . uniqid('phpt.'); - - // unlink old test results - @unlink($diff_filename); - @unlink($log_filename); - @unlink($exp_filename); - @unlink($output_filename); - @unlink($memcheck_filename); - @unlink($temp_file); - @unlink($temp_skipif); - @unlink($tmp_post); - @unlink($temp_clean); - } - - function _runSkipIf($section_text, $temp_skipif, $tested, $ini_settings) - { - $info = ''; - $warn = false; - if (array_key_exists('SKIPIF', $section_text) && trim($section_text['SKIPIF'])) { - $this->save_text($temp_skipif, $section_text['SKIPIF']); - $output = $this->system_with_timeout("$this->_php$ini_settings -f \"$temp_skipif\""); - $output = $output[1]; - $loutput = ltrim($output); - unlink($temp_skipif); - if (!strncasecmp('skip', $loutput, 4)) { - $skipreason = "SKIP $tested"; - if (preg_match('/^\s*skip\s*(.+)\s*/i', $output, $m)) { - $skipreason .= '(reason: ' . $m[1] . ')'; - } - if (!isset($this->_options['quiet'])) { - $this->_logger->log(0, $skipreason); - } - if (isset($this->_options['tapoutput'])) { - return array('ok', ' # skip ' . $reason); - } - return 'SKIPPED'; - } - - if (!strncasecmp('info', $loutput, 4) - && preg_match('/^\s*info\s*(.+)\s*/i', $output, $m)) { - $info = " (info: $m[1])"; - } - - if (!strncasecmp('warn', $loutput, 4) - && preg_match('/^\s*warn\s*(.+)\s*/i', $output, $m)) { - $warn = true; /* only if there is a reason */ - $info = " (warn: $m[1])"; - } - } - - return array('warn' => $warn, 'info' => $info); - } - - function _stripHeadersCGI($output) - { - $this->headers = array(); - if (!empty($this->_options['cgi']) && - $this->_php == $this->_options['cgi'] && - preg_match("/^(.*?)(?:\n\n(.*)|\\z)/s", $output, $match)) { - $output = isset($match[2]) ? trim($match[2]) : ''; - $this->_headers = $this->_processHeaders($match[1]); - } - - return $output; - } - - /** - * Return an array that can be used with array_diff() to compare headers - * - * @param string $text - */ - function _processHeaders($text) - { - $headers = array(); - $rh = preg_split("/[\n\r]+/", $text); - foreach ($rh as $line) { - if (strpos($line, ':')!== false) { - $line = explode(':', $line, 2); - $headers[trim($line[0])] = trim($line[1]); - } - } - return $headers; - } - - function _readFile($file) - { - // Load the sections of the test file. - $section_text = array( - 'TEST' => '(unnamed test)', - 'SKIPIF' => '', - 'GET' => '', - 'COOKIE' => '', - 'POST' => '', - 'ARGS' => '', - 'INI' => '', - 'CLEAN' => '', - ); - - if (!is_file($file) || !$fp = fopen($file, "r")) { - return PEAR::raiseError("Cannot open test file: $file"); - } - - $section = ''; - while (!feof($fp)) { - $line = fgets($fp); - - // Match the beginning of a section. - if (preg_match('/^--([_A-Z]+)--/', $line, $r)) { - $section = $r[1]; - $section_text[$section] = ''; - continue; - } elseif (empty($section)) { - fclose($fp); - return PEAR::raiseError("Invalid sections formats in test file: $file"); - } - - // Add to the section text. - $section_text[$section] .= $line; - } - fclose($fp); - - return $section_text; - } - - function _writeLog($logname, $data) - { - if (!$log = fopen($logname, 'w')) { - return PEAR::raiseError("Cannot create test log - $logname"); - } - fwrite($log, $data); - fclose($log); - } - - function _resetEnv($section_text, $temp_file) - { - $env = $_ENV; - $env['REDIRECT_STATUS'] = ''; - $env['QUERY_STRING'] = ''; - $env['PATH_TRANSLATED'] = ''; - $env['SCRIPT_FILENAME'] = ''; - $env['REQUEST_METHOD'] = ''; - $env['CONTENT_TYPE'] = ''; - $env['CONTENT_LENGTH'] = ''; - if (!empty($section_text['ENV'])) { - if (strpos($section_text['ENV'], '{PWD}') !== false) { - $section_text['ENV'] = str_replace('{PWD}', dirname($temp_file), $section_text['ENV']); - } - foreach (explode("\n", trim($section_text['ENV'])) as $e) { - $e = explode('=', trim($e), 2); - if (!empty($e[0]) && isset($e[1])) { - $env[$e[0]] = $e[1]; - } - } - } - if (array_key_exists('GET', $section_text)) { - $env['QUERY_STRING'] = trim($section_text['GET']); - } else { - $env['QUERY_STRING'] = ''; - } - if (array_key_exists('COOKIE', $section_text)) { - $env['HTTP_COOKIE'] = trim($section_text['COOKIE']); - } else { - $env['HTTP_COOKIE'] = ''; - } - $env['REDIRECT_STATUS'] = '1'; - $env['PATH_TRANSLATED'] = $temp_file; - $env['SCRIPT_FILENAME'] = $temp_file; - - return $env; - } - - function _processUpload($section_text, $file) - { - if (array_key_exists('UPLOAD', $section_text) && !empty($section_text['UPLOAD'])) { - $upload_files = trim($section_text['UPLOAD']); - $upload_files = explode("\n", $upload_files); - - $request = "Content-Type: multipart/form-data; boundary=---------------------------20896060251896012921717172737\n" . - "-----------------------------20896060251896012921717172737\n"; - foreach ($upload_files as $fileinfo) { - $fileinfo = explode('=', $fileinfo); - if (count($fileinfo) != 2) { - return PEAR::raiseError("Invalid UPLOAD section in test file: $file"); - } - if (!realpath(dirname($file) . '/' . $fileinfo[1])) { - return PEAR::raiseError("File for upload does not exist: $fileinfo[1] " . - "in test file: $file"); - } - $file_contents = file_get_contents(dirname($file) . '/' . $fileinfo[1]); - $fileinfo[1] = basename($fileinfo[1]); - $request .= "Content-Disposition: form-data; name=\"$fileinfo[0]\"; filename=\"$fileinfo[1]\"\n"; - $request .= "Content-Type: text/plain\n\n"; - $request .= $file_contents . "\n" . - "-----------------------------20896060251896012921717172737\n"; - } - - if (array_key_exists('POST', $section_text) && !empty($section_text['POST'])) { - // encode POST raw - $post = trim($section_text['POST']); - $post = explode('&', $post); - foreach ($post as $i => $post_info) { - $post_info = explode('=', $post_info); - if (count($post_info) != 2) { - return PEAR::raiseError("Invalid POST data in test file: $file"); - } - $post_info[0] = rawurldecode($post_info[0]); - $post_info[1] = rawurldecode($post_info[1]); - $post[$i] = $post_info; - } - foreach ($post as $post_info) { - $request .= "Content-Disposition: form-data; name=\"$post_info[0]\"\n\n"; - $request .= $post_info[1] . "\n" . - "-----------------------------20896060251896012921717172737\n"; - } - unset($section_text['POST']); - } - $section_text['POST_RAW'] = $request; - } - - return $section_text; - } - - function _testCleanup($section_text, $temp_clean) - { - if ($section_text['CLEAN']) { - // perform test cleanup - $this->save_text($temp_clean, $section_text['CLEAN']); - $output = $this->system_with_timeout("$this->_php $temp_clean 2>&1"); - if (strlen($output[1])) { - echo "BORKED --CLEAN-- section! output:\n", $output[1]; - } - if (file_exists($temp_clean)) { - unlink($temp_clean); - } - } - } -} -<?php require_once 'phar://install-pear-nozlib.phar/' . 'PEAR.php'; require_once 'phar://install-pear-nozlib.phar/' . 'System.php'; require_once 'phar://install-pear-nozlib.phar/' . 'PEAR/Config.php'; @@ -97462,6 +85975,7 @@ class PEAR_Start extends PEAR var $localInstall; var $PEARConfig; var $tarball = array(); + var $ptmp; function PEAR_Start() { @@ -97534,7 +86048,7 @@ class PEAR_Start extends PEAR } else { $this->prefix = dirname(PHP_BINDIR); $this->pear_conf = PEAR_CONFIG_SYSCONFDIR . '/pear.conf'; - if (get_current_user() != 'root') { + if ($this->getCurrentUser() != 'root') { $this->prefix = $this->safeGetenv('HOME') . '/pear'; $this->pear_conf = $this->safeGetenv('HOME') . '.pearrc'; } @@ -97561,6 +86075,21 @@ class PEAR_Start extends PEAR } } + /** + * Get the name of the user running the script. + * Only needed on unix for now. + * + * @return string Name of the user ("root", "cweiske") + */ + function getCurrentUser() + { + if (isset($_ENV['USER'])) { + return $_ENV['USER']; + } else { + return trim(`whoami`); + } + } + function safeGetenv($var) { if (is_array($_ENV) && isset($_ENV[$var])) { @@ -97828,6 +86357,18 @@ class PEAR_Start_CLI extends PEAR_Start var $origpwd; var $tty; + /** + * Path to .vbs file for directory selection + * @var string + */ + var $cscript; + + /** + * SAPI for selected php.exe + * @var string + */ + var $php_bin_sapi; + function PEAR_Start_CLI() { parent::PEAR_Start(); @@ -97858,6 +86399,9 @@ class PEAR_Start_CLI extends PEAR_Start if ($this->tty) { @fclose($this->tty); } + if ($this->cscript) { + @unlink($this->cscript); + } } function run() @@ -97897,7 +86441,7 @@ Are you installing a system-wide PEAR or a local copy? } } } else { - if (get_current_user() == 'root') { + if ($this->getCurrentUser() == 'root') { return; } $this->pear_conf = $this->safeGetenv('HOME') . '/.pearrc'; @@ -98024,9 +86568,7 @@ Press Enter to continue..."; */ function win32BrowseForFolder($label) { - static $wshSaved=false; - static $cscript=''; - $wsh_browserfolder = 'Option Explicit + $wsh_browserfolder = 'Option Explicit Dim ArgObj, var1, var2, sa, sFld Set ArgObj = WScript.Arguments Const BIF_EDITBOX = &H10 @@ -98056,15 +86598,15 @@ Else WScript.Echo "cancel" End If '; - if( !$wshSaved){ - $cscript = $this->ptmp . DIRECTORY_SEPARATOR . "bf.vbs"; - $fh = fopen($cscript, "wb+"); + if (!$this->cscript) { + $this->cscript = $this->ptmp . DIRECTORY_SEPARATOR . "bf.vbs"; + // TODO: use file_put_contents() + $fh = fopen($this->cscript, "wb+"); fwrite($fh, $wsh_browserfolder, strlen($wsh_browserfolder)); fclose($fh); - $wshSaved = true; } - exec('cscript ' . escapeshellarg($cscript) . ' "' . escapeshellarg($label) . '" //noLogo', $arPath); + exec('cscript ' . escapeshellarg($this->cscript) . ' "' . escapeshellarg($label) . '" //noLogo', $arPath); if (!count($arPath) || $arPath[0]=='' || $arPath[0]=='cancel') { return ''; } elseif ($arPath[0]=='invalid') { @@ -98072,7 +86614,6 @@ End If return ''; } - @unlink($cscript); return $arPath[0]; } @@ -98442,7 +86983,7 @@ Double-click this file to add it to the current user registry. * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id: Common.php 313023 2011-07-06 19:17:11Z dufuz $ + * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR * @since File available since Release 1.4.0a1 */ @@ -98480,7 +87021,7 @@ define('PEAR_TASK_PACKAGEANDINSTALL', 3); * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version Release: 1.9.4 + * @version Release: 1.9.5 * @link http://pear.php.net/package/PEAR * @since Class available since Release 1.4.0a1 * @abstract @@ -98643,7 +87184,7 @@ class PEAR_Task_Common * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id: Postinstallscript.php 313023 2011-07-06 19:17:11Z dufuz $ + * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR * @since File available since Release 1.4.0a1 */ @@ -98661,7 +87202,7 @@ require_once 'phar://install-pear-nozlib.phar/' . 'PEAR/Task/Common.php'; * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version Release: 1.9.4 + * @version Release: 1.9.5 * @link http://pear.php.net/package/PEAR * @since Class available since Release 1.4.0a1 */ @@ -98965,7 +87506,7 @@ class PEAR_Task_Postinstallscript extends PEAR_Task_Common * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id: rw.php 313023 2011-07-06 19:17:11Z dufuz $ + * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR * @since File available since Release 1.4.0a10 */ @@ -98980,7 +87521,7 @@ require_once 'phar://install-pear-nozlib.phar/' . 'PEAR/Task/Postinstallscript.p * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version Release: 1.9.4 + * @version Release: 1.9.5 * @link http://pear.php.net/package/PEAR * @since Class available since Release 1.4.0a10 */ @@ -99133,7 +87674,7 @@ class PEAR_Task_Postinstallscript_rw extends PEAR_Task_Postinstallscript * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id: Replace.php 313023 2011-07-06 19:17:11Z dufuz $ + * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR * @since File available since Release 1.4.0a1 */ @@ -99148,7 +87689,7 @@ require_once 'phar://install-pear-nozlib.phar/' . 'PEAR/Task/Common.php'; * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version Release: 1.9.4 + * @version Release: 1.9.5 * @link http://pear.php.net/package/PEAR * @since Class available since Release 1.4.0a1 */ @@ -99308,7 +87849,7 @@ class PEAR_Task_Replace extends PEAR_Task_Common * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id: rw.php 313023 2011-07-06 19:17:11Z dufuz $ + * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR * @since File available since Release 1.4.0a10 */ @@ -99323,7 +87864,7 @@ require_once 'phar://install-pear-nozlib.phar/' . 'PEAR/Task/Replace.php'; * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version Release: 1.9.4 + * @version Release: 1.9.5 * @link http://pear.php.net/package/PEAR * @since Class available since Release 1.4.0a10 */ @@ -99368,7 +87909,7 @@ class PEAR_Task_Replace_rw extends PEAR_Task_Replace * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id: Unixeol.php 313023 2011-07-06 19:17:11Z dufuz $ + * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR * @since File available since Release 1.4.0a1 */ @@ -99383,7 +87924,7 @@ require_once 'phar://install-pear-nozlib.phar/' . 'PEAR/Task/Common.php'; * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version Release: 1.9.4 + * @version Release: 1.9.5 * @link http://pear.php.net/package/PEAR * @since Class available since Release 1.4.0a1 */ @@ -99444,7 +87985,7 @@ class PEAR_Task_Unixeol extends PEAR_Task_Common * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id: rw.php 313023 2011-07-06 19:17:11Z dufuz $ + * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR * @since File available since Release 1.4.0a10 */ @@ -99459,7 +88000,7 @@ require_once 'phar://install-pear-nozlib.phar/' . 'PEAR/Task/Unixeol.php'; * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version Release: 1.9.4 + * @version Release: 1.9.5 * @link http://pear.php.net/package/PEAR * @since Class available since Release 1.4.0a10 */ @@ -99499,7 +88040,7 @@ class PEAR_Task_Unixeol_rw extends PEAR_Task_Unixeol * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id: Windowseol.php 313023 2011-07-06 19:17:11Z dufuz $ + * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR * @since File available since Release 1.4.0a1 */ @@ -99514,7 +88055,7 @@ require_once 'phar://install-pear-nozlib.phar/' . 'PEAR/Task/Common.php'; * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version Release: 1.9.4 + * @version Release: 1.9.5 * @link http://pear.php.net/package/PEAR * @since Class available since Release 1.4.0a1 */ @@ -99575,7 +88116,7 @@ class PEAR_Task_Windowseol extends PEAR_Task_Common * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id: rw.php 313023 2011-07-06 19:17:11Z dufuz $ + * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR * @since File available since Release 1.4.0a10 */ @@ -99590,7 +88131,7 @@ require_once 'phar://install-pear-nozlib.phar/' . 'PEAR/Task/Windowseol.php'; * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version Release: 1.9.4 + * @version Release: 1.9.5 * @link http://pear.php.net/package/PEAR * @since Class available since Release 1.4.0a10 */ @@ -99630,7 +88171,7 @@ class PEAR_Task_Windowseol_rw extends PEAR_Task_Windowseol * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id: Validate.php 313023 2011-07-06 19:17:11Z dufuz $ + * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR * @since File available since Release 1.4.0a1 */ @@ -99653,7 +88194,7 @@ require_once 'phar://install-pear-nozlib.phar/' . 'PEAR/Validator/PECL.php'; * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version Release: 1.9.4 + * @version Release: 1.9.5 * @link http://pear.php.net/package/PEAR * @since Class available since Release 1.4.0a1 */ @@ -100258,7 +88799,7 @@ class PEAR_Validate * @author Greg Beaver <cellog@php.net> * @copyright 1997-2006 The PHP Group * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id: PECL.php 313023 2011-07-06 19:17:11Z dufuz $ + * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR * @since File available since Release 1.4.0a5 */ @@ -100273,7 +88814,7 @@ require_once 'phar://install-pear-nozlib.phar/' . 'PEAR/Validate.php'; * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version Release: 1.9.4 + * @version Release: 1.9.5 * @link http://pear.php.net/package/PEAR * @since Class available since Release 1.4.0a5 */ @@ -100321,7 +88862,7 @@ class PEAR_Validator_PECL extends PEAR_Validate * @author Stephan Schmidt (original XML_Unserializer code) * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license New BSD License - * @version CVS: $Id: XMLParser.php 313023 2011-07-06 19:17:11Z dufuz $ + * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR * @since File available since Release 1.4.0a1 */ @@ -100334,7 +88875,7 @@ class PEAR_Validator_PECL extends PEAR_Validate * @author Stephan Schmidt (original XML_Unserializer code) * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license New BSD License - * @version Release: 1.9.4 + * @version Release: 1.9.5 * @link http://pear.php.net/package/PEAR * @since Class available since Release 1.4.0a1 */ @@ -105787,7 +94328,7 @@ That's all there is to it! * @author Tomas V.V.Cox <cox@idecnet.com> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id: System.php 313024 2011-07-06 19:51:24Z dufuz $ + * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR * @since File available since Release 0.1 */ @@ -105829,7 +94370,7 @@ $GLOBALS['_System_temp_files'] = array(); * @author Tomas V.V. Cox <cox@idecnet.com> * @copyright 1997-2006 The PHP Group * @license http://opensource.org/licenses/bsd-license.php New BSD License -* @version Release: 1.9.4 +* @version Release: 1.9.5 * @link http://pear.php.net/package/PEAR * @since Class available since Release 0.1 * @static @@ -105849,6 +94390,23 @@ class System function _parseArgs($argv, $short_options, $long_options = null) { if (!is_array($argv) && $argv !== null) { + /* + // Quote all items that are a short option + $av = preg_split('/(\A| )--?[a-z0-9]+[ =]?((?<!\\\\)((,\s*)|((?<!,)\s+))?)/i', $argv, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_OFFSET_CAPTURE); + $offset = 0; + foreach ($av as $a) { + $b = trim($a[0]); + if ($b{0} == '"' || $b{0} == "'") { + continue; + } + + $escape = escapeshellarg($b); + $pos = $a[1] + $offset; + $argv = substr_replace($argv, $escape, $pos, strlen($b)); + $offset += 2; + } + */ + // Find all items, quoted or otherwise preg_match_all("/(?:[\"'])(.*?)(?:['\"])|([^\s]+)/", $argv, $av); $argv = $av[1]; @@ -105859,6 +94417,7 @@ class System $argv[$k] = trim($a) ; } } + return Console_Getopt::getopt2($argv, $short_options, $long_options); } @@ -106412,7 +94971,7 @@ class System * XML_Util * * XML Utilities package - * + * * PHP versions 4 and 5 * * LICENSE: @@ -106449,7 +95008,7 @@ class System * @author Stephan Schmidt <schst@php.net> * @copyright 2003-2008 Stephan Schmidt <schst@php.net> * @license http://opensource.org/licenses/bsd-license New BSD License - * @version CVS: $Id: Util.php,v 1.38 2008/11/13 00:03:38 ashnazg Exp $ + * @version CVS: $Id$ * @link http://pear.php.net/package/XML_Util */ @@ -106525,7 +95084,7 @@ define('XML_UTIL_COLLAPSE_XHTML_ONLY', 2); * @author Stephan Schmidt <schst@php.net> * @copyright 2003-2008 Stephan Schmidt <schst@php.net> * @license http://opensource.org/licenses/bsd-license New BSD License - * @version Release: 1.2.1 + * @version Release: 1.2.3 * @link http://pear.php.net/package/XML_Util */ class XML_Util @@ -106567,11 +95126,11 @@ class XML_Util * ); * </code> * - * @param string $string string where XML special chars + * @param string $string string where XML special chars * should be replaced - * @param int $replaceEntities setting for entities in attribute values - * (one of XML_UTIL_ENTITIES_XML, - * XML_UTIL_ENTITIES_XML_REQUIRED, + * @param int $replaceEntities setting for entities in attribute values + * (one of XML_UTIL_ENTITIES_XML, + * XML_UTIL_ENTITIES_XML_REQUIRED, * XML_UTIL_ENTITIES_HTML) * @param string $encoding encoding value (if any)... * must be a valid encoding as determined @@ -106633,11 +95192,11 @@ class XML_Util * ); * </code> * - * @param string $string string where XML special chars + * @param string $string string where XML special chars * should be replaced - * @param int $replaceEntities setting for entities in attribute values - * (one of XML_UTIL_ENTITIES_XML, - * XML_UTIL_ENTITIES_XML_REQUIRED, + * @param int $replaceEntities setting for entities in attribute values + * (one of XML_UTIL_ENTITIES_XML, + * XML_UTIL_ENTITIES_XML_REQUIRED, * XML_UTIL_ENTITIES_HTML) * @param string $encoding encoding value (if any)... * must be a valid encoding as determined @@ -106692,7 +95251,7 @@ class XML_Util * @static * @uses attributesToString() to serialize the attributes of the XML declaration */ - function getXMLDeclaration($version = '1.0', $encoding = null, + function getXMLDeclaration($version = '1.0', $encoding = null, $standalone = null) { $attributes = array( @@ -106707,7 +95266,7 @@ class XML_Util $attributes['standalone'] = $standalone ? 'yes' : 'no'; } - return sprintf('<?xml%s?>', + return sprintf('<?xml%s?>', XML_Util::attributesToString($attributes, false)); } @@ -106722,7 +95281,7 @@ class XML_Util * </code> * * @param string $root name of the root tag - * @param string $uri uri of the doctype definition + * @param string $uri uri of the doctype definition * (or array with uri and public id) * @param string $internalDtd internal dtd entries * @@ -106764,20 +95323,20 @@ class XML_Util * </code> * * @param array $attributes attribute array - * @param bool|array $sort sort attribute list alphabetically, - * may also be an assoc array containing - * the keys 'sort', 'multiline', 'indent', + * @param bool|array $sort sort attribute list alphabetically, + * may also be an assoc array containing + * the keys 'sort', 'multiline', 'indent', * 'linebreak' and 'entities' - * @param bool $multiline use linebreaks, if more than + * @param bool $multiline use linebreaks, if more than * one attribute is given - * @param string $indent string used for indentation of + * @param string $indent string used for indentation of * multiline attributes - * @param string $linebreak string used for linebreaks of + * @param string $linebreak string used for linebreaks of * multiline attributes - * @param int $entities setting for entities in attribute values - * (one of XML_UTIL_ENTITIES_NONE, - * XML_UTIL_ENTITIES_XML, - * XML_UTIL_ENTITIES_XML_REQUIRED, + * @param int $entities setting for entities in attribute values + * (one of XML_UTIL_ENTITIES_NONE, + * XML_UTIL_ENTITIES_XML, + * XML_UTIL_ENTITIES_XML_REQUIRED, * XML_UTIL_ENTITIES_HTML) * * @return string string representation of the attributes @@ -106786,7 +95345,7 @@ class XML_Util * @uses replaceEntities() to replace XML entities in attribute values * @todo allow sort also to be an options array */ - function attributesToString($attributes, $sort = true, $multiline = false, + function attributesToString($attributes, $sort = true, $multiline = false, $indent = ' ', $linebreak = "\n", $entities = XML_UTIL_ENTITIES_XML) { /* @@ -106857,7 +95416,7 @@ class XML_Util * @todo PEAR CS - unable to avoid "space after open parens" error * in the IF branch */ - function collapseEmptyTags($xml, $mode = XML_UTIL_COLLAPSE_ALL) + function collapseEmptyTags($xml, $mode = XML_UTIL_COLLAPSE_ALL) { if ($mode == XML_UTIL_COLLAPSE_XHTML_ONLY) { return preg_replace( @@ -106880,9 +95439,9 @@ class XML_Util * require_once 'XML/Util.php'; * * // create an XML tag: - * $tag = XML_Util::createTag('myNs:myTag', - * array('foo' => 'bar'), - * 'This is inside the tag', + * $tag = XML_Util::createTag('myNs:myTag', + * array('foo' => 'bar'), + * 'This is inside the tag', * 'http://www.w3c.org/myNs#'); * </code> * @@ -106890,13 +95449,13 @@ class XML_Util * @param array $attributes array containg attributes * @param mixed $content the content * @param string $namespaceUri URI of the namespace - * @param int $replaceEntities whether to replace XML special chars in - * content, embedd it in a CData section + * @param int $replaceEntities whether to replace XML special chars in + * content, embedd it in a CData section * or none of both - * @param bool $multiline whether to create a multiline tag where + * @param bool $multiline whether to create a multiline tag where * each attribute gets written to a single line - * @param string $indent string used to indent attributes - * (_auto indents attributes so they start + * @param string $indent string used to indent attributes + * (_auto indents attributes so they start * at the same column) * @param string $linebreak string used for linebreaks * @param bool $sortAttributes Whether to sort the attributes or not @@ -106907,9 +95466,9 @@ class XML_Util * @see createTagFromArray() * @uses createTagFromArray() to create the tag */ - function createTag($qname, $attributes = array(), $content = null, - $namespaceUri = null, $replaceEntities = XML_UTIL_REPLACE_ENTITIES, - $multiline = false, $indent = '_auto', $linebreak = "\n", + function createTag($qname, $attributes = array(), $content = null, + $namespaceUri = null, $replaceEntities = XML_UTIL_REPLACE_ENTITIES, + $multiline = false, $indent = '_auto', $linebreak = "\n", $sortAttributes = true) { $tag = array( @@ -106927,7 +95486,7 @@ class XML_Util $tag['namespaceUri'] = $namespaceUri; } - return XML_Util::createTagFromArray($tag, $replaceEntities, $multiline, + return XML_Util::createTagFromArray($tag, $replaceEntities, $multiline, $indent, $linebreak, $sortAttributes); } @@ -106937,22 +95496,22 @@ class XML_Util * <pre> * array( * // qualified name of the tag - * 'qname' => $qname + * 'qname' => $qname * * // namespace prefix (optional, if qname is specified or no namespace) - * 'namespace' => $namespace + * 'namespace' => $namespace * * // local part of the tagname (optional, if qname is specified) - * 'localpart' => $localpart, + * 'localpart' => $localpart, * * // array containing all attributes (optional) - * 'attributes' => array(), + * 'attributes' => array(), * * // tag content (optional) - * 'content' => $content, + * 'content' => $content, * * // namespaceUri for the given namespace (optional) - * 'namespaceUri' => $namespaceUri + * 'namespaceUri' => $namespaceUri * ) * </pre> * @@ -106970,13 +95529,13 @@ class XML_Util * </code> * * @param array $tag tag definition - * @param int $replaceEntities whether to replace XML special chars in - * content, embedd it in a CData section + * @param int $replaceEntities whether to replace XML special chars in + * content, embedd it in a CData section * or none of both - * @param bool $multiline whether to create a multiline tag where each + * @param bool $multiline whether to create a multiline tag where each * attribute gets written to a single line - * @param string $indent string used to indent attributes - * (_auto indents attributes so they start + * @param string $indent string used to indent attributes + * (_auto indents attributes so they start * at the same column) * @param string $linebreak string used for linebreaks * @param bool $sortAttributes Whether to sort the attributes or not @@ -106991,7 +95550,7 @@ class XML_Util * @uses raiseError() */ function createTagFromArray($tag, $replaceEntities = XML_UTIL_REPLACE_ENTITIES, - $multiline = false, $indent = '_auto', $linebreak = "\n", + $multiline = false, $indent = '_auto', $linebreak = "\n", $sortAttributes = true) { if (isset($tag['content']) && !is_scalar($tag['content'])) { @@ -107001,7 +95560,7 @@ class XML_Util if (!isset($tag['qname']) && !isset($tag['localPart'])) { return XML_Util::raiseError('You must either supply a qualified name ' - . '(qname) or local tag name (localPart).', + . '(qname) or local tag name (localPart).', XML_UTIL_ERROR_NO_TAG_NAME); } @@ -107055,8 +95614,8 @@ class XML_Util } // create attribute list - $attList = XML_Util::attributesToString($tag['attributes'], - $sortAttributes, $multiline, $indent, $linebreak, $replaceEntities); + $attList = XML_Util::attributesToString($tag['attributes'], + $sortAttributes, $multiline, $indent, $linebreak); if (!isset($tag['content']) || (string)$tag['content'] == '') { $tag = sprintf('<%s%s />', $tag['qname'], $attList); } else { @@ -107067,7 +95626,7 @@ class XML_Util $tag['content'] = XML_Util::createCDataSection($tag['content']); break; default: - $tag['content'] = XML_Util::replaceEntities($tag['content'], + $tag['content'] = XML_Util::replaceEntities($tag['content'], $replaceEntities); break; } @@ -107084,14 +95643,14 @@ class XML_Util * require_once 'XML/Util.php'; * * // create an XML start element: - * $tag = XML_Util::createStartElement('myNs:myTag', + * $tag = XML_Util::createStartElement('myNs:myTag', * array('foo' => 'bar') ,'http://www.w3c.org/myNs#'); * </code> * * @param string $qname qualified tagname (including namespace) * @param array $attributes array containg attributes * @param string $namespaceUri URI of the namespace - * @param bool $multiline whether to create a multiline tag where each + * @param bool $multiline whether to create a multiline tag where each * attribute gets written to a single line * @param string $indent string used to indent attributes (_auto indents * attributes so they start at the same column) @@ -107104,7 +95663,7 @@ class XML_Util * @see createEndElement(), createTag() */ function createStartElement($qname, $attributes = array(), $namespaceUri = null, - $multiline = false, $indent = '_auto', $linebreak = "\n", + $multiline = false, $indent = '_auto', $linebreak = "\n", $sortAttributes = true) { // if no attributes hav been set, use empty attributes @@ -107134,7 +95693,7 @@ class XML_Util } // create attribute list - $attList = XML_Util::attributesToString($attributes, $sortAttributes, + $attList = XML_Util::attributesToString($attributes, $sortAttributes, $multiline, $indent, $linebreak); $element = sprintf('<%s%s>', $qname, $attList); return $element; @@ -107203,7 +95762,7 @@ class XML_Util */ function createCDataSection($data) { - return sprintf('<![CDATA[%s]]>', + return sprintf('<![CDATA[%s]]>', preg_replace('/\]\]>/', ']]]]><![CDATA[>', strval($data))); } @@ -107277,17 +95836,17 @@ class XML_Util function isValidName($string) { // check for invalid chars - if (!preg_match('/^[[:alpha:]_]$/', $string{0})) { + if (!preg_match('/^[[:alpha:]_]\\z/', $string{0})) { return XML_Util::raiseError('XML names may only start with letter ' . 'or underscore', XML_UTIL_ERROR_INVALID_START); } // check for invalid chars - if (!preg_match('/^([[:alpha:]_]([[:alnum:]\-\.]*)?:)?[[:alpha:]_]([[:alnum:]\_\-\.]+)?$/', + if (!preg_match('/^([[:alpha:]_]([[:alnum:]\-\.]*)?:)?[[:alpha:]_]([[:alnum:]\_\-\.]+)?\\z/', $string) ) { return XML_Util::raiseError('XML names may only contain alphanumeric ' - . 'chars, period, hyphen, colon and underscores', + . 'chars, period, hyphen, colon and underscores', XML_UTIL_ERROR_INVALID_CHARS); } // XML name is valid @@ -107315,8 +95874,8 @@ class XML_Util } } ?> -package.xml -<package packagerversion="1.7.2" version="2.0" xmlns="http://pear.php.net/dtd/package-2.0" xmlns:tasks="http://pear.php.net/dtd/tasks-1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://pear.php.net/dtd/tasks-1.0 http://pear.php.net/dtd/tasks-1.0.xsd http://pear.php.net/dtd/package-2.0 http://pear.php.net/dtd/package-2.0.xsd"> +package.xml +<package packagerversion="1.9.4" version="2.0" xmlns="http://pear.php.net/dtd/package-2.0" xmlns:tasks="http://pear.php.net/dtd/tasks-1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://pear.php.net/dtd/tasks-1.0 http://pear.php.net/dtd/tasks-1.0.xsd http://pear.php.net/dtd/package-2.0 http://pear.php.net/dtd/package-2.0.xsd"> <name>XML_Util</name> <channel>pear.php.net</channel> <summary>XML utility class</summary> @@ -107339,10 +95898,10 @@ package.xml <email>davey@php.net</email> <active>no</active> </helper> - <date>2008-12-07</date> - <time>19:41:10</time> + <date>2014-06-07</date> + <time>10:18:11</time> <version> - <release>1.2.1</release> + <release>1.2.3</release> <api>1.2.0</api> </version> <stability> @@ -107350,31 +95909,33 @@ package.xml <api>stable</api> </stability> <license uri="http://opensource.org/licenses/bsd-license">BSD License</license> - <notes>Fixed Bug #14760: Bug in getDocTypeDeclaration() [ashnazg|fpospisil]</notes> + <notes> +Bug #20293 Broken installation for 1.2.2 + </notes> <contents> - <dir baseinstalldir="XML" name="/"> - <file baseinstalldir="XML" md5sum="06b6662b91b1a466e7b5113f37d4725f" name="examples/example.php" role="doc" /> - <file baseinstalldir="XML" md5sum="77355702c9e861d3fc0a5318ea689eee" name="examples/example2.php" role="doc" /> - <file baseinstalldir="XML" md5sum="0af0cff09232a6c275803bb36213cdd9" name="tests/AllTests.php" role="test" /> - <file baseinstalldir="XML" md5sum="73088689d58b71cd4f86013c88b72216" name="tests/testBasic_apiVersion.phpt" role="test" /> - <file baseinstalldir="XML" md5sum="4b17c0df7fbfb1bb2f3f636ebd6c2cbd" name="tests/testBasic_attributesToString.phpt" role="test" /> - <file baseinstalldir="XML" md5sum="dc4202f1451bbeb62a5bc7d56a7c774c" name="tests/testBasic_collapseEmptyTags.phpt" role="test" /> - <file baseinstalldir="XML" md5sum="4c87fda94fdfb7a78ba84998d6e28f45" name="tests/testBasic_createCDataSection.phpt" role="test" /> - <file baseinstalldir="XML" md5sum="c101844768f146653c59c81978060158" name="tests/testBasic_createComment.phpt" role="test" /> - <file baseinstalldir="XML" md5sum="ba75d66c2f0fb0010c71f3bcd1f64eb2" name="tests/testBasic_createEndElement.phpt" role="test" /> - <file baseinstalldir="XML" md5sum="ad786fb687e1eea1f6890a7424709c79" name="tests/testBasic_createStartElement.phpt" role="test" /> - <file baseinstalldir="XML" md5sum="5f453edadebaa3435c8e6f09a3aaaa9c" name="tests/testBasic_createTag.phpt" role="test" /> - <file baseinstalldir="XML" md5sum="d2792da0d9c5f0987ee4587912017aa9" name="tests/testBasic_createTagFromArray.phpt" role="test" /> - <file baseinstalldir="XML" md5sum="817882a0ab33e60f17ee71874ad975f0" name="tests/testBasic_getDocTypeDeclaration.phpt" role="test" /> - <file baseinstalldir="XML" md5sum="5bc1926a488a6b63ec6366bfcf06a50a" name="tests/testBasic_getXmlDeclaration.phpt" role="test" /> - <file baseinstalldir="XML" md5sum="a727860d55c14194fdaffa839a59a540" name="tests/testBasic_isValidName.phpt" role="test" /> - <file baseinstalldir="XML" md5sum="300a6192f7cc6f7bc3d8f2576b51e4b0" name="tests/testBasic_raiseError.phpt" role="test" /> - <file baseinstalldir="XML" md5sum="e6717d43001775cccd52bd5195cf02e0" name="tests/testBasic_replaceEntities.phpt" role="test" /> - <file baseinstalldir="XML" md5sum="431856aa83a23396a9f00915dd2be192" name="tests/testBasic_reverseEntities.phpt" role="test" /> - <file baseinstalldir="XML" md5sum="ab035534463cae8cc903e907aead8ffe" name="tests/testBasic_splitQualifiedName.phpt" role="test" /> - <file baseinstalldir="XML" md5sum="1850856692ff6c6df5e8acb16e1080ce" name="tests/testBug_4950.phpt" role="test" /> - <file baseinstalldir="XML" md5sum="b4127883df40a4b0d1736ad42215ee25" name="tests/testBug_5392.phpt" role="test" /> - <file baseinstalldir="XML" md5sum="9bb265dafaaf06c86ca5c48f50368ded" name="Util.php" role="php"> + <dir baseinstalldir="/" name="/"> + <file baseinstalldir="/" md5sum="af2746028ae4395f549855a5e444ada7" name="examples/example.php" role="doc" /> + <file baseinstalldir="/" md5sum="b9e52f4aa372c4067c609f49c2285b8f" name="examples/example2.php" role="doc" /> + <file baseinstalldir="/" md5sum="73088689d58b71cd4f86013c88b72216" name="tests/testBasic_apiVersion.phpt" role="test" /> + <file baseinstalldir="/" md5sum="4b17c0df7fbfb1bb2f3f636ebd6c2cbd" name="tests/testBasic_attributesToString.phpt" role="test" /> + <file baseinstalldir="/" md5sum="dc4202f1451bbeb62a5bc7d56a7c774c" name="tests/testBasic_collapseEmptyTags.phpt" role="test" /> + <file baseinstalldir="/" md5sum="4c87fda94fdfb7a78ba84998d6e28f45" name="tests/testBasic_createCDataSection.phpt" role="test" /> + <file baseinstalldir="/" md5sum="c101844768f146653c59c81978060158" name="tests/testBasic_createComment.phpt" role="test" /> + <file baseinstalldir="/" md5sum="ba75d66c2f0fb0010c71f3bcd1f64eb2" name="tests/testBasic_createEndElement.phpt" role="test" /> + <file baseinstalldir="/" md5sum="ad786fb687e1eea1f6890a7424709c79" name="tests/testBasic_createStartElement.phpt" role="test" /> + <file baseinstalldir="/" md5sum="5f453edadebaa3435c8e6f09a3aaaa9c" name="tests/testBasic_createTag.phpt" role="test" /> + <file baseinstalldir="/" md5sum="637fa86b8bcf0086334f69004a435169" name="tests/testBasic_createTagFromArray.phpt" role="test" /> + <file baseinstalldir="/" md5sum="817882a0ab33e60f17ee71874ad975f0" name="tests/testBasic_getDocTypeDeclaration.phpt" role="test" /> + <file baseinstalldir="/" md5sum="5bc1926a488a6b63ec6366bfcf06a50a" name="tests/testBasic_getXmlDeclaration.phpt" role="test" /> + <file baseinstalldir="/" md5sum="a727860d55c14194fdaffa839a59a540" name="tests/testBasic_isValidName.phpt" role="test" /> + <file baseinstalldir="/" md5sum="300a6192f7cc6f7bc3d8f2576b51e4b0" name="tests/testBasic_raiseError.phpt" role="test" /> + <file baseinstalldir="/" md5sum="e6717d43001775cccd52bd5195cf02e0" name="tests/testBasic_replaceEntities.phpt" role="test" /> + <file baseinstalldir="/" md5sum="431856aa83a23396a9f00915dd2be192" name="tests/testBasic_reverseEntities.phpt" role="test" /> + <file baseinstalldir="/" md5sum="ab035534463cae8cc903e907aead8ffe" name="tests/testBasic_splitQualifiedName.phpt" role="test" /> + <file baseinstalldir="/" md5sum="1850856692ff6c6df5e8acb16e1080ce" name="tests/testBug_4950.phpt" role="test" /> + <file baseinstalldir="/" md5sum="b4127883df40a4b0d1736ad42215ee25" name="tests/testBug_5392.phpt" role="test" /> + <file baseinstalldir="/" md5sum="b133427f8ea9b60c5bec7400cd5e4c7f" name="tests/testBug_18343.phpt" role="test" /> + <file baseinstalldir="/" md5sum="2697c0187cca3fae63ce8f925059746b" name="XML/Util.php" role="php"> <tasks:replace from="@version@" to="version" type="package-info" /> </file> </dir> @@ -107396,169 +95957,162 @@ package.xml <changelog> <release> <version> - <release>1.2.1</release> - <api>1.2.0</api> + <release>0.1</release> + <api>0.1</api> </version> <stability> <release>stable</release> <api>stable</api> </stability> - <date>2008-12-07</date> - <license uri="http://opensource.org/licenses/bsd-license">BSD License</license> - <notes>Fixed Bug #14760: Bug in getDocTypeDeclaration() [ashnazg|fpospisil]</notes> + <date>2003-08-01</date> + <license uri="http://www.php.net/license">PHP License</license> + <notes> +inital release + </notes> </release> <release> <version> - <release>1.2.0</release> - <api>1.2.0</api> + <release>0.1.1</release> + <api>0.1.1</api> </version> <stability> <release>stable</release> <api>stable</api> </stability> - <date>2008-07-26</date> - <license uri="http://opensource.org/licenses/bsd-license">BSD License</license> - <notes>Changed license to New BSD License (Req #13826 [ashnazg]) -Added a test suite against all API methods [ashnazg] -Switch to package.xml v2 [ashnazg] -Added Req #13839: Missing XHTML empty tags to collapse [ashnazg|drry] -Fixed Bug #5392: encoding of ISO-8859-1 is the only supported encoding [ashnazg] -Fixed Bug #4950: Incorrect CDATA serializing [ashnazg|drry] --- (this fix differs from the one in v1.2.0a1)</notes> - </release> - <release> - <version> - <release>1.2.0RC1</release> - <api>1.2.0</api> - </version> - <stability> - <release>beta</release> - <api>beta</api> - </stability> - <date>2008-07-12</date> - <license uri="http://opensource.org/licenses/bsd-license">BSD License</license> - <notes>Changed license to New BSD License (Req #13826 [ashnazg]) -Added a test suite against all API methods [ashnazg] -Switch to package.xml v2 [ashnazg] -Added Req #13839: Missing XHTML empty tags to collapse [ashnazg|drry] -Fixed Bug #5392: encoding of ISO-8859-1 is the only supported encoding [ashnazg] -Fixed Bug #4950: Incorrect CDATA serializing [ashnazg|drry] --- (this fix differs from the one in v1.2.0a1)</notes> + <date>2003-08-02</date> + <license uri="http://www.php.net/license">PHP License</license> + <notes> +bugfix: removed bug in createTagFromArray + </notes> </release> <release> <version> - <release>1.2.0a2</release> - <api>1.2.0</api> + <release>0.2</release> + <api>0.2</api> </version> <stability> - <release>alpha</release> - <api>alpha</api> + <release>stable</release> + <api>stable</api> </stability> - <date>2008-05-22</date> - <license uri="http://opensource.org/licenses/bsd-license">BSD License</license> - <notes>Changed license to New BSD License (Req #13826 [ashnazg]) -Added a test suite against all API methods [ashnazg] -Switch to package.xml v2 [ashnazg] -Added Req #13839: Missing XHTML empty tags to collapse [ashnazg|drry] -Fixed Bug #5392: encoding of ISO-8859-1 is the only supported encoding [ashnazg] -Fixed Bug #4950: Incorrect CDATA serializing [ashnazg|drry] --- (this fix differs from the one in v1.2.0a1)</notes> + <date>2003-08-12</date> + <license uri="http://www.php.net/license">PHP License</license> + <notes> +added XML_Util::getDocTypeDeclaration() + </notes> </release> <release> <version> - <release>1.2.0a1</release> - <api>1.2.0</api> + <release>0.2.1</release> + <api>0.2.1</api> </version> <stability> - <release>alpha</release> - <api>alpha</api> + <release>stable</release> + <api>stable</api> </stability> - <date>2008-05-04</date> - <license uri="http://opensource.org/licenses/bsd-license">BSD License</license> - <notes>Changed license to New BSD License (Req #13826 [ashnazg]) -Added a test suite against all API methods [ashnazg] -Switch to package.xml v2 [ashnazg] -Fixed Bug #4950: Incorrect CDATA serializing [ashnazg|ja.doma]</notes> + <date>2003-09-05</date> + <license uri="http://www.php.net/license">PHP License</license> + <notes> +fixed bug with zero as tag content in createTagFromArray and createTag + </notes> </release> <release> <version> - <release>1.1.4</release> - <api>1.1.4</api> + <release>0.3</release> + <api>0.3</api> </version> <stability> <release>stable</release> <api>stable</api> </stability> - <date>2006-12-16</date> + <date>2003-09-12</date> <license uri="http://www.php.net/license">PHP License</license> - <notes>- Fixed bug #9561: Not allowing underscores in middle of tags</notes> + <notes> +added createStartElement() and createEndElement() + </notes> </release> <release> <version> - <release>1.1.2</release> - <api>1.1.2</api> + <release>0.4</release> + <api>0.4</api> </version> <stability> <release>stable</release> <api>stable</api> </stability> - <date>2006-12-01</date> + <date>2003-09-21</date> <license uri="http://www.php.net/license">PHP License</license> - <notes>- fixed bug #5419: isValidName() now checks for character classes -- implemented request #8196: added optional parameter to influence array sorting to createTag() createTagFromArray() and createStartElement()</notes> + <notes> +added createCDataSection(), +added support for CData sections in createTag* methods, +fixed bug #23, +fixed bug in splitQualifiedName() + </notes> </release> <release> <version> - <release>1.1.1</release> - <api>1.1.1</api> + <release>0.5</release> + <api>0.5</api> </version> <stability> <release>stable</release> <api>stable</api> </stability> - <date>2004-12-23</date> + <date>2003-09-23</date> <license uri="http://www.php.net/license">PHP License</license> - <notes>- fixed bug in replaceEntities() and reverseEntities() in conjunction with XML_UTIL_ENTITIES_HTML -- createTag() and createTagFromArray() now accept XML_UTIL_ENTITIES_XML, XML_UTIL_ENTITIES_XML_REQUIRED, XML_UTIL_ENTITIES_HTML, XML_UTIL_ENTITIES_NONE and XML_UTIL_CDATA_SECTION as $replaceEntities parameter</notes> + <notes> +added support for multiline attributes in attributesToString(), createTag*() and createStartElement (requested by Yavor Shahpasov for XML_Serializer), +added createComment + </notes> </release> <release> <version> - <release>1.1.0</release> - <api>1.1.0</api> + <release>0.5.1</release> + <api>0.5.1</api> </version> <stability> <release>stable</release> <api>stable</api> </stability> - <date>2004-11-19</date> + <date>2003-09-26</date> <license uri="http://www.php.net/license">PHP License</license> - <notes>- Added collapseEmptyTags (patch by Sebastian Bergmann and Thomas Duffey)</notes> + <notes> +added default namespace parameter (optional) in splitQualifiedName() (requested by Sebastian Bergmann) + </notes> </release> <release> <version> - <release>1.0.0</release> - <api>1.0.0</api> + <release>0.5.2</release> + <api>0.5.2</api> </version> <stability> <release>stable</release> <api>stable</api> </stability> - <date>2004-10-28</date> + <date>2003-11-22</date> <license uri="http://www.php.net/license">PHP License</license> - <notes>- Added reverseEntities() (request #2639)</notes> + <notes> +now creates XHTML compliant empty tags (Davey), +minor whitespace fixes (Davey) + </notes> </release> <release> <version> - <release>0.6.1</release> - <api>0.6.1</api> + <release>0.6.0beta1</release> + <api>0.6.0beta1</api> </version> <stability> - <release>stable</release> - <api>stable</api> + <release>beta</release> + <api>beta</api> </stability> - <date>2004-10-28</date> + <date>2004-05-24</date> <license uri="http://www.php.net/license">PHP License</license> - <notes>- Added check for tag name (either as local part or qualified name) in createTagFromArray() (bug #1083)</notes> + <notes> +- Fixed bug 1438 (namespaces not accepted for isValidName()) (thanks to davey) +- added optional parameter to replaceEntities() to define the set of entities to replace +- added optional parameter to attributesToString() to define, whether entities should be replaced (requested by Sebastian Bergmann) +- allowed second parameter to XML_Util::attributesToString() to be an array containing options (easier to use, if you only need to set the last parameter) +- introduced XML_Util::raiseError() to avoid the necessity of including PEAR.php, will only be included on error + </notes> </release> <release> <version> @@ -107571,154 +96125,239 @@ Fixed Bug #4950: Incorrect CDATA serializing [ashnazg|ja.doma]</notes> </stability> <date>2004-06-07</date> <license uri="http://www.php.net/license">PHP License</license> - <notes>- Fixed bug 1438 (namespaces not accepted for isValidName()) (thanks to davey) + <notes> +- Fixed bug 1438 (namespaces not accepted for isValidName()) (thanks to davey) - added optional parameter to replaceEntities() to define the set of entities to replace - added optional parameter to attributesToString() to define, whether entities should be replaced (requested by Sebastian Bergmann) - allowed second parameter to XML_Util::attributesToString() to be an array containing options (easier to use, if you only need to set the last parameter) -- introduced XML_Util::raiseError() to avoid the necessity of including PEAR.php, will only be included on error</notes> +- introduced XML_Util::raiseError() to avoid the necessity of including PEAR.php, will only be included on error + </notes> </release> <release> <version> - <release>0.6.0beta1</release> - <api>0.6.0beta1</api> + <release>0.6.1</release> + <api>0.6.1</api> </version> <stability> - <release>beta</release> - <api>beta</api> + <release>stable</release> + <api>stable</api> </stability> - <date>2004-05-24</date> + <date>2004-10-28</date> <license uri="http://www.php.net/license">PHP License</license> - <notes>- Fixed bug 1438 (namespaces not accepted for isValidName()) (thanks to davey) -- added optional parameter to replaceEntities() to define the set of entities to replace -- added optional parameter to attributesToString() to define, whether entities should be replaced (requested by Sebastian Bergmann) -- allowed second parameter to XML_Util::attributesToString() to be an array containing options (easier to use, if you only need to set the last parameter) -- introduced XML_Util::raiseError() to avoid the necessity of including PEAR.php, will only be included on error</notes> + <notes> +- Added check for tag name (either as local part or qualified name) in createTagFromArray() (bug #1083) + </notes> </release> <release> <version> - <release>0.5.2</release> - <api>0.5.2</api> + <release>1.0.0</release> + <api>1.0.0</api> </version> <stability> <release>stable</release> <api>stable</api> </stability> - <date>2003-11-22</date> + <date>2004-10-28</date> <license uri="http://www.php.net/license">PHP License</license> - <notes>now creates XHTML compliant empty tags (Davey), -minor whitespace fixes (Davey)</notes> + <notes> +- Added reverseEntities() (request #2639) + </notes> </release> <release> <version> - <release>0.5.1</release> - <api>0.5.1</api> + <release>1.1.0</release> + <api>1.1.0</api> </version> <stability> <release>stable</release> <api>stable</api> </stability> - <date>2003-09-26</date> + <date>2004-11-19</date> <license uri="http://www.php.net/license">PHP License</license> - <notes>added default namespace parameter (optional) in splitQualifiedName() (requested by Sebastian Bergmann)</notes> + <notes> +- Added collapseEmptyTags (patch by Sebastian Bergmann and Thomas Duffey) + </notes> </release> <release> <version> - <release>0.5</release> - <api>0.5</api> + <release>1.1.1</release> + <api>1.1.1</api> </version> <stability> <release>stable</release> <api>stable</api> </stability> - <date>2003-09-23</date> + <date>2004-12-23</date> <license uri="http://www.php.net/license">PHP License</license> - <notes>added support for multiline attributes in attributesToString(), createTag*() and createStartElement (requested by Yavor Shahpasov for XML_Serializer), -added createComment</notes> + <notes> +- fixed bug in replaceEntities() and reverseEntities() in conjunction with XML_UTIL_ENTITIES_HTML +- createTag() and createTagFromArray() now accept XML_UTIL_ENTITIES_XML, XML_UTIL_ENTITIES_XML_REQUIRED, XML_UTIL_ENTITIES_HTML, XML_UTIL_ENTITIES_NONE and XML_UTIL_CDATA_SECTION as $replaceEntities parameter + </notes> </release> <release> <version> - <release>0.4</release> - <api>0.4</api> + <release>1.1.2</release> + <api>1.1.2</api> </version> <stability> <release>stable</release> <api>stable</api> </stability> - <date>2003-09-21</date> + <date>2006-12-01</date> <license uri="http://www.php.net/license">PHP License</license> - <notes>added createCDataSection(), -added support for CData sections in createTag* methods, -fixed bug #23, -fixed bug in splitQualifiedName()</notes> + <notes> +- fixed bug #5419: isValidName() now checks for character classes +- implemented request #8196: added optional parameter to influence array sorting to createTag() createTagFromArray() and createStartElement() + </notes> </release> <release> <version> - <release>0.3</release> - <api>0.3</api> + <release>1.1.4</release> + <api>1.1.4</api> </version> <stability> <release>stable</release> <api>stable</api> </stability> - <date>2003-09-12</date> + <date>2006-12-16</date> <license uri="http://www.php.net/license">PHP License</license> - <notes>added createStartElement() and createEndElement()</notes> + <notes> +- Fixed bug #9561: Not allowing underscores in middle of tags + </notes> </release> <release> <version> - <release>0.2.1</release> - <api>0.2.1</api> + <release>1.2.0a1</release> + <api>1.2.0</api> + </version> + <stability> + <release>alpha</release> + <api>alpha</api> + </stability> + <date>2008-05-04</date> + <license uri="http://opensource.org/licenses/bsd-license">BSD License</license> + <notes> +Changed license to New BSD License (Req #13826 [ashnazg]) +Added a test suite against all API methods [ashnazg] +Switch to package.xml v2 [ashnazg] +Fixed Bug #4950: Incorrect CDATA serializing [ashnazg|ja.doma] + </notes> + </release> + <release> + <version> + <release>1.2.0a2</release> + <api>1.2.0</api> + </version> + <stability> + <release>alpha</release> + <api>alpha</api> + </stability> + <date>2008-05-22</date> + <license uri="http://opensource.org/licenses/bsd-license">BSD License</license> + <notes> +Changed license to New BSD License (Req #13826 [ashnazg]) +Added a test suite against all API methods [ashnazg] +Switch to package.xml v2 [ashnazg] +Added Req #13839: Missing XHTML empty tags to collapse [ashnazg|drry] +Fixed Bug #5392: encoding of ISO-8859-1 is the only supported encoding [ashnazg] +Fixed Bug #4950: Incorrect CDATA serializing [ashnazg|drry] +-- (this fix differs from the one in v1.2.0a1) + </notes> + </release> + <release> + <version> + <release>1.2.0RC1</release> + <api>1.2.0</api> + </version> + <stability> + <release>beta</release> + <api>beta</api> + </stability> + <date>2008-07-12</date> + <license uri="http://opensource.org/licenses/bsd-license">BSD License</license> + <notes> +Changed license to New BSD License (Req #13826 [ashnazg]) +Added a test suite against all API methods [ashnazg] +Switch to package.xml v2 [ashnazg] +Added Req #13839: Missing XHTML empty tags to collapse [ashnazg|drry] +Fixed Bug #5392: encoding of ISO-8859-1 is the only supported encoding [ashnazg] +Fixed Bug #4950: Incorrect CDATA serializing [ashnazg|drry] +-- (this fix differs from the one in v1.2.0a1) + </notes> + </release> + <release> + <version> + <release>1.2.0</release> + <api>1.2.0</api> </version> <stability> <release>stable</release> <api>stable</api> </stability> - <date>2003-09-05</date> - <license uri="http://www.php.net/license">PHP License</license> - <notes>fixed bug with zero as tag content in createTagFromArray and createTag</notes> + <date>2008-07-26</date> + <license uri="http://opensource.org/licenses/bsd-license">BSD License</license> + <notes> +Changed license to New BSD License (Req #13826 [ashnazg]) +Added a test suite against all API methods [ashnazg] +Switch to package.xml v2 [ashnazg] +Added Req #13839: Missing XHTML empty tags to collapse [ashnazg|drry] +Fixed Bug #5392: encoding of ISO-8859-1 is the only supported encoding [ashnazg] +Fixed Bug #4950: Incorrect CDATA serializing [ashnazg|drry] +-- (this fix differs from the one in v1.2.0a1) + </notes> </release> <release> <version> - <release>0.2</release> - <api>0.2</api> + <release>1.2.1</release> + <api>1.2.0</api> </version> <stability> <release>stable</release> <api>stable</api> </stability> - <date>2003-08-12</date> - <license uri="http://www.php.net/license">PHP License</license> - <notes>added XML_Util::getDocTypeDeclaration()</notes> + <date>2011-12-31</date> + <license uri="http://opensource.org/licenses/bsd-license">BSD License</license> + <notes> +Fixed Bug #14760: Bug in getDocTypeDeclaration() [ashnazg|fpospisil] + </notes> </release> <release> <version> - <release>0.1.1</release> - <api>0.1.1</api> + <release>1.2.2</release> + <api>1.2.0</api> </version> <stability> <release>stable</release> <api>stable</api> </stability> - <date>2003-08-02</date> - <license uri="http://www.php.net/license">PHP License</license> - <notes>bugfix: removed bug in createTagFromArray</notes> + <date>2014-06-07</date> + <license uri="http://opensource.org/licenses/bsd-license">BSD License</license> + <notes> +QA release + +Bug #18343 Entities in file names decoded during packaging +Bug #19174 upgrade PHPUnit require statements & other fixes (for PEAR QA Team) +Request #19750 examples/example.php encoding + </notes> </release> <release> <version> - <release>0.1</release> - <api>0.1</api> + <release>1.2.3</release> + <api>1.2.0</api> </version> <stability> <release>stable</release> <api>stable</api> </stability> - <date>2003-08-01</date> - <license uri="http://www.php.net/license">PHP License</license> - <notes>inital release</notes> + <date>2014-06-07</date> + <license uri="http://opensource.org/licenses/bsd-license">BSD License</license> + <notes> +Bug #20293 Broken installation for 1.2.2 + </notes> </release> </changelog> </package> - + /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */ @@ -107764,7 +96403,7 @@ fixed bug in splitQualifiedName()</notes> * @author Stephan Schmidt <schst@php.net> * @copyright 2003-2008 Stephan Schmidt <schst@php.net> * @license http://opensource.org/licenses/bsd-license New BSD License - * @version CVS: $Id: example.php,v 1.17 2008/05/05 19:05:28 ashnazg Exp $ + * @version CVS: $Id$ * @link http://pear.php.net/package/XML_Util */ @@ -108017,7 +96656,7 @@ fixed bug in splitQualifiedName()</notes> print '</pre>'; print "\n<br><br>\n"; ?> - + /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */ @@ -108063,7 +96702,7 @@ fixed bug in splitQualifiedName()</notes> * @author Stephan Schmidt <schst@php.net> * @copyright 2003-2008 Stephan Schmidt <schst@php.net> * @license http://opensource.org/licenses/bsd-license New BSD License - * @version CVS: $Id: example2.php,v 1.11 2008/05/05 19:03:13 ashnazg Exp $ + * @version CVS: $Id$ * @link http://pear.php.net/package/XML_Util */ @@ -108162,139 +96801,7 @@ fixed bug in splitQualifiedName()</notes> ?> - - -/** - * Master Unit Test Suite file for XML_Util - * - * This top-level test suite file organizes - * all class test suite files, - * so that the full suite can be run - * by PhpUnit or via "pear run-tests -u". - * - * PHP version 5 - * - * @category XML - * @package XML_Util - * @subpackage UnitTesting - * @author Chuck Burgess <ashnazg@php.net> - * @license http://www.opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id: AllTests.php,v 1.5 2008/05/30 11:53:09 ashnazg Exp $ - * @link http://pear.php.net/package/XML_Util - * @since 1.2.0a1 - */ - - -/** - * Check PHP version... PhpUnit v3+ requires at least PHP v5.1.4 - */ -if (version_compare(PHP_VERSION, "5.1.4") < 0) { - // Cannnot run test suites - echo 'Cannot run test suite via PhpUnit... requires at least PHP v5.1.4.' . PHP_EOL; - echo 'Use "pear run-tests -p xml_util" to run the PHPT tests directly.' . PHP_EOL -; - exit(1); -} - - -/** - * Derive the "main" method name - * @internal PhpUnit would have to rename PHPUnit_MAIN_METHOD to PHPUNIT_MAIN_METHOD - * to make this usage meet the PEAR CS... we cannot rename it here. - */ -if (!defined('PHPUnit_MAIN_METHOD')) { - define('PHPUnit_MAIN_METHOD', 'XML_Util_AllTests::main'); -} - - -/* - * Files needed by PhpUnit - */ -require_once 'PHPUnit/Framework.php'; -require_once 'PHPUnit/TextUI/TestRunner.php'; -require_once 'PHPUnit/Extensions/PhptTestSuite.php'; - -/* - * You must add each additional class-level test suite file here - */ -// there are no PhpUnit test files... only PHPTs.. so nothing is listed here - -/** - * directory where PHPT tests are located - */ -define('XML_UTIL_DIR_PHPT', dirname(__FILE__)); - -/** - * Master Unit Test Suite class for XML_Util - * - * This top-level test suite class organizes - * all class test suite files, - * so that the full suite can be run - * by PhpUnit or via "pear run-tests -up xml_util". - * - * @category XML - * @package XML_Util - * @subpackage UnitTesting - * @author Chuck Burgess <ashnazg@php.net> - * @license http://www.opensource.org/licenses/bsd-license.php New BSD License - * @version Release: @package_version@ - * @link http://pear.php.net/package/XML_Util - * @since 1.2.0a1 - */ -class XML_Util_AllTests -{ - - /** - * Launches the TextUI test runner - * - * @return void - * @uses PHPUnit_TextUI_TestRunner - */ - public static function main() - { - PHPUnit_TextUI_TestRunner::run(self::suite()); - } - - - /** - * Adds all class test suites into the master suite - * - * @return PHPUnit_Framework_TestSuite a master test suite - * containing all class test suites - * @uses PHPUnit_Framework_TestSuite - */ - public static function suite() - { - $suite = new PHPUnit_Framework_TestSuite( - 'XML_Util Full Suite of Unit Tests'); - - /* - * You must add each additional class-level test suite name here - */ - // there are no PhpUnit test files... only PHPTs.. so nothing is listed here - - /* - * add PHPT tests - */ - $phpt = new PHPUnit_Extensions_PhptTestSuite(XML_UTIL_DIR_PHPT); - $suite->addTestSuite($phpt); - - return $suite; - } -} - -/** - * Call the main method if this file is executed directly - * @internal PhpUnit would have to rename PHPUnit_MAIN_METHOD to PHPUNIT_MAIN_METHOD - * to make this usage meet the PEAR CS... we cannot rename it here. - */ -if (PHPUnit_MAIN_METHOD == 'XML_Util_AllTests::main') { - XML_Util_AllTests::main(); -} - -/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */ -?> - + XML_Util::apiVersion() basic tests --CREDITS-- Chuck Burgess <ashnazg@php.net> @@ -108312,7 +96819,7 @@ echo XML_Util::apiVersion() . PHP_EOL; TEST: basic apiVersion() call 1.1 - + XML_Util::attributesToString() basic tests --CREDITS-- Chuck Burgess <ashnazg@php.net> @@ -108430,7 +96937,7 @@ TEST: replace only required XML entities TEST: replace HTML entities boo="b><z" foo="b@&r" - + XML_Util::collapseEmptyTags() basic tests --CREDITS-- Chuck Burgess <ashnazg@php.net> @@ -108482,7 +96989,7 @@ TEST: one empty tag, with COLLAPSE_XHTML_ONLY set TEST: one empty tag alongside non-empty tag, with COLLAPSE_XHTML_ONLY set <foo></foo><b></b><bar>baz</bar> - + XML_Util::createCDataSection() basic tests --CREDITS-- Chuck Burgess <ashnazg@php.net> @@ -108500,7 +97007,7 @@ echo XML_Util::createCDataSection("I am content.") . PHP_EOL; TEST: basic usage <![CDATA[I am content.]]> - + XML_Util::createComment() basic tests --CREDITS-- Chuck Burgess <ashnazg@php.net> @@ -108518,7 +97025,7 @@ echo XML_Util::createComment("I am comment.") . PHP_EOL; TEST: basic usage <!-- I am comment. --> - + XML_Util::createEndElement() basic tests --CREDITS-- Chuck Burgess <ashnazg@php.net> @@ -108542,7 +97049,7 @@ TEST: basic usage (myTag) TEST: basic usage with a namespaced tag (myNs:myTag) </myNs:myTag> - + XML_Util::createStartElement() basic tests --CREDITS-- Chuck Burgess <ashnazg@php.net> @@ -108666,7 +97173,7 @@ TEST: tag with attributes, namespace, multiline = true, indent = (2 spaces only TEST: tag with attributes, namespace, multiline = true, indent = (2 spaces only), linebreak = '^', and sortAttributes = false <myNs:myTag foo="bar"^ boo="baz"^ xmlns:myNs="http://www.w3c.org/myNs#"> - + XML_Util::createTag() basic tests --CREDITS-- Chuck Burgess <ashnazg@php.net> @@ -108821,7 +97328,7 @@ TEST: tag with attribute, content, namespace, REPLACE_ENTITIES, multiline = tru TEST: tag with attribute, content, namespace, REPLACE_ENTITIES, multiline = true, indent = (2 spaces), linebreak = '^', and sortAttributes = false <myNs:myTag foo="bar"^ boo="baz"^ xmlns:myNs="http://www.w3c.org/myNs#">This is inside the tag and has < & @ > in it</myNs:myTag> - + XML_Util::createTagFromArray() basic tests --CREDITS-- Chuck Burgess <ashnazg@php.net> @@ -108986,7 +97493,7 @@ TEST: basic usage with a valid array (qname, namespaceUri, attributes, and cont <foo:bar argh="fruit&vegetable" key="value" xmlns:foo="http://foo.com">I'm inside the tag</foo:bar> TEST: basic usage with a valid array (qname, namespaceUri, attributes, and content), plus ENTITIES_NONE -<foo:bar argh="fruit&vegetable" key="value" xmlns:foo="http://foo.com">I'm inside the tag</foo:bar> +<foo:bar argh="fruit&vegetable" key="value" xmlns:foo="http://foo.com">I'm inside the tag</foo:bar> TEST: basic usage with a valid array (qname, namespaceUri, attributes, and content), REPLACE_ENTITIES, and multiline = false <foo:bar argh="fruit&vegetable" key="value" xmlns:foo="http://foo.com">I'm inside the tag</foo:bar> @@ -109024,7 +97531,7 @@ TEST: qname is derived from localPart only TEST: namespaceUri is given, but namespace is not <foo xmlns="http://bar.org" /> - + XML_Util::getDocTypeDeclaration() basic tests --CREDITS-- Chuck Burgess <ashnazg@php.net> @@ -109068,7 +97575,7 @@ TEST: using root and an array URI and an internal DTD entry <!DOCTYPE rootTag PUBLIC "-//PHP//PEAR/DTD PACKAGE 0.1" "http://pear.php.net/dtd/package-1.0" [ <!ELEMENT additionalInfo (#PCDATA)> ]> - + XML_Util::getXmlDeclaration() basic tests --CREDITS-- Chuck Burgess <ashnazg@php.net> @@ -109104,7 +97611,7 @@ TEST: using version, encoding, and standalone flag TEST: using version and standalone flag <?xml version="1.0" standalone="yes"?> - + XML_Util::isValidName() basic tests --CREDITS-- Chuck Burgess <ashnazg@php.net> @@ -109150,7 +97657,7 @@ Invalid XML name: XML names may only contain alphanumeric chars, period, hyphen, TEST: invalid tag that doesn't start with a letter Invalid XML name: XML names may only start with letter or underscore - + XML_Util::raiseError() basic tests --CREDITS-- Chuck Burgess <ashnazg@php.net> @@ -109169,7 +97676,7 @@ if (is_a($error, 'PEAR_Error')) { =====XML_Util::raiseError() basic tests===== PEAR Error: I am an error - + XML_Util::replaceEntities() basic tests --CREDITS-- Chuck Burgess <ashnazg@php.net> @@ -109251,7 +97758,7 @@ This string contains < & >. TEST: utf8 usage with ENTITIES_HTML and UTF-8 This data contains special chars like <, >, & and " as well as ä, ö, ß, à and ê - + XML_Util::reverseEntities() basic tests --CREDITS-- Chuck Burgess <ashnazg@php.net> @@ -109332,7 +97839,7 @@ This string contains < & >. TEST: utf8 usage with ENTITIES_HTML and UTF-8 This data contains special chars like <, >, & and " as well as ä, ö, ß, à and ê - + XML_Util::splitQualifiedName() basic tests --CREDITS-- Chuck Burgess <ashnazg@php.net> @@ -109364,7 +97871,7 @@ localPart => stylesheet TEST: basic usage with namespace namespace => myNs localPart => stylesheet - + XML_Util tests for Bug #4950 "Incorrect CDATA serializing" --CREDITS-- Chuck Burgess <ashnazg@php.net> @@ -109385,7 +97892,7 @@ echo XML_Util::createTag("test", array(), "Content ]]></test> here!", TEST: test case provided in bug report <test><![CDATA[Content ]]]]><![CDATA[></test> here!]]></test> - + XML_Util tests for Bug #5392 "encoding of ISO-8859-1 is the only supported encoding" --CREDITS-- Chuck Burgess <ashnazg@php.net> @@ -109412,7 +97919,69 @@ echo $reversed . PHP_EOL; TEST: test case provided in bug report This data contains special chars like <, >, & and " as well as ä, ö, ß, à and ê This data contains special chars like <, >, & and " as well as ä, ö, ß, à and ê - + +XML_Util tests for Bug #18343 Entities in file names decoded during packaging +--CREDITS-- +Chuck Burgess <ashnazg@php.net> +# created for v1.2.2a1 2014-06-03 +--FILE-- +<?php +require_once 'XML' . DIRECTORY_SEPARATOR . 'Util.php'; +echo '=====XML_Util tests for Bug #18343 "Entities in file names decoded during packaging"=====' . PHP_EOL . PHP_EOL; + +echo "TEST: test case provided in bug report" . PHP_EOL; +$array = array( + "qname" => "install", + "attributes" => array( + "as" => "Horde/Feed/fixtures/lexicon/http-p.moreover.com-cgi-local-page%2Fo=rss&s=Newsweek", + "name" => "test/Horde/Feed/fixtures/lexicon/http-p.moreover.com-cgi-local-page%2Fo=rss&s=Newsweek", + ) +); + +echo "No matter what flags are given to createTagFromArray(), an attribute must *always* be at least ENTITIES_XML encoded..." . PHP_EOL . PHP_EOL; + +$flags = array( + 'no flag' => null, + 'false' => false, + 'ENTITIES_NONE' => XML_UTIL_ENTITIES_NONE, + 'ENTITIES_XML' => XML_UTIL_ENTITIES_XML, + 'ENTITIES_XML_REQUIRED' => XML_UTIL_ENTITIES_XML_REQUIRED, + 'ENTITIES_HTML' => XML_UTIL_ENTITIES_HTML, + 'REPLACE_ENTITIES' => XML_UTIL_REPLACE_ENTITIES, +); +foreach ($flags as $flagKey => $flagValue) { + echo "Testing with $flagKey:" . PHP_EOL; + echo XML_Util::createTagFromArray($array, $flagValue) . PHP_EOL . PHP_EOL; +} +?> +--EXPECT-- +=====XML_Util tests for Bug #18343 "Entities in file names decoded during packaging"===== + +TEST: test case provided in bug report +No matter what flags are given to createTagFromArray(), an attribute must *always* be at least ENTITIES_XML encoded... + +Testing with no flag: +<install as="Horde/Feed/fixtures/lexicon/http-p.moreover.com-cgi-local-page%2Fo=rss&s=Newsweek" name="test/Horde/Feed/fixtures/lexicon/http-p.moreover.com-cgi-local-page%2Fo=rss&s=Newsweek" /> + +Testing with false: +<install as="Horde/Feed/fixtures/lexicon/http-p.moreover.com-cgi-local-page%2Fo=rss&s=Newsweek" name="test/Horde/Feed/fixtures/lexicon/http-p.moreover.com-cgi-local-page%2Fo=rss&s=Newsweek" /> + +Testing with ENTITIES_NONE: +<install as="Horde/Feed/fixtures/lexicon/http-p.moreover.com-cgi-local-page%2Fo=rss&s=Newsweek" name="test/Horde/Feed/fixtures/lexicon/http-p.moreover.com-cgi-local-page%2Fo=rss&s=Newsweek" /> + +Testing with ENTITIES_XML: +<install as="Horde/Feed/fixtures/lexicon/http-p.moreover.com-cgi-local-page%2Fo=rss&s=Newsweek" name="test/Horde/Feed/fixtures/lexicon/http-p.moreover.com-cgi-local-page%2Fo=rss&s=Newsweek" /> + +Testing with ENTITIES_XML_REQUIRED: +<install as="Horde/Feed/fixtures/lexicon/http-p.moreover.com-cgi-local-page%2Fo=rss&s=Newsweek" name="test/Horde/Feed/fixtures/lexicon/http-p.moreover.com-cgi-local-page%2Fo=rss&s=Newsweek" /> + +Testing with ENTITIES_HTML: +<install as="Horde/Feed/fixtures/lexicon/http-p.moreover.com-cgi-local-page%2Fo=rss&s=Newsweek" name="test/Horde/Feed/fixtures/lexicon/http-p.moreover.com-cgi-local-page%2Fo=rss&s=Newsweek" /> + +Testing with REPLACE_ENTITIES: +<install as="Horde/Feed/fixtures/lexicon/http-p.moreover.com-cgi-local-page%2Fo=rss&s=Newsweek" name="test/Horde/Feed/fixtures/lexicon/http-p.moreover.com-cgi-local-page%2Fo=rss&s=Newsweek" /> + + /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */ @@ -109420,7 +97989,7 @@ This data contains special chars like <, >, & and " as well as ä, ö, ß, à an * XML_Util * * XML Utilities package - * + * * PHP versions 4 and 5 * * LICENSE: @@ -109457,7 +98026,7 @@ This data contains special chars like <, >, & and " as well as ä, ö, ß, à an * @author Stephan Schmidt <schst@php.net> * @copyright 2003-2008 Stephan Schmidt <schst@php.net> * @license http://opensource.org/licenses/bsd-license New BSD License - * @version CVS: $Id: Util.php,v 1.38 2008/11/13 00:03:38 ashnazg Exp $ + * @version CVS: $Id$ * @link http://pear.php.net/package/XML_Util */ @@ -109533,7 +98102,7 @@ define('XML_UTIL_COLLAPSE_XHTML_ONLY', 2); * @author Stephan Schmidt <schst@php.net> * @copyright 2003-2008 Stephan Schmidt <schst@php.net> * @license http://opensource.org/licenses/bsd-license New BSD License - * @version Release: 1.2.1 + * @version Release: 1.2.3 * @link http://pear.php.net/package/XML_Util */ class XML_Util @@ -109575,11 +98144,11 @@ class XML_Util * ); * </code> * - * @param string $string string where XML special chars + * @param string $string string where XML special chars * should be replaced - * @param int $replaceEntities setting for entities in attribute values - * (one of XML_UTIL_ENTITIES_XML, - * XML_UTIL_ENTITIES_XML_REQUIRED, + * @param int $replaceEntities setting for entities in attribute values + * (one of XML_UTIL_ENTITIES_XML, + * XML_UTIL_ENTITIES_XML_REQUIRED, * XML_UTIL_ENTITIES_HTML) * @param string $encoding encoding value (if any)... * must be a valid encoding as determined @@ -109641,11 +98210,11 @@ class XML_Util * ); * </code> * - * @param string $string string where XML special chars + * @param string $string string where XML special chars * should be replaced - * @param int $replaceEntities setting for entities in attribute values - * (one of XML_UTIL_ENTITIES_XML, - * XML_UTIL_ENTITIES_XML_REQUIRED, + * @param int $replaceEntities setting for entities in attribute values + * (one of XML_UTIL_ENTITIES_XML, + * XML_UTIL_ENTITIES_XML_REQUIRED, * XML_UTIL_ENTITIES_HTML) * @param string $encoding encoding value (if any)... * must be a valid encoding as determined @@ -109700,7 +98269,7 @@ class XML_Util * @static * @uses attributesToString() to serialize the attributes of the XML declaration */ - function getXMLDeclaration($version = '1.0', $encoding = null, + function getXMLDeclaration($version = '1.0', $encoding = null, $standalone = null) { $attributes = array( @@ -109715,7 +98284,7 @@ class XML_Util $attributes['standalone'] = $standalone ? 'yes' : 'no'; } - return sprintf('<?xml%s?>', + return sprintf('<?xml%s?>', XML_Util::attributesToString($attributes, false)); } @@ -109730,7 +98299,7 @@ class XML_Util * </code> * * @param string $root name of the root tag - * @param string $uri uri of the doctype definition + * @param string $uri uri of the doctype definition * (or array with uri and public id) * @param string $internalDtd internal dtd entries * @@ -109772,20 +98341,20 @@ class XML_Util * </code> * * @param array $attributes attribute array - * @param bool|array $sort sort attribute list alphabetically, - * may also be an assoc array containing - * the keys 'sort', 'multiline', 'indent', + * @param bool|array $sort sort attribute list alphabetically, + * may also be an assoc array containing + * the keys 'sort', 'multiline', 'indent', * 'linebreak' and 'entities' - * @param bool $multiline use linebreaks, if more than + * @param bool $multiline use linebreaks, if more than * one attribute is given - * @param string $indent string used for indentation of + * @param string $indent string used for indentation of * multiline attributes - * @param string $linebreak string used for linebreaks of + * @param string $linebreak string used for linebreaks of * multiline attributes - * @param int $entities setting for entities in attribute values - * (one of XML_UTIL_ENTITIES_NONE, - * XML_UTIL_ENTITIES_XML, - * XML_UTIL_ENTITIES_XML_REQUIRED, + * @param int $entities setting for entities in attribute values + * (one of XML_UTIL_ENTITIES_NONE, + * XML_UTIL_ENTITIES_XML, + * XML_UTIL_ENTITIES_XML_REQUIRED, * XML_UTIL_ENTITIES_HTML) * * @return string string representation of the attributes @@ -109794,7 +98363,7 @@ class XML_Util * @uses replaceEntities() to replace XML entities in attribute values * @todo allow sort also to be an options array */ - function attributesToString($attributes, $sort = true, $multiline = false, + function attributesToString($attributes, $sort = true, $multiline = false, $indent = ' ', $linebreak = "\n", $entities = XML_UTIL_ENTITIES_XML) { /* @@ -109865,7 +98434,7 @@ class XML_Util * @todo PEAR CS - unable to avoid "space after open parens" error * in the IF branch */ - function collapseEmptyTags($xml, $mode = XML_UTIL_COLLAPSE_ALL) + function collapseEmptyTags($xml, $mode = XML_UTIL_COLLAPSE_ALL) { if ($mode == XML_UTIL_COLLAPSE_XHTML_ONLY) { return preg_replace( @@ -109888,9 +98457,9 @@ class XML_Util * require_once 'XML/Util.php'; * * // create an XML tag: - * $tag = XML_Util::createTag('myNs:myTag', - * array('foo' => 'bar'), - * 'This is inside the tag', + * $tag = XML_Util::createTag('myNs:myTag', + * array('foo' => 'bar'), + * 'This is inside the tag', * 'http://www.w3c.org/myNs#'); * </code> * @@ -109898,13 +98467,13 @@ class XML_Util * @param array $attributes array containg attributes * @param mixed $content the content * @param string $namespaceUri URI of the namespace - * @param int $replaceEntities whether to replace XML special chars in - * content, embedd it in a CData section + * @param int $replaceEntities whether to replace XML special chars in + * content, embedd it in a CData section * or none of both - * @param bool $multiline whether to create a multiline tag where + * @param bool $multiline whether to create a multiline tag where * each attribute gets written to a single line - * @param string $indent string used to indent attributes - * (_auto indents attributes so they start + * @param string $indent string used to indent attributes + * (_auto indents attributes so they start * at the same column) * @param string $linebreak string used for linebreaks * @param bool $sortAttributes Whether to sort the attributes or not @@ -109915,9 +98484,9 @@ class XML_Util * @see createTagFromArray() * @uses createTagFromArray() to create the tag */ - function createTag($qname, $attributes = array(), $content = null, - $namespaceUri = null, $replaceEntities = XML_UTIL_REPLACE_ENTITIES, - $multiline = false, $indent = '_auto', $linebreak = "\n", + function createTag($qname, $attributes = array(), $content = null, + $namespaceUri = null, $replaceEntities = XML_UTIL_REPLACE_ENTITIES, + $multiline = false, $indent = '_auto', $linebreak = "\n", $sortAttributes = true) { $tag = array( @@ -109935,7 +98504,7 @@ class XML_Util $tag['namespaceUri'] = $namespaceUri; } - return XML_Util::createTagFromArray($tag, $replaceEntities, $multiline, + return XML_Util::createTagFromArray($tag, $replaceEntities, $multiline, $indent, $linebreak, $sortAttributes); } @@ -109945,22 +98514,22 @@ class XML_Util * <pre> * array( * // qualified name of the tag - * 'qname' => $qname + * 'qname' => $qname * * // namespace prefix (optional, if qname is specified or no namespace) - * 'namespace' => $namespace + * 'namespace' => $namespace * * // local part of the tagname (optional, if qname is specified) - * 'localpart' => $localpart, + * 'localpart' => $localpart, * * // array containing all attributes (optional) - * 'attributes' => array(), + * 'attributes' => array(), * * // tag content (optional) - * 'content' => $content, + * 'content' => $content, * * // namespaceUri for the given namespace (optional) - * 'namespaceUri' => $namespaceUri + * 'namespaceUri' => $namespaceUri * ) * </pre> * @@ -109978,13 +98547,13 @@ class XML_Util * </code> * * @param array $tag tag definition - * @param int $replaceEntities whether to replace XML special chars in - * content, embedd it in a CData section + * @param int $replaceEntities whether to replace XML special chars in + * content, embedd it in a CData section * or none of both - * @param bool $multiline whether to create a multiline tag where each + * @param bool $multiline whether to create a multiline tag where each * attribute gets written to a single line - * @param string $indent string used to indent attributes - * (_auto indents attributes so they start + * @param string $indent string used to indent attributes + * (_auto indents attributes so they start * at the same column) * @param string $linebreak string used for linebreaks * @param bool $sortAttributes Whether to sort the attributes or not @@ -109999,7 +98568,7 @@ class XML_Util * @uses raiseError() */ function createTagFromArray($tag, $replaceEntities = XML_UTIL_REPLACE_ENTITIES, - $multiline = false, $indent = '_auto', $linebreak = "\n", + $multiline = false, $indent = '_auto', $linebreak = "\n", $sortAttributes = true) { if (isset($tag['content']) && !is_scalar($tag['content'])) { @@ -110009,7 +98578,7 @@ class XML_Util if (!isset($tag['qname']) && !isset($tag['localPart'])) { return XML_Util::raiseError('You must either supply a qualified name ' - . '(qname) or local tag name (localPart).', + . '(qname) or local tag name (localPart).', XML_UTIL_ERROR_NO_TAG_NAME); } @@ -110063,8 +98632,8 @@ class XML_Util } // create attribute list - $attList = XML_Util::attributesToString($tag['attributes'], - $sortAttributes, $multiline, $indent, $linebreak, $replaceEntities); + $attList = XML_Util::attributesToString($tag['attributes'], + $sortAttributes, $multiline, $indent, $linebreak); if (!isset($tag['content']) || (string)$tag['content'] == '') { $tag = sprintf('<%s%s />', $tag['qname'], $attList); } else { @@ -110075,7 +98644,7 @@ class XML_Util $tag['content'] = XML_Util::createCDataSection($tag['content']); break; default: - $tag['content'] = XML_Util::replaceEntities($tag['content'], + $tag['content'] = XML_Util::replaceEntities($tag['content'], $replaceEntities); break; } @@ -110092,14 +98661,14 @@ class XML_Util * require_once 'XML/Util.php'; * * // create an XML start element: - * $tag = XML_Util::createStartElement('myNs:myTag', + * $tag = XML_Util::createStartElement('myNs:myTag', * array('foo' => 'bar') ,'http://www.w3c.org/myNs#'); * </code> * * @param string $qname qualified tagname (including namespace) * @param array $attributes array containg attributes * @param string $namespaceUri URI of the namespace - * @param bool $multiline whether to create a multiline tag where each + * @param bool $multiline whether to create a multiline tag where each * attribute gets written to a single line * @param string $indent string used to indent attributes (_auto indents * attributes so they start at the same column) @@ -110112,7 +98681,7 @@ class XML_Util * @see createEndElement(), createTag() */ function createStartElement($qname, $attributes = array(), $namespaceUri = null, - $multiline = false, $indent = '_auto', $linebreak = "\n", + $multiline = false, $indent = '_auto', $linebreak = "\n", $sortAttributes = true) { // if no attributes hav been set, use empty attributes @@ -110142,7 +98711,7 @@ class XML_Util } // create attribute list - $attList = XML_Util::attributesToString($attributes, $sortAttributes, + $attList = XML_Util::attributesToString($attributes, $sortAttributes, $multiline, $indent, $linebreak); $element = sprintf('<%s%s>', $qname, $attList); return $element; @@ -110211,7 +98780,7 @@ class XML_Util */ function createCDataSection($data) { - return sprintf('<![CDATA[%s]]>', + return sprintf('<![CDATA[%s]]>', preg_replace('/\]\]>/', ']]]]><![CDATA[>', strval($data))); } @@ -110285,17 +98854,17 @@ class XML_Util function isValidName($string) { // check for invalid chars - if (!preg_match('/^[[:alpha:]_]$/', $string{0})) { + if (!preg_match('/^[[:alpha:]_]\\z/', $string{0})) { return XML_Util::raiseError('XML names may only start with letter ' . 'or underscore', XML_UTIL_ERROR_INVALID_START); } // check for invalid chars - if (!preg_match('/^([[:alpha:]_]([[:alnum:]\-\.]*)?:)?[[:alpha:]_]([[:alnum:]\_\-\.]+)?$/', + if (!preg_match('/^([[:alpha:]_]([[:alnum:]\-\.]*)?:)?[[:alpha:]_]([[:alnum:]\_\-\.]+)?\\z/', $string) ) { return XML_Util::raiseError('XML names may only contain alphanumeric ' - . 'chars, period, hyphen, colon and underscores', + . 'chars, period, hyphen, colon and underscores', XML_UTIL_ERROR_INVALID_CHARS); } // XML name is valid @@ -110323,11 +98892,4 @@ class XML_Util } } ?> - -Version: GnuPG v1.4.9 (GNU/Linux) - -iEYEABECAAYFAkk8e2QACgkQcqMhusJF8XULZgCg0iwVLWueraJzK5s1AesDkVzv -GucAn22sSv3QiTSUWG9BmakiW9hFsb4V -=g2mr ------END PGP SIGNATURE----- - + diff --git a/sapi/cgi/tests/bug61605.phpt b/sapi/cgi/tests/bug61605.phpt index c6e4cf20c..9c29e6dda 100644 --- a/sapi/cgi/tests/bug61605.phpt +++ b/sapi/cgi/tests/bug61605.phpt @@ -4,6 +4,8 @@ Bug #61605 (header_remove() does not remove all headers) <?php include "skipif.inc"; ?> --GET-- foo=bar +--INI-- +expose_php=On --FILE-- <?php header("A: first"); diff --git a/sapi/cli/php_cli_server.c b/sapi/cli/php_cli_server.c index 64cca0eb6..f333addaf 100644 --- a/sapi/cli/php_cli_server.c +++ b/sapi/cli/php_cli_server.c @@ -666,11 +666,10 @@ static int sapi_cli_server_send_headers(sapi_headers_struct *sapi_headers TSRMLS h = (sapi_header_struct*)zend_llist_get_first_ex(&sapi_headers->headers, &pos); while (h) { - if (!h->header_len) { - continue; + if (h->header_len) { + smart_str_appendl(&buffer, h->header, h->header_len); + smart_str_appendl(&buffer, "\r\n", 2); } - smart_str_appendl(&buffer, h->header, h->header_len); - smart_str_appendl(&buffer, "\r\n", 2); h = (sapi_header_struct*)zend_llist_get_next_ex(&sapi_headers->headers, &pos); } smart_str_appendl(&buffer, "\r\n", 2); @@ -1686,10 +1685,14 @@ static int php_cli_server_client_read_request_on_header_value(php_http_parser *p return 1; } { - char *header_name = zend_str_tolower_dup(client->current_header_name, client->current_header_name_len); - zend_hash_add(&client->request.headers, header_name, client->current_header_name_len + 1, &value, sizeof(char *), NULL); - zend_hash_add(&client->request.headers_original_case, client->current_header_name, client->current_header_name_len + 1, &value, sizeof(char *), NULL); - efree(header_name); + /* strip off the colon */ + char *orig_header_name = estrndup(client->current_header_name, client->current_header_name_len); + char *lc_header_name = zend_str_tolower_dup(client->current_header_name, client->current_header_name_len); + + zend_hash_add(&client->request.headers, lc_header_name, client->current_header_name_len + 1, &value, sizeof(char *), NULL); + zend_hash_add(&client->request.headers_original_case, orig_header_name, client->current_header_name_len + 1, &value, sizeof(char *), NULL); + efree(lc_header_name); + efree(orig_header_name); } if (client->current_header_name_allocated) { diff --git a/sapi/cli/tests/bug66830.phpt b/sapi/cli/tests/bug66830.phpt new file mode 100644 index 000000000..58c07e031 --- /dev/null +++ b/sapi/cli/tests/bug66830.phpt @@ -0,0 +1,43 @@ +--TEST-- +Bug #66830 (Empty header causes PHP built-in web server to hang) +--SKIPIF-- +<?php +include "skipif.inc"; +?> +--FILE-- +<?php +include "php_cli_server.inc"; +php_cli_server_start(<<<'PHP' +header(' '); +PHP +); + +list($host, $port) = explode(':', PHP_CLI_SERVER_ADDRESS); +$port = intval($port)?:80; + +$fp = fsockopen($host, $port, $errno, $errstr, 0.5); +if (!$fp) { + die("connect failed"); +} + +if(fwrite($fp, <<<HEADER +GET / HTTP/1.1 +Host: {$host} + + +HEADER +)) { + while (!feof($fp)) { + echo fgets($fp); + } +} + +fclose($fp); +?> +--EXPECTF-- +HTTP/1.1 200 OK +Host: %s +Connection: close +X-Powered-By: %s +Content-type: text/html; charset=UTF-8 + diff --git a/sapi/fpm/config.m4 b/sapi/fpm/config.m4 index 40cd69c71..9c10aa6be 100644 --- a/sapi/fpm/config.m4 +++ b/sapi/fpm/config.m4 @@ -584,14 +584,41 @@ if test "$PHP_FPM" != "no"; then [ --with-fpm-systemd Activate systemd integration], no, no) if test "$PHP_FPM_SYSTEMD" != "no" ; then - AC_CHECK_LIB(systemd-daemon, sd_notify, SYSTEMD_LIBS="-lsystemd-daemon") + if test -z "$PKG_CONFIG"; then + AC_PATH_PROG(PKG_CONFIG, pkg-config, no) + fi + unset SYSTEMD_LIBS + unset SYSTEMD_INCS + + if test -x "$PKG_CONFIG" && $PKG_CONFIG --exists libsystemd; then + dnl systemd version >= 209 provides libsystemd + AC_MSG_CHECKING([for libsystemd]) + SYSTEMD_LIBS=`$PKG_CONFIG --libs libsystemd` + SYSTEMD_INCS=`$PKG_CONFIG --cflags-only-I libsystemd` + SYSTEMD_VERS=`$PKG_CONFIG --modversion libsystemd` + AC_MSG_RESULT([version $SYSTEMD_VERS]) + + elif test -x "$PKG_CONFIG" && $PKG_CONFIG --exists libsystemd-daemon; then + dnl systemd version < 209 provides libsystemd-daemon + AC_MSG_CHECKING([for libsystemd-daemon]) + SYSTEMD_LIBS=`$PKG_CONFIG --libs libsystemd-daemon` + SYSTEMD_INCS=`$PKG_CONFIG --cflags-only-I libsystemd-daemon` + SYSTEMD_VERS=`$PKG_CONFIG --modversion libsystemd-daemon` + AC_MSG_RESULT([version $SYSTEMD_VERS]) + + else + dnl failback when no pkg-config + AC_CHECK_LIB(systemd-daemon, sd_notify, SYSTEMD_LIBS="-lsystemd-daemon") + fi + AC_CHECK_HEADERS(systemd/sd-daemon.h, [HAVE_SD_DAEMON_H="yes"], [HAVE_SD_DAEMON_H="no"]) if test $HAVE_SD_DAEMON_H = "no" || test -z "${SYSTEMD_LIBS}"; then AC_MSG_ERROR([Your system does not support systemd.]) else AC_DEFINE(HAVE_SYSTEMD, 1, [FPM use systemd integration]) PHP_FPM_SD_FILES="fpm/fpm_systemd.c" - PHP_ADD_LIBRARY(systemd-daemon) + PHP_EVAL_LIBLINE($SYSTEMD_LIBS) + PHP_EVAL_INCLINE($SYSTEMD_INCS) php_fpm_systemd=notify fi else diff --git a/sapi/fpm/fpm/fpm_stdio.c b/sapi/fpm/fpm/fpm_stdio.c index 33b0e01c8..fcec78435 100644 --- a/sapi/fpm/fpm/fpm_stdio.c +++ b/sapi/fpm/fpm/fpm_stdio.c @@ -268,7 +268,11 @@ int fpm_stdio_open_error_log(int reopen) /* {{{ */ if (!strcasecmp(fpm_global_config.error_log, "syslog")) { openlog(fpm_global_config.syslog_ident, LOG_PID | LOG_CONS, fpm_global_config.syslog_facility); fpm_globals.error_log_fd = ZLOG_SYSLOG; +#if HAVE_UNISTD_H + if (fpm_global_config.daemonize || (!isatty(STDERR_FILENO) && !fpm_globals.force_stderr)) { +#else if (fpm_global_config.daemonize) { +#endif zlog_set_fd(fpm_globals.error_log_fd); } return 0; diff --git a/sapi/litespeed/lsapi_main.c b/sapi/litespeed/lsapi_main.c index 34ae751b2..3413a423a 100644 --- a/sapi/litespeed/lsapi_main.c +++ b/sapi/litespeed/lsapi_main.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2007 The PHP Group | + | Copyright (c) 1997-2014 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 | @@ -16,8 +16,6 @@ +----------------------------------------------------------------------+ */ -/* $Id: lsapi_main.c,v 1.57 2013/08/23 14:50:25 gwang Exp $ */ - #include "php.h" #include "SAPI.h" #include "php_main.h" @@ -372,7 +370,7 @@ static void sapi_lsapi_log_message(char *message TSRMLS_DC) static sapi_module_struct lsapi_sapi_module = { "litespeed", - "LiteSpeed V6.4", + "LiteSpeed V6.6", php_lsapi_startup, /* startup */ php_module_shutdown_wrapper, /* shutdown */ @@ -737,9 +735,9 @@ static int cli_main( int argc, char * argv[] ) case 'v': if (php_request_startup(TSRMLS_C) != FAILURE) { #if ZEND_DEBUG - php_printf("PHP %s (%s) (built: %s %s) (DEBUG)\nCopyright (c) 1997-2004 The PHP Group\n%s", PHP_VERSION, sapi_module.name, __DATE__, __TIME__, get_zend_version()); + php_printf("PHP %s (%s) (built: %s %s) (DEBUG)\nCopyright (c) 1997-2014 The PHP Group\n%s", PHP_VERSION, sapi_module.name, __DATE__, __TIME__, get_zend_version()); #else - php_printf("PHP %s (%s) (built: %s %s)\nCopyright (c) 1997-2004 The PHP Group\n%s", PHP_VERSION, sapi_module.name, __DATE__, __TIME__, get_zend_version()); + php_printf("PHP %s (%s) (built: %s %s)\nCopyright (c) 1997-2014 The PHP Group\n%s", PHP_VERSION, sapi_module.name, __DATE__, __TIME__, get_zend_version()); #endif #ifdef PHP_OUTPUT_NEWAPI php_output_end_all(TSRMLS_C); diff --git a/sapi/litespeed/lsapidef.h b/sapi/litespeed/lsapidef.h index 5d5b4c168..fb75d01a1 100644 --- a/sapi/litespeed/lsapidef.h +++ b/sapi/litespeed/lsapidef.h @@ -1,5 +1,23 @@ /* -Copyright (c) 2005, Lite Speed Technologies Inc. + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | Copyright (c) 1997-2014 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 at 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: George Wang <gwang@litespeedtech.com> | + +----------------------------------------------------------------------+ +*/ + +/* +Copyright (c) 2002-2014, Lite Speed Technologies Inc. All rights reserved. Redistribution and use in source and binary forms, with or without @@ -30,13 +48,6 @@ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -/*************************************************************************** - $Id: lsapidef.h,v 1.17 2012/12/01 19:23:31 gwang Exp $ - ------------------- - begin : Thu Feb 10 2005 - author : George Wang - email : gwang@litespeedtech.com - ***************************************************************************/ #ifndef _LSAPIDEF_H_ #define _LSAPIDEF_H_ diff --git a/sapi/litespeed/lsapilib.c b/sapi/litespeed/lsapilib.c index 4a9affc60..786a3bd20 100644 --- a/sapi/litespeed/lsapilib.c +++ b/sapi/litespeed/lsapilib.c @@ -1,5 +1,23 @@ /* -Copyright (c) 2013, Lite Speed Technologies Inc. + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | Copyright (c) 1997-2014 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 at 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: George Wang <gwang@litespeedtech.com> | + +----------------------------------------------------------------------+ +*/ + +/* +Copyright (c) 2002-2014, Lite Speed Technologies Inc. All rights reserved. Redistribution and use in source and binary forms, with or without @@ -30,14 +48,6 @@ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -/*************************************************************************** - lsapilib.c - description - ------------------- - begin : Mon Feb 21 2005 - copyright : (C) 2005 by George Wang - email : gwang@litespeedtech.com - ***************************************************************************/ - #include <ctype.h> #include <dlfcn.h> @@ -1211,6 +1221,7 @@ int LSAPI_IsRunning(void) int LSAPI_InitRequest( LSAPI_Request * pReq, int fd ) { + int newfd; if ( !pReq ) return -1; memset( pReq, 0, sizeof( LSAPI_Request ) ); @@ -1224,7 +1235,14 @@ int LSAPI_InitRequest( LSAPI_Request * pReq, int fd ) pReq->m_respPktHeaderEnd = &pReq->m_respPktHeader[5]; if ( allocateRespHeaderBuf( pReq, LSAPI_INIT_RESP_HEADER_LEN ) == -1 ) return -1; - + + if ( fd == STDIN_FILENO ) + { + fd = dup( fd ); + newfd = open( "/dev/null", O_RDWR ); + dup2( newfd, STDIN_FILENO ); + } + if ( isPipe( fd ) ) { pReq->m_fdListen = -1; @@ -1927,6 +1945,7 @@ int LSAPI_ForeachOrgHeader_r( LSAPI_Request * pReq, { pKey = pReq->m_pHttpHeader + pCur->nameOff; keyLen = pCur->nameLen; + *(pKey + keyLen ) = 0; pValue = pReq->m_pHttpHeader + pCur->valueOff; *(pValue + pCur->valueLen ) = 0; @@ -2386,6 +2405,8 @@ typedef struct _lsapi_prefork_server int m_iAvoidFork; lsapi_child_status * m_pChildrenStatus; + lsapi_child_status * m_pChildrenStatusCur; + lsapi_child_status * m_pChildrenStatusEnd; }lsapi_prefork_server; @@ -2474,11 +2495,15 @@ static void lsapi_cleanup(int signal) static lsapi_child_status * find_child_status( int pid ) { lsapi_child_status * pStatus = g_prefork_server->m_pChildrenStatus; - lsapi_child_status * pEnd = g_prefork_server->m_pChildrenStatus + g_prefork_server->m_iMaxChildren * 2; + lsapi_child_status * pEnd = g_prefork_server->m_pChildrenStatusEnd; while( pStatus < pEnd ) { if ( pStatus->m_pid == pid ) + { + if ( pStatus + 1 > g_prefork_server->m_pChildrenStatusCur ) + g_prefork_server->m_pChildrenStatusCur = pStatus + 1; return pStatus; + } ++pStatus; } return NULL; @@ -2513,8 +2538,12 @@ static void lsapi_sigchild( int signal ) { child_status->m_pid = 0; --g_prefork_server->m_iCurChildren; + } } + while(( g_prefork_server->m_pChildrenStatusCur > g_prefork_server->m_pChildrenStatus ) + &&( g_prefork_server->m_pChildrenStatusCur[-1].m_pid == 0 )) + --g_prefork_server->m_pChildrenStatusCur; } @@ -2523,7 +2552,7 @@ static int lsapi_init_children_status() int size = 4096; char * pBuf; - size = g_prefork_server->m_iMaxChildren * sizeof( lsapi_child_status ) * 2; + size = (g_prefork_server->m_iMaxChildren + g_prefork_server->m_iExtraChildren ) * sizeof( lsapi_child_status ) * 2; size = (size + 4095 ) / 4096 * 4096; pBuf =( char*) mmap( NULL, size, PROT_READ | PROT_WRITE, MAP_ANON | MAP_SHARED, -1, 0 ); @@ -2533,7 +2562,9 @@ static int lsapi_init_children_status() return -1; } memset( pBuf, 0, size ); - g_prefork_server->m_pChildrenStatus = (lsapi_child_status *)pBuf; + g_prefork_server->m_pChildrenStatus = (lsapi_child_status *)pBuf; + g_prefork_server->m_pChildrenStatusCur = (lsapi_child_status *)pBuf; + g_prefork_server->m_pChildrenStatusEnd = (lsapi_child_status *)pBuf + size / sizeof( lsapi_child_status ); return 0; } @@ -2563,7 +2594,7 @@ static void lsapi_check_child_status( long tmCur ) int dying = 0; int count = 0; lsapi_child_status * pStatus = g_prefork_server->m_pChildrenStatus; - lsapi_child_status * pEnd = g_prefork_server->m_pChildrenStatus + g_prefork_server->m_iMaxChildren * 2; + lsapi_child_status * pEnd = g_prefork_server->m_pChildrenStatusCur; while( pStatus < pEnd ) { tobekilled = 0; @@ -2576,13 +2607,15 @@ static void lsapi_check_child_status( long tmCur ) if (( g_prefork_server->m_iCurChildren - dying > g_prefork_server->m_iMaxChildren)|| ( idle > g_prefork_server->m_iMaxIdleChildren )) { - tobekilled = SIGUSR1; + ++pStatus->m_iKillSent; + //tobekilled = SIGUSR1; } else { if (( s_max_idle_secs> 0)&&(tmCur - pStatus->m_tmWaitBegin > s_max_idle_secs + 5 )) { - tobekilled = SIGUSR1; + ++pStatus->m_iKillSent; + //tobekilled = SIGUSR1; } } if ( !tobekilled ) @@ -2716,6 +2749,8 @@ static int lsapi_prefork_server_accept( lsapi_prefork_server * pServer, LSAPI_Re if ( pServer->m_iCurChildren >= (pServer->m_iMaxChildren + pServer->m_iExtraChildren ) ) { + fprintf( stderr, "Reached max children process limit: %d, extra: %d, current: %d, please increase LSAPI_CHILDREN.\n", + pServer->m_iMaxChildren, pServer->m_iExtraChildren, pServer->m_iCurChildren ); usleep( 100000 ); continue; } @@ -2822,8 +2857,8 @@ static int lsapi_prefork_server_accept( lsapi_prefork_server * pServer, LSAPI_Re } } sigaction( SIGUSR1, &old_usr1, 0 ); - kill( -getpgrp(), SIGUSR1 ); - lsapi_all_children_must_die(); /* Sorry, children ;-) */ + //kill( -getpgrp(), SIGUSR1 ); + //lsapi_all_children_must_die(); /* Sorry, children ;-) */ return -1; } @@ -2876,7 +2911,7 @@ int LSAPI_Prefork_Accept_r( LSAPI_Request * pReq ) { if ( !g_running ) return -1; - if (( s_pChildStatus )&&( s_pChildStatus->m_iKillSent )) + if ((s_req_processed)&&( s_pChildStatus )&&( s_pChildStatus->m_iKillSent )) return -1; FD_ZERO( &readfds ); FD_SET( fd, &readfds ); @@ -2904,7 +2939,7 @@ int LSAPI_Prefork_Accept_r( LSAPI_Request * pReq ) } else if ( ret >= 1 ) { - if (( s_pChildStatus )&&( s_pChildStatus->m_iKillSent )) + if (s_req_processed && ( s_pChildStatus )&&( s_pChildStatus->m_iKillSent )) return -1; if ( fd == pReq->m_fdListen ) { @@ -3066,6 +3101,8 @@ static int lsapi_initSuEXEC() { if ( g_prefork_server->m_iMaxChildren < 100 ) g_prefork_server->m_iMaxChildren = 100; + if ( g_prefork_server->m_iExtraChildren < 1000 ) + g_prefork_server->m_iExtraChildren = 1000; } } if ( !s_defaultUid || !s_defaultGid ) diff --git a/sapi/litespeed/lsapilib.h b/sapi/litespeed/lsapilib.h index b0638fd43..cae1863c7 100644 --- a/sapi/litespeed/lsapilib.h +++ b/sapi/litespeed/lsapilib.h @@ -1,5 +1,23 @@ /* -Copyright (c) 2013, Lite Speed Technologies Inc. + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | Copyright (c) 1997-2014 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 at 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: George Wang <gwang@litespeedtech.com> | + +----------------------------------------------------------------------+ +*/ + +/* +Copyright (c) 2002-2014, Lite Speed Technologies Inc. All rights reserved. Redistribution and use in source and binary forms, with or without @@ -30,14 +48,6 @@ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -/*************************************************************************** - lsapilib.h - description - ------------------- - begin : Mon Feb 21 2005 - copyright : (C) 2005 by George Wang - email : gwang@litespeedtech.com - ***************************************************************************/ - #ifndef _LSAPILIB_H_ #define _LSAPILIB_H_ diff --git a/sapi/phpdbg/Makefile.frag b/sapi/phpdbg/Makefile.frag index b276aaaa5..36c7512d6 100644 --- a/sapi/phpdbg/Makefile.frag +++ b/sapi/phpdbg/Makefile.frag @@ -28,7 +28,7 @@ install-phpdbg: $(BUILD_BINARY) @$(INSTALL) -m 0755 $(BUILD_BINARY) $(INSTALL_ROOT)$(bindir)/$(program_prefix)phpdbg$(program_suffix)$(EXEEXT) @echo "Installing phpdbg man page: $(INSTALL_ROOT)$(mandir)/man1/" @$(mkinstalldirs) $(INSTALL_ROOT)$(mandir)/man1 - @$(INSTALL_DATA) sapi/phpdbg/phpdbg.1 $(INSTALL_ROOT)$(mandir)/man1/$(program_prefix)phpdbg$(program_suffix).1 + @$(INSTALL_DATA) $(srcdir)/phpdbg.1 $(INSTALL_ROOT)$(mandir)/man1/$(program_prefix)phpdbg$(program_suffix).1 clean-phpdbg: @echo "Cleaning phpdbg object files ..." diff --git a/sapi/phpdbg/phpdbg.c b/sapi/phpdbg/phpdbg.c index 93fdbd742..1fbd18a42 100644 --- a/sapi/phpdbg/phpdbg.c +++ b/sapi/phpdbg/phpdbg.c @@ -856,7 +856,8 @@ int phpdbg_open_sockets(char *address, int port[2], int (*listen)[2], int (*sock return SUCCESS; } /* }}} */ -void phpdbg_signal_handler(int sig, siginfo_t *info, void *context) { +void phpdbg_signal_handler(int sig, siginfo_t *info, void *context) /* {{{ */ +{ int is_handled = FAILURE; TSRMLS_FETCH(); @@ -874,10 +875,11 @@ void phpdbg_signal_handler(int sig, siginfo_t *info, void *context) { break; } -} +} /* }}} */ #endif -static inline zend_mm_heap *phpdbg_mm_get_heap() { +static inline zend_mm_heap *phpdbg_mm_get_heap() /* {{{ */ +{ zend_mm_heap *mm_heap; TSRMLS_FETCH(); @@ -886,22 +888,22 @@ static inline zend_mm_heap *phpdbg_mm_get_heap() { zend_mm_set_heap(mm_heap TSRMLS_CC); return mm_heap; -} +} /* }}} */ -void *phpdbg_malloc_wrapper(size_t size) +void *phpdbg_malloc_wrapper(size_t size) /* {{{ */ { return zend_mm_alloc(phpdbg_mm_get_heap(), size); -} +} /* }}} */ -void phpdbg_free_wrapper(void *p) +void phpdbg_free_wrapper(void *p) /* {{{ */ { zend_mm_free(phpdbg_mm_get_heap(), p); -} +} /* }}} */ -void *phpdbg_realloc_wrapper(void *ptr, size_t size) +void *phpdbg_realloc_wrapper(void *ptr, size_t size) /* {{{ */ { return zend_mm_realloc(phpdbg_mm_get_heap(), ptr, size); -} +} /* }}} */ int main(int argc, char **argv) /* {{{ */ { diff --git a/tests/basic/025.phpt b/tests/basic/025.phpt index 58191bcd6..37561a2a2 100644 --- a/tests/basic/025.phpt +++ b/tests/basic/025.phpt @@ -3,6 +3,7 @@ Test HTTP_RAW_POST_DATA with excessive post length --INI-- always_populate_raw_post_data=1 post_max_size=1K +expose_php=On --POST-- a=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --FILE-- diff --git a/travis/compile.sh b/travis/compile.sh index babb945a0..52748c6db 100755 --- a/travis/compile.sh +++ b/travis/compile.sh @@ -49,5 +49,12 @@ $TS \ --with-openssl \ --with-gmp \ --enable-bcmath \ ---enable-phpdbg +--enable-phpdbg \ +--enable-calendar \ +--enable-ftp \ +--with-pspell=/usr \ +--with-recode=/usr \ +--with-enchant=/usr \ +--enable-wddx \ +--enable-sysvmsg make --quiet diff --git a/travis/de b/travis/de new file mode 100644 index 000000000..ae49d969e --- /dev/null +++ b/travis/de @@ -0,0 +1,2 @@ +de_DE.UTF-8 UTF-8 +de_DE ISO-8859-1 diff --git a/win32/build/Makefile b/win32/build/Makefile index 057b58454..7a3be93e8 100644 --- a/win32/build/Makefile +++ b/win32/build/Makefile @@ -183,7 +183,7 @@ msi-installer: dist # need to redirect, since INSTALL is a file in the root... install: really-install install-sdk -build-lib: +build-lib: build-ext-libs @if not exist $(BUILD_DIR_DEV)\lib mkdir $(BUILD_DIR_DEV)\lib >nul @copy $(BUILD_DIR)\$(PHPLIB) $(BUILD_DIR_DEV)\lib /y >nul diff --git a/win32/build/Makefile.phpize b/win32/build/Makefile.phpize index 17cfc90fb..1f92f7716 100644 --- a/win32/build/Makefile.phpize +++ b/win32/build/Makefile.phpize @@ -5,10 +5,8 @@ MT="$(MT)" PHPSDK_DIR=$(PHP_DIR)
PHPLIB=$(PHPSDK_DIR)\lib\$(PHPLIB)
-LDFLAGS=/libpath:"$(PHPSDK_DIR)\lib\;$(PHPSDK_DIR)"
-
-CFLAGS=/nologo /FD $(BASE_INCLUDES) /D _WINDOWS /D ZEND_WIN32=1 /D PHP_WIN32=1 /D WIN32 /D_USE_32BIT_TIME_T=1 /D ZEND_WIN32_FORCE_INLINE /GF /D ZEND_DEBUG=0 /D ZTS=1 /D FD_SETSIZE=256
-CFLAGS_PHP=/D _USRDLL /D PHP5DLLTS_EXPORTS /D PHP_EXPORTS /D TSRM_EXPORTS /D SAPI_EXPORTS /D WINVER=0x500 /D COMPILE_DL_AJAXMIN
+LDFLAGS=$(LDFLAGS) /libpath:"$(PHPSDK_DIR)\lib\;$(PHPSDK_DIR)"
+BUILD_DIR_DEV=$(PHPSDK_DIR)
all: $(EXT_TARGETS) $(PECL_TARGETS)
@@ -36,3 +34,5 @@ _VC_MANIFEST_EMBED_EXE= if exist $@.manifest $(MT) -nologo -manifest $@.manifest _VC_MANIFEST_EMBED_DLL= if exist $@.manifest $(MT) -nologo -manifest $@.manifest -outputresource:$@;2
!endif
+install: build-headers build-bins
+
diff --git a/win32/build/config.w32 b/win32/build/config.w32 index 3fe8469a9..564cea2dc 100644 --- a/win32/build/config.w32 +++ b/win32/build/config.w32 @@ -474,5 +474,7 @@ if (PHP_ANALYZER == "vs") { pvscfg.WriteLine("preprocessor = visualcpp"); pvscfg.WriteLine("language = C"); } +} else { + PHP_ANALYZER = "no" } diff --git a/win32/build/config.w32.phpize.in b/win32/build/config.w32.phpize.in index 7b3b40633..cfec2a28f 100644 --- a/win32/build/config.w32.phpize.in +++ b/win32/build/config.w32.phpize.in @@ -105,6 +105,11 @@ if (PHP_DEBUG == "yes" && PHP_DEBUG_PACK == "yes") { ERROR("Use of both --enable-debug and --enable-debug-pack not allowed.");
}
+if (PHP_PREFIX == '') {
+ PHP_PREFIX = "C:\\php";
+ if (PHP_DEBUG == "yes")
+ PHP_PREFIX += "\\debug";
+}
DEFINE('PHP_PREFIX', PHP_PREFIX);
DEFINE("BASE_INCLUDES", "/I " + PHP_DIR + "/include /I " + PHP_DIR + "/include/main /I " + PHP_DIR + "/include/Zend /I " + PHP_DIR + "/include/TSRM /I " + PHP_DIR + "/include/ext ");
diff --git a/win32/build/confutils.js b/win32/build/confutils.js index 1dbc75b28..489adf34a 100644 --- a/win32/build/confutils.js +++ b/win32/build/confutils.js @@ -1024,6 +1024,11 @@ function is_pgo_desired(mod) {
var varname = "PHP_" + mod.toUpperCase() + "_PGO";
+ /* XXX enable PGO in phpize mode */
+ if (MODE_PHPIZE) {
+ return false;
+ }
+
/* don't disable if there's no mention of the varname */
if (eval("typeof " + varname + " == 'undefined'")) {
return true;
@@ -1165,11 +1170,6 @@ function ADD_EXTENSION_DEP(extname, dependson, optional) var dep_present = false;
var dep_shared = false;
- if (MODE_PHPIZE) {
- ext_deps_js = file_get_contents(PHP_DIR + "\\script\\ext_deps.js");
- eval(ext_deps_js);
- }
-
try {
dep_present = eval("PHP_" + DEP);
@@ -1203,9 +1203,14 @@ function ADD_EXTENSION_DEP(extname, dependson, optional) ERROR("static " + extname + " cannot depend on shared " + dependson);
}
- ADD_FLAG("LDFLAGS_" + EXT, "/libpath:$(BUILD_DIR)");
ADD_FLAG("LIBS_" + EXT, "php_" + dependson + ".lib");
- ADD_FLAG("DEPS_" + EXT, "$(BUILD_DIR)\\php_" + dependson + ".lib");
+ if (MODE_PHPIZE) {
+ ADD_FLAG("LDFLAGS_" + EXT, "/libpath:$(BUILD_DIR_DEV)\\lib");
+ ADD_FLAG("DEPS_" + EXT, "$(BUILD_DIR_DEV)\\lib\\php_" + dependson + ".lib");
+ } else {
+ ADD_FLAG("LDFLAGS_" + EXT, "/libpath:$(BUILD_DIR)");
+ ADD_FLAG("DEPS_" + EXT, "$(BUILD_DIR)\\php_" + dependson + ".lib");
+ }
} else {
@@ -1356,6 +1361,9 @@ function EXTENSION(extname, file_list, shared, cflags, dllname, obj_dir) DEFINE('CFLAGS_' + EXT + '_OBJ', '$(CFLAGS_PHP) $(CFLAGS_' + EXT + ')');
}
+ if (MODE_PHPIZE && FSO.FileExists(PHP_DIR + "/include/main/config.pickle.h")) {
+ cflags = "/FI main/config.pickle.h " + cflags;
+ }
ADD_FLAG("CFLAGS_" + EXT, cflags);
if (PHP_DSP != "no") {
@@ -1520,7 +1528,7 @@ function output_as_table(header, ar_out) var min = new Array(l);
var max = new Array(l);
- if (l != ar_out[0].length) {
+ if (!!ar_out[0] && l != ar_out[0].length) {
STDOUT.WriteLine("Invalid header argument, can't output the table " + l + " " + ar_out[0].length );
return;
}
@@ -1672,6 +1680,9 @@ function generate_files() generate_internal_functions();
generate_config_h();
generate_phpize();
+ } else {
+ generate_config_pickle_h();
+ generate_ext_pickle();
}
STDOUT.WriteLine("Done.");
STDOUT.WriteBlankLines(1);
@@ -1684,6 +1695,140 @@ function generate_files() }
}
+function generate_ext_pickle()
+{
+ var content;
+ var DEPS = null;
+ var dest;
+ var deps_lines = new Array();
+
+ var build_var_name = function(name) {
+ return "PHP_" + name.toUpperCase();
+ }
+
+ STDOUT.WriteLine("Generating pickle deps");
+ dest = PHP_DIR + "/script/";
+
+ if (!FSO.FolderExists(dest)) {
+ FSO.CreateFolder(dest);
+ }
+
+ if (FSO.FileExists(dest + "/ext_pickle.js")) {
+ DEPS = FSO.OpenTextFile(dest + "/ext_pickle.js", 1);
+
+ while (!DEPS.AtEndOfStream) {
+ var ln = DEPS.ReadLine();
+ var found = false;
+
+ for (var i in extensions_enabled) {
+ var reg0 = new RegExp(build_var_name(extensions_enabled[i][0]) + "\s*=.+", "g");
+ var reg1 = new RegExp(build_var_name(extensions_enabled[i][0]) + "_SHARED" + "\s*=.+", "g");
+
+ if (ln.match(reg1) || ln.match(reg0)) {
+ found = true;
+ break;
+ }
+ }
+
+ if (!found) {
+ deps_lines.push(ln);
+ }
+ }
+ }
+
+ for (var i in extensions_enabled) {
+ deps_lines.push(build_var_name(extensions_enabled[i][0]) + "=true;");
+ deps_lines.push(build_var_name(extensions_enabled[i][0]) + "_SHARED=" + (extensions_enabled[i][1] == 'shared' ? 'true' : 'false') + ";");
+ }
+
+ if (!!DEPS) {
+ DEPS.Close();
+ DEPS = null;
+ }
+
+ /* Replace the ext_pickle.js with the new content */
+ DEPS = FSO.CreateTextFile(dest + "/ext_pickle.js", true);
+
+ for (var j in deps_lines) {
+ DEPS.WriteLine(deps_lines[j]);
+ }
+
+ DEPS.Close();
+}
+
+function generate_config_pickle_h()
+{
+ var outfile = null;
+ var lines = new Array();
+ var keys = (new VBArray(configure_hdr.Keys())).toArray();
+ dest = PHP_DIR + "/include/main";
+
+ var ignore_key = function(key) {
+ var ignores = [ "CONFIGURE_COMMAND", "PHP_COMPILER_ID", "COMPILER", "ARCHITECTURE", "HAVE_STRNLEN", "PHP_DIR" ];
+
+ for (var k in ignores) {
+ if (ignores[k] == key) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+
+ STDOUT.WriteLine("Generating main/config.pickle.h");
+
+ if (FSO.FileExists(dest + "/config.pickle.h")) {
+ outfile = FSO.OpenTextFile(dest + "/config.pickle.h", 1);
+
+ while (!outfile.AtEndOfStream) {
+ var found = false;
+ var ln = outfile.ReadLine();
+
+ for (var i in keys) {
+ var reg = new RegExp("#define[\s ]+" + keys[i] + "[\s ]*.*", "g");
+
+ if (ln.match(reg)) {
+ found = true;
+ break;
+ }
+ }
+
+ if (!found) {
+ lines.push(ln);
+ }
+ }
+ }
+
+ for (var i in keys) {
+ var item = configure_hdr.Item(keys[i]);
+
+ if (ignore_key(keys[i])) {
+ continue;
+ }
+
+ /* XXX fix comment handling */
+ /*if (!lines[j].match(/^#define.+/g)) {
+ continue;
+ }*/
+
+ lines.push("#define " + keys[i] + " " + item[0]);
+ }
+
+ if (outfile) {
+ outfile.Close();
+ outfile = null;
+ }
+
+ outfile = FSO.CreateTextFile(dest + "/config.pickle.h", true);
+
+ for (var k in lines) {
+ outfile.WriteLine(lines[k]);
+ }
+
+ outfile.Close();
+}
+
function generate_config_h()
{
var infile, outfile;
@@ -1757,6 +1902,7 @@ function generate_phpize() var MF = FSO.CreateTextFile(dest + "/phpize.js", true);
var DEPS = FSO.CreateTextFile(dest + "/ext_deps.js", true);
+
prefix = get_define("PHP_PREFIX");
prefix = prefix.replace(new RegExp("/", "g"), "\\");
prefix = prefix.replace(new RegExp("\\\\", "g"), "\\\\");
@@ -1836,13 +1982,38 @@ function generate_makefile() }
}
MF.WriteLine(" @for %D in ($(INSTALL_HEADERS_DIR)) do @copy %D*.h $(BUILD_DIR_DEV)\\include\\%D /y >nul");
+ if (MODE_PHPIZE) {
+ MF.WriteBlankLines(1);
+ MF.WriteLine("build-bins:");
+ for (var i in extensions_enabled) {
+ var lib = "php_" + extensions_enabled[i][0] + ".lib";
+ var dll = "php_" + extensions_enabled[i][0] + ".dll";
+ MF.WriteLine(" @copy $(BUILD_DIR)\\" + lib + " $(BUILD_DIR_DEV)\\lib");
+ MF.WriteLine(" @copy $(BUILD_DIR)\\" + dll + " $(PHP_PREFIX)");
+ }
+ } else {
+ MF.WriteBlankLines(1);
+ MF.WriteLine("build-ext-libs:");
+ MF.WriteLine(" @if not exist $(BUILD_DIR_DEV)\\lib mkdir $(BUILD_DIR_DEV)\\lib >nul");
+ for (var i in extensions_enabled) {
+ var lib;
+
+ lib = "php_" + extensions_enabled[i][0] + "*.lib";
+
+ if ('shared' == extensions_enabled[i][1]) {
+ MF.WriteLine(" @if exist $(BUILD_DIR)\\" + lib + " copy $(BUILD_DIR)\\" + lib + " $(BUILD_DIR_DEV)\\lib");
+ }
+ }
+ }
TF.Close();
MF.WriteBlankLines(2);
MFO.Close();
TF = FSO.OpenTextFile("Makefile.objects", 1);
- MF.Write(TF.ReadAll());
+ if (!TF.AtEndOfStream) {
+ MF.Write(TF.ReadAll());
+ }
TF.Close();
MF.Close();
diff --git a/win32/build/mkdist.php b/win32/build/mkdist.php index 23d26c9c5..640e9b3bd 100644 --- a/win32/build/mkdist.php +++ b/win32/build/mkdist.php @@ -246,7 +246,8 @@ foreach ($text_files as $src => $dest) { /* general other files */ $general_files = array( - "php.gif" => "php.gif", + "php.gif" => "php.gif", + "$GLOBALS[build_dir]\\deplister.exe" => "deplister.exe", ); foreach ($general_files as $src => $dest) { diff --git a/win32/build/phpize.js.in b/win32/build/phpize.js.in index 4813ec0b5..c99dece61 100644 --- a/win32/build/phpize.js.in +++ b/win32/build/phpize.js.in @@ -40,9 +40,13 @@ function ERROR(msg) function file_get_contents(filename)
{
+ var t = "";
var F = FSO.OpenTextFile(filename, 1);
- var t = F.ReadAll();
- F.Close();
+
+ if (!F.AtEndOfStream) {
+ t = F.ReadAll();
+ F.Close();
+ }
return t;
}
@@ -208,6 +212,12 @@ STDOUT.WriteLine(PHP_DIR); C.WriteLine("/* This file automatically generated from script/confutils.js */");
C.WriteLine("var MODE_PHPIZE = true;");
C.WriteLine("var PHP_DIR = " + '"' + PHP_DIR.replace(new RegExp('(["\\\\])', "g"), '\\$1') + '"');
+C.WriteLine("var PHP_PREFIX = " + '"' + PHP_PREFIX.replace(new RegExp('(["\\\\])', "g"), '\\$1') + '"');
+
+C.Write(file_get_contents(PHP_DIR + "//script//ext_deps.js"));
+if (FSO.FileExists(PHP_DIR + "/script/ext_pickle.js")) {
+ C.Write(file_get_contents(PHP_DIR + "//script//ext_pickle.js"));
+}
C.Write(file_get_contents(PHP_DIR + "/script/confutils.js"));
C.Write(file_get_contents(PHP_DIR + "/script/config.phpize.js"));
|