Re: [PHP-DEV] ref fix revisited

2005-09-14 Thread Pierre Joye
On 9/14/05, Zeev Suraski <[EMAIL PROTECTED]> wrote: > I think it's probably equally big, but it's besides the point. I'm trying > to understand what we can do (in 5.0.6 or whatever) that will really solve > the problem. The 4.4 approach at this point doesn't appear to be any > better since regar

Re: [PHP-DEV] ref fix revisited

2005-09-14 Thread Rasmus Lerdorf
Zeev Suraski wrote: > At 15:36 14/09/2005, Derick Rethans wrote: > >> On Tue, 13 Sep 2005, Rasmus Lerdorf wrote: >> >> > Zeev Suraski wrote: >> > >> But there are many other cases >> > >> where a function legitimately takes a by-ref and doesn't necessarily >> > >> write to it or the write is a s

Re: [PHP-DEV] ref fix revisited

2005-09-14 Thread Marcus Boerger
Hello Rasmus, my solution was (and i proposed a patch for it here) that we have a way to allow function signatures that pass variables as const just like c++ allows. This i did because first it is faster and second it applies to most pass by ref signatures. Or in other words we could get rid of

Re: [PHP-DEV] ref fix revisited

2005-09-14 Thread Andreas Ahlenstorf
Am 14.09.2005 um 15:40 schrieb Derick Rethans: $filename = sprintf('%s.%s', md5(uniqid(rand(), true)), array_pop (explode('.', $name))); echo $filename; D'oh - I see it. My ISP changed the PHP version once again. It's now PHP 5.0.5. I'm very very sorry for the confusion. A. -- PHP Inte

Re: [PHP-DEV] ref fix revisited

2005-09-14 Thread Derick Rethans
On Wed, 14 Sep 2005, Andreas Ahlenstorf wrote: > Fatal error: Only variables can be passed by reference in /home/www/ > core/media.class.php on line 221 The following script works fine too: echos: [EMAIL PROTECTED]:~$ php-4.4dev -derror_reporting=2047 /tmp/test.php Notice: Undefined variable:

Re: [PHP-DEV] ref fix revisited

2005-09-14 Thread Andreas Ahlenstorf
Am 14.09.2005 um 15:10 schrieb Derick Rethans: Of course it does, you have a ) too much. Besides this, the following I should drink more coffee... script does not make a fatal error: Fatal error: Only variables can be passed by reference in /home/www/ core/media.class.php on line 221

Re: [PHP-DEV] ref fix revisited

2005-09-14 Thread Derick Rethans
On Wed, 14 Sep 2005, Andreas Ahlenstorf wrote: > > Am 14.09.2005 um 14:36 schrieb Derick Rethans: > > > > Since we can detect a ref to a temp var at call time now, how about > > > making a local copy in the function and effectively treat it as a > > > by-value arg and also issue an E_NOTICE or a

Re: [PHP-DEV] ref fix revisited

2005-09-14 Thread Andreas Ahlenstorf
Am 14.09.2005 um 14:36 schrieb Derick Rethans: Since we can detect a ref to a temp var at call time now, how about making a local copy in the function and effectively treat it as a by-value arg and also issue an E_NOTICE or an E_STRICT? I think that would solve the corruption problem without b

Re: [PHP-DEV] ref fix revisited

2005-09-14 Thread Zeev Suraski
At 15:54 14/09/2005, Edin Kadribasic wrote: Zeev Suraski wrote: > At 15:36 14/09/2005, Derick Rethans wrote: > >> On Tue, 13 Sep 2005, Rasmus Lerdorf wrote: >> >> > Zeev Suraski wrote: >> > >> But there are many other cases >> > >> where a function legitimately takes a by-ref and doesn't necess

Re: [PHP-DEV] ref fix revisited

2005-09-14 Thread Edin Kadribasic
Zeev Suraski wrote: > At 15:36 14/09/2005, Derick Rethans wrote: > >> On Tue, 13 Sep 2005, Rasmus Lerdorf wrote: >> >> > Zeev Suraski wrote: >> > >> But there are many other cases >> > >> where a function legitimately takes a by-ref and doesn't necessarily >> > >> write to it or the write is a s

Re: [PHP-DEV] ref fix revisited

2005-09-14 Thread Zeev Suraski
At 15:36 14/09/2005, Derick Rethans wrote: On Tue, 13 Sep 2005, Rasmus Lerdorf wrote: > Zeev Suraski wrote: > >> But there are many other cases > >> where a function legitimately takes a by-ref and doesn't necessarily > >> write to it or the write is a secondary action not required for the cod

Re: [PHP-DEV] ref fix revisited

2005-09-14 Thread Derick Rethans
On Tue, 13 Sep 2005, Rasmus Lerdorf wrote: > Zeev Suraski wrote: > >> But there are many other cases > >> where a function legitimately takes a by-ref and doesn't necessarily > >> write to it or the write is a secondary action not required for the code > >> to work. Could we not catch this on t

Re: [PHP-DEV] ref fix revisited

2005-09-13 Thread Zeev Suraski
At 21:22 13/09/2005, Rasmus Lerdorf wrote: Zeev Suraski wrote: >> But there are many other cases >> where a function legitimately takes a by-ref and doesn't necessarily >> write to it or the write is a secondary action not required for the code >> to work. Could we not catch this on the write

Re: [PHP-DEV] ref fix revisited

2005-09-13 Thread Zeev Suraski
At 18:07 12/09/2005, Derick Rethans wrote: On Mon, 12 Sep 2005, Zeev Suraski wrote: > I don't really agree that it's out of whack, since you are passing a piece of > data by reference, which is an undefined behavior. I agree that it would have > been nice if we could allow for this and only c

Re: [PHP-DEV] ref fix revisited

2005-09-13 Thread Rasmus Lerdorf
Zeev Suraski wrote: >> But there are many other cases >> where a function legitimately takes a by-ref and doesn't necessarily >> write to it or the write is a secondary action not required for the code >> to work. Could we not catch this on the write instead of on the call? > > The problem is t

RE: [PHP-DEV] ref fix revisited

2005-09-13 Thread Sönke Ruempler
Hi, Rasmus Lerdorf wrote on Tuesday, September 13, 2005 3:08 PM: >> As it is too late now anyway, regain BC makes little sense. > > I don't agree. This is one of the main things stopping people from > migrating to PHP5 right now. If we can remove a bit of the migrati

Re: [PHP-DEV] ref fix revisited

2005-09-13 Thread Rasmus Lerdorf
Pierre Joye wrote: > As it is too late now anyway, regain BC makes little sense. I don't agree. This is one of the main things stopping people from migrating to PHP5 right now. If we can remove a bit of the migration pain with some of clever temp var handling, I think it is worthwhile. -Rasmus

Re: [PHP-DEV] ref fix revisited

2005-09-13 Thread Pierre Joye
On 9/13/05, Rasmus Lerdorf <[EMAIL PROTECTED]> wrote: > Just got back from Sri Lanka and am catching up on email. But in > general I don't agree with your statement that things that are quiet in > 5.0.4 must be quiet in 5.0.5. Quietly corrupting memory doesn't really > work. Sometimes we need to

Re: [PHP-DEV] ref fix revisited

2005-09-13 Thread Rasmus Lerdorf
Just got back from Sri Lanka and am catching up on email. But in general I don't agree with your statement that things that are quiet in 5.0.4 must be quiet in 5.0.5. Quietly corrupting memory doesn't really work. Sometimes we need to break things slightly to fix things. My message was more abo

Re: [PHP-DEV] ref fix revisited

2005-09-12 Thread Pierre Joye
Hi Rasmus, You start a new thread for my question, maybe you will get more answers or at least better ones. If it is a reference or not, I do not care, it should not "act" differently. Understand that a quiet code in 5.0.4 must be quiet in 5.0.5. If we add notices in 5.1.0 and then make them fa

Re: [PHP-DEV] ref fix revisited

2005-09-12 Thread Derick Rethans
On Mon, 12 Sep 2005, Zeev Suraski wrote: > I don't really agree that it's out of whack, since you are passing a piece of > data by reference, which is an undefined behavior. I agree that it would have > been nice if we could allow for this and only complain if the data is written > to in the func

Re: [PHP-DEV] ref fix revisited

2005-09-12 Thread Zeev Suraski
At 10:57 12/09/2005, Rasmus Lerdorf wrote: Guys, could we take a look at making the ref to temp var fix a bit narrower? Currently we try to catch it at call-time. This means that something like: current(explode(' ','a b')) as per bug #34468 doesn't work. Now, I think there is a secondary b