Re: Connecting data
| From: | Gregory Wild-Smith | Date: | Mon, 06 Dec 2004 14:43:32 +0000 |
| Subject: | Re: Connecting data | ||
| References: | 1 2 3 4 5 6 7 8 9 10 11 12 | Groups: | php.gtk.general |
| Request: | Send a blank email to php-gtk-general+get-5312@lists.php.net to get a copy of this message | ||
*I* wasn't... its a known bug in it.
Think it was originally brought to light with WordPress... and its since been confimed as a bug in PHP5.
----- Original Message ----- From: "Steph" <steph@zend.com>
To: "Gregory Wild-Smith" <greg@twilightuniverse.com>; <php-gtk-general@lists.php.net>
Sent: Monday, December 06, 2004 1:58 PM
Subject: Re: [PHP-GTK] Connecting data
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 dataThat 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,thattends 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 dataGregory Wild-Smith wrote:inI didn't realise the callback was passed as a copy, that does make the behavior make more sense. However I've never encountered this behaviorThe 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/scottmattocksPHP before. Perhaps that's just me. It is however very anoying ;) Why will php-gtk2 not do this?-- PHP-GTK General Mailing List (http://gtk.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php