Mombu the Php Forum sponsored links

Go Back   Mombu the Php Forum > Php > #30642 : static variables not inherited by other classes when extended
User Name
Password
REGISTER NOW! Mark Forums Read

sponsored links


Reply
 
1 26th February 05:39
php-bugs
External User
 
Posts: 1
Default #30642 : static variables not inherited by other classes when extended



From: keith dot ward at gmail dot com
Operating system: Debian Linux r3 unstable
PHP version: 5CVS-2004-11-01 (dev)
PHP Bug Type: Class/Object related
Bug description: static variables not inherited by other classes when extended

Description:
------------
When using extend to extend a class . Static variables are not inherited
..

Reproduce code:
---------------
class a
{
public static $myvar;
public function __construct()
{
$this->myvar = '1';
echo ' Set myvar to 1 ... ' . "\n";
var_dump($this);
}
}

$a = new a();
class b extends a
{
function __construct()
{
echo 'DUmping from class b' . "\n";
var_dump($this);
}
}
$a = new b();
?>

Expected result:
----------------
Set myvar to 1 ...
object(a)#1 (1) {
["myvar"]=>
string(1) "1"
}
Dumping from class b
object(b)#2 (1) {
["myvar"]=>
string(1) "1"
}


Actual result:
--------------
Set myvar to 1 ...
object(a)#1 (1) {
["myvar"]=>
string(1) "1"
}
Dumping from class b
object(b)#2 (0) {
}


--
Edit bug report at http://bugs.php.net/?id=30642&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=30642&r=trysnapshot4
Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=30642&r=trysnapshot50
Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=30642&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=30642&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=30642&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=30642&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=30642&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=30642&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=30642&r=support
Expected behavior: http://bugs.php.net/fix.php?id=30642&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=30642&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=30642&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=30642&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=30642&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=30642&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=30642&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=30642&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=30642&r=float
MySQL Configuration Error: http://bugs.php.net/fix.php?id=30642&r=mysqlcfg
  Reply With Quote


  sponsored links


2 26th February 08:13
External User
 
Posts: 1
Default #30642 : static variables not inherited by other classes when extended



ID: 30642
Updated by: helly@php.net
Reported By: keith dot ward at gmail dot com
-Status: Open
+Status: Bogus
Bug Type: Class/Object related
Operating System: Debian Linux r3 unstable
PHP Version: 5CVS-2004-11-01 (dev)
New Comment:

Thank you for taking the time to write to us, but this is not
a bug. Please double-check the do***entation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

var_dump() doesn't show static members.

And don't reopen this report - check your code


Previous Comments:
------------------------------------------------------------------------

[2004-11-01 04:53:01] keith dot ward at gmail dot com

Description:
------------
When using extend to extend a class . Static variables are not
inherited .

Reproduce code:
---------------
class a
{
public static $myvar;
public function __construct()
{
$this->myvar = '1';
echo ' Set myvar to 1 ... ' . "\n";
var_dump($this);
}
}

$a = new a();
class b extends a
{
function __construct()
{
echo 'DUmping from class b' . "\n";
var_dump($this);
}
}
$a = new b();
?>

Expected result:
----------------
Set myvar to 1 ...
object(a)#1 (1) {
["myvar"]=>
string(1) "1"
}
Dumping from class b
object(b)#2 (1) {
["myvar"]=>
string(1) "1"
}


Actual result:
--------------
Set myvar to 1 ...
object(a)#1 (1) {
["myvar"]=>
string(1) "1"
}
Dumping from class b
object(b)#2 (0) {
}

------------------------------------------------------------------------


--
Edit this bug report at http://bugs.php.net/?id=30642&edit=1
  Reply With Quote
3 26th February 08:13
External User
 
Posts: 1
Default #30642 : static variables not inherited by other classes when extended


ID: 30642
Updated by: helly@php.net
Reported By: keith dot ward at gmail dot com
Status: Bogus
Bug Type: Class/Object related
-Operating System: Debian Linux r3 unstable
+Operating System: *
-PHP Version: 5CVS-2004-11-01 (dev)
+PHP Version: 5.*
-Assigned To:
+Assigned To: helly
New Comment:

var_dump() doesn't show static members.

And don't reopen this report - check your code


Previous Comments:
------------------------------------------------------------------------

[2004-11-01 04:53:01] keith dot ward at gmail dot com

Description:
------------
When using extend to extend a class . Static variables are not
inherited .

Reproduce code:
---------------
class a
{
public static $myvar;
public function __construct()
{
$this->myvar = '1';
echo ' Set myvar to 1 ... ' . "\n";
var_dump($this);
}
}

$a = new a();
class b extends a
{
function __construct()
{
echo 'DUmping from class b' . "\n";
var_dump($this);
}
}
$a = new b();
?>

Expected result:
----------------
Set myvar to 1 ...
object(a)#1 (1) {
["myvar"]=>
string(1) "1"
}
Dumping from class b
object(b)#2 (1) {
["myvar"]=>
string(1) "1"
}


Actual result:
--------------
Set myvar to 1 ...
object(a)#1 (1) {
["myvar"]=>
string(1) "1"
}
Dumping from class b
object(b)#2 (0) {
}

------------------------------------------------------------------------


--
Edit this bug report at http://bugs.php.net/?id=30642&edit=1
  Reply With Quote
4 26th February 08:14
php-bugs
External User
 
Posts: 1
Default #30642 : static variables not inherited by other classes when extended


ID: 30642
User updated by: keith dot ward at gmail dot com
Reported By: keith dot ward at gmail dot com
-Status: Bogus
+Status: Open
Bug Type: Class/Object related
Operating System: *
PHP Version: 5.*
Assigned To: helly
New Comment:

This is NOT BOGUS , had you bothered to read the results , you would
see that var_dump , did indeed return the static member myvar( from
class A ) .
If returning static members with var_dump was not to be supported
(that's what it sounds like) it should not show up in the first
var_dump either !.
In Addition ... using echo parent::$myvar; or echo $this->myvar within
class B , also returns nothing . So this bug is perfectly valid .


Previous Comments:
------------------------------------------------------------------------

[2004-11-01 11:51:48] helly@php.net

var_dump() doesn't show static members.

And don't reopen this report - check your code

------------------------------------------------------------------------

[2004-11-01 04:53:01] keith dot ward at gmail dot com

Description:
------------
When using extend to extend a class . Static variables are not
inherited .

Reproduce code:
---------------
class a
{
public static $myvar;
public function __construct()
{
$this->myvar = '1';
echo ' Set myvar to 1 ... ' . "\n";
var_dump($this);
}
}

$a = new a();
class b extends a
{
function __construct()
{
echo 'DUmping from class b' . "\n";
var_dump($this);
}
}
$a = new b();
?>

Expected result:
----------------
Set myvar to 1 ...
object(a)#1 (1) {
["myvar"]=>
string(1) "1"
}
Dumping from class b
object(b)#2 (1) {
["myvar"]=>
string(1) "1"
}


Actual result:
--------------
Set myvar to 1 ...
object(a)#1 (1) {
["myvar"]=>
string(1) "1"
}
Dumping from class b
object(b)#2 (0) {
}

------------------------------------------------------------------------


--
Edit this bug report at http://bugs.php.net/?id=30642&edit=1
  Reply With Quote
5 26th February 11:57
php-bugs
External User
 
Posts: 1
Default #30642 : static variables not inherited by other classes when extended


ID: 30642
Comment by: ashk06 at dsl dot pipex dot com
Reported By: keith dot ward at gmail dot com
Status: Open
Bug Type: Class/Object related
Operating System: *
PHP Version: 5.*
Assigned To: helly
New Comment:

http://bugs.php.net/bug.php?id=30451

Seems to be a duplicate of this .


Previous Comments:
------------------------------------------------------------------------

[2004-11-02 01:52:15] keith dot ward at gmail dot com

This is NOT BOGUS , had you bothered to read the results , you would
see that var_dump , did indeed return the static member myvar( from
class A ) .
If returning static members with var_dump was not to be supported
(that's what it sounds like) it should not show up in the first
var_dump either !.
In Addition ... using echo parent::$myvar; or echo $this->myvar within
class B , also returns nothing . So this bug is perfectly valid .

------------------------------------------------------------------------

[2004-11-01 11:51:48] helly@php.net

var_dump() doesn't show static members.

And don't reopen this report - check your code

------------------------------------------------------------------------

[2004-11-01 04:53:01] keith dot ward at gmail dot com

Description:
------------
When using extend to extend a class . Static variables are not
inherited .

Reproduce code:
---------------
class a
{
public static $myvar;
public function __construct()
{
$this->myvar = '1';
echo ' Set myvar to 1 ... ' . "\n";
var_dump($this);
}
}

$a = new a();
class b extends a
{
function __construct()
{
echo 'DUmping from class b' . "\n";
var_dump($this);
}
}
$a = new b();
?>

Expected result:
----------------
Set myvar to 1 ...
object(a)#1 (1) {
["myvar"]=>
string(1) "1"
}
Dumping from class b
object(b)#2 (1) {
["myvar"]=>
string(1) "1"
}


Actual result:
--------------
Set myvar to 1 ...
object(a)#1 (1) {
["myvar"]=>
string(1) "1"
}
Dumping from class b
object(b)#2 (0) {
}

------------------------------------------------------------------------


--
Edit this bug report at http://bugs.php.net/?id=30642&edit=1
  Reply With Quote
6 27th February 19:03
External User
 
Posts: 1
Default #30642 : static variables not inherited by other classes when extended


ID: 30642
Updated by: tony2001@php.net
Reported By: keith dot ward at gmail dot com
-Status: Open
+Status: Bogus
Bug Type: Class/Object related
Operating System: *
PHP Version: 5.*
Assigned To: helly
New Comment:

Nope, #30451 has nothing to do with it.
And yes, var_dump() DOES NOT show static members (see #30820, this
issue is correctly reported there).

I'm closing this report, as there is no sense in keeping duplicates.


Previous Comments:
------------------------------------------------------------------------

[2004-11-03 17:34:06] ashk06 at dsl dot pipex dot com

http://bugs.php.net/bug.php?id=30451

Seems to be a duplicate of this .

------------------------------------------------------------------------

[2004-11-02 01:52:15] keith dot ward at gmail dot com

This is NOT BOGUS , had you bothered to read the results , you would
see that var_dump , did indeed return the static member myvar( from
class A ) .
If returning static members with var_dump was not to be supported
(that's what it sounds like) it should not show up in the first
var_dump either !.
In Addition ... using echo parent::$myvar; or echo $this->myvar within
class B , also returns nothing . So this bug is perfectly valid .

------------------------------------------------------------------------

[2004-11-01 11:51:48] helly@php.net

var_dump() doesn't show static members.

And don't reopen this report - check your code

------------------------------------------------------------------------

[2004-11-01 04:53:01] keith dot ward at gmail dot com

Description:
------------
When using extend to extend a class . Static variables are not
inherited .

Reproduce code:
---------------
class a
{
public static $myvar;
public function __construct()
{
$this->myvar = '1';
echo ' Set myvar to 1 ... ' . "\n";
var_dump($this);
}
}

$a = new a();
class b extends a
{
function __construct()
{
echo 'DUmping from class b' . "\n";
var_dump($this);
}
}
$a = new b();
?>

Expected result:
----------------
Set myvar to 1 ...
object(a)#1 (1) {
["myvar"]=>
string(1) "1"
}
Dumping from class b
object(b)#2 (1) {
["myvar"]=>
string(1) "1"
}


Actual result:
--------------
Set myvar to 1 ...
object(a)#1 (1) {
["myvar"]=>
string(1) "1"
}
Dumping from class b
object(b)#2 (0) {
}

------------------------------------------------------------------------


--
Edit this bug report at http://bugs.php.net/?id=30642&edit=1
  Reply With Quote


  sponsored links


Reply


Thread Tools
Display Modes




Copyright © 2006 SmartyDevil.com - Dies Mies Jeschet Boenedoesef Douvema Enitemaus -
666