--TEST--
Check that arguments are freed when calling a deprecated function
+--SKIPIF--
+<?php
+if (!extension_loaded('zend-test')) die('skip zend-test extension not loaded');
--FILE--
<?php
});
try {
- ezmlm_hash(new stdClass);
+ zend_test_deprecated(new stdClass);
} catch (Error $e) {
echo $e->getMessage(), "\n";
}
$ret = new stdClass;
try {
- $ret = ezmlm_hash(new stdClass);
+ $ret = zend_test_deprecated(new stdClass());
} catch (Error $e) {
echo $e->getMessage(), "\n";
}
try {
- $fn = 'ezmlm_hash';
+ $fn = 'zend_test_deprecated';
$fn(new stdClass);
} catch (Error $e) {
echo $e->getMessage(), "\n";
$ret = new stdClass;
try {
- $fn = 'ezmlm_hash';
+ $fn = 'zend_test_deprecated';
$ret = $fn(new stdClass);
} catch (Error $e) {
echo $e->getMessage(), "\n";
?>
--EXPECT--
-Function ezmlm_hash() is deprecated
-Function ezmlm_hash() is deprecated
-Function ezmlm_hash() is deprecated
-Function ezmlm_hash() is deprecated
+Function zend_test_deprecated() is deprecated
+Function zend_test_deprecated() is deprecated
+Function zend_test_deprecated() is deprecated
+Function zend_test_deprecated() is deprecated
/* functions from mail.c */
PHP_FE(mail, arginfo_mail)
- PHP_DEP_FE(ezmlm_hash, arginfo_ezmlm_hash)
/* functions from syslog.c */
#ifdef HAVE_SYSLOG_H
/* mail.c */
-function ezmlm_hash(string $str): int {}
-
/** @param string|array $additional_headers */
function mail(string $to, string $subject, string $message, $additional_headers = UNKNOWN, string $additional_parameters = ""): bool {}
#define arginfo_link arginfo_symlink
#endif
-#define arginfo_ezmlm_hash arginfo_crc32
-
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_mail, 0, 3, _IS_BOOL, 0)
ZEND_ARG_TYPE_INFO(0, to, IS_STRING, 0)
ZEND_ARG_TYPE_INFO(0, subject, IS_STRING, 0)
extern zend_long php_getuid(void);
-/* {{{ proto int ezmlm_hash(string addr)
- Calculate EZMLM list hash value. */
-PHP_FUNCTION(ezmlm_hash)
-{
- char *str = NULL;
- unsigned int h = 5381;
- size_t j, str_len;
-
- ZEND_PARSE_PARAMETERS_START(1, 1)
- Z_PARAM_STRING(str, str_len)
- ZEND_PARSE_PARAMETERS_END();
-
- for (j = 0; j < str_len; j++) {
- h = (h + (h << 5)) ^ (zend_ulong) (unsigned char) tolower(str[j]);
- }
-
- h = (h % 53);
-
- RETURN_LONG((zend_long) h);
-}
-/* }}} */
-
-
static zend_bool php_mail_build_headers_check_field_value(zval *val)
{
size_t len = 0;
#define PHP_MAIL_H
PHP_FUNCTION(mail);
-PHP_FUNCTION(ezmlm_hash);
PHP_MINFO_FUNCTION(mail);
+++ /dev/null
---TEST--
-Test ezmlm_hash() function : basic functionality
---FILE--
-<?php
-/* Prototype : int ezmlm_hash ( string $addr )
- * Description: Calculate the hash value needed by EZMLM.
- * Source code: ext/standard/mail.c
- */
-
-echo "*** Testing ezmlm_hash() : basic functionality ***\n";
-
-var_dump(ezmlm_hash("webmaster@somewhere.com"));
-var_dump(ezmlm_hash("foo@somewhere.com"));
-
-?>
---EXPECTF--
-*** Testing ezmlm_hash() : basic functionality ***
-
-Deprecated: Function ezmlm_hash() is deprecated in %s on line %d
-int(1)
-
-Deprecated: Function ezmlm_hash() is deprecated in %s on line %d
-int(7)
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO(arginfo_zend_test_void_return, IS_VOID, 0)
ZEND_END_ARG_INFO()
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO(arginfo_zend_test_deprecated, IS_VOID, 0)
+ ZEND_ARG_INFO(0, arg1)
+ZEND_END_ARG_INFO()
+
ZEND_BEGIN_ARG_INFO_EX(arginfo_zend_terminate_string, 0, 0, 1)
ZEND_ARG_INFO(1, str)
ZEND_END_ARG_INFO()
/* dummy */
}
+ZEND_FUNCTION(zend_test_deprecated)
+{
+ zval *arg1;
+
+ zend_parse_parameters(ZEND_NUM_ARGS(), "|z", &arg1);
+}
+
/* Create a string without terminating null byte. Must be termined with
* zend_terminate_string() before destruction, otherwise a warning is issued
* in debug builds. */
ZEND_FE(zend_test_array_return, arginfo_zend_test_array_return)
ZEND_FE(zend_test_nullable_array_return, arginfo_zend_test_nullable_array_return)
ZEND_FE(zend_test_void_return, arginfo_zend_test_void_return)
+ ZEND_DEP_FE(zend_test_deprecated, arginfo_zend_test_deprecated)
ZEND_FE(zend_create_unterminated_string, NULL)
ZEND_FE(zend_terminate_string, arginfo_zend_terminate_string)
ZEND_FE(zend_leak_bytes, NULL)