]> granicus.if.org Git - php/commitdiff
- Fixed invalid free in call_user_method() function
authorFelipe Pena <felipe@php.net>
Tue, 22 Nov 2011 12:47:08 +0000 (12:47 +0000)
committerFelipe Pena <felipe@php.net>
Tue, 22 Nov 2011 12:47:08 +0000 (12:47 +0000)
ext/standard/basic_functions.c
ext/standard/tests/general_functions/call_user_method_002.phpt [new file with mode: 0644]

index 3e65c024274fbfeb7fa852d63a90c4c976ad0d0d..0068b96e90657d0bbc3601f3f2bad7a47e12fb2a 100644 (file)
@@ -4797,7 +4797,9 @@ PHP_FUNCTION(call_user_method)
                Z_TYPE_P(object) != IS_STRING
        ) {
                php_error_docref(NULL TSRMLS_CC, E_WARNING, "Second argument is not an object or class name");
-               efree(params);
+               if (params) {
+                       efree(params);
+               }
                RETURN_FALSE;
        }
 
diff --git a/ext/standard/tests/general_functions/call_user_method_002.phpt b/ext/standard/tests/general_functions/call_user_method_002.phpt
new file mode 100644 (file)
index 0000000..054bc3e
--- /dev/null
@@ -0,0 +1,12 @@
+--TEST--
+call_user_method() Invalid free
+--FILE--
+<?php
+
+call_user_method("1", $arr1);
+
+?>
+--EXPECTF--
+Deprecated: Function call_user_method() is deprecated in %s on line %d
+
+Warning: call_user_method(): Second argument is not an object or class name in %s on line %d