big summary OO
| From: | André Langhorst | Date: | Sat, 11 Nov 2000 12:43:24 +0000 |
| Subject: | big summary OO | ||
| References: | 1 2 | Groups: | php.dev php.qa |
| Request: | Send a blank email to php-dev+get-37737@lists.php.net to get a copy of this message | ||
Stas,Zeev,Andi&Co please read 2+3+4; 1+3 in reply to Kirill,Mike,Daniel
there are tree problems here: references, OO (new foo), OO (bug 7515)
1) explanation regarding REFERENCES:
function tt() {
global $a;
$a = 5;
$b = 6;
$a = &$b; }
Of course this prints out 5 outside of the function. And this is correct and it won´t change.
a) creating a local variable $a beeing the same as non-existing global variable $a
b) assigning 5 to local and global variable (hardlinked)
c) assigning 6 to a local variable $b
d) KILLING $a in the local scope replacing and hardlinking it to $b, beeing identical after that, BOTH have the value 6, the GLOBAL variable $a is not influenced by that, NOT AT ALL
there´s not possibility to CHANGE global
anyway what you expected to happen is simply not possible (at first),
we´ve had (stas remembers for sure :) ) enough discussion about this topic and I´m not sure if there are new results in stas' researches trying to serialize references and avoiding REFERENCED variables to be printed out by var_dump() infinitely in some cases
2) regarding REFERENCES, question (stas, zeev, Andi):
in case anoyone of you hasn´t developed biometric identification for variables, is there are possibility to MERGE referenced variables (our last results were that there is no possibility)
function tt() { global $a; $a = 5; $b = 6; merge($a,$b); }so that all these three variables (the global $a, local $a, local $b) reference to the same zval which is taken from the second arguement of merge(), taking from $b? that merge() is exactly what confused people would think the following line should achieve
$a = &$b;in some cases btw, *IF* there´s a possible I´d vote for a new operator to do this 3) regarding some RECENT OO changes
2. Andre reported that foo( new foo) changed its behaviour. As far as I am concerned, the patch should not affect this. The patch doesn?t modify "new"'s behaviour. It only comes into action when "new" is assigned to a variable.IIRC, foo (new foo) wasn´t of interest, it wasn´t even that complicated,simply passing by reference does not work anymore if the function argument is another method, regardless if it passes a variable or not
lookint into it. But recalling Andi and Zeev words, I think this is an issue belonging to passing by reference being banned in PHP 4.0.4.passing by reference from call-time, sure - but not at all, I´m not sure what Zeev did recently but I can´t imagine passing by reference has been eleminated :) 4) regarding NEW and REFERENCES the problem as follows, $foo = new bar(); class bar { function bar() {
global $LIST;
$LIST[]=&$this; }}
case a) if new does not return a reference (as in the past), $LIST[0] and $foo are not referenced
case b) if new returns a references everything should be fine, but Andis patch broke a few other things
SUM-SUMMARY:
there are three problems
a) there´s no possibility to merge references (known)
b)
the patch which made "new" returning references broke some code (unfortunately I cannot cite, I´ve deleted that mail)
OR
the patch which should fix bug 7515 broke some code
OR
both broke some code
c) another sub-patch "detects" non-passed variables, but in fact prevents me from using methods returning variables
what about not applying all patches concurrently? following Andi we´re not in rush...
I hope to have understood, explained and covered everything correctly
andré
--
· André Langhorst · t: +49 571 3201801 ·
· waldschrott@php.net · m: +49 173 9558736 ·
· PHP Quality Assurance · http://qa.php.net ·