|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2005-08-05 07:43 UTC] tony2001 at phpclub dot net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Nov 05 15:00:01 2025 UTC |
Description: ------------ I have a memcache (version 1.4) setup working on my PHP 5.0.4 config. When I try to subclass the memcache class I get some unexpected results when I call the connect() function. It connects allright, but changes the type of the class, and "forgets" the variables the class allready had. I allready took a peek in the memcache.c sourcefile, and I think the problem is on line 1418 or 1419, but I have no idea how to fix the problem. Is there anybody who van help me? PHP configure line: './configure' '--prefix=/usr/local/lib/php5' '--with-mysql=/usr/local/mysql/' '--with-apxs2=/usr/local/apache2-php5/bin/apxs' '--with-gd=/usr/local/' Lines added in php.ini: extension=memcache.so Reproduce code: --------------- <? $memcache = new MemcacheConnection( "localhost" ); var_dump($memcache); $memcache->connect(); var_dump($memcache); class MemcacheConnection extends Memcache { private $host, $port, $persistent; function __construct( $host, $port = 11211, $persistent = false ) { $this->host = $host; $this->port = $port; $this->persistent = $persistent; } function connect() { if( !parent::connect( $this->host, $this->port ) ) throw new Exception( "Could not connect to memcache on ".$this->host ); } } ?> Expected result: ---------------- object(MemcacheConnection)#1 (3) { ["host:private"]=> string(9) "localhost" ["port:private"]=> int(11211) ["persistent:private"]=> bool(false) } object(MemcacheConnection)#1 (3) { ["host:private"]=> string(9) "localhost" ["port:private"]=> int(11211) ["persistent:private"]=> bool(false) ["connection"]=> resource(4) of type (memcache connection) } Actual result: -------------- object(MemcacheConnection)#1 (3) { ["host:private"]=> string(9) "localhost" ["port:private"]=> int(11211) ["persistent:private"]=> bool(false) } object(Memcache)#1 (1) { ["connection"]=> resource(4) of type (memcache connection) }