Re[8]: mixing of asign() and assign_by_ref() overwrites external vars
Dmitry Koteroff <[email protected]>
| Newsgroups | gmane.comp.php.smarty.devel |
|---|---|
| Message-ID | <[email protected]> |
D>> $b = "xxx";
D>> $smarty->assign_by_ref("b", $b);
D>> $smarty->assign("b", "!");
D>> echo $b;
D>> What THEORETICALLY should print last echo statement? "!" or
D>> "xxx"? Whad documentation says about that (or should say)? Please
D>> answer.
B> *READ* my previous post for my discussion on this. We already
B> discussed this issue.
B> Why do you create a new example to demonstrate an example
B> that was already given and discussed? You aren't answering my question,
B> you are trying to wiggle out of it be restating my example.
OK, let's close the theme.
Maybe it is useful now to write to the Smarty documentation that
behavour of assign() and assign_by_ref() is EXACTLY the same as
behavour of = and =& operators in PHP?
B> Dmitry, I'm curious -- why are you pushing this so heavily?
Because I have to pass English exams in the end of June and need
some practice. (-;
No-no, it's joke, of course.
I just trying to understand Smarty developers point of view to
any changes - before offering my own big release (if your
remember, I'm trying to "push", as you have said, line number
synchronization ideology). How else could I do it if I would not
speak and discuss impugnable things? (-;
And, of course, I am still agreed with Sebastian Mendel.
B> Have you noticed I am the only one replying? NO ONE CARES. Do you want me to
B> tell you that your patch was really clever and simple and that you came
B> up with it really quick?
Forget about that. (-;
B>> On an ancillary note, it will be interesting to see how everything
B>> pans out in the PHP5 timeframe where all of these PHP4 copy/ref
B>> semantics take on new meanings, but that is another story...
D>> PHP5 does not introduce new meaning for &=. It only introduses
D>> new meaning of object dereferencing.
B> My point is that:
B> $a = new foo;
B> $b = $a; // in php5 this is equivalent to PHP4's $b =& $a; afaik
B> But I'm sorry I mentioned it :)
Not quite.
Operators "=" and "=&" works in PHP5 IDENTICAL to PHP4. But,
"objects" are not objects now, only lightweight "object
pointers". It is pointer copied by "=", not object itself, that's
why it is safe now to use "=" in PHP5.
--
Best regards,
Dmitry Koteroff.
--
Smarty Development Mailing List (http://smarty.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php