]> granicus.if.org Git - php/commitdiff
- Improved warning message to call-time pass-by-reference when used with internal...
authorFelipe Pena <felipe@php.net>
Sun, 15 Jun 2008 18:27:37 +0000 (18:27 +0000)
committerFelipe Pena <felipe@php.net>
Sun, 15 Jun 2008 18:27:37 +0000 (18:27 +0000)
  (http://news.php.net/php.internals/38252)

Zend/zend_compile.c

index da0757bb975212f90035fb9f2fae420a237ad6c6..8580e35bef99be1c8efde431817412e11bc24865 100644 (file)
@@ -2019,14 +2019,19 @@ void zend_do_pass_param(znode *param, zend_uchar op, int offset TSRMLS_DC)
        zend_stack_top(&CG(function_call_stack), (void **) &function_ptr_ptr);
        function_ptr = *function_ptr_ptr;
 
-       if (original_op==ZEND_SEND_REF
-               && !CG(allow_call_time_pass_reference)) {
-               zend_error(E_DEPRECATED,
-                                       "Call-time pass-by-reference has been deprecated; "
-                                       "If you would like to pass it by reference, modify the declaration of %s().  "
-                                       "If you would like to enable call-time pass-by-reference, you can set "
-                                       "allow_call_time_pass_reference to true in your INI file",
-                                       (function_ptr ? function_ptr->common.function_name : "[runtime function name]"));
+       if (original_op == ZEND_SEND_REF && !CG(allow_call_time_pass_reference)) {
+               if (function_ptr &&
+                   function_ptr->common.function_name &&
+                   function_ptr->common.type == ZEND_USER_FUNCTION &&
+                   !ARG_SHOULD_BE_SENT_BY_REF(function_ptr, (zend_uint) offset)) {
+                       zend_error(E_DEPRECATED,
+                                               "Call-time pass-by-reference has been deprecated; "
+                                               "If you would like to pass it by reference, modify the declaration of %s().  "
+                                               "If you would like to enable call-time pass-by-reference, you can set "
+                                               "allow_call_time_pass_reference to true in your INI file", function_ptr->common.function_name);
+               } else {
+                       zend_error(E_DEPRECATED, "Call-time pass-by-reference has been deprecated");
+               }
        }
 
        if (function_ptr) {