trigger mirror
[m6w6/ext-ircclient] / php_ircclient.c
index 3ac38ca10e761c6b6c3b72aaf5b3ac670dead789..e1e6ab65be1dc7d39cc07b30eae784e5ccc75a95 100644 (file)
@@ -19,6 +19,7 @@
 #include <main/php_network.h>
 #include <ext/standard/php_string.h>
 #include <ext/standard/info.h>
+#include <ext/standard/basic_functions.h>
 
 #include <Zend/zend.h>
 #include <Zend/zend_constants.h>
@@ -418,7 +419,7 @@ PHP_METHOD(Session, doConnect)
        if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "bs|ls!", &ip6, &server_str, &server_len, &port, &passwd_str, &passwd_len)) {
                php_ircclient_session_object_t *obj = zend_object_store_get_object(getThis() TSRMLS_CC);
                char *nick = NULL, *user = NULL, *real = NULL;
-               zval *znick, *zuser, *zreal, *tmp;
+               zval *znick, *zuser, *zreal;
 
                znick = zend_read_property(php_ircclient_session_class_entry, getThis(), ZEND_STRL("nick"), 0 TSRMLS_CC);
                SEPARATE_ARG_IF_REF(znick);
@@ -1137,7 +1138,7 @@ static void call_closure(INTERNAL_FUNCTION_PARAMETERS, /* stupid non-const API *
                INIT_PZVAL(&za);
                array_init(&za);
 
-               if (SUCCESS == zend_copy_parameters_array(ZEND_NUM_ARGS(), &za)) {
+               if (SUCCESS == zend_copy_parameters_array(ZEND_NUM_ARGS(), &za TSRMLS_CC)) {
                        php_printf("ircclient: %s - ", prop_str);
                        zend_print_flat_zval_r(&za TSRMLS_CC);
                        php_printf("\n");
@@ -1417,14 +1418,15 @@ PHP_MINFO_FUNCTION(ircclient)
 {
        unsigned int high, low;
        char *version[2];
+       char *lt16 = "<=1.6";
 
        irc_get_version(&high, &low);
        spprintf(&version[1], 0, "%u.%u", high, low);
-#if PHP_IPHP_IRCCLIENT_LIBIRCCLIENT_VERSION_HIGH
+#if PHP_IRCCLIENT_LIBIRCCLIENT_VERSION_HIGH
        spprintf(&version[0], 0, "%u.%u", PHP_IRCCLIENT_LIBIRCCLIENT_VERSION_HIGH, PHP_IRCCLIENT_LIBIRCCLIENT_VERSION_LOW);
 #else
-       /* version <= 1.6 doesn't exposed its version */
-       spprintf(&version[0], 0, "-");
+       /* version <= 1.6 doesn't expose its version */
+       version[0] = lt16;
 #endif
        php_info_print_table_start();
        php_info_print_table_header(2, "IRC client support", "enabled");
@@ -1440,7 +1442,9 @@ PHP_MINFO_FUNCTION(ircclient)
        );
        php_info_print_table_end();
 
-       efree(version[0]);
+       if (version[0] != lt16) {
+               efree(version[0]);
+       }
        efree(version[1]);
 }