1 diff -urN php-pecl-idn-0.1/idn-0.1/config.m4 php-pecl-idn-cvs/idn-0.1/config.m4
2 --- php-pecl-idn-0.1/idn-0.1/config.m4 2004-04-26 17:41:17.000000000 +0200
3 +++ php-pecl-idn-cvs/idn-0.1/config.m4 2004-04-27 21:36:38.000000000 +0200
7 dnl config.m4 for extension idn
9 -PHP_ARG_WITH(idn, for idn support,
10 -[ --with-idn Include GNU Libidn support])
11 +PHP_ARG_WITH(idn, for GNU Libidn support,
12 +[ --with-idn[=DIR] Include GNU Libidn support])
14 if test "$PHP_IDN" != "no"; then
15 SEARCH_PATH="/usr/local /usr"
16 - SEARCH_FOR="/include/idn.h"
17 + SEARCH_FOR="/include/idna.h"
19 if test -r $PHP_IDN/$SEARCH_FOR; then # path given as parameter
26 - if test "PHP_IDN" == "no"; then
27 + if test -z "$IDN_DIR"; then
28 AC_MSG_RESULT([not found])
29 - AC_MSG_ERROR([Please reinstall the GNU libidn distribution])
30 + AC_MSG_ERROR([Please reinstall the GNU Libidn distribution])
33 + AC_MSG_CHECKING([for optional tld files])
34 + if test -r "$IDN_DIR/include/tld.h"; then
36 + AC_DEFINE(HAVE_TLD,1,[ ])
41 PHP_ADD_INCLUDE($IDN_DIR/include)
42 diff -urN php-pecl-idn-0.1/idn-0.1/EXPERIMENTAL php-pecl-idn-cvs/idn-0.1/EXPERIMENTAL
43 --- php-pecl-idn-0.1/idn-0.1/EXPERIMENTAL 2004-04-26 17:17:39.000000000 +0200
44 +++ php-pecl-idn-cvs/idn-0.1/EXPERIMENTAL 2004-04-27 02:19:11.000000000 +0200
46 +This extension is experimental,
47 +its functions may change their names
48 +or move to extension all together
49 +so do not rely to much on them
50 +you have been warned!
51 diff -urN php-pecl-idn-0.1/idn-0.1/idn.c php-pecl-idn-cvs/idn-0.1/idn.c
52 --- php-pecl-idn-0.1/idn-0.1/idn.c 2004-04-26 17:41:17.000000000 +0200
53 +++ php-pecl-idn-cvs/idn-0.1/idn.c 2008-03-31 11:43:28.000000000 +0200
55 +----------------------------------------------------------------------+
64 PHP_RSHUTDOWN(idn), /* Replace with NULL if there's nothing to do at request end */
66 #if ZEND_MODULE_API_NO >= 20010901
67 - "0.1", /* Replace with version number for your extension */
70 STANDARD_MODULE_PROPERTIES
73 PHP_MINFO_FUNCTION(idn)
75 php_info_print_table_start();
76 - php_info_print_table_header(2, "GNU libidn support", "enabled");
77 - php_info_print_table_row(2, "GNU libidn version", STRINGPREP_VERSION);
78 + php_info_print_table_header(2, "GNU Libidn support", "enabled");
79 + php_info_print_table_row(2, "GNU Libidn version", STRINGPREP_VERSION);
80 + php_info_print_table_row(2, "Extension version", PHP_IDN_VERSION);
81 php_info_print_table_end();
83 /* Remove comments if you have entries in php.ini
85 Converts an UTF-8 encoded string to corresponding ASCII name */
86 PHP_FUNCTION(idn_to_ascii)
88 - /* The domain name the user enters */
89 + /* The domainname the user enters */
93 /* PHP reference for error code */
94 - zval *errorcode = NULL;
96 - /* For returning error messages */
98 + zval *php_errorcode = NULL;
100 /* libidn return values */
104 + char *punycode; /* Punycode represantation of domain String */
105 + int idna_returncode; /* Returned value from idna_to_ascii call */
108 - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|z", &domain, &domain_len, &errorcode) == FAILURE) {
109 + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|z", &domain, &domain_len, &php_errorcode) == FAILURE) {
113 - if (errorcode != NULL && !PZVAL_IS_REF(errorcode)) {
114 - zend_error(E_WARNING, "Second parameter wasn't passed by reference");
115 + if (php_errorcode != NULL && !PZVAL_IS_REF(php_errorcode)) {
116 + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Second parameter wasn't passed by reference");
120 - rc = idna_to_ascii_8z(domain, &p, 0);
121 - if (rc != IDNA_SUCCESS) {
124 - len = sprintf(string, "Couldn't convert domainname");
125 - if (errorcode != NULL) {
126 - ZVAL_LONG(errorcode, rc);
127 + idna_returncode = idna_to_ascii_8z(domain, &punycode, 0);
128 + if (idna_returncode != IDNA_SUCCESS) {
131 + if (php_errorcode != NULL) {
132 + ZVAL_LONG(php_errorcode, idna_returncode);
135 - zend_error(E_WARNING, string);
136 + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Could not convert domainname");
140 - RETVAL_STRINGL(p, strlen(p), 1);
142 + RETVAL_STRING(punycode, 1);
148 /* {{{ proto string idn_to_utf8(string arg)
149 - Converts an ASCII compatible domain name to UTF-8 */
150 + Converts an ASCII compatible domainname to UTF-8 */
151 PHP_FUNCTION(idn_to_utf8)
153 - /* The domain name the user enters */
154 + /* The domainname the user enters */
158 /* PHP reference for error code */
159 - zval *errorcode = NULL;
161 - /* For returning error messages */
163 + zval *php_errorcode = NULL;
165 /* libidn return values */
169 + char *utf8; /* UTF-8 representation of domain */
170 + int idna_returncode; /* Returned value from idna_to_unicode call */
173 - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|z", &domain, &domain_len, &errorcode) == FAILURE) {
174 + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|z", &domain, &domain_len, &php_errorcode) == FAILURE) {
178 - if (errorcode != NULL && !PZVAL_IS_REF(errorcode)) {
179 - zend_error(E_WARNING, "Second parameter wasn't passed by reference");
180 + if (php_errorcode != NULL && !PZVAL_IS_REF(php_errorcode)) {
181 + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Second parameter wasn't passed by reference");
185 - rc = idna_to_unicode_8z8z(domain, &p, 0);
186 - if (rc != IDNA_SUCCESS) {
189 - len = sprintf(string, "Couldn't convert domainname");
190 - if (errorcode != NULL) {
191 - ZVAL_LONG(errorcode, rc);
192 + idna_returncode = idna_to_unicode_8z8z(domain, &utf8, 0);
193 + if (idna_returncode != IDNA_SUCCESS) {
196 + if (php_errorcode != NULL) {
197 + ZVAL_LONG(php_errorcode, idna_returncode);
200 - zend_error(E_WARNING, string);
201 + php_error_docref(NULL TSRMLS_CC, E_WARNING, 'Could not convert domainname');
205 - RETVAL_STRINGL(p, strlen(p), 1);
207 + RETVAL_STRING(utf8, 1);
212 diff -urN php-pecl-idn-0.1/idn-0.1/idn.php php-pecl-idn-cvs/idn-0.1/idn.php
213 --- php-pecl-idn-0.1/idn-0.1/idn.php 1970-01-01 01:00:00.000000000 +0100
214 +++ php-pecl-idn-cvs/idn-0.1/idn.php 2004-04-26 17:41:17.000000000 +0200
217 +if(!extension_loaded('idn')) {
218 + dl('idn.' . PHP_SHLIB_SUFFIX);
221 +$functions = get_extension_funcs($module);
222 +echo "Functions available in the test extension:<br>\n";
223 +foreach($functions as $func) {
224 + echo $func."<br>\n";
227 +$function = 'confirm_' . $module . '_compiled';
228 +if (extension_loaded($module)) {
229 + $str = $function($module);
231 + $str = "Module $module is not compiled into PHP";
235 diff -urN php-pecl-idn-0.1/idn-0.1/php_idn.h php-pecl-idn-cvs/idn-0.1/php_idn.h
236 --- php-pecl-idn-0.1/idn-0.1/php_idn.h 2004-04-26 17:41:17.000000000 +0200
237 +++ php-pecl-idn-cvs/idn-0.1/php_idn.h 2008-03-31 11:43:28.000000000 +0200
239 +----------------------------------------------------------------------+
248 extern zend_module_entry idn_module_entry;
249 #define phpext_idn_ptr &idn_module_entry
251 +#define PHP_IDN_VERSION "0.2.0-dev"
254 #define PHP_IDN_API __declspec(dllexport)
256 diff -urN php-pecl-idn-0.1/idn-0.1/tests/001.phpt php-pecl-idn-cvs/idn-0.1/tests/001.phpt
257 --- php-pecl-idn-0.1/idn-0.1/tests/001.phpt 2004-04-26 17:17:41.000000000 +0200
258 +++ php-pecl-idn-cvs/idn-0.1/tests/001.phpt 2004-04-27 02:19:11.000000000 +0200
261 -Check for GNU libidn
262 +idn: Testing idn_to_ascii & idn_to_utf8
264 <?php @dl('idn.so'); if (!extension_loaded("idn")) print "skip"; ?>
266 diff -urN php-pecl-idn-0.1/idn-0.1/tests/002.phpt php-pecl-idn-cvs/idn-0.1/tests/002.phpt
267 --- php-pecl-idn-0.1/idn-0.1/tests/002.phpt 1970-01-01 01:00:00.000000000 +0100
268 +++ php-pecl-idn-cvs/idn-0.1/tests/002.phpt 2004-04-27 02:19:11.000000000 +0200
271 +idn: Testing error handling on bad input
273 +<?php @dl('idn.so'); if (!extension_loaded("idn")) print "skip"; ?>
280 +$return = idn_to_ascii($in, &$error);
282 +if ($return === false && $error == IDNA_STRINGPREP_ERROR) {
288 +Warning: idn_to_ascii(): Could not convert domainname in %s002.php on line %d
290 diff -urN php-pecl-idn-0.1/package.xml php-pecl-idn-cvs/package.xml
291 --- php-pecl-idn-0.1/package.xml 2004-04-26 17:48:30.000000000 +0200
292 +++ php-pecl-idn-cvs/package.xml 2004-04-26 17:41:17.000000000 +0200
294 <?xml version="1.0" encoding="ISO-8859-1" ?>
295 <!DOCTYPE package SYSTEM "http://pear.php.net/dtd/package-1.0">
296 <package version="1.0">
298 <summary>GNU Libidn</summary>
299 - <description>Binding to the GNU libidn for using Internationalized Domain Names.</description>
302 <user>johannes</user>
308 + Binding to the GNU libidn for using Internationalized Domain Names.
310 + <license>PHP</license>
312 + <state>beta</state>
313 <version>0.1</version>
314 <date>2004-04-26</date>
315 - <license>PHP</license>
316 - <state>beta</state>
317 - <notes>First PECL release</notes>
319 - <dep type="php" rel="ge" version="4"/>
325 <configureoption name="with-idn" default="autodetect" prompt="GNU libidn installation dir?"/>
328 <file role="src" name="config.m4"/>
329 <file role="src" name="idn.c"/>
330 <file role="src" name="php_idn.h"/>
332 <file role="doc" name="CREDITS"/>
333 <file role="doc" name="README"/>
334 <file role="doc" name="EXPERIMENTAL"/>
336 <file role="test" name="tests/001.phpt"/>
339 + <dep type="php" rel="ge" version="4" />