diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..4e61e3f --- /dev/null +++ b/LICENSE @@ -0,0 +1,11 @@ +Copyright (c) 2008-2012, Dmitry Zenovich +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. + * The names of contributors of "runkit" may not be used to endorse or promote products derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + diff --git a/php_runkit.h b/php_runkit.h index 7887421..aa0faf8 100644 --- a/php_runkit.h +++ b/php_runkit.h @@ -2,13 +2,13 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2006 The PHP Group | + | Copyright (c) 1997-2006 The PHP Group, (c) 2008-2012 Dmitry Zenovich | +----------------------------------------------------------------------+ - | This source file is subject to version 3.0 of the PHP license, | + | This source file is subject to the new BSD license, | | that is bundled with this package in the file LICENSE, and is | | available through the world-wide-web at the following url: | - | http://www.php.net/license/3_0.txt. | - | If you did not receive a copy of the PHP license and are unable to | + | http://www.opensource.org/licenses/BSD-3-Clause | + | If you did not receive a copy of the 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. | +----------------------------------------------------------------------+ diff --git a/runkit.c b/runkit.c index 0dfd32d..f1906ed 100644 --- a/runkit.c +++ b/runkit.c @@ -2,13 +2,13 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2006 The PHP Group | + | Copyright (c) 1997-2006 The PHP Group, (c) 2008-2012 Dmitry Zenovich | +----------------------------------------------------------------------+ - | This source file is subject to version 3.0 of the PHP license, | + | This source file is subject to the new BSD license, | | that is bundled with this package in the file LICENSE, and is | | available through the world-wide-web at the following url: | - | http://www.php.net/license/3_0.txt. | - | If you did not receive a copy of the PHP license and are unable to | + | http://www.opensource.org/licenses/BSD-3-Clause | + | If you did not receive a copy of the 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. | +----------------------------------------------------------------------+ @@ -139,7 +139,7 @@ zend_module_entry runkit_module_entry = { PHP_RSHUTDOWN(runkit), PHP_MINFO(runkit), #if ZEND_MODULE_API_NO >= 20010901 - PHP_RUNKIT_VERSION, + PHP_RUNKIT_VERSION, #endif STANDARD_MODULE_PROPERTIES }; @@ -174,7 +174,7 @@ static void php_runkit_globals_ctor(zend_runkit_globals *runkit_global TSRMLS_DC #define php_runkit_feature_constant(feature, enabled) \ _php_runkit_feature_constant("RUNKIT_FEATURE_" #feature, sizeof("RUNKIT_FEATURE_" #feature), (enabled), \ CONST_CS | CONST_PERSISTENT, module_number TSRMLS_CC) -static void _php_runkit_feature_constant(const char *name, size_t name_len, zend_bool enabled, +static void _php_runkit_feature_constant(const char *name, size_t name_len, zend_bool enabled, int flags, int module_number TSRMLS_DC) { zend_constant c; diff --git a/runkit_classes.c b/runkit_classes.c index 6e86bb2..84984ef 100644 --- a/runkit_classes.c +++ b/runkit_classes.c @@ -2,13 +2,13 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2006 The PHP Group | + | Copyright (c) 1997-2006 The PHP Group, (c) 2008-2012 Dmitry Zenovich | +----------------------------------------------------------------------+ - | This source file is subject to version 3.0 of the PHP license, | + | This source file is subject to the new BSD license, | | that is bundled with this package in the file LICENSE, and is | | available through the world-wide-web at the following url: | - | http://www.php.net/license/3_0.txt. | - | If you did not receive a copy of the PHP license and are unable to | + | http://www.opensource.org/licenses/BSD-3-Clause | + | If you did not receive a copy of the 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. | +----------------------------------------------------------------------+ diff --git a/runkit_constants.c b/runkit_constants.c index bfc4f6d..da668af 100644 --- a/runkit_constants.c +++ b/runkit_constants.c @@ -2,13 +2,13 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2006 The PHP Group | + | Copyright (c) 1997-2006 The PHP Group, (c) 2008-2012 Dmitry Zenovich | +----------------------------------------------------------------------+ - | This source file is subject to version 3.0 of the PHP license, | + | This source file is subject to the new BSD license, | | that is bundled with this package in the file LICENSE, and is | | available through the world-wide-web at the following url: | - | http://www.php.net/license/3_0.txt. | - | If you did not receive a copy of the PHP license and are unable to | + | http://www.opensource.org/licenses/BSD-3-Clause | + | If you did not receive a copy of the 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. | +----------------------------------------------------------------------+ diff --git a/runkit_functions.c b/runkit_functions.c index c7bbf78..00ae347 100644 --- a/runkit_functions.c +++ b/runkit_functions.c @@ -2,13 +2,13 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2006 The PHP Group | + | Copyright (c) 1997-2006 The PHP Group, (c) 2008-2012 Dmitry Zenovich | +----------------------------------------------------------------------+ - | This source file is subject to version 3.0 of the PHP license, | + | This source file is subject to the new BSD license, | | that is bundled with this package in the file LICENSE, and is | | available through the world-wide-web at the following url: | - | http://www.php.net/license/3_0.txt. | - | If you did not receive a copy of the PHP license and are unable to | + | http://www.opensource.org/licenses/BSD-3-Clause | + | If you did not receive a copy of the 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. | +----------------------------------------------------------------------+ @@ -441,7 +441,7 @@ PHP_FUNCTION(runkit_function_copy) PHP_RUNKIT_DECL_STRING_PARAM(dfunc) zend_function *fe; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, PHP_RUNKIT_STRING_SPEC "/" PHP_RUNKIT_STRING_SPEC "/", PHP_RUNKIT_STRING_PARAM(sfunc), PHP_RUNKIT_STRING_PARAM(dfunc)) == FAILURE) { diff --git a/runkit_import.c b/runkit_import.c index d672482..0b74e3d 100644 --- a/runkit_import.c +++ b/runkit_import.c @@ -2,13 +2,13 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2006 The PHP Group | + | Copyright (c) 1997-2006 The PHP Group, (c) 2008-2012 Dmitry Zenovich | +----------------------------------------------------------------------+ - | This source file is subject to version 3.0 of the PHP license, | + | This source file is subject to the new BSD license, | | that is bundled with this package in the file LICENSE, and is | | available through the world-wide-web at the following url: | - | http://www.php.net/license/3_0.txt. | - | If you did not receive a copy of the PHP license and are unable to | + | http://www.opensource.org/licenses/BSD-3-Clause | + | If you did not receive a copy of the 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. | +----------------------------------------------------------------------+ @@ -43,9 +43,9 @@ static int php_runkit_import_functions(HashTable *function_table, long flags TSR new_key = fe->common.function_name; new_key_len = strlen(new_key) + 1; - if (((type = zend_hash_get_current_key_ex(function_table, &key, &key_len, &idx, 0, &pos)) != HASH_KEY_NON_EXISTANT) && + if (((type = zend_hash_get_current_key_ex(function_table, &key, &key_len, &idx, 0, &pos)) != HASH_KEY_NON_EXISTANT) && fe && fe->type == ZEND_USER_FUNCTION) { - + if (type == HASH_KEY_IS_STRING) { new_key = key; new_key_len = key_len; @@ -112,7 +112,7 @@ static int php_runkit_import_class_methods(zend_class_entry *dce, zend_class_ent zend_function *dfe; int fn_len = strlen(fe->common.function_name); zend_class_entry *fe_scope = php_runkit_locate_scope(ce, fe, fe->common.function_name, fn_len); - + if (fe_scope != ce) { /* This is an inhereted function, let's skip it */ zend_hash_move_forward_ex(&ce->function_table, &pos); @@ -354,7 +354,7 @@ static int php_runkit_import_classes(HashTable *class_table, long flags TSRMLS_D return FAILURE; } - if (((type = zend_hash_get_current_key_ex(EG(class_table), &key, &key_len, &idx, 0, &pos)) != HASH_KEY_NON_EXISTANT) && + if (((type = zend_hash_get_current_key_ex(EG(class_table), &key, &key_len, &idx, 0, &pos)) != HASH_KEY_NON_EXISTANT) && ce && ce->type == ZEND_USER_CLASS) { zend_class_entry *dce; @@ -366,7 +366,7 @@ static int php_runkit_import_classes(HashTable *class_table, long flags TSRMLS_D php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot redeclare class %s", ce->name); continue; } - + if (flags & PHP_RUNKIT_IMPORT_CLASS_METHODS) { php_runkit_import_class_methods(dce, ce, (flags & PHP_RUNKIT_IMPORT_OVERRIDE) TSRMLS_CC); } @@ -465,7 +465,7 @@ static zend_op_array *php_runkit_compile_filename(int type, zval *filename TSRML /* }}} */ /* {{{ array runkit_import(string filename[, long flags]) - Import functions and class definitions from a file + Import functions and class definitions from a file Similar to include(), but doesn't execute root op_array, and allows pre-existing functions/methods to be overridden */ PHP_FUNCTION(runkit_import) { @@ -491,7 +491,7 @@ PHP_FUNCTION(runkit_import) class_table = (HashTable *) emalloc(sizeof(HashTable)); zend_hash_init_ex(class_table, 10, NULL, ZEND_CLASS_DTOR, 0, 0); function_table = (HashTable *) emalloc(sizeof(HashTable)); - zend_hash_init_ex(function_table, 100, NULL, ZEND_FUNCTION_DTOR, 0, 0); + zend_hash_init_ex(function_table, 100, NULL, ZEND_FUNCTION_DTOR, 0, 0); current_class_table = CG(class_table); CG(class_table) = class_table; @@ -499,10 +499,10 @@ PHP_FUNCTION(runkit_import) CG(function_table) = function_table; new_op_array = local_compile_filename(ZEND_INCLUDE, filename TSRMLS_CC); - + CG(class_table) = current_class_table; CG(function_table) = current_function_table; - + if (!new_op_array) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Import Failure"); RETURN_FALSE; diff --git a/runkit_methods.c b/runkit_methods.c index 84763dc..2d531fb 100644 --- a/runkit_methods.c +++ b/runkit_methods.c @@ -2,13 +2,13 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2006 The PHP Group | + | Copyright (c) 1997-2006 The PHP Group, (c) 2008-2012 Dmitry Zenovich | +----------------------------------------------------------------------+ - | This source file is subject to version 3.0 of the PHP license, | + | This source file is subject to the new BSD license, | | that is bundled with this package in the file LICENSE, and is | | available through the world-wide-web at the following url: | - | http://www.php.net/license/3_0.txt. | - | If you did not receive a copy of the PHP license and are unable to | + | http://www.opensource.org/licenses/BSD-3-Clause | + | If you did not receive a copy of the 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. | +----------------------------------------------------------------------+ @@ -161,7 +161,7 @@ int php_runkit_fetch_interface(char *classname, int classname_len, zend_class_en /* {{{ php_runkit_fetch_class_method */ -static int php_runkit_fetch_class_method(char *classname, int classname_len, char *fname, int fname_len, zend_class_entry **pce, zend_function **pfe +static int php_runkit_fetch_class_method(char *classname, int classname_len, char *fname, int fname_len, zend_class_entry **pce, zend_function **pfe TSRMLS_DC) { HashTable *ftable = EG(function_table); @@ -434,7 +434,7 @@ static void php_runkit_method_add_or_update(INTERNAL_FUNCTION_PARAMETERS, int ad } #endif - zend_hash_apply_with_arguments(RUNKIT_53_TSRMLS_PARAM(EG(class_table)), (apply_func_args_t)php_runkit_update_children_methods, 5, ancestor_class, ce, &func, methodname, + zend_hash_apply_with_arguments(RUNKIT_53_TSRMLS_PARAM(EG(class_table)), (apply_func_args_t)php_runkit_update_children_methods, 5, ancestor_class, ce, &func, methodname, methodname_len); if (zend_hash_add_or_update(&ce->function_table, methodname_lower, methodname_len + 1, &func, sizeof(zend_function), NULL, add_or_update) == FAILURE) { @@ -493,7 +493,7 @@ static int php_runkit_method_copy(char *dclass, int dclass_len, char *dfunc, int } dfe = *sfe; - php_runkit_function_copy_ctor(&dfe, estrndup(dfunc, dfunc_len)); + php_runkit_function_copy_ctor(&dfe, estrndup(dfunc, dfunc_len)); #ifdef ZEND_ENGINE_2 dfe.common.scope = dce; @@ -624,7 +624,7 @@ PHP_FUNCTION(runkit_method_rename) } ancestor_class = php_runkit_locate_scope(ce, fe, methodname, methodname_len); - zend_hash_apply_with_arguments(RUNKIT_53_TSRMLS_PARAM(EG(class_table)), (apply_func_args_t)php_runkit_clean_children_methods, 4, ancestor_class, ce, methodname, + zend_hash_apply_with_arguments(RUNKIT_53_TSRMLS_PARAM(EG(class_table)), (apply_func_args_t)php_runkit_clean_children_methods, 4, ancestor_class, ce, methodname, methodname_len); func = *fe; diff --git a/runkit_props.c b/runkit_props.c index 54df0f1..e345954 100644 --- a/runkit_props.c +++ b/runkit_props.c @@ -2,13 +2,13 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2006 The PHP Group | + | Copyright (c) 1997-2006 The PHP Group, (c) 2008-2012 Dmitry Zenovich | +----------------------------------------------------------------------+ - | This source file is subject to version 3.0 of the PHP license, | + | This source file is subject to the new BSD license, | | that is bundled with this package in the file LICENSE, and is | | available through the world-wide-web at the following url: | - | http://www.php.net/license/3_0.txt. | - | If you did not receive a copy of the PHP license and are unable to | + | http://www.opensource.org/licenses/BSD-3-Clause | + | If you did not receive a copy of the 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. | +----------------------------------------------------------------------+ diff --git a/runkit_sandbox.c b/runkit_sandbox.c index f5a730a..d0d22a2 100644 --- a/runkit_sandbox.c +++ b/runkit_sandbox.c @@ -2,13 +2,13 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2006 The PHP Group | + | Copyright (c) 1997-2006 The PHP Group, (c) 2008-2012 Dmitry Zenovich | +----------------------------------------------------------------------+ - | This source file is subject to version 3.0 of the PHP license, | + | This source file is subject to the new BSD license, | | that is bundled with this package in the file LICENSE, and is | | available through the world-wide-web at the following url: | - | http://www.php.net/license/3_0.txt. | - | If you did not receive a copy of the PHP license and are unable to | + | http://www.opensource.org/licenses/BSD-3-Clause | + | If you did not receive a copy of the 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. | +----------------------------------------------------------------------+ @@ -387,7 +387,7 @@ PHP_METHOD(Runkit_Sandbox,__call) zend_closure *closure; closure = (zend_closure *) zend_object_store_get_object(*sandbox_args[i], prior_context); zend_object_store_set_object(*sandbox_args[i], closure TSRMLS_CC); - } else + } else #endif PHP_SANDBOX_CROSS_SCOPE_ZVAL_COPY_CTOR(*sandbox_args[i]); } @@ -733,7 +733,7 @@ static zval *php_runkit_sandbox_read_property(zval *object, zval *member, int ty if (zend_hash_find(&EG(symbol_table), Z_STRVAL_P(member), Z_STRLEN_P(member) + 1, (void**)&value) == SUCCESS) { retval = **value; - prop_found = 1; + prop_found = 1; } } zend_catch { /* Almost certainly impossible... */ @@ -984,7 +984,7 @@ static int php_runkit_sandbox_sapi_ub_write(const char *str, uint str_length TSR } tsrm_set_interpreter_context(objval->context); - return bytes_written; + return bytes_written; } /* }}} */ @@ -1414,7 +1414,7 @@ PHP_FUNCTION(runkit_sandbox_output_handler) } php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Use of runkit_sandbox_output_handler() is deprecated. Use $sandbox['output_handler'] instead."); - objval = PHP_RUNKIT_SANDBOX_FETCHBOX(sandbox); + objval = PHP_RUNKIT_SANDBOX_FETCHBOX(sandbox); if (!objval->active) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Current sandbox is no longer active"); RETURN_NULL(); diff --git a/runkit_sandbox_parent.c b/runkit_sandbox_parent.c index b06e37f..adc4074 100644 --- a/runkit_sandbox_parent.c +++ b/runkit_sandbox_parent.c @@ -2,13 +2,13 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2006 The PHP Group | + | Copyright (c) 1997-2006 The PHP Group, (c) 2008-2012 Dmitry Zenovich | +----------------------------------------------------------------------+ - | This source file is subject to version 3.0 of the PHP license, | + | This source file is subject to the new BSD license, | | that is bundled with this package in the file LICENSE, and is | | available through the world-wide-web at the following url: | - | http://www.php.net/license/3_0.txt. | - | If you did not receive a copy of the PHP license and are unable to | + | http://www.opensource.org/licenses/BSD-3-Clause | + | If you did not receive a copy of the 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. | +----------------------------------------------------------------------+