[prev in list] [next in list] [prev in thread] [next in thread] 

List:       php-internals
Subject:    RE: [PHP-DEV] RE: Another Interesting Reference Issue
From:       "Dmitry Stogov" <dmitry () zend ! com>
Date:       2005-05-27 14:32:55
Message-ID: 000001c562c8$fbc637a0$8202a8c0 () thinkpad
[Download RAW message or body]

We need to increment refcount then put for stack, because we can lose zval.

When we pass temporary vallue to function we haven't zval on caller side.
But function may ignore this parameter.
So it live only on stack and destroied on exit from function.

Look into example:

<?php
function foo($a) {}

$a=1;
foo($a,$a+1); 
?>

Thanks. Dmitry.

> -----Original Message-----
> From: Derick Rethans [mailto:derick@php.net] 
> Sent: Friday, May 27, 2005 5:12 PM
> To: Dmitry Stogov
> Cc: Marcus Brg; 'Andi Gutmans'; 'PHP Developers Mailing List'
> Subject: [PHP-DEV] RE: Another Interesting Reference Issue
> 
> 
> On Fri, 27 May 2005, Dmitry Stogov wrote:
> 
> > One for global $tree.
> > 
> > One for stack.
> > 
> > One for local $node.
> > 
> > = 3
> > 
> > What is wrong?
> 
> I didn't say it was wrong :) I was wondering *why* it was three. I 
> didn't know we kept a reference for it being on the stack. Do you 
> perhaps want to divulge what the reason for this is?
> 
> thanks,
> Derick
> 
> -- 
> Derick Rethans
> http://derickrethans.nl | http://ez.no | http://xdebug.org
> 
> -- 
> PHP Internals - PHP Runtime Development Mailing List
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic