diff options
| author | Kalle Sommer Nielsen <kalle@php.net> | 2015-06-25 19:09:00 +0200 |
|---|---|---|
| committer | Kalle Sommer Nielsen <kalle@php.net> | 2015-06-25 19:09:00 +0200 |
| commit | 7517d385eae7dd00ff7cc518490e2c2d8526b6e6 (patch) | |
| tree | 9e373b1bf2bb84d90163ec12fcc4cc04abe902a5 | |
| parent | 6129a56c02f3a1072353663ec15f4f569a788ac3 (diff) | |
| parent | 2a2f42c25d068a5233bd1239222ad7d2948963ee (diff) | |
| download | php-git-7517d385eae7dd00ff7cc518490e2c2d8526b6e6.tar.gz | |
Merge branch 'master' of https://git.php.net/push/php-src
61 files changed, 561 insertions, 303 deletions
@@ -1,5 +1,14 @@ PHP NEWS ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| +09 Jul 2015, PHP 7.0.0 Beta 1 + +- Core: + . Fixed bug #69768 (escapeshell*() doesn't cater to !). (cmb) + +- PCRE: + . Fixed Bug #53823 (preg_replace: * qualifier on unicode replace garbles the + string). (cmb) + 25 Jun 2015, PHP 7.0.0 Alpha 2 - Core: @@ -49,6 +58,9 @@ . Removed opcache.load_comments configuration directive. Now doc comments loading costs nothing and always enabled. (Dmitry) . Fixed bug #69838 (Wrong size calculation for function table). (Anatol) + +- PCRE: + . Fixed bug #69864 (Segfault in preg_replace_callback) (cmb, ab) - PDO_pgsql: . Fixed bug #69752 (PDOStatement::execute() leaks memory with DML diff --git a/README.RELEASE_PROCESS b/README.RELEASE_PROCESS index 84e22a35a9..227df6e920 100644 --- a/README.RELEASE_PROCESS +++ b/README.RELEASE_PROCESS @@ -266,7 +266,9 @@ to upgrade. 8. Commit all the changes to their respective git repos -9. Wait an hour or two, then send a mail to php-announce@lists.php.net, +9. Please note down the sha256 and the PGP signature (.asc). These *must* be + included in the release mail. +10. Wait an hour or two, then send a mail to php-announce@lists.php.net, php-general@lists.php.net and internals@lists.php.net with a text similar to http://news.php.net/php.internals/17222. Please make sure that the mail to php-announce@ is its own completely seperate email. diff --git a/UPGRADING.INTERNALS b/UPGRADING.INTERNALS index 60ae493434..9700af595b 100644 --- a/UPGRADING.INTERNALS +++ b/UPGRADING.INTERNALS @@ -79,7 +79,7 @@ changes. See: https://wiki.php.net/phpng-upgrading g. sprintf() formats New printf modifier 'p' was implemented to platform independently output zend_long, - zend_ulong and php_size_t datatypes. That modifier can be used with'd', 'u', 'x' and 'o' + zend_ulong and php_size_t datatypes. That modifier can be used with 'd', 'u', 'x' and 'o' printf format specs with spprintf, snprintf and the wrapping printf implementations. %pu is sufficient for both zend_ulong and php_size_t. the code using %p spec to output pointer address might need to be enclosed into #ifdef when it unlickily followed by 'd', diff --git a/Zend/bug69756.phpt b/Zend/tests/bug69756.phpt index ca638fb2d6..ca638fb2d6 100644 --- a/Zend/bug69756.phpt +++ b/Zend/tests/bug69756.phpt diff --git a/Zend/tests/bug69905.phpt b/Zend/tests/bug69905.phpt new file mode 100644 index 0000000000..fb25341bde --- /dev/null +++ b/Zend/tests/bug69905.phpt @@ -0,0 +1,11 @@ +--TEST-- +Bug #69905 (null ptr deref and segfault in ZEND_FETCH_DIM_RW_SPEC_VAR_UNUSED_HANDLER) +--FILE-- +<?php +md5(0)[]--; +?> +--EXPECTF-- +Fatal error: Uncaught Error: [] operator not supported for strings in %sbug69905.php:2 +Stack trace: +#0 {main} + thrown in %sbug69905.php on line 2 diff --git a/Zend/tests/generators/aborted_yield_during_nested_fcalls.phpt b/Zend/tests/generators/aborted_yield_during_nested_fcalls.phpt new file mode 100644 index 0000000000..9d3bea3ea2 --- /dev/null +++ b/Zend/tests/generators/aborted_yield_during_nested_fcalls.phpt @@ -0,0 +1,18 @@ +--TEST-- +Aborted yield during nested calls +--FILE-- +<?php + +function func() {} + +function gen($x) { + func(func($x, $x, func($x, yield))); +} + +$gen = gen("x"); +$gen->rewind(); + +?> +===DONE=== +--EXPECT-- +===DONE=== diff --git a/Zend/tests/generators/aborted_yield_during_switch.phpt b/Zend/tests/generators/aborted_yield_during_switch.phpt new file mode 100644 index 0000000000..1b1d6a15e6 --- /dev/null +++ b/Zend/tests/generators/aborted_yield_during_switch.phpt @@ -0,0 +1,19 @@ +--TEST-- +Aborted yield during switch +--FILE-- +<?php + +function gen($x) { + switch ($x."y") { + default: + yield; + } +} + +$gen = gen("x"); +$gen->rewind(); + +?> +===DONE=== +--EXPECT-- +===DONE=== diff --git a/Zend/zend_alloc.h b/Zend/zend_alloc.h index f76494e0d4..6c12b4247d 100644 --- a/Zend/zend_alloc.h +++ b/Zend/zend_alloc.h @@ -84,7 +84,7 @@ ZEND_API size_t ZEND_FASTCALL _zend_mem_block_size(void *ptr ZEND_FILE_LINE_DC Z #include "zend_alloc_sizes.h" /* _emalloc() & _efree() specialization */ -#if !ZEND_DEBUG && !defined(_WIN32) +#if !ZEND_DEBUG && defined(HAVE_BUILTIN_CONSTANT_P) # define _ZEND_BIN_ALLOCATOR_DEF(_num, _size, _elements, _pages, x, y) \ ZEND_API void* ZEND_FASTCALL _emalloc_ ## _size(void) ZEND_ATTRIBUTE_MALLOC; diff --git a/Zend/zend_builtin_functions.c b/Zend/zend_builtin_functions.c index 8ea758adcc..1cdee8ac63 100644 --- a/Zend/zend_builtin_functions.c +++ b/Zend/zend_builtin_functions.c @@ -129,7 +129,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_error_reporting, 0, 0, 0) ZEND_ARG_INFO(0, new_error_level) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_define, 0, 0, 3) +ZEND_BEGIN_ARG_INFO_EX(arginfo_define, 0, 0, 2) ZEND_ARG_INFO(0, constant_name) ZEND_ARG_INFO(0, value) ZEND_ARG_INFO(0, case_insensitive) @@ -600,8 +600,8 @@ ZEND_FUNCTION(strncasecmp) } /* }}} */ -/* {{{ proto array each(array arr) - Return the currently pointed key..value pair in the passed array, and advance the pointer to the next element */ +/* {{{ proto mixed each(array &arr) + Return the currently pointed key..value pair in the passed array, and advance the pointer to the next element, or false if there is no element at this place */ ZEND_FUNCTION(each) { zval *array, *entry, tmp; @@ -775,7 +775,7 @@ static void copy_constant_array(zval *dst, zval *src) /* {{{ */ } /* }}} */ -/* {{{ proto bool define(string constant_name, mixed value, boolean case_insensitive=false) +/* {{{ proto bool define(string constant_name, mixed value[, boolean case_insensitive]) Define a new constant */ ZEND_FUNCTION(define) { @@ -933,8 +933,8 @@ ZEND_FUNCTION(get_called_class) } /* }}} */ -/* {{{ proto string get_parent_class([mixed object]) - Retrieves the parent class name for object or class or current scope. */ +/* {{{ proto mixed get_parent_class([mixed object]) + Retrieves the parent class name for object or class or current scope or false if not in a scope. */ ZEND_FUNCTION(get_parent_class) { zval *arg; @@ -1025,7 +1025,7 @@ static void is_a_impl(INTERNAL_FUNCTION_PARAMETERS, zend_bool only_subclass) /* } /* }}} */ -/* {{{ proto bool is_subclass_of(mixed object_or_string, string class_name [, bool allow_string=true]) +/* {{{ proto bool is_subclass_of(mixed object_or_string, string class_name [, bool allow_string]) Returns true if the object has this class as one of its parents */ ZEND_FUNCTION(is_subclass_of) { @@ -1033,7 +1033,7 @@ ZEND_FUNCTION(is_subclass_of) } /* }}} */ -/* {{{ proto bool is_a(mixed object_or_string, string class_name [, bool allow_string=false]) +/* {{{ proto bool is_a(mixed object_or_string, string class_name [, bool allow_string]) Returns true if the first argument is an object and is this class or has this class as one of its parents, */ ZEND_FUNCTION(is_a) { @@ -1566,7 +1566,7 @@ ZEND_FUNCTION(class_alias) /* }}} */ #if ZEND_DEBUG -/* {{{ proto void leak(int num_bytes=3) +/* {{{ proto void leak([int num_bytes]) Cause an intentional memory leak, for testing/debugging purposes */ ZEND_FUNCTION(leak) { @@ -1670,7 +1670,7 @@ ZEND_FUNCTION(trigger_error) } /* }}} */ -/* {{{ proto string set_error_handler(string error_handler [, int error_types]) +/* {{{ proto string set_error_handler(callable error_handler [, int error_types]) Sets a user-defined error handler function. Returns the previously defined error handler, or false on error */ ZEND_FUNCTION(set_error_handler) { @@ -1739,8 +1739,8 @@ ZEND_FUNCTION(restore_error_handler) } /* }}} */ -/* {{{ proto string set_exception_handler(callable exception_handler) - Sets a user-defined exception handler function. Returns the previously defined exception handler, or false on error */ +/* {{{ proto mixed set_exception_handler(callable exception_handler) + Sets a user-defined exception handler function. Returns the previously defined exception handler, or false on error */ ZEND_FUNCTION(set_exception_handler) { zval *exception_handler; @@ -2115,7 +2115,7 @@ static int add_constant_info(zval *item, void *arg) /* {{{ */ } /* }}} */ -/* {{{ proto array get_loaded_extensions([bool zend_extensions]) U +/* {{{ proto array get_loaded_extensions([bool zend_extensions]) Return an array containing names of loaded extensions */ ZEND_FUNCTION(get_loaded_extensions) { diff --git a/Zend/zend_closures.c b/Zend/zend_closures.c index 4e642ffb1c..865f8b1afb 100644 --- a/Zend/zend_closures.c +++ b/Zend/zend_closures.c @@ -69,7 +69,7 @@ ZEND_METHOD(Closure, __invoke) /* {{{ */ } /* }}} */ -/* {{{ proto mixed Closure::call(object $to [, mixed $parameter] [, mixed $...] ) +/* {{{ proto mixed Closure::call(object to [, mixed parameter] [, mixed ...] ) Call closure, binding to a given object with its class as the scope */ ZEND_METHOD(Closure, call) { @@ -143,7 +143,7 @@ ZEND_METHOD(Closure, call) } /* }}} */ -/* {{{ proto Closure Closure::bind(Closure $old, object $to [, mixed $scope = "static" ] ) +/* {{{ proto Closure Closure::bind(callable old, object to [, mixed scope]) Create a closure from another one and bind to another object and scope */ ZEND_METHOD(Closure, bind) { diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c index 246372fee2..8fc40245c9 100644 --- a/Zend/zend_execute.c +++ b/Zend/zend_execute.c @@ -1682,11 +1682,11 @@ convert_to_array: if (dim == NULL) { zend_error(E_EXCEPTION | E_ERROR, "[] operator not supported for strings"); + ZVAL_NULL(result); } else { zend_check_string_offset(dim, type); + ZVAL_INDIRECT(result, NULL); /* wrong string offset */ } - - ZVAL_INDIRECT(result, NULL); /* wrong string offset */ } else if (EXPECTED(Z_TYPE_P(container) == IS_OBJECT)) { if (!Z_OBJ_HT_P(container)->read_dimension) { zend_error(E_EXCEPTION | E_ERROR, "Cannot use object as array"); diff --git a/Zend/zend_execute.h b/Zend/zend_execute.h index 9719eda42b..f595edca9b 100644 --- a/Zend/zend_execute.h +++ b/Zend/zend_execute.h @@ -58,7 +58,7 @@ static zend_always_inline zval* zend_assign_to_variable(zval *variable_ptr, zval { zend_refcounted *ref = NULL; - if ((value_type & (IS_VAR|IS_CV)) && Z_ISREF_P(value)) { + if (ZEND_CONST_COND(value_type & (IS_VAR|IS_CV), 1) && Z_ISREF_P(value)) { ref = Z_COUNTED_P(value); value = Z_REFVAL_P(value); } @@ -78,7 +78,7 @@ static zend_always_inline zval* zend_assign_to_variable(zval *variable_ptr, zval Z_OBJ_HANDLER_P(variable_ptr, set)(variable_ptr, value); return variable_ptr; } - if ((value_type & (IS_VAR|IS_CV)) && variable_ptr == value) { + if (ZEND_CONST_COND(value_type & (IS_VAR|IS_CV), 1) && variable_ptr == value) { return variable_ptr; } garbage = Z_COUNTED_P(variable_ptr); @@ -93,7 +93,7 @@ static zend_always_inline zval* zend_assign_to_variable(zval *variable_ptr, zval if (UNEXPECTED(Z_OPT_REFCOUNTED_P(variable_ptr))) { Z_ADDREF_P(variable_ptr); } - } else if (/* value_type == IS_VAR && */ UNEXPECTED(ref)) { + } else if (ZEND_CONST_COND(value_type == IS_VAR, 1) && UNEXPECTED(ref)) { if (UNEXPECTED(--GC_REFCOUNT(ref) == 0)) { efree_size(ref, sizeof(zend_reference)); } else if (Z_OPT_REFCOUNTED_P(variable_ptr)) { @@ -122,7 +122,7 @@ static zend_always_inline zval* zend_assign_to_variable(zval *variable_ptr, zval if (UNEXPECTED(Z_OPT_REFCOUNTED_P(variable_ptr))) { Z_ADDREF_P(variable_ptr); } - } else if (/* value_type == IS_VAR && */ UNEXPECTED(ref)) { + } else if (ZEND_CONST_COND(value_type == IS_VAR, 1) && UNEXPECTED(ref)) { if (UNEXPECTED(--GC_REFCOUNT(ref) == 0)) { efree_size(ref, sizeof(zend_reference)); } else if (Z_OPT_REFCOUNTED_P(variable_ptr)) { diff --git a/Zend/zend_generators.c b/Zend/zend_generators.c index 6a04ebd123..6e847fb7c0 100644 --- a/Zend/zend_generators.c +++ b/Zend/zend_generators.c @@ -34,15 +34,16 @@ static zend_object *zend_generator_create(zend_class_entry *class_type); static void zend_generator_cleanup_unfinished_execution(zend_generator *generator) /* {{{ */ { zend_execute_data *execute_data = generator->execute_data; - /* -1 required because we want the last run opcode, not the next to-be-run one. */ - uint32_t op_num = execute_data->opline - execute_data->func->op_array.opcodes - 1; if (generator->send_target) { - if (Z_REFCOUNTED_P(generator->send_target)) Z_DELREF_P(generator->send_target); + Z_TRY_DELREF_P(generator->send_target); generator->send_target = NULL; } - { + if (execute_data->opline != execute_data->func->op_array.opcodes) { + /* -1 required because we want the last run opcode, not the next to-be-run one. */ + uint32_t op_num = execute_data->opline - execute_data->func->op_array.opcodes - 1; + /* There may be calls to zend_vm_stack_free_call_frame(), which modifies the VM stack * globals, so need to load/restore those. */ zend_vm_stack original_stack = EG(vm_stack); @@ -847,7 +848,7 @@ ZEND_METHOD(Generator, next) } /* }}} */ -/* {{{ proto mixed Generator::send(mixed $value) +/* {{{ proto mixed Generator::send(mixed value) * Sends a value to the generator */ ZEND_METHOD(Generator, send) { @@ -886,7 +887,7 @@ ZEND_METHOD(Generator, send) } /* }}} */ -/* {{{ proto mixed Generator::throw(Exception $exception) +/* {{{ proto mixed Generator::throw(Exception exception) * Throws an exception into the generator */ ZEND_METHOD(Generator, throw) { diff --git a/Zend/zend_portability.h b/Zend/zend_portability.h index 57080ca7b7..214ece53e6 100644 --- a/Zend/zend_portability.h +++ b/Zend/zend_portability.h @@ -246,6 +246,18 @@ char *alloca(); # define HAVE_ATTRIBUTE_WEAK #endif +#if ZEND_GCC_VERSION >= 3001 || __has_builtin(__builtin_constant_p) +# define HAVE_BUILTIN_CONSTANT_P +#endif + +#ifdef HAVE_BUILTIN_CONSTANT_P +# define ZEND_CONST_COND(_condition, _default) \ + (__builtin_constant_p(_condition) ? (_condition) : (_default)) +#else +# define ZEND_CONST_COND(_condition, _default) \ + (_default) +#endif + #if ZEND_DEBUG # define zend_always_inline inline # define zend_never_inline diff --git a/ext/dom/attr.c b/ext/dom/attr.c index 1ecf6610b7..66f677058e 100644 --- a/ext/dom/attr.c +++ b/ext/dom/attr.c @@ -52,7 +52,7 @@ const zend_function_entry php_dom_attr_class_functions[] = { PHP_FE_END }; -/* {{{ proto void DOMAttr::__construct(string name, [string value]); */ +/* {{{ proto void DOMAttr::__construct(string name, [string value]) */ PHP_METHOD(domattr, __construct) { zval *id = getThis(); @@ -220,7 +220,7 @@ int dom_attr_schema_type_info_read(dom_object *obj, zval *retval) /* }}} */ -/* {{{ proto boolean dom_attr_is_id(); +/* {{{ proto boolean dom_attr_is_id() URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#Attr-isId Since: DOM Level 3 */ diff --git a/ext/dom/document.c b/ext/dom/document.c index 3e4e298654..9e18d7fcba 100644 --- a/ext/dom/document.c +++ b/ext/dom/document.c @@ -687,7 +687,7 @@ int dom_document_config_read(dom_object *obj, zval *retval) /* }}} */ -/* {{{ proto DOMElement dom_document_create_element(string tagName [, string value]); +/* {{{ proto DOMElement dom_document_create_element(string tagName [, string value]) URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-2141741547 Since: */ @@ -721,7 +721,7 @@ PHP_FUNCTION(dom_document_create_element) } /* }}} end dom_document_create_element */ -/* {{{ proto DOMDocumentFragment dom_document_create_document_fragment(); +/* {{{ proto DOMDocumentFragment dom_document_create_document_fragment() URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-35CB04B5 Since: */ @@ -748,7 +748,7 @@ PHP_FUNCTION(dom_document_create_document_fragment) } /* }}} end dom_document_create_document_fragment */ -/* {{{ proto DOMText dom_document_create_text_node(string data); +/* {{{ proto DOMText dom_document_create_text_node(string data) URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-1975348127 Since: */ @@ -777,7 +777,7 @@ PHP_FUNCTION(dom_document_create_text_node) } /* }}} end dom_document_create_text_node */ -/* {{{ proto DOMComment dom_document_create_comment(string data); +/* {{{ proto DOMComment dom_document_create_comment(string data) URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-1334481328 Since: */ @@ -806,7 +806,7 @@ PHP_FUNCTION(dom_document_create_comment) } /* }}} end dom_document_create_comment */ -/* {{{ proto DOMCdataSection dom_document_create_cdatasection(string data); +/* {{{ proto DOMCdataSection dom_document_create_cdatasection(string data) URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-D26C0AF8 Since: */ @@ -835,7 +835,7 @@ PHP_FUNCTION(dom_document_create_cdatasection) } /* }}} end dom_document_create_cdatasection */ -/* {{{ proto DOMProcessingInstruction dom_document_create_processing_instruction(string target, string data); +/* {{{ proto DOMProcessingInstruction dom_document_create_processing_instruction(string target, string data) URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-135944439 Since: */ @@ -871,7 +871,7 @@ PHP_FUNCTION(dom_document_create_processing_instruction) } /* }}} end dom_document_create_processing_instruction */ -/* {{{ proto DOMAttr dom_document_create_attribute(string name); +/* {{{ proto DOMAttr dom_document_create_attribute(string name) URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-1084891198 Since: */ @@ -906,7 +906,7 @@ PHP_FUNCTION(dom_document_create_attribute) } /* }}} end dom_document_create_attribute */ -/* {{{ proto DOMEntityReference dom_document_create_entity_reference(string name); +/* {{{ proto DOMEntityReference dom_document_create_entity_reference(string name) URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-392B75AE Since: */ @@ -940,7 +940,7 @@ PHP_FUNCTION(dom_document_create_entity_reference) } /* }}} end dom_document_create_entity_reference */ -/* {{{ proto DOMNodeList dom_document_get_elements_by_tag_name(string tagname); +/* {{{ proto DOMNodeList dom_document_get_elements_by_tag_name(string tagname) URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-A6C9094 Since: */ @@ -966,7 +966,7 @@ PHP_FUNCTION(dom_document_get_elements_by_tag_name) } /* }}} end dom_document_get_elements_by_tag_name */ -/* {{{ proto DOMNode dom_document_import_node(DOMNode importedNode, boolean deep); +/* {{{ proto DOMNode dom_document_import_node(DOMNode importedNode, boolean deep) URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#Core-Document-importNode Since: DOM Level 2 */ @@ -1021,7 +1021,7 @@ PHP_FUNCTION(dom_document_import_node) } /* }}} end dom_document_import_node */ -/* {{{ proto DOMElement dom_document_create_element_ns(string namespaceURI, string qualifiedName [,string value]); +/* {{{ proto DOMElement dom_document_create_element_ns(string namespaceURI, string qualifiedName [,string value]) URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-DocCrElNS Since: DOM Level 2 */ @@ -1085,7 +1085,7 @@ PHP_FUNCTION(dom_document_create_element_ns) } /* }}} end dom_document_create_element_ns */ -/* {{{ proto DOMAttr dom_document_create_attribute_ns(string namespaceURI, string qualifiedName); +/* {{{ proto DOMAttr dom_document_create_attribute_ns(string namespaceURI, string qualifiedName) URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-DocCrAttrNS Since: DOM Level 2 */ @@ -1151,7 +1151,7 @@ PHP_FUNCTION(dom_document_create_attribute_ns) } /* }}} end dom_document_create_attribute_ns */ -/* {{{ proto DOMNodeList dom_document_get_elements_by_tag_name_ns(string namespaceURI, string localName); +/* {{{ proto DOMNodeList dom_document_get_elements_by_tag_name_ns(string namespaceURI, string localName) URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-getElBTNNS Since: DOM Level 2 */ @@ -1178,7 +1178,7 @@ PHP_FUNCTION(dom_document_get_elements_by_tag_name_ns) } /* }}} end dom_document_get_elements_by_tag_name_ns */ -/* {{{ proto DOMElement dom_document_get_element_by_id(string elementId); +/* {{{ proto DOMElement dom_document_get_element_by_id(string elementId) URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-getElBId Since: DOM Level 2 */ @@ -1209,7 +1209,7 @@ PHP_FUNCTION(dom_document_get_element_by_id) } /* }}} end dom_document_get_element_by_id */ -/* {{{ proto DOMNode dom_document_adopt_node(DOMNode source); +/* {{{ proto DOMNode dom_document_adopt_node(DOMNode source) URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-Document3-adoptNode Since: DOM Level 3 */ @@ -1219,7 +1219,7 @@ PHP_FUNCTION(dom_document_adopt_node) } /* }}} end dom_document_adopt_node */ -/* {{{ proto void dom_document_normalize_document(); +/* {{{ proto void dom_document_normalize_document() URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-Document3-normalizeDocument Since: DOM Level 3 */ @@ -1239,7 +1239,7 @@ PHP_FUNCTION(dom_document_normalize_document) } /* }}} end dom_document_normalize_document */ -/* {{{ proto DOMNode dom_document_rename_node(node n, string namespaceURI, string qualifiedName); +/* {{{ proto DOMNode dom_document_rename_node(node n, string namespaceURI, string qualifiedName) URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-Document3-renameNode Since: DOM Level 3 */ @@ -1528,7 +1528,7 @@ static void dom_parse_document(INTERNAL_FUNCTION_PARAMETERS, int mode) { } /* }}} end dom_parser_document */ -/* {{{ proto DOMNode dom_document_load(string source [, int options]); +/* {{{ proto DOMNode dom_document_load(string source [, int options]) URL: http://www.w3.org/TR/DOM-Level-3-LS/load-save.html#LS-DocumentLS-load Since: DOM Level 3 */ @@ -1538,7 +1538,7 @@ PHP_METHOD(domdocument, load) } /* }}} end dom_document_load */ -/* {{{ proto DOMNode dom_document_loadxml(string source [, int options]); +/* {{{ proto DOMNode dom_document_loadxml(string source [, int options]) URL: http://www.w3.org/TR/DOM-Level-3-LS/load-save.html#LS-DocumentLS-loadXML Since: DOM Level 3 */ @@ -1548,7 +1548,7 @@ PHP_METHOD(domdocument, loadXML) } /* }}} end dom_document_loadxml */ -/* {{{ proto int dom_document_save(string file); +/* {{{ proto int dom_document_save(string file) Convenience method to save to file */ PHP_FUNCTION(dom_document_save) @@ -1592,7 +1592,7 @@ PHP_FUNCTION(dom_document_save) } /* }}} end dom_document_save */ -/* {{{ proto string dom_document_savexml([node n]); +/* {{{ proto string dom_document_savexml([node n]) URL: http://www.w3.org/TR/DOM-Level-3-LS/load-save.html#LS-DocumentLS-saveXML Since: DOM Level 3 */ @@ -1744,7 +1744,7 @@ PHP_FUNCTION(dom_document_xinclude) } /* }}} */ -/* {{{ proto boolean dom_document_validate(); +/* {{{ proto boolean dom_document_validate() Since: DOM extended */ PHP_FUNCTION(dom_document_validate) @@ -2062,7 +2062,7 @@ static void dom_load_html(INTERNAL_FUNCTION_PARAMETERS, int mode) /* {{{ */ } /* }}} */ -/* {{{ proto DOMNode dom_document_load_html_file(string source); +/* {{{ proto DOMNode dom_document_load_html_file(string source) Since: DOM extended */ PHP_METHOD(domdocument, loadHTMLFile) @@ -2071,7 +2071,7 @@ PHP_METHOD(domdocument, loadHTMLFile) } /* }}} end dom_document_load_html_file */ -/* {{{ proto DOMNode dom_document_load_html(string source); +/* {{{ proto DOMNode dom_document_load_html(string source) Since: DOM extended */ PHP_METHOD(domdocument, loadHTML) @@ -2080,7 +2080,7 @@ PHP_METHOD(domdocument, loadHTML) } /* }}} end dom_document_load_html */ -/* {{{ proto int dom_document_save_html_file(string file); +/* {{{ proto int dom_document_save_html_file(string file) Convenience method to save to file as html */ PHP_FUNCTION(dom_document_save_html_file) @@ -2119,7 +2119,7 @@ PHP_FUNCTION(dom_document_save_html_file) } /* }}} end dom_document_save_html_file */ -/* {{{ proto string dom_document_save_html(); +/* {{{ proto string dom_document_save_html() Convenience method to output as html */ PHP_FUNCTION(dom_document_save_html) @@ -2206,7 +2206,7 @@ PHP_FUNCTION(dom_document_save_html) #endif /* defined(LIBXML_HTML_ENABLED) */ -/* {{{ proto boolean DOMDocument::registerNodeClass(string baseclass, string extendedclass); +/* {{{ proto boolean DOMDocument::registerNodeClass(string baseclass, string extendedclass) Register extended class used to create base node type */ PHP_METHOD(domdocument, registerNodeClass) { diff --git a/ext/dom/documentfragment.c b/ext/dom/documentfragment.c index 9cf0fd5423..05494ea8c3 100644 --- a/ext/dom/documentfragment.c +++ b/ext/dom/documentfragment.c @@ -49,7 +49,7 @@ const zend_function_entry php_dom_documentfragment_class_functions[] = { PHP_FE_END }; -/* {{{ proto void DOMDocumentFragment::__construct(); */ +/* {{{ proto void DOMDocumentFragment::__construct() */ PHP_METHOD(domdocumentfragment, __construct) { @@ -112,7 +112,7 @@ static void php_dom_xmlSetTreeDoc(xmlNodePtr tree, xmlDocPtr doc) /* {{{ */ } /* }}} */ -/* {{{ proto void DOMDocumentFragment::appendXML(string data); */ +/* {{{ proto void DOMDocumentFragment::appendXML(string data) */ PHP_METHOD(domdocumentfragment, appendXML) { zval *id; xmlNode *nodep; diff --git a/ext/dom/element.c b/ext/dom/element.c index 4af6c9accf..faeff9e389 100644 --- a/ext/dom/element.c +++ b/ext/dom/element.c @@ -150,7 +150,7 @@ const zend_function_entry php_dom_element_class_functions[] = { /* {{{ */ }; /* }}} */ -/* {{{ proto void DOMElement::__construct(string name, [string value], [string uri]); */ +/* {{{ proto void DOMElement::__construct(string name, [string value], [string uri]) */ PHP_METHOD(domelement, __construct) { diff --git a/ext/dom/entityreference.c b/ext/dom/entityreference.c index a3e3eaea0f..ba609fd0f3 100644 --- a/ext/dom/entityreference.c +++ b/ext/dom/entityreference.c @@ -45,7 +45,7 @@ const zend_function_entry php_dom_entityreference_class_functions[] = { PHP_FE_END }; -/* {{{ proto void DOMEntityReference::__construct(string name); */ +/* {{{ proto void DOMEntityReference::__construct(string name) */ PHP_METHOD(domentityreference, __construct) { zval *id = getThis(); diff --git a/ext/dom/text.c b/ext/dom/text.c index f857163ce1..bdd6e38f40 100644 --- a/ext/dom/text.c +++ b/ext/dom/text.c @@ -133,7 +133,7 @@ int dom_text_whole_text_read(dom_object *obj, zval *retval) /* }}} */ -/* {{{ proto DOMText dom_text_split_text(int offset); +/* {{{ proto DOMText dom_text_split_text(int offset) URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-38853C1D Since: */ @@ -194,7 +194,7 @@ PHP_FUNCTION(dom_text_split_text) } /* }}} end dom_text_split_text */ -/* {{{ proto boolean dom_text_is_whitespace_in_element_content(); +/* {{{ proto boolean dom_text_is_whitespace_in_element_content() URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-Text3-isWhitespaceInElementContent Since: DOM Level 3 */ @@ -217,7 +217,7 @@ PHP_FUNCTION(dom_text_is_whitespace_in_element_content) } /* }}} end dom_text_is_whitespace_in_element_content */ -/* {{{ proto DOMText dom_text_replace_whole_text(string content); +/* {{{ proto DOMText dom_text_replace_whole_text(string content) URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-Text3-replaceWholeText Since: DOM Level 3 */ diff --git a/ext/dom/xpath.c b/ext/dom/xpath.c index 58155c1aa9..63a877b3a1 100644 --- a/ext/dom/xpath.c +++ b/ext/dom/xpath.c @@ -309,7 +309,7 @@ int dom_xpath_document_read(dom_object *obj, zval *retval) } /* }}} */ -/* {{{ proto boolean dom_xpath_register_ns(string prefix, string uri); */ +/* {{{ proto boolean dom_xpath_register_ns(string prefix, string uri) */ PHP_FUNCTION(dom_xpath_register_ns) { zval *id; @@ -490,14 +490,14 @@ static void php_xpath_eval(INTERNAL_FUNCTION_PARAMETERS, int type) /* {{{ */ } /* }}} */ -/* {{{ proto DOMNodeList dom_xpath_query(string expr [,DOMNode context [, boolean registerNodeNS]]); */ +/* {{{ proto DOMNodeList dom_xpath_query(string expr [,DOMNode context [, boolean registerNodeNS]]) */ PHP_FUNCTION(dom_xpath_query) { php_xpath_eval(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_DOM_XPATH_QUERY); } /* }}} end dom_xpath_query */ -/* {{{ proto mixed dom_xpath_evaluate(string expr [,DOMNode context [, boolean registerNodeNS]]); */ +/* {{{ proto mixed dom_xpath_evaluate(string expr [,DOMNode context [, boolean registerNodeNS]]) */ PHP_FUNCTION(dom_xpath_evaluate) { php_xpath_eval(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_DOM_XPATH_EVALUATE); diff --git a/ext/exif/exif.c b/ext/exif/exif.c index e06308764f..0d7d99e5f9 100644 --- a/ext/exif/exif.c +++ b/ext/exif/exif.c @@ -2328,7 +2328,7 @@ static char * exif_get_markername(int marker) #endif /* }}} */ -/* {{{ proto string exif_tagname(index) +/* {{{ proto string exif_tagname(int index) Get headername for index or false if not defined */ PHP_FUNCTION(exif_tagname) { @@ -3905,7 +3905,7 @@ static int exif_read_file(image_info_type *ImageInfo, char *FileName, int read_t } /* }}} */ -/* {{{ proto array exif_read_data(string filename [, sections_needed [, sub_arrays[, read_thumbnail]]]) +/* {{{ proto array exif_read_data(string filename [, string sections_needed [, bool sub_arrays[, bool read_thumbnail]]]) Reads header data from the JPEG/TIFF image filename and optionally reads the internal thumbnails */ PHP_FUNCTION(exif_read_data) { diff --git a/ext/gd/gd.c b/ext/gd/gd.c index 9b47118fd5..8004585fe0 100644 --- a/ext/gd/gd.c +++ b/ext/gd/gd.c @@ -2670,7 +2670,7 @@ PHP_FUNCTION(imagepng) #ifdef HAVE_GD_WEBP -/* {{{ proto bool imagewebp(resource im [, string filename[, quality]] ) +/* {{{ proto bool imagewebp(resource im [, string filename[, int quality]] ) Output WEBP image to browser or file */ PHP_FUNCTION(imagewebp) { @@ -2690,7 +2690,7 @@ PHP_FUNCTION(imagejpeg) /* }}} */ #endif /* HAVE_GD_JPG */ -/* {{{ proto bool imagewbmp(resource im [, string filename, [, int foreground]]) +/* {{{ proto bool imagewbmp(resource im [, string filename [, int foreground]]) Output WBMP image to browser or file */ PHP_FUNCTION(imagewbmp) { @@ -2706,7 +2706,7 @@ PHP_FUNCTION(imagegd) } /* }}} */ -/* {{{ proto bool imagegd2(resource im [, string filename, [, int chunk_size, [, int type]]]) +/* {{{ proto bool imagegd2(resource im [, string filename [, int chunk_size [, int type]]]) Output GD2 image to browser or file */ PHP_FUNCTION(imagegd2) { @@ -4376,7 +4376,7 @@ static void php_image_filter_pixelate(INTERNAL_FUNCTION_PARAMETERS) RETURN_FALSE; } -/* {{{ proto bool imagefilter(resource src_im, int filtertype, [args] ) +/* {{{ proto bool imagefilter(resource src_im, int filtertype[, int arg1 [, int arg2 [, int arg3 [, int arg4 ]]]] ) Applies Filter an image using a custom angle */ PHP_FUNCTION(imagefilter) { @@ -4582,7 +4582,7 @@ PHP_FUNCTION(imagecrop) } /* }}} */ -/* {{{ proto void imagecropauto(resource im [, int mode [, threshold [, color]]]) +/* {{{ proto void imagecropauto(resource im [, int mode [, float threshold [, int color]]]) Crop an image automatically using one of the available modes. */ PHP_FUNCTION(imagecropauto) { @@ -4632,7 +4632,7 @@ PHP_FUNCTION(imagecropauto) } /* }}} */ -/* {{{ proto resource imagescale(resource im, new_width[, new_height[, method]]) +/* {{{ proto resource imagescale(resource im, int new_width[, int new_height[, int method]]) Scale an image using the given new width and height. */ PHP_FUNCTION(imagescale) { @@ -4775,7 +4775,7 @@ PHP_FUNCTION(imageaffine) } /* }}} */ -/* {{{ proto array imageaffinematrixget(type[, options]) +/* {{{ proto array imageaffinematrixget(int type[, array options]) Return an image containing the affine tramsformed src image, using an optional clipping area */ PHP_FUNCTION(imageaffinematrixget) { @@ -4923,7 +4923,7 @@ PHP_FUNCTION(imageaffinematrixconcat) } } /* }}} */ -/* {{{ proto resource imagesetinterpolation(resource im, [, method]]) +/* {{{ proto resource imagesetinterpolation(resource im [, int method]]) Set the default interpolation method, passing -1 or 0 sets it to the libgd default (bilinear). */ PHP_FUNCTION(imagesetinterpolation) { diff --git a/ext/ldap/ldap.c b/ext/ldap/ldap.c index ebc2b7ba8b..f58e9c8367 100644 --- a/ext/ldap/ldap.c +++ b/ext/ldap/ldap.c @@ -2498,7 +2498,7 @@ PHP_FUNCTION(ldap_parse_reference) /* }}} */ #endif -/* {{{ proto bool ldap_rename(resource link, string dn, string newrdn, string newparent, bool deleteoldrdn); +/* {{{ proto bool ldap_rename(resource link, string dn, string newrdn, string newparent, bool deleteoldrdn) Modify the name of an entry */ PHP_FUNCTION(ldap_rename) { diff --git a/ext/ldap/tests/ldap_delete_basic.phpt b/ext/ldap/tests/ldap_delete_basic.phpt index 17b8a22f15..84499f2a06 100644 --- a/ext/ldap/tests/ldap_delete_basic.phpt +++ b/ext/ldap/tests/ldap_delete_basic.phpt @@ -32,7 +32,7 @@ require "connect.inc"; $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); -ldap_delete($link, "$base"); +ldap_delete($link, "dc=my-domain,$base"); ?> --EXPECT-- bool(true) diff --git a/ext/ldap/tests/ldap_get_entries_basic.phpt b/ext/ldap/tests/ldap_get_entries_basic.phpt index 8ed479ee4c..3efa818ee2 100644 --- a/ext/ldap/tests/ldap_get_entries_basic.phpt +++ b/ext/ldap/tests/ldap_get_entries_basic.phpt @@ -57,7 +57,7 @@ array(2) { ["count"]=> int(2) ["dn"]=> - string(23) "o=test,dc=mcmic,dc=test" + string(%d) "o=test,%s" } } ===DONE=== diff --git a/ext/mysqli/mysqli_api.c b/ext/mysqli/mysqli_api.c index 22ef0c8a1a..f52884f12c 100644 --- a/ext/mysqli/mysqli_api.c +++ b/ext/mysqli/mysqli_api.c @@ -315,7 +315,7 @@ end: #endif /* }}} */ -/* {{{ proto bool mysqli_stmt_bind_param(object stmt, string types, mixed variable [,mixed,....]) U +/* {{{ proto bool mysqli_stmt_bind_param(object stmt, string types, mixed variable [,mixed ...]) Bind variables to a prepared statement as parameters */ PHP_FUNCTION(mysqli_stmt_bind_param) { @@ -580,7 +580,7 @@ mysqli_stmt_bind_result_do_bind(MY_STMT *stmt, zval *args, unsigned int argc) #endif /* }}} */ -/* {{{ proto bool mysqli_stmt_bind_result(object stmt, mixed var, [,mixed, ...]) U +/* {{{ proto bool mysqli_stmt_bind_result(object stmt, mixed var [,mixed ...]) Bind variables to a prepared statement for result storage */ PHP_FUNCTION(mysqli_stmt_bind_result) { @@ -790,7 +790,7 @@ PHP_FUNCTION(mysqli_data_seek) } /* }}} */ -/* {{{ proto void mysqli_debug(string debug) U +/* {{{ proto void mysqli_debug(string debug) */ PHP_FUNCTION(mysqli_debug) { @@ -1137,7 +1137,7 @@ void mysqli_stmt_fetch_mysqlnd(INTERNAL_FUNCTION_PARAMETERS) #endif /* }}} */ -/* {{{ proto mixed mysqli_stmt_fetch(object stmt) U +/* {{{ proto mixed mysqli_stmt_fetch(object stmt) Fetch results from a prepared statement into the bound variables */ PHP_FUNCTION(mysqli_stmt_fetch) { @@ -2235,7 +2235,7 @@ PHP_FUNCTION(mysqli_sqlstate) } /* }}} */ -/* {{{ proto bool mysqli_ssl_set(object link ,string key ,string cert ,string ca ,string capath ,string cipher]) U +/* {{{ proto bool mysqli_ssl_set(object link ,string key ,string cert ,string ca ,string capath ,string cipher]) */ PHP_FUNCTION(mysqli_ssl_set) { @@ -2507,7 +2507,7 @@ PHP_FUNCTION(mysqli_stmt_result_metadata) } /* }}} */ -/* {{{ proto bool mysqli_stmt_store_result(stmt) +/* {{{ proto bool mysqli_stmt_store_result(object stmt) */ PHP_FUNCTION(mysqli_stmt_store_result) { @@ -2576,7 +2576,7 @@ PHP_FUNCTION(mysqli_stmt_sqlstate) } /* }}} */ -/* {{{ proto object mysqli_store_result(object link [, flags]) +/* {{{ proto object mysqli_store_result(object link [, int flags]) Buffer result set on client */ PHP_FUNCTION(mysqli_store_result) { diff --git a/ext/oci8/oci8_interface.c b/ext/oci8/oci8_interface.c index c4a27739f1..e1452dca01 100644 --- a/ext/oci8/oci8_interface.c +++ b/ext/oci8/oci8_interface.c @@ -93,7 +93,7 @@ PHP_FUNCTION(oci_define_by_name) } /* }}} */ -/* {{{ proto bool oci_bind_by_name(resource stmt, string name, mixed &var, [, int maxlength [, int type]]) +/* {{{ proto bool oci_bind_by_name(resource stmt, string name, mixed &var [, int maxlength [, int type]]) Bind a PHP variable to an Oracle placeholder by name */ /* if you want to bind a LOB/CLOB etc make sure you allocate it via OCINewDescriptor BEFORE binding!!! */ PHP_FUNCTION(oci_bind_by_name) diff --git a/ext/odbc/php_odbc.c b/ext/odbc/php_odbc.c index 9e51dca75f..eac443660a 100644 --- a/ext/odbc/php_odbc.c +++ b/ext/odbc/php_odbc.c @@ -1843,7 +1843,7 @@ PHP_FUNCTION(odbc_fetch_array) /* }}} */ #endif -/* {{{ proto int odbc_fetch_into(resource result_id, array &result_array, [, int rownumber]) +/* {{{ proto int odbc_fetch_into(resource result_id, array &result_array [, int rownumber]) Fetch one result row into an array */ PHP_FUNCTION(odbc_fetch_into) { diff --git a/ext/pcre/php_pcre.c b/ext/pcre/php_pcre.c index 11b74b45b3..59a0aa569f 100644 --- a/ext/pcre/php_pcre.c +++ b/ext/pcre/php_pcre.c @@ -187,13 +187,14 @@ static PHP_MSHUTDOWN_FUNCTION(pcre) /* {{{ static pcre_clean_cache */ static int pcre_clean_cache(zval *data, void *arg) { + pcre_cache_entry *pce = (pcre_cache_entry *) Z_PTR_P(data); int *num_clean = (int *)arg; - if (*num_clean > 0) { + if (*num_clean > 0 && !pce->refcount) { (*num_clean)--; - return 1; + return ZEND_HASH_APPLY_REMOVE; } else { - return 0; + return ZEND_HASH_APPLY_KEEP; } } /* }}} */ @@ -232,6 +233,25 @@ static char **make_subpats_table(int num_subpats, pcre_cache_entry *pce) } /* }}} */ +/* {{{ static calculate_unit_length */ +/* Calculates the byte length of the next character. Assumes valid UTF-8 for PCRE_UTF8. */ +static zend_always_inline int calculate_unit_length(pcre_cache_entry *pce, char *start) +{ + int unit_len; + + if (pce->compile_options & PCRE_UTF8) { + char *end = start; + + /* skip continuation bytes */ + while ((*++end & 0xC0) == 0x80); + unit_len = end - start; + } else { + unit_len = 1; + } + return unit_len; +} +/* }}} */ + /* {{{ pcre_get_compiled_regex_cache */ PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(zend_string *regex) @@ -461,6 +481,7 @@ PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(zend_string *regex) NULL; new_entry.tables = tables; #endif + new_entry.refcount = 0; rc = pcre_fullinfo(re, extra, PCRE_INFO_CAPTURECOUNT, &new_entry.capture_count); if (rc < 0) { @@ -584,8 +605,10 @@ static void php_do_pcre_match(INTERNAL_FUNCTION_PARAMETERS, int global) /* {{{ * RETURN_FALSE; } + pce->refcount++; php_pcre_match_impl(pce, subject->val, (int)subject->len, return_value, subpats, global, ZEND_NUM_ARGS() >= 4, flags, start_offset); + pce->refcount--; } /* }}} */ @@ -850,8 +873,10 @@ PHPAPI void php_pcre_match_impl(pcre_cache_entry *pce, char *subject, int subjec the start offset, and continue. Fudge the offset values to achieve this, unless we're already at the end of the string. */ if (g_notempty != 0 && start_offset < subject_len) { + int unit_len = calculate_unit_length(pce, subject + start_offset); + offsets[0] = (int)start_offset; - offsets[1] = (int)(start_offset + 1); + offsets[1] = (int)(start_offset + unit_len); } else break; } else { @@ -1017,14 +1042,18 @@ PHPAPI zend_string *php_pcre_replace(zend_string *regex, int limit, int *replace_count) { pcre_cache_entry *pce; /* Compiled regular expression */ + zend_string *result; /* Function result */ /* Compile regex or get it from cache. */ if ((pce = pcre_get_compiled_regex_cache(regex)) == NULL) { return NULL; } - - return php_pcre_replace_impl(pce, subject_str, subject, subject_len, replace_val, + pce->refcount++; + result = php_pcre_replace_impl(pce, subject_str, subject, subject_len, replace_val, is_callable_replace, limit, replace_count); + pce->refcount--; + + return result; } /* }}} */ @@ -1239,10 +1268,12 @@ PHPAPI zend_string *php_pcre_replace_impl(pcre_cache_entry *pce, zend_string *su the start offset, and continue. Fudge the offset values to achieve this, unless we're already at the end of the string. */ if (g_notempty != 0 && start_offset < subject_len) { + int unit_len = calculate_unit_length(pce, piece); + offsets[0] = start_offset; - offsets[1] = start_offset + 1; - memcpy(&result->val[result_len], piece, 1); - result_len++; + offsets[1] = start_offset + unit_len; + memcpy(&result->val[result_len], piece, unit_len); + result_len += unit_len; } else { if (!result && subject_str) { result = zend_string_copy(subject_str); @@ -1660,7 +1691,9 @@ static PHP_FUNCTION(preg_split) RETURN_FALSE; } + pce->refcount++; php_pcre_split_impl(pce, subject->val, (int)subject->len, return_value, (int)limit_val, flags); + pce->refcount--; } /* }}} */ @@ -1967,7 +2000,9 @@ static PHP_FUNCTION(preg_grep) RETURN_FALSE; } + pce->refcount++; php_pcre_grep_impl(pce, input, return_value, flags); + pce->refcount--; } /* }}} */ diff --git a/ext/pcre/tests/bug53823.phpt b/ext/pcre/tests/bug53823.phpt new file mode 100644 index 0000000000..c1d8f999e0 --- /dev/null +++ b/ext/pcre/tests/bug53823.phpt @@ -0,0 +1,13 @@ +--TEST-- +Bug #53823 - preg_replace: * qualifier on unicode replace garbles the string +--FILE-- +<?php +var_dump(preg_replace('/[^\pL\pM]*/iu', '', 'áéíóú')); +// invalid UTF-8 +var_dump(preg_replace('/[^\pL\pM]*/iu', '', "\xFCáéíóú")); +var_dump(preg_replace('/[^\pL\pM]*/iu', '', "áéíóú\xFC")); +?> +--EXPECT-- +string(10) "áéíóú" +NULL +NULL diff --git a/ext/pcre/tests/bug66121.phpt b/ext/pcre/tests/bug66121.phpt new file mode 100644 index 0000000000..89c2f2d5d8 --- /dev/null +++ b/ext/pcre/tests/bug66121.phpt @@ -0,0 +1,47 @@ +--TEST-- +Bug #66121 - UTF-8 lookbehinds match bytes instead of characters +--FILE-- +<?php +// Sinhala characters +var_dump(preg_replace('/(?<!ක)/u', '*', 'ක')); +var_dump(preg_replace('/(?<!ක)/u', '*', 'ම')); +// English characters +var_dump(preg_replace('/(?<!k)/u', '*', 'k')); +var_dump(preg_replace('/(?<!k)/u', '*', 'm')); +// Sinhala characters +preg_match_all('/(?<!ක)/u', 'ම', $matches, PREG_OFFSET_CAPTURE); +var_dump($matches); +// invalid UTF-8 +var_dump(preg_replace('/(?<!ක)/u', '*', "\xFCක")); +var_dump(preg_replace('/(?<!ක)/u', '*', "ක\xFC")); +var_dump(preg_match_all('/(?<!ක)/u', "\xFCම", $matches, PREG_OFFSET_CAPTURE)); +var_dump(preg_match_all('/(?<!ක)/u', "\xFCම", $matches, PREG_OFFSET_CAPTURE)); +?> +--EXPECT-- +string(4) "*ක" +string(5) "*ම*" +string(2) "*k" +string(3) "*m*" +array(1) { + [0]=> + array(2) { + [0]=> + array(2) { + [0]=> + string(0) "" + [1]=> + int(0) + } + [1]=> + array(2) { + [0]=> + string(0) "" + [1]=> + int(3) + } + } +} +NULL +NULL +bool(false) +bool(false) diff --git a/ext/pcre/tests/bug69864.phpt b/ext/pcre/tests/bug69864.phpt new file mode 100644 index 0000000000..d84862aeda --- /dev/null +++ b/ext/pcre/tests/bug69864.phpt @@ -0,0 +1,36 @@ +--TEST--
+Bug #69864 (Segfault in preg_replace_callback)
+--FILE--
+<?php
+const PREG_CACHE_SIZE = 4096; // this has to be >= the resp. constant in php_pcre.c
+
+var_dump(preg_replace_callback('/a/', function($m) {
+ for ($i = 0; $i < PREG_CACHE_SIZE; $i++) {
+ preg_match('/foo' . $i . 'bar/', '???foo' . $i . 'bar???');
+ }
+ return 'b';
+}, 'aa'));
+var_dump(preg_replace_callback('/a/', function($m) {
+ for ($i = 0; $i < PREG_CACHE_SIZE; $i++) {
+ preg_replace('/foo' . $i . 'bar/', 'baz', '???foo' . $i . 'bar???');
+ }
+ return 'b';
+}, 'aa'));
+var_dump(preg_replace_callback('/a/', function($m) {
+ for ($i = 0; $i < PREG_CACHE_SIZE; $i++) {
+ preg_split('/foo' . $i . 'bar/', '???foo' . $i . 'bar???');
+ }
+ return 'b';
+}, 'aa'));
+var_dump(preg_replace_callback('/a/', function($m) {
+ for ($i = 0; $i < PREG_CACHE_SIZE; $i++) {
+ preg_grep('/foo' . $i . 'bar/', ['???foo' . $i . 'bar???']);
+ }
+ return 'b';
+}, 'aa'));
+?>
+--EXPECT--
+string(2) "bb"
+string(2) "bb"
+string(2) "bb"
+string(2) "bb"
diff --git a/ext/pdo_pgsql/pgsql_driver.c b/ext/pdo_pgsql/pgsql_driver.c index f913eb7c31..9fa78e0cb1 100644 --- a/ext/pdo_pgsql/pgsql_driver.c +++ b/ext/pdo_pgsql/pgsql_driver.c @@ -750,7 +750,7 @@ static PHP_METHOD(PDO, pgsqlCopyFromFile) /* }}} */ -/* {{{ proto string PDO::pgsqlCopyToFile(string $table_name , $filename, [string $delimiter [, string $null_as [, string $fields]]]) +/* {{{ proto string PDO::pgsqlCopyToFile(string $table_name , string $filename, [string $delimiter [, string $null_as [, string $fields]]]) Returns true if the copy worked fine or false if error */ static PHP_METHOD(PDO, pgsqlCopyToFile) { diff --git a/ext/pgsql/pgsql.c b/ext/pgsql/pgsql.c index 6965589154..704a919712 100644 --- a/ext/pgsql/pgsql.c +++ b/ext/pgsql/pgsql.c @@ -5260,7 +5260,7 @@ PHP_FUNCTION(pg_result_status) } /* }}} */ -/* {{{ proto array pg_get_notify([resource connection[, result_type]]) +/* {{{ proto mixed pg_get_notify([resource connection[, int result_type]]) Get asynchronous notification */ PHP_FUNCTION(pg_get_notify) { @@ -5400,7 +5400,7 @@ static int php_pgsql_fd_cast(php_stream *stream, int cast_as, void **ret) /* {{{ } /* }}} */ -/* {{{ proto resource pg_socket(resource) +/* {{{ proto resource pg_socket(resource connection) Get a read-only handle to the socket underlying the pgsql connection */ PHP_FUNCTION(pg_socket) { @@ -5427,7 +5427,7 @@ PHP_FUNCTION(pg_socket) } /* }}} */ -/* {{{ proto bool pg_consume_input(resource) +/* {{{ proto bool pg_consume_input(resource connection) Reads input on the connection */ PHP_FUNCTION(pg_consume_input) { @@ -5446,7 +5446,7 @@ PHP_FUNCTION(pg_consume_input) } /* }}} */ -/* {{{ proto mixed pg_flush(resource) +/* {{{ proto mixed pg_flush(resource connection) Flush outbound query data on the connection */ PHP_FUNCTION(pg_flush) { diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c index 2252233c47..5c7f26a9fa 100644 --- a/ext/reflection/php_reflection.c +++ b/ext/reflection/php_reflection.c @@ -2153,7 +2153,7 @@ ZEND_METHOD(reflection_function, getExtensionName) } /* }}} */ -/* {{{ proto public void ReflectionGenerator::__construct(Generator) */ +/* {{{ proto public void ReflectionGenerator::__construct(object Generator) */ ZEND_METHOD(reflection_generator, __construct) { zval *generator, *object; @@ -3839,7 +3839,7 @@ ZEND_METHOD(reflection_class, getStaticPropertyValue) } /* }}} */ -/* {{{ proto public void ReflectionClass::setStaticPropertyValue($name, $value) +/* {{{ proto public void ReflectionClass::setStaticPropertyValue(string $name, mixed $value) Sets the value of a static property */ ZEND_METHOD(reflection_class, setStaticPropertyValue) { diff --git a/ext/simplexml/simplexml.c b/ext/simplexml/simplexml.c index 9beb946aea..003ad4cee7 100644 --- a/ext/simplexml/simplexml.c +++ b/ext/simplexml/simplexml.c @@ -1926,7 +1926,7 @@ static int sxe_object_cast(zval *readobj, zval *writeobj, int type) } /* }}} */ -/* {{{ proto object SimpleXMLElement::__toString() U +/* {{{ proto object SimpleXMLElement::__toString() Returns the string content */ SXE_METHOD(__toString) { diff --git a/ext/soap/soap.c b/ext/soap/soap.c index 05c7b857f3..29e09e81fb 100644 --- a/ext/soap/soap.c +++ b/ext/soap/soap.c @@ -1333,7 +1333,7 @@ PHP_METHOD(SoapServer, setClass) /* }}} */ -/* {{{ proto void SoapServer::setObject(object) +/* {{{ proto void SoapServer::setObject(object obj) Sets object which will handle SOAP requests */ PHP_METHOD(SoapServer, setObject) { diff --git a/ext/spl/php_spl.c b/ext/spl/php_spl.c index 917411ab6f..40e3126355 100644 --- a/ext/spl/php_spl.c +++ b/ext/spl/php_spl.c @@ -450,7 +450,7 @@ PHP_FUNCTION(spl_autoload_call) zend_hash_rehash(ht); \ } while (0) -/* {{{ proto bool spl_autoload_register([mixed autoload_function = "spl_autoload" [, throw = true [, prepend]]]) +/* {{{ proto bool spl_autoload_register([mixed autoload_function [, bool throw [, bool prepend]]]) Register given function as __autoload() implementation */ PHP_FUNCTION(spl_autoload_register) { diff --git a/ext/spl/spl_directory.c b/ext/spl/spl_directory.c index 3fed81949a..b159601ad6 100644 --- a/ext/spl/spl_directory.c +++ b/ext/spl/spl_directory.c @@ -978,7 +978,7 @@ SPL_METHOD(DirectoryIterator, getExtension) } /* }}} */ -/* {{{ proto string SplFileInfo::getBasename([string $suffix]) U +/* {{{ proto string SplFileInfo::getBasename([string $suffix]) Returns filename component of path */ SPL_METHOD(SplFileInfo, getBasename) { @@ -1005,7 +1005,7 @@ SPL_METHOD(SplFileInfo, getBasename) } /* }}}*/ -/* {{{ proto string DirectoryIterator::getBasename([string $suffix]) U +/* {{{ proto string DirectoryIterator::getBasename([string $suffix]) Returns filename component of current dir entry */ SPL_METHOD(DirectoryIterator, getBasename) { @@ -1215,7 +1215,7 @@ FileInfoFunction(isDir, FS_IS_DIR) FileInfoFunction(isLink, FS_IS_LINK) /* }}} */ -/* {{{ proto string SplFileInfo::getLinkTarget() U +/* {{{ proto string SplFileInfo::getLinkTarget() Return the target of a symbolic link */ SPL_METHOD(SplFileInfo, getLinkTarget) { @@ -2656,7 +2656,7 @@ SPL_METHOD(SplFileObject, fputcsv) } /* }}} */ -/* {{{ proto void SplFileObject::setCsvControl([string delimiter = ',' [, string enclosure = '"' [, string escape = '\\']]]) +/* {{{ proto void SplFileObject::setCsvControl([string delimiter [, string enclosure [, string escape ]]]) Set the delimiter and enclosure character used in fgetcsv */ SPL_METHOD(SplFileObject, setCsvControl) { diff --git a/ext/spl/spl_dllist.c b/ext/spl/spl_dllist.c index 6dc2e23b3d..dfdbfdab03 100644 --- a/ext/spl/spl_dllist.c +++ b/ext/spl/spl_dllist.c @@ -559,7 +559,7 @@ static HashTable *spl_dllist_object_get_gc(zval *obj, zval **gc_data, int *gc_da } /* }}} */ -/* {{{ proto bool SplDoublyLinkedList::push(mixed $value) +/* {{{ proto bool SplDoublyLinkedList::push(mixed value) Push $value on the SplDoublyLinkedList */ SPL_METHOD(SplDoublyLinkedList, push) { @@ -577,7 +577,7 @@ SPL_METHOD(SplDoublyLinkedList, push) } /* }}} */ -/* {{{ proto bool SplDoublyLinkedList::unshift(mixed $value) +/* {{{ proto bool SplDoublyLinkedList::unshift(mixed value) Unshift $value on the SplDoublyLinkedList */ SPL_METHOD(SplDoublyLinkedList, unshift) { @@ -712,7 +712,7 @@ SPL_METHOD(SplDoublyLinkedList, isEmpty) } /* }}} */ -/* {{{ proto int SplDoublyLinkedList::setIteratorMode($flags) +/* {{{ proto int SplDoublyLinkedList::setIteratorMode(int flags) Set the mode of iteration */ SPL_METHOD(SplDoublyLinkedList, setIteratorMode) { @@ -753,7 +753,7 @@ SPL_METHOD(SplDoublyLinkedList, getIteratorMode) } /* }}} */ -/* {{{ proto bool SplDoublyLinkedList::offsetExists(mixed $index) +/* {{{ proto bool SplDoublyLinkedList::offsetExists(mixed index) Returns whether the requested $index exists. */ SPL_METHOD(SplDoublyLinkedList, offsetExists) { @@ -771,7 +771,7 @@ SPL_METHOD(SplDoublyLinkedList, offsetExists) RETURN_BOOL(index >= 0 && index < intern->llist->count); } /* }}} */ -/* {{{ proto mixed SplDoublyLinkedList::offsetGet(mixed $index) +/* {{{ proto mixed SplDoublyLinkedList::offsetGet(mixed index) Returns the value at the specified $index. */ SPL_METHOD(SplDoublyLinkedList, offsetGet) { @@ -802,7 +802,7 @@ SPL_METHOD(SplDoublyLinkedList, offsetGet) } } /* }}} */ -/* {{{ proto void SplDoublyLinkedList::offsetSet(mixed $index, mixed $newval) +/* {{{ proto void SplDoublyLinkedList::offsetSet(mixed index, mixed newval) Sets the value at the specified $index to $newval. */ SPL_METHOD(SplDoublyLinkedList, offsetSet) { @@ -856,7 +856,7 @@ SPL_METHOD(SplDoublyLinkedList, offsetSet) } } /* }}} */ -/* {{{ proto void SplDoublyLinkedList::offsetUnset(mixed $index) +/* {{{ proto void SplDoublyLinkedList::offsetUnset(mixed index) Unsets the value at the specified $index. */ SPL_METHOD(SplDoublyLinkedList, offsetUnset) { @@ -1226,7 +1226,7 @@ error: } /* }}} */ -/* {{{ proto void SplDoublyLinkedList::add(mixed $index, mixed $newval) +/* {{{ proto void SplDoublyLinkedList::add(mixed index, mixed newval) Inserts a new entry before the specified $index consisting of $newval. */ SPL_METHOD(SplDoublyLinkedList, add) { diff --git a/ext/spl/spl_heap.c b/ext/spl/spl_heap.c index 5d045f7457..f790576b70 100644 --- a/ext/spl/spl_heap.c +++ b/ext/spl/spl_heap.c @@ -579,7 +579,7 @@ SPL_METHOD(SplHeap, isEmpty) } /* }}} */ -/* {{{ proto bool SplHeap::insert(mixed $value) +/* {{{ proto bool SplHeap::insert(mixed value) Push $value on the heap */ SPL_METHOD(SplHeap, insert) { @@ -630,7 +630,7 @@ SPL_METHOD(SplHeap, extract) } /* }}} */ -/* {{{ proto bool SplPriorityQueue::insert(mixed $value, mixed $priority) +/* {{{ proto bool SplPriorityQueue::insert(mixed value, mixed priority) Push $value with the priority $priodiry on the priorityqueue */ SPL_METHOD(SplPriorityQueue, insert) { @@ -736,7 +736,7 @@ SPL_METHOD(SplPriorityQueue, top) /* }}} */ -/* {{{ proto int SplPriorityQueue::setExtractFlags($flags) +/* {{{ proto int SplPriorityQueue::setExtractFlags(int flags) Set the flags of extraction*/ SPL_METHOD(SplPriorityQueue, setExtractFlags) { diff --git a/ext/spl/spl_iterators.c b/ext/spl/spl_iterators.c index ed325a1880..eca51fbca3 100644 --- a/ext/spl/spl_iterators.c +++ b/ext/spl/spl_iterators.c @@ -1602,7 +1602,7 @@ SPL_METHOD(FilterIterator, __construct) spl_dual_it_construct(INTERNAL_FUNCTION_PARAM_PASSTHRU, spl_ce_FilterIterator, zend_ce_iterator, DIT_FilterIterator); } /* }}} */ -/* {{{ proto void CallbackFilterIterator::__construct(Iterator it, callback) +/* {{{ proto void CallbackFilterIterator::__construct(Iterator it, callback func) Create an Iterator from another iterator */ SPL_METHOD(CallbackFilterIterator, __construct) { @@ -1881,7 +1881,7 @@ SPL_METHOD(FilterIterator, next) spl_filter_it_next(getThis(), intern); } /* }}} */ -/* {{{ proto void RecursiveCallbackFilterIterator::__construct(RecursiveIterator it, callback) +/* {{{ proto void RecursiveCallbackFilterIterator::__construct(RecursiveIterator it, callback func) Create a RecursiveCallbackFilterIterator from a RecursiveIterator */ SPL_METHOD(RecursiveCallbackFilterIterator, __construct) { diff --git a/ext/spl/spl_observer.c b/ext/spl/spl_observer.c index e2a55735a3..23cc73f6eb 100644 --- a/ext/spl/spl_observer.c +++ b/ext/spl/spl_observer.c @@ -417,7 +417,7 @@ int spl_object_storage_contains(spl_SplObjectStorage *intern, zval *this, zval * return found; } /* }}} */ -/* {{{ proto void SplObjectStorage::attach($obj, $inf = NULL) +/* {{{ proto void SplObjectStorage::attach(object obj, mixed inf = NULL) Attaches an object to the storage if not yet contained */ SPL_METHOD(SplObjectStorage, attach) { @@ -431,7 +431,7 @@ SPL_METHOD(SplObjectStorage, attach) spl_object_storage_attach(intern, getThis(), obj, inf); } /* }}} */ -/* {{{ proto void SplObjectStorage::detach($obj) +/* {{{ proto void SplObjectStorage::detach(object obj) Detaches an object from the storage */ SPL_METHOD(SplObjectStorage, detach) { @@ -447,7 +447,7 @@ SPL_METHOD(SplObjectStorage, detach) intern->index = 0; } /* }}} */ -/* {{{ proto string SplObjectStorage::getHash($object) +/* {{{ proto string SplObjectStorage::getHash(object obj) Returns the hash of an object */ SPL_METHOD(SplObjectStorage, getHash) { @@ -461,7 +461,7 @@ SPL_METHOD(SplObjectStorage, getHash) } /* }}} */ -/* {{{ proto mixed SplObjectStorage::offsetGet($object) +/* {{{ proto mixed SplObjectStorage::offsetGet(object obj) Returns associated information for a stored object */ SPL_METHOD(SplObjectStorage, offsetGet) { @@ -564,7 +564,7 @@ SPL_METHOD(SplObjectStorage, removeAllExcept) } /* }}} */ -/* {{{ proto bool SplObjectStorage::contains($obj) +/* {{{ proto bool SplObjectStorage::contains(object obj) Determine whethe an object is contained in the storage */ SPL_METHOD(SplObjectStorage, contains) { diff --git a/ext/standard/array.c b/ext/standard/array.c index a998079d64..1cf5da1d01 100644 --- a/ext/standard/array.c +++ b/ext/standard/array.c @@ -4389,7 +4389,7 @@ static void array_bucket_p_sawp(void *p, void *q) /* {{{ */ { } /* }}} */ -/* {{{ proto bool array_multisort(array ar1 [, SORT_ASC|SORT_DESC [, SORT_REGULAR|SORT_NUMERIC|SORT_STRING|SORT_NATURAL|SORT_FLAG_CASE]] [, array ar2 [, SORT_ASC|SORT_DESC [, SORT_REGULAR|SORT_NUMERIC|SORT_STRING|SORT_NATURAL|SORT_FLAG_CASE]], ...]) +/* {{{ proto bool array_multisort(array &$array1 [, mixed $array1_sort_order [, mixed $array1_sort_flags [, mixed ... ]]] Sort multiple arrays at once similar to how ORDER BY clause works in SQL */ PHP_FUNCTION(array_multisort) { diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c index c4e0cee9f1..c96996e091 100644 --- a/ext/standard/basic_functions.c +++ b/ext/standard/basic_functions.c @@ -836,8 +836,9 @@ ZEND_END_ARG_INFO() #endif /* }}} */ /* {{{ assert.c */ -ZEND_BEGIN_ARG_INFO(arginfo_assert, 0) +ZEND_BEGIN_ARG_INFO_EX(arginfo_assert, 0, 0, 1) ZEND_ARG_INFO(0, assertion) + ZEND_ARG_INFO(0, description) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_assert_options, 0, 0, 1) diff --git a/ext/standard/exec.c b/ext/standard/exec.c index 60fd7ba1aa..d13ac454ad 100644 --- a/ext/standard/exec.c +++ b/ext/standard/exec.c @@ -282,10 +282,11 @@ PHPAPI zend_string *php_escape_shell_cmd(char *str) cmd->val[y++] = str[x]; break; #else - /* % is Windows specific for environmental variables, ^%PATH% will - output PATH whil ^%PATH^% not. escapeshellcmd->val will escape all %. + /* % is Windows specific for environmental variables, ^%PATH% will + output PATH while ^%PATH^% will not. escapeshellcmd->val will escape all % and !. */ case '%': + case '!': case '"': case '\'': #endif @@ -369,6 +370,7 @@ PHPAPI zend_string *php_escape_shell_arg(char *str) #ifdef PHP_WIN32 case '"': case '%': + case '!': cmd->val[y++] = ' '; break; #else diff --git a/ext/standard/string.c b/ext/standard/string.c index a5e22842d4..93e0f19e45 100644 --- a/ext/standard/string.c +++ b/ext/standard/string.c @@ -347,7 +347,7 @@ static void php_spn_common_handler(INTERNAL_FUNCTION_PARAMETERS, int behavior) / } /* }}} */ -/* {{{ proto int strspn(string str, string mask [, start [, len]]) +/* {{{ proto int strspn(string str, string mask [, int start [, int len]]) Finds length of initial segment consisting entirely of characters found in mask. If start or/and length is provided works like strspn(substr($s,$start,$len),$good_chars) */ PHP_FUNCTION(strspn) { @@ -355,7 +355,7 @@ PHP_FUNCTION(strspn) } /* }}} */ -/* {{{ proto int strcspn(string str, string mask [, start [, len]]) +/* {{{ proto int strcspn(string str, string mask [, int start [, int len]]) Finds length of initial segment consisting entirely of characters not found in mask. If start or/and length is provide works like strcspn(substr($s,$start,$len),$bad_chars) */ PHP_FUNCTION(strcspn) { @@ -801,9 +801,10 @@ PHPAPI zend_string *php_trim(zend_string *str, char *what, size_t what_len, int if (what) { if (what_len == 1) { + char p = *what; if (mode & 1) { for (i = 0; i < len; i++) { - if (c[i] == *what) { + if (c[i] == p) { trimmed++; } else { break; @@ -816,7 +817,7 @@ PHPAPI zend_string *php_trim(zend_string *str, char *what, size_t what_len, int if (len > 0) { i = len - 1; do { - if (c[i] == *what) { + if (c[i] == p) { len--; } else { break; @@ -1200,12 +1201,12 @@ PHP_FUNCTION(explode) */ PHPAPI void php_implode(const zend_string *delim, zval *arr, zval *return_value) { - zval *tmp; + zval *tmp; int numelems; zend_string *str; char *cptr; size_t len = 0; - zend_string **strings, **strptr, **s; + zend_string **strings, **strptr; numelems = zend_hash_num_elements(Z_ARRVAL_P(arr)); @@ -1222,24 +1223,54 @@ PHPAPI void php_implode(const zend_string *delim, zval *arr, zval *return_value) strptr = strings - 1; ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(arr), tmp) { - *++strptr = zval_get_string(tmp); - len += (*strptr)->len; + if (Z_TYPE_P(tmp) == IS_LONG) { + double val = Z_LVAL_P(tmp); + *++strptr = NULL; + ((zend_long *) (strings + numelems))[strptr - strings] = Z_LVAL_P(tmp); + if (val < 0) { + val = -10 * val; + } + if (val < 10) { + len++; + } else { + len += (int) log10(10 * (double) val); + } + } else { + *++strptr = zval_get_string(tmp); + len += (*strptr)->len; + } } ZEND_HASH_FOREACH_END(); str = zend_string_alloc(len + (numelems - 1) * delim->len, 0); - cptr = str->val; + cptr = str->val + str->len; + *cptr = 0; - for (s = strings; s < strptr; s++) { - memcpy(cptr, (*s)->val, (*s)->len); - cptr += (*s)->len; - zend_string_release(*s); + do { + if (*strptr) { + cptr -= (*strptr)->len; + memcpy(cptr, (*strptr)->val, (*strptr)->len); + zend_string_release(*strptr); + } else { + char *oldPtr = cptr; + char oldVal = *cptr; + zend_long val = ((zend_long *) (strings + numelems))[strptr - strings]; + cptr = zend_print_long_to_buf(cptr, val); + *oldPtr = oldVal; + } + cptr -= delim->len; memcpy(cptr, delim->val, delim->len); - cptr += delim->len; - } + } while (--strptr > strings); - memcpy(cptr, (*s)->val, (*s)->len + 1); - zend_string_release(*s); + if (*strptr) { + memcpy(str->val, (*strptr)->val, (*strptr)->len); + zend_string_release(*strptr); + } else { + char *oldPtr = cptr; + char oldVal = *cptr; + zend_print_long_to_buf(cptr, ((zend_long *) (strings + numelems))[strptr - strings]); + *oldPtr = oldVal; + } efree(strings); RETURN_NEW_STR(str); diff --git a/ext/standard/tests/general_functions/bug44295-win.phpt b/ext/standard/tests/general_functions/bug44295-win.phpt index d210a54d51..222b7beda7 100644 --- a/ext/standard/tests/general_functions/bug44295-win.phpt +++ b/ext/standard/tests/general_functions/bug44295-win.phpt @@ -23,7 +23,7 @@ try { ?> ==DONE== <?php exit(0); ?> ---EXPECT-- +--EXPECTF-- before -in catch: DirectoryIterator::__construct(c:\not\exists\here,c:\not\exists\here): The system cannot find the path specified. (code: 3) +in catch: DirectoryIterator::__construct(c:\not\exists\here,c:\not\exists\here): %s (code: 3) ==DONE== diff --git a/ext/standard/tests/general_functions/escapeshellarg_basic-win32.phpt b/ext/standard/tests/general_functions/escapeshellarg_basic-win32.phpt index 888005633d..d97c1a956b 100644 --- a/ext/standard/tests/general_functions/escapeshellarg_basic-win32.phpt +++ b/ext/standard/tests/general_functions/escapeshellarg_basic-win32.phpt @@ -18,6 +18,7 @@ echo "Simple testcase for escapeshellarg() function\n"; var_dump(escapeshellarg("Mr O'Neil")); var_dump(escapeshellarg("Mr O\'Neil")); var_dump(escapeshellarg("%FILENAME")); +var_dump(escapeshellarg("!FILENAME")); var_dump(escapeshellarg("")); echo "Done\n"; @@ -27,5 +28,6 @@ Simple testcase for escapeshellarg() function string(11) ""Mr O'Neil"" string(12) ""Mr O\'Neil"" string(11) "" FILENAME"" +string(11) "" FILENAME"" string(2) """" Done
\ No newline at end of file diff --git a/ext/standard/tests/general_functions/escapeshellcmd-win32.phpt b/ext/standard/tests/general_functions/escapeshellcmd-win32.phpt index 9fcb99188c..7d2a029b47 100644 --- a/ext/standard/tests/general_functions/escapeshellcmd-win32.phpt +++ b/ext/standard/tests/general_functions/escapeshellcmd-win32.phpt @@ -17,7 +17,8 @@ $data = array( '%^', '#&;`|*?', '~<>\\', - '%NOENV%' + '%NOENV%', + '!NOENV!' ); $count = 1; @@ -46,4 +47,6 @@ string(14) "^#^&^;^`^|^*^?" string(8) "^~^<^>^\" -- Test 8 -- string(9) "^%NOENV^%" +-- Test 9 -- +string(9) "^!NOENV^!" Done diff --git a/ext/standard/var.c b/ext/standard/var.c index fc6be9234a..2870821fad 100644 --- a/ext/standard/var.c +++ b/ext/standard/var.c @@ -1054,7 +1054,7 @@ PHP_FUNCTION(unserialize) } /* }}} */ -/* {{{ proto int memory_get_usage([real_usage]) +/* {{{ proto int memory_get_usage([bool real_usage]) Returns the allocated by PHP memory */ PHP_FUNCTION(memory_get_usage) { zend_bool real_usage = 0; @@ -1067,7 +1067,7 @@ PHP_FUNCTION(memory_get_usage) { } /* }}} */ -/* {{{ proto int memory_get_peak_usage([real_usage]) +/* {{{ proto int memory_get_peak_usage([bool real_usage]) Returns the peak allocated by PHP memory */ PHP_FUNCTION(memory_get_peak_usage) { zend_bool real_usage = 0; diff --git a/ext/xmlrpc/xmlrpc-epi-php.c b/ext/xmlrpc/xmlrpc-epi-php.c index 1d3de75d6d..4c1b6ef785 100644 --- a/ext/xmlrpc/xmlrpc-epi-php.c +++ b/ext/xmlrpc/xmlrpc-epi-php.c @@ -1417,7 +1417,7 @@ PHP_FUNCTION(xmlrpc_get_type) } /* }}} */ -/* {{{ proto bool xmlrpc_is_fault(array) +/* {{{ proto bool xmlrpc_is_fault(array arg) Determines if an array value represents an XMLRPC fault. */ PHP_FUNCTION(xmlrpc_is_fault) { diff --git a/ext/xsl/xsltprocessor.c b/ext/xsl/xsltprocessor.c index 1aa3412aad..f39d17105e 100644 --- a/ext/xsl/xsltprocessor.c +++ b/ext/xsl/xsltprocessor.c @@ -384,7 +384,7 @@ void xsl_ext_function_object_php(xmlXPathParserContextPtr ctxt, int nargs) /* {{ } /* }}} */ -/* {{{ proto void xsl_xsltprocessor_import_stylesheet(domdocument doc); +/* {{{ proto void xsl_xsltprocessor_import_stylesheet(domdocument doc) URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html# Since: */ @@ -613,7 +613,7 @@ static xmlDocPtr php_xsl_apply_stylesheet(zval *id, xsl_object *intern, xsltStyl } /* }}} */ -/* {{{ proto domdocument xsl_xsltprocessor_transform_to_doc(domnode doc); +/* {{{ proto domdocument xsl_xsltprocessor_transform_to_doc(domnode doc) URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html# Since: */ @@ -670,7 +670,7 @@ PHP_FUNCTION(xsl_xsltprocessor_transform_to_doc) } /* }}} end xsl_xsltprocessor_transform_to_doc */ -/* {{{ proto int xsl_xsltprocessor_transform_to_uri(domdocument doc, string uri); +/* {{{ proto int xsl_xsltprocessor_transform_to_uri(domdocument doc, string uri) */ PHP_FUNCTION(xsl_xsltprocessor_transform_to_uri) { @@ -702,7 +702,7 @@ PHP_FUNCTION(xsl_xsltprocessor_transform_to_uri) } /* }}} end xsl_xsltprocessor_transform_to_uri */ -/* {{{ proto string xsl_xsltprocessor_transform_to_xml(domdocument doc); +/* {{{ proto string xsl_xsltprocessor_transform_to_xml(domdocument doc) */ PHP_FUNCTION(xsl_xsltprocessor_transform_to_xml) { @@ -740,7 +740,7 @@ PHP_FUNCTION(xsl_xsltprocessor_transform_to_xml) } /* }}} end xsl_xsltprocessor_transform_to_xml */ -/* {{{ proto bool xsl_xsltprocessor_set_parameter(string namespace, mixed name [, string value]); +/* {{{ proto bool xsl_xsltprocessor_set_parameter(string namespace, mixed name [, string value]) */ PHP_FUNCTION(xsl_xsltprocessor_set_parameter) { @@ -784,7 +784,7 @@ PHP_FUNCTION(xsl_xsltprocessor_set_parameter) } /* }}} end xsl_xsltprocessor_set_parameter */ -/* {{{ proto string xsl_xsltprocessor_get_parameter(string namespace, string name); +/* {{{ proto string xsl_xsltprocessor_get_parameter(string namespace, string name) */ PHP_FUNCTION(xsl_xsltprocessor_get_parameter) { @@ -810,7 +810,7 @@ PHP_FUNCTION(xsl_xsltprocessor_get_parameter) } /* }}} end xsl_xsltprocessor_get_parameter */ -/* {{{ proto bool xsl_xsltprocessor_remove_parameter(string namespace, string name); +/* {{{ proto bool xsl_xsltprocessor_remove_parameter(string namespace, string name) */ PHP_FUNCTION(xsl_xsltprocessor_remove_parameter) { @@ -834,7 +834,7 @@ PHP_FUNCTION(xsl_xsltprocessor_remove_parameter) } /* }}} end xsl_xsltprocessor_remove_parameter */ -/* {{{ proto void xsl_xsltprocessor_register_php_functions([mixed $restrict]); +/* {{{ proto void xsl_xsltprocessor_register_php_functions([mixed $restrict]) */ PHP_FUNCTION(xsl_xsltprocessor_register_php_functions) { @@ -933,7 +933,7 @@ PHP_FUNCTION(xsl_xsltprocessor_get_security_prefs) } /* }}} end xsl_xsltprocessor_get_security_prefs */ -/* {{{ proto bool xsl_xsltprocessor_has_exslt_support(); +/* {{{ proto bool xsl_xsltprocessor_has_exslt_support() */ PHP_FUNCTION(xsl_xsltprocessor_has_exslt_support) { diff --git a/main/fastcgi.c b/main/fastcgi.c index 03dcc57b3c..cd8ca4523c 100644 --- a/main/fastcgi.c +++ b/main/fastcgi.c @@ -132,6 +132,106 @@ static int is_impersonate = 0; #include "fastcgi.h" +typedef struct _fcgi_header { + unsigned char version; + unsigned char type; + unsigned char requestIdB1; + unsigned char requestIdB0; + unsigned char contentLengthB1; + unsigned char contentLengthB0; + unsigned char paddingLength; + unsigned char reserved; +} fcgi_header; + +typedef struct _fcgi_begin_request { + unsigned char roleB1; + unsigned char roleB0; + unsigned char flags; + unsigned char reserved[5]; +} fcgi_begin_request; + +typedef struct _fcgi_begin_request_rec { + fcgi_header hdr; + fcgi_begin_request body; +} fcgi_begin_request_rec; + +typedef struct _fcgi_end_request { + unsigned char appStatusB3; + unsigned char appStatusB2; + unsigned char appStatusB1; + unsigned char appStatusB0; + unsigned char protocolStatus; + unsigned char reserved[3]; +} fcgi_end_request; + +typedef struct _fcgi_end_request_rec { + fcgi_header hdr; + fcgi_end_request body; +} fcgi_end_request_rec; + +typedef struct _fcgi_hash_bucket { + unsigned int hash_value; + unsigned int var_len; + char *var; + unsigned int val_len; + char *val; + struct _fcgi_hash_bucket *next; + struct _fcgi_hash_bucket *list_next; +} fcgi_hash_bucket; + +typedef struct _fcgi_hash_buckets { + unsigned int idx; + struct _fcgi_hash_buckets *next; + struct _fcgi_hash_bucket data[FCGI_HASH_TABLE_SIZE]; +} fcgi_hash_buckets; + +typedef struct _fcgi_data_seg { + char *pos; + char *end; + struct _fcgi_data_seg *next; + char data[1]; +} fcgi_data_seg; + +typedef struct _fcgi_hash { + fcgi_hash_bucket *hash_table[FCGI_HASH_TABLE_SIZE]; + fcgi_hash_bucket *list; + fcgi_hash_buckets *buckets; + fcgi_data_seg *data; +} fcgi_hash; + +typedef struct _fcgi_req_hook fcgi_req_hook; + +struct _fcgi_req_hook { + void(*on_accept)(); + void(*on_read)(); + void(*on_close)(); +}; + +struct _fcgi_request { + int listen_socket; + int tcp; + int fd; + int id; + int keep; +#ifdef TCP_NODELAY + int nodelay; +#endif + int closed; + int in_len; + int in_pad; + + fcgi_header *out_hdr; + + unsigned char *out_pos; + unsigned char out_buf[1024*8]; + unsigned char reserved[sizeof(fcgi_end_request_rec)]; + + fcgi_req_hook hook; + + int has_env; + fcgi_hash env; +}; + /* maybe it's better to use weak name instead */ #ifndef HAVE_ATTRIBUTE_WEAK static fcgi_logger fcgi_log; @@ -772,9 +872,9 @@ static void fcgi_hook_dummy() { return; } -fcgi_request *fcgi_init_request(fcgi_request *req, int listen_socket) +fcgi_request *fcgi_init_request(int listen_socket, void(*on_accept)(), void(*on_read)(), void(*on_close)()) { - memset(req, 0, sizeof(fcgi_request)); + fcgi_request *req = calloc(1, sizeof(fcgi_request)); req->listen_socket = listen_socket; req->fd = -1; req->id = -1; @@ -794,9 +894,9 @@ fcgi_request *fcgi_init_request(fcgi_request *req, int listen_socket) */ req->out_pos = req->out_buf; - req->hook.on_accept = fcgi_hook_dummy; - req->hook.on_read = fcgi_hook_dummy; - req->hook.on_close = fcgi_hook_dummy; + req->hook.on_accept = on_accept ? on_accept : fcgi_hook_dummy; + req->hook.on_read = on_read ? on_read : fcgi_hook_dummy; + req->hook.on_close = on_close ? on_close : fcgi_hook_dummy; #ifdef _WIN32 req->tcp = !GetNamedPipeInfo((HANDLE)_get_osfhandle(req->listen_socket), NULL, NULL, NULL, NULL); @@ -809,6 +909,7 @@ fcgi_request *fcgi_init_request(fcgi_request *req, int listen_socket) void fcgi_destroy_request(fcgi_request *req) { fcgi_hash_destroy(&req->env); + free(req); } static inline ssize_t safe_write(fcgi_request *req, const void *buf, size_t count) @@ -1553,6 +1654,11 @@ int fcgi_finish_request(fcgi_request *req, int force_close) return ret; } +int fcgi_has_env(fcgi_request *req) +{ + return req && req->has_env; +} + char* fcgi_getenv(fcgi_request *req, const char* var, int var_len) { unsigned int val_len; diff --git a/main/fastcgi.h b/main/fastcgi.h index 7e56f0ef89..df7d9ed314 100644 --- a/main/fastcgi.h +++ b/main/fastcgi.h @@ -77,43 +77,6 @@ typedef enum _fcgi_protocol_status { FCGI_UNKNOWN_ROLE = 3 } dcgi_protocol_status; -typedef struct _fcgi_header { - unsigned char version; - unsigned char type; - unsigned char requestIdB1; - unsigned char requestIdB0; - unsigned char contentLengthB1; - unsigned char contentLengthB0; - unsigned char paddingLength; - unsigned char reserved; -} fcgi_header; - -typedef struct _fcgi_begin_request { - unsigned char roleB1; - unsigned char roleB0; - unsigned char flags; - unsigned char reserved[5]; -} fcgi_begin_request; - -typedef struct _fcgi_begin_request_rec { - fcgi_header hdr; - fcgi_begin_request body; -} fcgi_begin_request_rec; - -typedef struct _fcgi_end_request { - unsigned char appStatusB3; - unsigned char appStatusB2; - unsigned char appStatusB1; - unsigned char appStatusB0; - unsigned char protocolStatus; - unsigned char reserved[3]; -} fcgi_end_request; - -typedef struct _fcgi_end_request_rec { - fcgi_header hdr; - fcgi_end_request body; -} fcgi_end_request_rec; - /* FastCGI client API */ typedef void (*fcgi_apply_func)(char *var, unsigned int var_len, char *val, unsigned int val_len, void *arg); @@ -122,69 +85,7 @@ typedef void (*fcgi_apply_func)(char *var, unsigned int var_len, char *val, unsi #define FCGI_HASH_TABLE_MASK (FCGI_HASH_TABLE_SIZE - 1) #define FCGI_HASH_SEG_SIZE 4096 -typedef struct _fcgi_hash_bucket { - unsigned int hash_value; - unsigned int var_len; - char *var; - unsigned int val_len; - char *val; - struct _fcgi_hash_bucket *next; - struct _fcgi_hash_bucket *list_next; -} fcgi_hash_bucket; - -typedef struct _fcgi_hash_buckets { - unsigned int idx; - struct _fcgi_hash_buckets *next; - struct _fcgi_hash_bucket data[FCGI_HASH_TABLE_SIZE]; -} fcgi_hash_buckets; - -typedef struct _fcgi_data_seg { - char *pos; - char *end; - struct _fcgi_data_seg *next; - char data[1]; -} fcgi_data_seg; - -typedef struct _fcgi_hash { - fcgi_hash_bucket *hash_table[FCGI_HASH_TABLE_SIZE]; - fcgi_hash_bucket *list; - fcgi_hash_buckets *buckets; - fcgi_data_seg *data; -} fcgi_hash; - -typedef struct _fcgi_request fcgi_request; -typedef struct _fcgi_req_hook fcgi_req_hook; - -struct _fcgi_req_hook { - void(*on_accept)(); - void(*on_read)(); - void(*on_close)(); -}; - -struct _fcgi_request { - int listen_socket; - int tcp; - int fd; - int id; - int keep; -#ifdef TCP_NODELAY - int nodelay; -#endif - int closed; - int in_len; - int in_pad; - - fcgi_header *out_hdr; - - unsigned char *out_pos; - unsigned char out_buf[1024*8]; - unsigned char reserved[sizeof(fcgi_end_request_rec)]; - - fcgi_req_hook hook; - - int has_env; - fcgi_hash env; -}; +typedef struct _fcgi_request fcgi_request; int fcgi_init(void); void fcgi_shutdown(void); @@ -194,7 +95,7 @@ void fcgi_close(fcgi_request *req, int force, int destroy); int fcgi_in_shutdown(void); void fcgi_terminate(void); int fcgi_listen(const char *path, int backlog); -fcgi_request* fcgi_init_request(fcgi_request *request, int listen_socket); +fcgi_request* fcgi_init_request(int listen_socket, void(*on_accept)(), void(*on_read)(), void(*on_close)()); void fcgi_destroy_request(fcgi_request *req); void fcgi_set_allowed_clients(char *ip); int fcgi_accept_request(fcgi_request *req); @@ -207,6 +108,7 @@ typedef void (*fcgi_logger)(int type, const char *fmt, ...); void fcgi_set_logger(fcgi_logger lg); #endif +int fcgi_has_env(fcgi_request *req); char* fcgi_getenv(fcgi_request *req, const char* var, int var_len); char* fcgi_putenv(fcgi_request *req, char* var, int var_len, char* val); char* fcgi_quick_getenv(fcgi_request *req, const char* var, int var_len, unsigned int hash_value); diff --git a/sapi/cgi/cgi_main.c b/sapi/cgi/cgi_main.c index eb6ef66427..73b9d774a7 100644 --- a/sapi/cgi/cgi_main.c +++ b/sapi/cgi/cgi_main.c @@ -1036,12 +1036,12 @@ static int is_valid_path(const char *path) /* }}} */ #define CGI_GETENV(name) \ - ((request->has_env) ? \ + ((has_env) ? \ FCGI_GETENV(request, name) : \ getenv(name)) #define CGI_PUTENV(name, value) \ - ((request->has_env) ? \ + ((has_env) ? \ FCGI_PUTENV(request, name, value) : \ _sapi_cgi_putenv(name, sizeof(name)-1, value)) @@ -1113,6 +1113,7 @@ static int is_valid_path(const char *path) */ static void init_request_info(fcgi_request *request) { + int has_env = fcgi_has_env(request); char *env_script_filename = CGI_GETENV("SCRIPT_FILENAME"); char *env_path_translated = CGI_GETENV("PATH_TRANSLATED"); char *script_path_translated = env_script_filename; @@ -1734,7 +1735,7 @@ int main(int argc, char *argv[]) int fastcgi; char *bindpath = NULL; int fcgi_fd = 0; - fcgi_request request = {0}; + fcgi_request *request = NULL; int warmup_repeats = 0; int repeats = 1; int benchmark = 0; @@ -1972,7 +1973,7 @@ consult the installation file that came with this distribution, or visit \n\ php_import_environment_variables = cgi_php_import_environment_variables; /* library is already initialized, now init our request */ - fcgi_init_request(&request, fcgi_fd); + request = fcgi_init_request(fcgi_fd, NULL, NULL, NULL); #ifndef PHP_WIN32 /* Pre-fork, if required */ @@ -2101,8 +2102,8 @@ consult the installation file that came with this distribution, or visit \n\ break; case 'h': case '?': - if (request.listen_socket) { - fcgi_destroy_request(&request); + if (request) { + fcgi_destroy_request(request); } fcgi_shutdown(); no_headers = 1; @@ -2125,9 +2126,9 @@ consult the installation file that came with this distribution, or visit \n\ fcgi_impersonate(); } #endif - while (!fastcgi || fcgi_accept_request(&request) >= 0) { - SG(server_context) = fastcgi ? (void *)&request : (void *) 1; - init_request_info(&request); + while (!fastcgi || fcgi_accept_request(request) >= 0) { + SG(server_context) = fastcgi ? (void *)request : (void *) 1; + init_request_info(request); if (!cgi && !fastcgi) { while ((c = php_getopt(argc, argv, OPTIONS, &php_optarg, &php_optind, 0, 2)) != -1) { @@ -2312,7 +2313,7 @@ consult the installation file that came with this distribution, or visit \n\ * get path_translated */ if (php_request_startup() == FAILURE) { if (fastcgi) { - fcgi_finish_request(&request, 1); + fcgi_finish_request(request, 1); } SG(server_context) = NULL; php_module_shutdown(); @@ -2523,7 +2524,7 @@ fastcgi_request_done: /* only fastcgi will get here */ requests++; if (max_requests && (requests == max_requests)) { - fcgi_finish_request(&request, 1); + fcgi_finish_request(request, 1); if (bindpath) { free(bindpath); } @@ -2536,8 +2537,8 @@ fastcgi_request_done: /* end of fastcgi loop */ } - if (request.listen_socket) { - fcgi_destroy_request(&request); + if (request) { + fcgi_destroy_request(request); } fcgi_shutdown(); diff --git a/sapi/fpm/fpm/fpm_main.c b/sapi/fpm/fpm/fpm_main.c index 001355ec1e..e836c7a284 100644 --- a/sapi/fpm/fpm/fpm_main.c +++ b/sapi/fpm/fpm/fpm_main.c @@ -561,7 +561,7 @@ static void cgi_php_load_env_var(char *var, unsigned int var_len, char *val, uns void cgi_php_import_environment_variables(zval *array_ptr) /* {{{ */ { - fcgi_request *request; + fcgi_request *request = NULL; if (Z_TYPE(PG(http_globals)[TRACK_VARS_ENV]) == IS_ARRAY && Z_ARR_P(array_ptr) != Z_ARR(PG(http_globals)[TRACK_VARS_ENV]) && @@ -1391,11 +1391,12 @@ static void init_request_info(void) } /* }}} */ -static void fpm_init_request(fcgi_request *req, int listen_fd) /* {{{ */ { - fcgi_init_request(req, listen_fd); - req->hook.on_accept = fpm_request_accepting; - req->hook.on_read = fpm_request_reading_headers; - req->hook.on_close = fpm_request_finished; +static fcgi_request *fpm_init_request(int listen_fd) /* {{{ */ { + fcgi_request *req = fcgi_init_request(listen_fd, + fpm_request_accepting, + fpm_request_reading_headers, + fpm_request_finished); + return req; } /* }}} */ @@ -1562,7 +1563,7 @@ int main(int argc, char *argv[]) int max_requests = 500; int requests = 0; int fcgi_fd = 0; - fcgi_request request; + fcgi_request *request; char *fpm_config = NULL; char *fpm_prefix = NULL; char *fpm_pid = NULL; @@ -1862,13 +1863,13 @@ consult the installation file that came with this distribution, or visit \n\ php_import_environment_variables = cgi_php_import_environment_variables; /* library is already initialized, now init our request */ - fpm_init_request(&request, fcgi_fd); + request = fpm_init_request(fcgi_fd); zend_first_try { - while (EXPECTED(fcgi_accept_request(&request) >= 0)) { + while (EXPECTED(fcgi_accept_request(request) >= 0)) { char *primary_script = NULL; request_body_fd = -1; - SG(server_context) = (void *) &request; + SG(server_context) = (void *) request; init_request_info(); fpm_request_info(); @@ -1876,7 +1877,7 @@ consult the installation file that came with this distribution, or visit \n\ /* request startup only after we've done all we can to * get path_translated */ if (UNEXPECTED(php_request_startup() == FAILURE)) { - fcgi_finish_request(&request, 1); + fcgi_finish_request(request, 1); SG(server_context) = NULL; php_module_shutdown(); return FPM_EXIT_SOFTWARE; @@ -1969,12 +1970,12 @@ fastcgi_request_done: requests++; if (UNEXPECTED(max_requests && (requests == max_requests))) { - fcgi_finish_request(&request, 1); + fcgi_finish_request(request, 1); break; } /* end of fastcgi loop */ } - fcgi_destroy_request(&request); + fcgi_destroy_request(request); fcgi_shutdown(); if (cgi_sapi_module.php_ini_path_override) { diff --git a/sapi/phpdbg/phpdbg_list.c b/sapi/phpdbg/phpdbg_list.c index c96d8652f0..d38495bf9d 100644 --- a/sapi/phpdbg/phpdbg_list.c +++ b/sapi/phpdbg/phpdbg_list.c @@ -181,7 +181,7 @@ void phpdbg_list_function(const zend_function *fbc) /* {{{ */ const zend_op_array *ops; if (fbc->type != ZEND_USER_FUNCTION) { - phpdbg_error("list", "type=\"internalfunction\" function=\"%s\"", "The function requested (%s) is not user defined", fbc->common.function_name); + phpdbg_error("list", "type=\"internalfunction\" function=\"%s\"", "The function requested (%s) is not user defined", fbc->common.function_name->val); return; } diff --git a/sapi/phpdbg/phpdbg_prompt.c b/sapi/phpdbg/phpdbg_prompt.c index 146532f81e..3b1ec1f19a 100644 --- a/sapi/phpdbg/phpdbg_prompt.c +++ b/sapi/phpdbg/phpdbg_prompt.c @@ -346,9 +346,12 @@ void phpdbg_init(char *init_file, size_t init_file_len, zend_bool use_default) / { if (!init_file && use_default) { char *scan_dir = getenv("PHP_INI_SCAN_DIR"); + char *sys_ini; int i; - phpdbg_try_file_init(PHPDBG_STRL(PHP_CONFIG_FILE_PATH "/" PHPDBG_INIT_FILENAME), 0); + asprintf(&sys_ini, "%s/" PHPDBG_INIT_FILENAME, PHP_CONFIG_FILE_PATH); + phpdbg_try_file_init(sys_ini, strlen(sys_ini), 0); + free(sys_ini); if (!scan_dir) { scan_dir = PHP_CONFIG_FILE_SCAN_DIR; diff --git a/win32/build/config.w32.h.in b/win32/build/config.w32.h.in index 3276fea705..b2ee6f1958 100644 --- a/win32/build/config.w32.h.in +++ b/win32/build/config.w32.h.in @@ -10,7 +10,7 @@ #define NTDDI_VERSION 0x06000100 /* Default PHP / PEAR directories */ -#define PHP_CONFIG_FILE_PATH (getenv("SystemRoot"))?getenv("SystemRoot"):"" +#define PHP_CONFIG_FILE_PATH (getenv("SystemRoot")?getenv("SystemRoot"):"") #define CONFIGURATION_FILE_PATH "php.ini" #define PEAR_INSTALLDIR "@PREFIX@\\pear" #define PHP_BINDIR "@PREFIX@" |
