logo       

cvs: ZendEngine2(PHP_5_0) / zend_execute.c /tests bug33257.phpt: msg#00057

Subject: cvs: ZendEngine2(PHP_5_0) / zend_execute.c /tests bug33257.phpt
dmitry          Mon Sep 19 12:02:46 2005 EDT

  Modified files:              (Branch: PHP_5_0)
    /ZendEngine2        zend_execute.c 
    /ZendEngine2/tests  bug33257.phpt 
  Log:
  Fixed parameter passing incompatibilities.
  Now it is possible to call array_pop(explode("&","1&2&3")) again.
  
  
http://cvs.php.net/diff.php/ZendEngine2/zend_execute.c?r1=1.652.2.50&r2=1.652.2.51&ty=u
Index: ZendEngine2/zend_execute.c
diff -u ZendEngine2/zend_execute.c:1.652.2.50 
ZendEngine2/zend_execute.c:1.652.2.51
--- ZendEngine2/zend_execute.c:1.652.2.50       Mon Sep 12 13:46:46 2005
+++ ZendEngine2/zend_execute.c  Mon Sep 19 12:02:44 2005
@@ -17,7 +17,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: zend_execute.c,v 1.652.2.50 2005/09/12 17:46:46 pollita Exp $ */
+/* $Id: zend_execute.c,v 1.652.2.51 2005/09/19 16:02:44 dmitry Exp $ */
 
 #define ZEND_INTENSIVE_DEBUGGING 0
 
@@ -3077,6 +3077,8 @@
 
 int zend_send_var_no_ref_handler(ZEND_OPCODE_HANDLER_ARGS)
 {
+       zval *varptr;
+
        if (opline->extended_value & ZEND_ARG_COMPILE_TIME_BOUND) { /* Had 
function_ptr at compile_time */
                if (!(opline->extended_value & ZEND_ARG_SEND_BY_REF)) {
                        return 
zend_send_by_var_helper(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
@@ -3084,20 +3086,26 @@
        } else if (!ARG_SHOULD_BE_SENT_BY_REF(EX(fbc), 
opline->op2.u.opline_num)) {
                return 
zend_send_by_var_helper(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
        }
-       if ((opline->extended_value & ZEND_ARG_SEND_FUNCTION) &&
-           !EX_T(opline->op1.u.var).var.fcall_returned_reference) {
-               zend_error(E_ERROR, "Only variables can be passed by 
reference");
+       
+       varptr = get_zval_ptr(&opline->op1, EX(Ts), &EG(free_op1), BP_VAR_R);
+       if ((!(opline->extended_value & ZEND_ARG_SEND_FUNCTION) ||
+            EX_T(opline->op1.u.var).var.fcall_returned_reference) &&
+           varptr != &EG(uninitialized_zval) && 
+           (PZVAL_IS_REF(varptr) || varptr->refcount == 1)) {
+               varptr->is_ref = 1;
+               varptr->refcount++;
+               zend_ptr_stack_push(&EG(argument_stack), varptr);
        } else {
-               zval *varptr;
-               varptr = get_zval_ptr(&opline->op1, EX(Ts), &EG(free_op1), 
BP_VAR_R);
+               zval *valptr;
 
-               if (varptr != &EG(uninitialized_zval) && (PZVAL_IS_REF(varptr) 
|| varptr->refcount == 1)) {
-                       varptr->is_ref = 1;
-                       varptr->refcount++;
-                       zend_ptr_stack_push(&EG(argument_stack), varptr);
-                       NEXT_OPCODE();
+               zend_error(E_STRICT, "Only variables should be passed by 
reference");
+               ALLOC_ZVAL(valptr);
+               *valptr = *varptr;
+               if (!EG(free_op1)) {
+                       zval_copy_ctor(valptr);
                }
-               zend_error(E_ERROR, "Only variables can be passed by 
reference");
+               INIT_PZVAL(valptr);
+               zend_ptr_stack_push(&EG(argument_stack), valptr);
        }
        NEXT_OPCODE();
 }
http://cvs.php.net/diff.php/ZendEngine2/tests/bug33257.phpt?r1=1.1.2.1&r2=1.1.2.2&ty=u
Index: ZendEngine2/tests/bug33257.phpt
diff -u ZendEngine2/tests/bug33257.phpt:1.1.2.1 
ZendEngine2/tests/bug33257.phpt:1.1.2.2
--- ZendEngine2/tests/bug33257.phpt:1.1.2.1     Wed Jun 22 04:31:02 2005
+++ ZendEngine2/tests/bug33257.phpt     Mon Sep 19 12:02:45 2005
@@ -14,4 +14,10 @@
 print_r(X::getArr());
 ?>
 --EXPECTF--
-Fatal error: Only variables can be passed by reference in %sbug33257.php on 
line 10
+Strict Standards: Only variables should be passed by reference in 
%sbug33257.php on line 10
+Array
+(
+    [0] => a
+    [1] => b
+    [2] => c
+)

-- 
Zend Engine CVS Mailing List (http://cvs.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
audio.irate.dev...    yellowdog.gener...    ietf.ips/2002-0...    xfree86.fonts/2...    busybox/2003-07...    emacs.jdee/2004...    linux.mandrake....    hardware.microc...    user-groups.lin...    science.analysi...    version-control...    db.filemaker.de...    cluster.openmos...    mail.eyebrowse....    text.xml.xerces...    kde.devel.kwrit...    finance.moneyda...    gcc.regression/...    network.routing...    os.freebsd.deve...    recreation.radi...    qnx.openqnx.dev...    python.xml/2002...   
Home | blog view | USPTO Patent Archive | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe