Re: Connecting data
| From: | Steph | Date: | Mon, 06 Dec 2004 13:58:43 +0000 |
| Subject: | Re: Connecting data | ||
| References: | 1 2 3 4 5 6 7 8 9 10 11 | Groups: | php.gtk.general |
| Request: | Send a blank email to php-gtk-general+get-5310@lists.php.net to get a copy of this message | ||
What on earth were you doing to it to make it segfault? :)
----- Original Message -----
From: "Gregory Wild-Smith" <greg@twilightuniverse.com>
To: <php-gtk-general@lists.php.net>
Sent: Monday, December 06, 2004 3:55 PM
Subject: Re: [PHP-GTK] Connecting data
> That made perfect sense... and yes, now I feel dumb for not spotting that.
>
> It will use php5? the rather unstable version of php that no-one uses,
that
> tends to segfault? Hmmm... I guess its not going to be coming out for a
> while then ;)
>
> -- Greg
>
> ----- Original Message -----
> From: "Scott Mattocks" <scott@crisscott.com>
> To: "Gregory Wild-Smith" <greg@twilightuniverse.com>
> Cc: <php-gtk-general@lists.php.net>
> Sent: Monday, December 06, 2004 1:38 PM
> Subject: Re: [PHP-GTK] Connecting data
>
>
> > Gregory Wild-Smith wrote:
> >> I didn't realise the callback was passed as a copy, that does make the
> >> behavior make more sense. However I've never encountered this behavior
in
> >> PHP before. Perhaps that's just me. It is however very anoying ;) Why
> >> will php-gtk2 not do this?
> >
> > The callback isn't passed as a copy. The copy is made when you put $this
> > into the array. The array that you passing to the callback is being
passed
> > by reference because of the connect() function signature. When you call
> > connect() with an array you are doing a couple of operations at once.
The
> > part that most people miss is the creation of the array (array(&$this,
> > 'method')) If you look at that part alone it is a little easier to see
> > what is going on. In PHP4 everthing is passed as a copy unless you tell
it
> > specifically not to. You need to specifically tell the array to use a
> > reference rather than a copy of the $this object.
> >
> > PHP-Gtk2 will use PHP5. In PHP5, objects are always passed by reference.
> > This means that array($this) and array(&$this) will both pass the $this
> > object to the array as a reference instead of making a copy. It is more
> > along the lines of what you would expect from a traditional OOP
> > perspective.
> >
> > I hope that makes sense. I am not the best at explaining these things.
> >
> > --
> > Scott Mattocks
> > scott@crisscott.com
> > http://www.crisscott.com
> > http://pear.php.net/user/scottmattocks
> >
> >
> >
>
> --
> PHP-GTK General Mailing List (http://gtk.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>