diff options
| -rw-r--r-- | php-bug66218.patch | 252 | ||||
| -rw-r--r-- | php54.spec | 43 | 
2 files changed, 22 insertions, 273 deletions
diff --git a/php-bug66218.patch b/php-bug66218.patch deleted file mode 100644 index 6c2d17b..0000000 --- a/php-bug66218.patch +++ /dev/null @@ -1,252 +0,0 @@ -From 3e963f8eb44863ef3d758eabe791190b0fd7bb9a Mon Sep 17 00:00:00 2001 -From: Remi Collet <remi@php.net> -Date: Tue, 10 Dec 2013 16:07:16 +0100 -Subject: [PATCH] Fixed Bug #66218 zend_register_functions breaks reflection - -Functions registered using zend_register_functions instead of zend_module_entry.functions are not seen on reflection. - -Ex: additional_functions from api_module_entry. -Ex: in CLI, dl, cli_set_process_title and cli_get_process_title - -Note: -- also affects functions overrided in extension -  (should be be reported in extension, where overrided, not in original extension) -- also allow extension to call zend_register_functions for various list -  (instead of having a single bug list) ---- - NEWS                                               |  1 + - Zend/tests/bug66218.phpt                           | 21 +++++++ - Zend/zend_builtin_functions.c                      | 51 ++++++++++------- - ext/reflection/php_reflection.c                    | 66 +++++++++------------- - .../tests/ReflectionExtension_bug66218.phpt        | 21 +++++++ - 5 files changed, 101 insertions(+), 59 deletions(-) - create mode 100644 Zend/tests/bug66218.phpt - create mode 100644 ext/reflection/tests/ReflectionExtension_bug66218.phpt - -diff --git a/Zend/tests/bug66218.phpt b/Zend/tests/bug66218.phpt -new file mode 100644 -index 0000000..af7a5ab ---- /dev/null -+++ b/Zend/tests/bug66218.phpt -@@ -0,0 +1,21 @@ -+--TEST-- -+Bug #66218 zend_register_functions breaks reflection -+--SKIPIF-- -+<?php -+if (PHP_SAPI != "cli") die("skip CLI only test"); -+if (!function_exists("dl")) die("skip need dl"); -+?> -+--FILE-- -+<?php -+$tab = get_extension_funcs("standard"); -+$fcts = array("dl"); -+foreach ($fcts as $fct) { -+	if (in_array($fct, $tab)) { -+		echo "$fct Ok\n"; -+	} -+} -+?> -+Done -+--EXPECTF-- -+dl Ok -+Done -diff --git a/Zend/zend_builtin_functions.c b/Zend/zend_builtin_functions.c -index 04f4ebe..12a8fb2 100644 ---- a/Zend/zend_builtin_functions.c -+++ b/Zend/zend_builtin_functions.c -@@ -2452,36 +2452,49 @@ ZEND_FUNCTION(extension_loaded) -    Returns an array with the names of functions belonging to the named extension */ - ZEND_FUNCTION(get_extension_funcs) - { --	char *extension_name; --	int extension_name_len; -+	char *extension_name, *lcname; -+	int extension_name_len, array; - 	zend_module_entry *module; --	const zend_function_entry *func; -- -+	HashPosition iterator; -+	zend_function *zif; - 	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &extension_name, &extension_name_len) == FAILURE) { - 		return; - 	} -- - 	if (strncasecmp(extension_name, "zend", sizeof("zend"))) { --		char *lcname = zend_str_tolower_dup(extension_name, extension_name_len); --		if (zend_hash_find(&module_registry, lcname, --			extension_name_len+1, (void**)&module) == FAILURE) { --			efree(lcname); --			RETURN_FALSE; --		} -+		lcname = zend_str_tolower_dup(extension_name, extension_name_len); -+	} else { -+		lcname = estrdup("core"); -+	} -+	if (zend_hash_find(&module_registry, lcname, -+		extension_name_len+1, (void**)&module) == FAILURE) { - 		efree(lcname); -+		RETURN_FALSE; -+	} -  --		if (!(func = module->functions)) { --			RETURN_FALSE; --		} -+	zend_hash_internal_pointer_reset_ex(CG(function_table), &iterator); -+	if (module->functions) { -+		/* avoid BC break, if functions list is empty, will return an empty array */ -+		array_init(return_value); -+		array = 1; - 	} else { --		func = builtin_functions; -+		array = 0; -+	} -+	while (zend_hash_get_current_data_ex(CG(function_table), (void **) &zif, &iterator) == SUCCESS) { -+		if (zif->common.type==ZEND_INTERNAL_FUNCTION -+			&& zif->internal_function.module == module) { -+			if (!array) { -+				array_init(return_value); -+				array = 1; -+			} -+			add_next_index_string(return_value, zif->common.function_name, 1); -+		} -+		zend_hash_move_forward_ex(CG(function_table), &iterator); - 	} -  --	array_init(return_value); -+	efree(lcname); -  --	while (func->fname) { --		add_next_index_string(return_value, func->fname, 1); --		func++; -+	if (!array) { -+		RETURN_FALSE; - 	} - } - /* }}} */ -diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c -index c4a7c55..803b12b 100644 ---- a/ext/reflection/php_reflection.c -+++ b/ext/reflection/php_reflection.c -@@ -1105,29 +1105,26 @@ static void _extension_string(string *str, zend_module_entry *module, char *inde - 		string_free(&str_constants); - 	} -  --	if (module->functions && module->functions->fname) { -+	{ -+		HashPosition iterator; - 		zend_function *fptr; --		const zend_function_entry *func = module->functions; -- --		string_printf(str, "\n  - Functions {\n"); -- --		/* Is there a better way of doing this? */ --		while (func->fname) { --			int fname_len = strlen(func->fname); --			char *lc_name = zend_str_tolower_dup(func->fname, fname_len); --		 --			if (zend_hash_find(EG(function_table), lc_name, fname_len + 1, (void**) &fptr) == FAILURE) { --				php_error_docref(NULL TSRMLS_CC, E_WARNING, "Internal error: Cannot find extension function %s in global function table", func->fname); --				func++; --				efree(lc_name); --				continue; -+		int first = 1; -+ -+		zend_hash_internal_pointer_reset_ex(CG(function_table), &iterator); -+		while (zend_hash_get_current_data_ex(CG(function_table), (void **) &fptr, &iterator) == SUCCESS) { -+			if (fptr->common.type==ZEND_INTERNAL_FUNCTION -+				&& fptr->internal_function.module == module) { -+				if (first) { -+					string_printf(str, "\n  - Functions {\n"); -+					first = 0; -+				} -+				_function_string(str, fptr, NULL, "    " TSRMLS_CC); - 			} -- --			_function_string(str, fptr, NULL, "    " TSRMLS_CC); --			efree(lc_name); --			func++; -+			zend_hash_move_forward_ex(CG(function_table), &iterator); -+		} -+		if (!first) { -+			string_printf(str, "%s  }\n", indent); - 		} --		string_printf(str, "%s  }\n", indent); - 	} -  - 	{ -@@ -5242,6 +5239,9 @@ ZEND_METHOD(reflection_extension, getFunctions) - { - 	reflection_object *intern; - 	zend_module_entry *module; -+	HashPosition iterator; -+	zval *function; -+	zend_function *fptr; -  - 	if (zend_parse_parameters_none() == FAILURE) { - 		return; -@@ -5249,29 +5249,15 @@ ZEND_METHOD(reflection_extension, getFunctions) - 	GET_REFLECTION_OBJECT_PTR(module); -  - 	array_init(return_value); --	if (module->functions) { --		zval *function; --		zend_function *fptr; --		const zend_function_entry *func = module->functions; -- --		/* Is there a better way of doing this? */ --		while (func->fname) { --			int fname_len = strlen(func->fname); --			char *lc_name = zend_str_tolower_dup(func->fname, fname_len); --			 --			if (zend_hash_find(EG(function_table), lc_name, fname_len + 1, (void**) &fptr) == FAILURE) { --				php_error_docref(NULL TSRMLS_CC, E_WARNING, "Internal error: Cannot find extension function %s in global function table", func->fname); --				func++; --				efree(lc_name); --				continue; --			} -- -+	zend_hash_internal_pointer_reset_ex(CG(function_table), &iterator); -+	while (zend_hash_get_current_data_ex(CG(function_table), (void **) &fptr, &iterator) == SUCCESS) { -+		if (fptr->common.type==ZEND_INTERNAL_FUNCTION -+			&& fptr->internal_function.module == module) { - 			ALLOC_ZVAL(function); - 			reflection_function_factory(fptr, NULL, function TSRMLS_CC); --			add_assoc_zval_ex(return_value, func->fname, fname_len+1, function); --			func++; --			efree(lc_name); -+			add_assoc_zval(return_value, fptr->common.function_name, function); - 		} -+		zend_hash_move_forward_ex(CG(function_table), &iterator); - 	} - } - /* }}} */ -diff --git a/ext/reflection/tests/ReflectionExtension_bug66218.phpt b/ext/reflection/tests/ReflectionExtension_bug66218.phpt -new file mode 100644 -index 0000000..e263624 ---- /dev/null -+++ b/ext/reflection/tests/ReflectionExtension_bug66218.phpt -@@ -0,0 +1,21 @@ -+--TEST-- -+ReflectionExtension::getFunctions() ##6218 zend_register_functions breaks reflection -+--SKIPIF-- -+<?php -+if (!extension_loaded('reflection')) print 'skip missing reflection extension'; -+if (PHP_SAPI != "cli") die("skip CLI only test"); -+if (!function_exists("dl")) die("skip need dl"); -+?> -+--FILE-- -+<?php -+$r = new ReflectionExtension('standard'); -+$t = $r->getFunctions(); -+var_dump($t['dl']); -+?> -+Done -+--EXPECTF-- -+object(ReflectionFunction)#%d (1) { -+  ["name"]=> -+  string(2) "dl" -+} -+Done ---  -1.8.4.3 - @@ -71,13 +71,13 @@  %endif  #global snapdate      201201041830 -#global rcver         RC1 +%global rcver         RC1  Summary: PHP scripting language for creating dynamic web sites  Name: php -Version: 5.4.23 +Version: 5.4.24  %if 0%{?snapdate:1}%{?rcver:1} -Release: 0.2.%{?snapdate}%{?rcver}%{?dist} +Release: 0.1.%{?snapdate}%{?rcver}%{?dist}  %else  Release: 1%{?dist}  %endif @@ -130,7 +130,6 @@ Patch46: php-5.4.9-fixheader.patch  Patch47: php-5.4.9-phpinfo.patch  # Upstream fixes -Patch100: php-bug66218.patch  # Security fixes @@ -190,7 +189,7 @@ easy for developers to write dynamically generated web pages. PHP also  offers built-in database integration for several commercial and  non-commercial database management systems, so writing a  database-enabled webpage with PHP is fairly simple. The most common -use of PHP coding is probably as a replacement for CGI scripts.  +use of PHP coding is probably as a replacement for CGI scripts.  The php package contains the module (often referred to as mod_php)  which adds support for the PHP language to Apache HTTP Server. @@ -205,7 +204,7 @@ Provides: php-readline, php-readline%{?_isa}  Obsoletes: php53-cli, php53u-cli, php54-cli  %description cli -The php-cli package contains the command-line interface  +The php-cli package contains the command-line interface  executing PHP scripts, /usr/bin/php, and the CGI interface. @@ -378,7 +377,7 @@ Obsoletes: php53-pdo, php53u-pdo, php54-pdo  %description pdo  The php-pdo package contains a dynamic shared object that will add  a database access abstraction layer to PHP.  This module provides -a common interface for accessing MySQL, PostgreSQL or other  +a common interface for accessing MySQL, PostgreSQL or other  databases.  %package mysql @@ -513,11 +512,11 @@ The php-interbase package contains a dynamic shared object that will add  database support through Interbase/Firebird to PHP.  InterBase is the name of the closed-source variant of this RDBMS that was -developed by Borland/Inprise.  +developed by Borland/Inprise. -Firebird is a commercially independent project of C and C++ programmers,  -technical advisors and supporters developing and enhancing a multi-platform  -relational database management system based on the source code released by  +Firebird is a commercially independent project of C and C++ programmers, +technical advisors and supporters developing and enhancing a multi-platform +relational database management system based on the source code released by  Inprise Corp (now known as Borland Software Corp) under the InterBase Public  License. @@ -794,7 +793,6 @@ rm -f ext/json/utf8_to_utf16.*  %patch91 -p1 -b .remi-oci8 -%patch100 -p1 -b .bug66218  # Prevent %%doc confusion over LICENSE files  cp Zend/LICENSE Zend/ZEND_LICENSE @@ -981,8 +979,8 @@ ln -sf ../configure          --with-system-tzdata \  %endif  	--with-mhash \ -	$*  -if test $? != 0; then  +	$* +if test $? != 0; then    tail -500 config.log    : configure failed    exit 1 @@ -1640,6 +1638,9 @@ fi  %changelog +* Sat Dec 28 2013 Remi Collet <rcollet@redhat.com> 5.4.24-0.1.RC1 +- test build of 5.4.24RC1 +  * Wed Dec 11 2013 Remi Collet <rcollet@redhat.com> 5.4.23-1  - update to 5.4.23, fix for CVE-2013-6420  - fix zend_register_functions breaks reflection, php bug 66218 @@ -2154,7 +2155,7 @@ fi  - fix provides for obsoleted pecl extension  * Sun Apr 05 2009 Remi Collet <rpms@famillecollet.com> 5.3.0-0.4.RC1.el5.remi -- EL5 rebuild without new sqlite3 extension  +- EL5 rebuild without new sqlite3 extension  * Wed Mar 25 2009 Remi Collet <rpms@famillecollet.com> 5.3.0-0.4.RC1.fc10.remi  - add php-enchant sub-package (new extension) @@ -2207,11 +2208,11 @@ fi  - use system GD instead of bundled GD when >= 2.0.35 (Fedora >= 6)  * Sun Aug 17 2008 Remi Collet <rpms@famillecollet.com> 5.3.0-0.1.alpha2-dev.200808170830.fc9.remi -- new snapshot (5.3.0alpha2-dev)  +- new snapshot (5.3.0alpha2-dev)  - php-5.2.4-tests-dashn.patch applied upstream  * Sun Aug 10 2008 Remi Collet <rpms@famillecollet.com> 5.3.0-0.1.alpha2-dev.200808101630.fc9.remi -- new snapshot (5.3.0alpha2-dev)  +- new snapshot (5.3.0alpha2-dev)  - no more dbase extension  * Wed Aug 06 2008 Remi Collet <rpms@famillecollet.com> 5.3.0-0.1.alpha2-dev.200808061630.fc9.remi @@ -2433,10 +2434,10 @@ fi  - add disclaimer  * Sat Oct 14 2006 Remi Collet <rpms@famillecollet.com> 5.2.0-0.200610140830.fc5.remi -- latest snapshot  +- latest snapshot  * Sun Oct  8 2006 Remi Collet <rpms@famillecollet.com> 5.2.0-0.200610081430.fc5.remi -- latest snapshot  +- latest snapshot  * Sun Oct  1 2006 Remi Collet <rpms@famillecollet.com> 5.2.0-0.200610011230.fc5.remi  - latest snapshot for http://bugs.php.net/bug.php?id=37103 @@ -2461,7 +2462,7 @@ fi  * Sat Jun 24 2006 Remi Collet <rpms@famillecollet.com> 5.1.4-2.fc{3,4,5}.remi  - rebuild fromFC3, FC4 & FC5 (from rawhide)  - build with oracle-instantclient 10.2.0.2 -- requires libclntsh.so.10.1 (not oracle-instantclient-basic)  +- requires libclntsh.so.10.1 (not oracle-instantclient-basic)  * Fri Jun  9 2006 Joe Orton <jorton@redhat.com> 5.1.4-8  - Provide php-posix (#194583) @@ -2530,7 +2531,7 @@ fi  - update to 5.1.2  * Sat Jan  7 2006 Remi Collet <remi.collet@univ-reims.fr> 5.1.1-2.fc{3,4}.remi -- rebuild with mhash and mcrypt  +- rebuild with mhash and mcrypt  * Thu Jan  5 2006 Joe Orton <jorton@redhat.com> 5.1.1-8  - rebuild again  | 
