php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Return to Bug #71631
Patch update-for-php7 revision 2016-03-01 09:18 UTC by nikitin dot dv27 at gmail dot com

Patch update-for-php7 for stem Bug #71631

Patch version 2016-03-01 09:18 UTC

Return to Bug #71631 | Download this patch
Patch Revisions:

Developer: nikitin.dv27@gmail.com

diff --git a/stem.c b/stem.c
index f827f86..219f605 100644
--- a/stem.c
+++ b/stem.c
@@ -18,75 +18,87 @@ $Id$
 #include "ext/standard/info.h"
 #include "php_stem.h"
 
+ZEND_BEGIN_ARG_INFO_EX(arginfo_stem_params, 0, 0, 1)
+	ZEND_ARG_INFO(0, string)
+	ZEND_ARG_INFO(0, lang)
+ZEND_END_ARG_INFO()
+
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_stem_params_lang_preset, 0, 0, 1)
+	ZEND_ARG_INFO(0, string)
+	ZEND_ARG_INFO(0, lang)
+ZEND_END_ARG_INFO()
+
+
 /* {{{ stem_functions[]
 */
 zend_function_entry stem_functions[] = {
-	PHP_FE(stem,				NULL)
-	PHP_FE(stem_porter,			NULL)
+	PHP_FE(stem,				arginfo_stem_params)
+	PHP_FE(stem_porter,			arginfo_stem_params)
 	PHP_FE(stem_enabled,		NULL)
 
 	#if ENABLE_DANISH
-	PHP_FE(stem_danish,			NULL)
+	PHP_FE(stem_danish,			arginfo_stem_params_lang_preset)
 	#endif
 
 	#if ENABLE_DUTCH
-	PHP_FE(stem_dutch,			NULL)
+	PHP_FE(stem_dutch,			arginfo_stem_params_lang_preset)
 	#endif
 
 	#if ENABLE_ENGLISH
-	PHP_FE(stem_english,		NULL)
+	PHP_FE(stem_english,		arginfo_stem_params_lang_preset)
 	#endif
 
 	#if ENABLE_FINNISH
-	PHP_FE(stem_finnish,		NULL)
+	PHP_FE(stem_finnish,		arginfo_stem_params_lang_preset)
 	#endif
 
 	#if ENABLE_FRENCH
-	PHP_FE(stem_french,			NULL)
+	PHP_FE(stem_french,			arginfo_stem_params_lang_preset)
 	#endif
 
 	#if ENABLE_GERMAN
-	PHP_FE(stem_german,			NULL)
+	PHP_FE(stem_german,			arginfo_stem_params_lang_preset)
 	#endif
 
 	#if ENABLE_HUNGARIAN
-	PHP_FE(stem_hungarian,		NULL)
+	PHP_FE(stem_hungarian,		arginfo_stem_params_lang_preset)
 	#endif
 	
 	#if ENABLE_ITALIAN
-	PHP_FE(stem_italian,		NULL)
+	PHP_FE(stem_italian,		arginfo_stem_params_lang_preset)
 	#endif
 
 	#if ENABLE_NORWEGIAN
-	PHP_FE(stem_norwegian,		NULL)
+	PHP_FE(stem_norwegian,		arginfo_stem_params_lang_preset)
 	#endif
 
 	#if ENABLE_PORTUGUESE
-	PHP_FE(stem_portuguese,		NULL)
+	PHP_FE(stem_portuguese,		arginfo_stem_params_lang_preset)
 	#endif
 
 	#if ENABLE_ROMANIAN
-	PHP_FE(stem_romanian,		NULL)
+	PHP_FE(stem_romanian,		arginfo_stem_params_lang_preset)
 	#endif
 
 	#if ENABLE_RUSSIAN
-	PHP_FE(stem_russian,		NULL)
+	PHP_FE(stem_russian,		arginfo_stem_params_lang_preset)
 	#endif
 
 	#if ENABLE_RUSSIAN_UNICODE
-	PHP_FE(stem_russian_unicode,	NULL)
+	PHP_FE(stem_russian_unicode,	arginfo_stem_params_lang_preset)
 	#endif
 
 	#if ENABLE_SPANISH
-	PHP_FE(stem_spanish,		NULL)
+	PHP_FE(stem_spanish,		arginfo_stem_params_lang_preset)
 	#endif
 
 	#if ENABLE_SWEDISH
-	PHP_FE(stem_swedish,		NULL)
+	PHP_FE(stem_swedish,		arginfo_stem_params_lang_preset)
 	#endif
 
 	#if ENABLE_TURKISH_UNICODE
-	PHP_FE(stem_turkish_unicode,	NULL)
+	PHP_FE(stem_turkish_unicode,	arginfo_stem_params_lang_preset)
 	#endif
 
 	{NULL, NULL, NULL}	
@@ -210,16 +222,17 @@ void php_stem(INTERNAL_FUNCTION_PARAMETERS, long lang)
 	void (*close_env)(struct SN_env*);
 	int (*stem)(struct SN_env*);
 
-	char * incoming;
-	int arglen;
+	const char* incoming;
+	size_t arglen;
 
-	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &incoming, &arglen, &lang) == FAILURE) {
+	if (zend_parse_parameters_ex(0, MIN(ZEND_NUM_ARGS(),2), "s|l", &incoming, &arglen, &lang) == FAILURE) {
 		return;
 	}
 
+
 	/* Empty string */
 	if (arglen <= 0) {
-		RETURN_STRINGL(incoming, arglen, 1);
+		RETURN_STRINGL(incoming, arglen);
 	}
 
 	switch (lang)
@@ -336,7 +349,7 @@ void php_stem(INTERNAL_FUNCTION_PARAMETERS, long lang)
 	stem(z);
 	z->p[z->l]= '\0';
 
-	RETVAL_STRINGL(z->p, z->l, 1);
+	RETVAL_STRINGL(z->p,z->l);
 	close_env(z);
 }
 /* }}} */
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 16:01:29 2024 UTC