diff -urN php-pecl-idn-0.1/idn-0.1/config.m4 php-pecl-idn-cvs/idn-0.1/config.m4
--- php-pecl-idn-0.1/idn-0.1/config.m4 2004-04-26 17:41:17.000000000 +0200
+++ php-pecl-idn-cvs/idn-0.1/config.m4 2004-04-27 21:36:38.000000000 +0200
@@ -1,12 +1,13 @@
-dnl $Id$
+dnl $Id$
dnl config.m4 for extension idn
-PHP_ARG_WITH(idn, for idn support,
-[ --with-idn Include GNU Libidn support])
+PHP_ARG_WITH(idn, for GNU Libidn support,
+[ --with-idn[=DIR] Include GNU Libidn support])
if test "$PHP_IDN" != "no"; then
SEARCH_PATH="/usr/local /usr"
- SEARCH_FOR="/include/idn.h"
+ SEARCH_FOR="/include/idna.h"
+
if test -r $PHP_IDN/$SEARCH_FOR; then # path given as parameter
IDN_DIR=$PHP_IDN
else
@@ -19,9 +20,17 @@
done
fi
- if test "PHP_IDN" == "no"; then
+ if test -z "$IDN_DIR"; then
AC_MSG_RESULT([not found])
- AC_MSG_ERROR([Please reinstall the GNU libidn distribution])
+ AC_MSG_ERROR([Please reinstall the GNU Libidn distribution])
+ fi
+
+ AC_MSG_CHECKING([for optional tld files])
+ if test -r "$IDN_DIR/include/tld.h"; then
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_TLD,1,[ ])
+ else
+ AC_MSG_RESULT([no])
fi
PHP_ADD_INCLUDE($IDN_DIR/include)
diff -urN php-pecl-idn-0.1/idn-0.1/EXPERIMENTAL php-pecl-idn-cvs/idn-0.1/EXPERIMENTAL
--- php-pecl-idn-0.1/idn-0.1/EXPERIMENTAL 2004-04-26 17:17:39.000000000 +0200
+++ php-pecl-idn-cvs/idn-0.1/EXPERIMENTAL 2004-04-27 02:19:11.000000000 +0200
@@ -0,0 +1,5 @@
+This extension is experimental,
+its functions may change their names
+or move to extension all together
+so do not rely to much on them
+you have been warned!
diff -urN php-pecl-idn-0.1/idn-0.1/idn.c php-pecl-idn-cvs/idn-0.1/idn.c
--- php-pecl-idn-0.1/idn-0.1/idn.c 2004-04-26 17:41:17.000000000 +0200
+++ php-pecl-idn-cvs/idn-0.1/idn.c 2008-03-31 11:43:28.000000000 +0200
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id$ */
+/* $Id$ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -59,7 +59,7 @@
PHP_RSHUTDOWN(idn), /* Replace with NULL if there's nothing to do at request end */
PHP_MINFO(idn),
#if ZEND_MODULE_API_NO >= 20010901
- "0.1", /* Replace with version number for your extension */
+ PHP_IDN_VERSION,
#endif
STANDARD_MODULE_PROPERTIES
};
@@ -153,8 +153,9 @@
PHP_MINFO_FUNCTION(idn)
{
php_info_print_table_start();
- php_info_print_table_header(2, "GNU libidn support", "enabled");
- php_info_print_table_row(2, "GNU libidn version", STRINGPREP_VERSION);
+ php_info_print_table_header(2, "GNU Libidn support", "enabled");
+ php_info_print_table_row(2, "GNU Libidn version", STRINGPREP_VERSION);
+ php_info_print_table_row(2, "Extension version", PHP_IDN_VERSION);
php_info_print_table_end();
/* Remove comments if you have entries in php.ini
@@ -167,94 +168,84 @@
Converts an UTF-8 encoded string to corresponding ASCII name */
PHP_FUNCTION(idn_to_ascii)
{
- /* The domain name the user enters */
+ /* The domainname the user enters */
char *domain = NULL;
int domain_len, len;
/* PHP reference for error code */
- zval *errorcode = NULL;
-
- /* For returning error messages */
- char string[256];
+ zval *php_errorcode = NULL;
/* libidn return values */
- char *p;
- int rc;
- size_t i;
+ char *punycode; /* Punycode represantation of domain String */
+ int idna_returncode; /* Returned value from idna_to_ascii call */
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|z", &domain, &domain_len, &errorcode) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|z", &domain, &domain_len, &php_errorcode) == FAILURE) {
return;
}
- if (errorcode != NULL && !PZVAL_IS_REF(errorcode)) {
- zend_error(E_WARNING, "Second parameter wasn't passed by reference");
+ if (php_errorcode != NULL && !PZVAL_IS_REF(php_errorcode)) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Second parameter wasn't passed by reference");
RETURN_FALSE;
}
- rc = idna_to_ascii_8z(domain, &p, 0);
- if (rc != IDNA_SUCCESS) {
- free(p);
-
- len = sprintf(string, "Couldn't convert domainname");
- if (errorcode != NULL) {
- ZVAL_LONG(errorcode, rc);
+ idna_returncode = idna_to_ascii_8z(domain, &punycode, 0);
+ if (idna_returncode != IDNA_SUCCESS) {
+ free(punycode);
+
+ if (php_errorcode != NULL) {
+ ZVAL_LONG(php_errorcode, idna_returncode);
}
- zend_error(E_WARNING, string);
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Could not convert domainname");
RETURN_FALSE;
}
- RETVAL_STRINGL(p, strlen(p), 1);
- free(p);
+ RETVAL_STRING(punycode, 1);
+ free(punycode);
return;
}
/* }}} */
/* {{{ proto string idn_to_utf8(string arg)
- Converts an ASCII compatible domain name to UTF-8 */
+ Converts an ASCII compatible domainname to UTF-8 */
PHP_FUNCTION(idn_to_utf8)
{
- /* The domain name the user enters */
+ /* The domainname the user enters */
char *domain = NULL;
int domain_len, len;
/* PHP reference for error code */
- zval *errorcode = NULL;
-
- /* For returning error messages */
- char string[256];
+ zval *php_errorcode = NULL;
/* libidn return values */
- char *p;
- int rc;
- size_t i;
+ char *utf8; /* UTF-8 representation of domain */
+ int idna_returncode; /* Returned value from idna_to_unicode call */
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|z", &domain, &domain_len, &errorcode) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|z", &domain, &domain_len, &php_errorcode) == FAILURE) {
return;
}
- if (errorcode != NULL && !PZVAL_IS_REF(errorcode)) {
- zend_error(E_WARNING, "Second parameter wasn't passed by reference");
+ if (php_errorcode != NULL && !PZVAL_IS_REF(php_errorcode)) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Second parameter wasn't passed by reference");
RETURN_FALSE;
}
- rc = idna_to_unicode_8z8z(domain, &p, 0);
- if (rc != IDNA_SUCCESS) {
- free(p);
-
- len = sprintf(string, "Couldn't convert domainname");
- if (errorcode != NULL) {
- ZVAL_LONG(errorcode, rc);
+ idna_returncode = idna_to_unicode_8z8z(domain, &utf8, 0);
+ if (idna_returncode != IDNA_SUCCESS) {
+ free(utf8);
+
+ if (php_errorcode != NULL) {
+ ZVAL_LONG(php_errorcode, idna_returncode);
}
- zend_error(E_WARNING, string);
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, 'Could not convert domainname');
RETURN_FALSE;
}
- RETVAL_STRINGL(p, strlen(p), 1);
- free(p);
+ RETVAL_STRING(utf8, 1);
+ free(utf8);
return;
}
/* }}} */
diff -urN php-pecl-idn-0.1/idn-0.1/idn.php php-pecl-idn-cvs/idn-0.1/idn.php
--- php-pecl-idn-0.1/idn-0.1/idn.php 1970-01-01 01:00:00.000000000 +0100
+++ php-pecl-idn-cvs/idn-0.1/idn.php 2004-04-26 17:41:17.000000000 +0200
@@ -0,0 +1,19 @@
+
+if(!extension_loaded('idn')) {
+ dl('idn.' . PHP_SHLIB_SUFFIX);
+}
+$module = 'idn';
+$functions = get_extension_funcs($module);
+echo "Functions available in the test extension:
\n";
+foreach($functions as $func) {
+ echo $func."
\n";
+}
+echo "
\n";
+$function = 'confirm_' . $module . '_compiled';
+if (extension_loaded($module)) {
+ $str = $function($module);
+} else {
+ $str = "Module $module is not compiled into PHP";
+}
+echo "$str\n";
+?>
diff -urN php-pecl-idn-0.1/idn-0.1/php_idn.h php-pecl-idn-cvs/idn-0.1/php_idn.h
--- php-pecl-idn-0.1/idn-0.1/php_idn.h 2004-04-26 17:41:17.000000000 +0200
+++ php-pecl-idn-cvs/idn-0.1/php_idn.h 2008-03-31 11:43:28.000000000 +0200
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id$ */
+/* $Id$ */
#ifndef PHP_IDN_H
#define PHP_IDN_H
@@ -24,6 +24,8 @@
extern zend_module_entry idn_module_entry;
#define phpext_idn_ptr &idn_module_entry
+#define PHP_IDN_VERSION "0.2.0-dev"
+
#ifdef PHP_WIN32
#define PHP_IDN_API __declspec(dllexport)
#else
diff -urN php-pecl-idn-0.1/idn-0.1/tests/001.phpt php-pecl-idn-cvs/idn-0.1/tests/001.phpt
--- php-pecl-idn-0.1/idn-0.1/tests/001.phpt 2004-04-26 17:17:41.000000000 +0200
+++ php-pecl-idn-cvs/idn-0.1/tests/001.phpt 2004-04-27 02:19:11.000000000 +0200
@@ -1,5 +1,5 @@
--TEST--
-Check for GNU libidn
+idn: Testing idn_to_ascii & idn_to_utf8
--SKIPIF--
--POST--
diff -urN php-pecl-idn-0.1/idn-0.1/tests/002.phpt php-pecl-idn-cvs/idn-0.1/tests/002.phpt
--- php-pecl-idn-0.1/idn-0.1/tests/002.phpt 1970-01-01 01:00:00.000000000 +0100
+++ php-pecl-idn-cvs/idn-0.1/tests/002.phpt 2004-04-27 02:19:11.000000000 +0200
@@ -0,0 +1,20 @@
+--TEST--
+idn: Testing error handling on bad input
+--SKIPIF--
+
+--POST--
+--GET--
+--INI--
+--FILE--
+
+--EXPECTF--
+
+Warning: idn_to_ascii(): Could not convert domainname in %s002.php on line %d
+ok
diff -urN php-pecl-idn-0.1/package.xml php-pecl-idn-cvs/package.xml
--- php-pecl-idn-0.1/package.xml 2004-04-26 17:48:30.000000000 +0200
+++ php-pecl-idn-cvs/package.xml 2004-04-26 17:41:17.000000000 +0200
@@ -1,9 +1,8 @@
idn
GNU Libidn
- Binding to the GNU libidn for using Internationalized Domain Names.
johannes
@@ -12,15 +11,17 @@
lead
+
+ Binding to the GNU libidn for using Internationalized Domain Names.
+
+ PHP
+ beta
0.1
2004-04-26
- PHP
- beta
- First PECL release
-
-
-
+
+ First PECL release
+
@@ -28,10 +29,18 @@
+
+
+
+
+
+