Re[6]: 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>> But you surely can not modify API nor use deprecated syntax.
B> Grrr. It does modify the API. It introduces pass-by-reference into
B> assign() which is not what is allowed in the current or previous
B> versions.
It does not introduce that. Please see code in previous mail
carefully.
D>> So, now API is not touched, deprecated & call works as without &,
D>> but assign() after assign_by_ref() does not modify source
D>> variable.
B> If it doesn't change the source variable, what was the point of using a
B> assign_by_ref() in the first place?
Of course, to pass objects to template without copying.
$b = "xxx";
$smarty->assign_by_ref("b", $b);
$smarty->assign("b", "!");
echo $b;
What THEORETICALLY should print last echo statement? "!" or
"xxx"? Whad documentation says about that (or should say)? Please
answer.
D>> P.S.
D>> It is now question of principle, of course, not practical.
B> Yes, if it was a practical issue, I'm sure I (and others) would lend
B> support behind it or something like it. If it is a matter of principle,
B> what do you suppose the principle at stake is?
See example above. That is the question.
B> On an ancillary note, it will be interesting to see how everything pans
B> out in the PHP5 timeframe where all of these PHP4 copy/ref semantics
B> take on new meanings, but that is another story...
PHP5 does not introduce new meaning for &=. It only introduses
new meaning of object dereferencing.
--
Best regards,
Dmitry Koteroff.
--
Smarty Development Mailing List (http://smarty.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php