[from internals] Re: ref fix revisited
| From: | Jochem Maas | Date: | Tue, 13 Sep 2005 08:04:44 +0000 |
| Subject: | [from internals] Re: ref fix revisited | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-222251@lists.php.net to get a copy of this message | ||
hello Rasmus,
sorry to interrupt ... but ... could you possibly
spare a moment to explain why the SquirrelMail example you gave
is 'dumb' code? (I for one would like to avoid writing dumb code
wherever possible, and it looks a lot like I line I could have written!)
many thanks and regards,
jochem
Rasmus Lerdorf wrote:
...
SquirrelMail has code like this all over the place: $value = strtolower(array_shift(split('/\w/',trim($value)))); Here array_shift() does of course change the arg, so that is a potential problem. And yes, that's a dumb way to do this, but people write code like this. In some of these array manipulation calls, which seems to account for a number of the BC problems we are having, we could check for a non-ref and behave slightly differently. In the case of array_shift() we could return the first arg and throw a notice. Same would go for reset(), end(), next(), prev() and probably a few others. -Rasmus