Re: [php-gtk-cvs] GTK inheritance oddity
| From: | Markus Fischer | Date: | Sun, 17 Mar 2002 07:34:45 +0000 |
| Subject: | Re: [php-gtk-cvs] GTK inheritance oddity | ||
| References: | 1 | Groups: | php.gtk.cvs php.gtk.general |
| Request: | Send a blank email to php-gtk-general+get-1575@lists.php.net to get a copy of this message | ||
It's a limitation with PHP4 and Zend Engine 1 and only the
upcomming Zend Engine 2 can solve this. You'll have to
workaround this for now.
Working with custom widgets extending existing ones is very
tricky and should only be used 'if you know what you're
doing' .
- Markus
On Sat, Mar 16, 2002 at 09:50:28PM -0800, david lazar Butcher wrote :
> I'm primarily a C++ programmer and am probably pushing PHPs OO but I don't
> understand why the enclosed code fails (for Bonk but not NoBonk). Does it
> have something to do with GtkTable being a wrapper to a C class?
>
> I can work around this problem (using an external array of references with
> an entry for each Bonk instance, ugh), but its seems like it may be a bug
> in either PHP or PHP/GTK?
>
> thanks for any insight you can provide,
> david
>
> ======
> Output:
> X-Powered-By: PHP/4.2.0-dev
> Content-type: text/html
>
> <br />
> <b>Fatal error</b>: Cannot create references to/from string offsets nor
> overloaded objects in <b>test.php</b> on line <b>25</b><br />
> =====
> Code:
> <?php
> if (!class_exists('gtk')) {
> if (strtoupper(substr(PHP_OS, 0,3) == 'WIN'))
> dl('php_gtk.dll');
> else
> dl('php_gtk.so');
> }
>
> class Foo
> {
> var $i;
>
> function Foo($i)
> {
> $this->i = $i;
> }
> }
>
> class Bonk extends GtkTable
> {
> var $foo;
>
> function Bonk($f)
> {
> $this->foo = &$f;
> }
> }
>
> class NoBonk extends Foo
> {
> var $foo;
>
> function NoBonk($f)
> {
> $this->foo = &$f;
> }
> }
>
> $f = &new Foo(0);
> $b = &new NoBonk($f);
>
> $f = &new Foo(0);
> $b = &new Bonk($f);
>
> ?>
>
>
> --
> PHP-GTK CVS Mailing List (http://gtk.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
--
Please always Cc to me when replying to me on the lists.
GnuPG Key: http://guru.josefine.at/~mfischer/C2272BD0.asc