]> granicus.if.org Git - php/commitdiff
Fix segfault on readline without parameters
authorStanislav Malyshev <stas@php.net>
Thu, 24 Aug 2000 14:41:12 +0000 (14:41 +0000)
committerStanislav Malyshev <stas@php.net>
Thu, 24 Aug 2000 14:41:12 +0000 (14:41 +0000)
ext/readline/readline.c

index 37900e43ca82059cff2aacc786d14284d5025d9d..f838ba616872e7fd50cdd445372cecf8711cb0c1 100644 (file)
@@ -99,9 +99,11 @@ PHP_FUNCTION(readline)
        if (ac < 0 || ac > 1 || zend_get_parameters_ex(ac, &arg) == FAILURE) {
                WRONG_PARAM_COUNT;
        }
-       convert_to_string_ex(arg);
+       if(ac == 1) {
+               convert_to_string_ex(arg);
+       }
 
-       result = readline((*arg)->value.str.val);
+       result = readline(ac?(*arg)->value.str.val:NULL);
 
        if (! result) {
                RETURN_FALSE;