com php-src: Deprecate INTL_IDNA_VARIANT_2003: ext/intl/idn/idn.c ext/intl/tests/idn.phpt ext/intl/ tests/idn_uts46_errors.phpt

[email protected] (Christoph Michael Becker)
Newsgroups php.cvs
Message-ID <[email protected]>
Commit:    6cfbb7f9bd4576f8f6172a33d49e7498b3b617e1
Author:    Christoph M. Becker <[email protected]>         Tue, 31 Jan 2017 12:16:29 +0100
Parents:   fba9eb86ec3ee40c77d5b14a7d61283fad91fa06
Branches:  master

Link:       http://git.php.net/?p=php-src.git;a=commitdiff;h=6cfbb7f9bd4576f8f6172a33d49e7498b3b617e1

Log:
Deprecate INTL_IDNA_VARIANT_2003

As of ICU 55.1 the IDNA2003 APIs are deprecated, so we're deprecating
INTL_IDNA_VARIANT_2003 as well, according to
https://wiki.php.net/rfc/deprecate-and-remove-intl_idna_variant_2003.

Changed paths:
  M  ext/intl/idn/idn.c
  M  ext/intl/tests/idn.phpt
  M  ext/intl/tests/idn_uts46_errors.phpt


Diff:
diff --git a/ext/intl/idn/idn.c b/ext/intl/idn/idn.c
index 4a4a09f..adfa81f 100644
--- a/ext/intl/idn/idn.c
+++ b/ext/intl/idn/idn.c
@@ -291,6 +291,10 @@ static void php_intl_idn_handoff(INTERNAL_FUNCTION_PARAMETERS, int mode)
 	}
 	/* don't check options; it wasn't checked before */
 
+	if (variant == INTL_IDN_VARIANT_2003) {
+		php_error_docref(NULL, E_DEPRECATED, "INTL_IDNA_VARIANT_2003 is deprecated");
+	}
+
 	if (idna_info != NULL) {
 		if (variant == INTL_IDN_VARIANT_2003) {
 			php_error_docref0(NULL, E_NOTICE,
diff --git a/ext/intl/tests/idn.phpt b/ext/intl/tests/idn.phpt
index fde822a..6c00c95 100644
--- a/ext/intl/tests/idn.phpt
+++ b/ext/intl/tests/idn.phpt
@@ -13,6 +13,9 @@ echo idn_to_ascii("t\xC3\xA4st.de")."\n";
 echo urlencode(idn_to_utf8('xn--tst-qla.de'))."\n";
 
 ?>
---EXPECT--
+--EXPECTF--
+Deprecated: idn_to_ascii(): INTL_IDNA_VARIANT_2003 is deprecated in %s on line %d
 xn--tst-qla.de
+
+Deprecated: idn_to_utf8(): INTL_IDNA_VARIANT_2003 is deprecated in %s on line %d
 t%C3%A4st.de
\ No newline at end of file
diff --git a/ext/intl/tests/idn_uts46_errors.phpt b/ext/intl/tests/idn_uts46_errors.phpt
index 3b1a2f0..5de890e 100644
--- a/ext/intl/tests/idn_uts46_errors.phpt
+++ b/ext/intl/tests/idn_uts46_errors.phpt
@@ -62,6 +62,8 @@ Warning: idn_to_ascii(): idn_to_ascii: empty domain name in %s on line %d
 bool(false)
 fourth arg for 2003 variant (only notice raised):
 
+Deprecated: idn_to_ascii(): INTL_IDNA_VARIANT_2003 is deprecated in %s on line %d
+
 Notice: idn_to_ascii(): 4 arguments were provided, but INTL_IDNA_VARIANT_2003 only takes 3 - extra argument ignored in %s on line %d
 string(7) "foo.com"
 with error, but no details arg:
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.