php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #28854 Class and Vars
Submitted: 2004-06-20 16:27 UTC Modified: 2004-08-30 19:27 UTC
Votes:1
Avg. Score:1.0 ± 0.0
Reproduced:0 of 1 (0.0%)
From: toppi at kacke dot de Assigned:
Status: Not a bug Package: *General Issues
PHP Version: 5.0.0RC3 OS: linux/unix
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: toppi at kacke dot de
New email:
PHP Version: OS:

 

 [2004-06-20 16:27 UTC] toppi at kacke dot de
Description:
------------
Class and Vars

Declare a var twice

Script breaks without error when including

Reproduce code:
---------------
class a {

    var a;
    var b;
    var a;

    function a(){
       //
    }
}



Expected result:
----------------
any warning/error

Actual result:
--------------
script ends/break regular @ including-point

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-06-21 23:43 UTC] rodolfo at rodsoft dot org
The correct way to declare the member variables would be: 
var $a. This way, your example would be:
class a
{
   var $a;
   var $b;
   var $a;
}

which would give the correct fatal error:
Fatal error: Cannot redeclare a::$a in /var/www/htdocs/tst.php on line 5
 [2004-06-22 12:01 UTC] toppi at kacke dot de
Yes right.

I figured out, that i used always , until yet, error_reporting(7) as default error level.

Try

classA.php

<?
Class a {
	
    var $ssl;
    var $ssl;
    var $ssl;

	function a (){
		$ssl = true;
	}
}
?>

and 

test.php

<?
error_reporting(7);
include "classA.php";
echo "Hello";
exit;
?>

and nothing will happen. NO fatal error, no hello displayed.

Are the error_levels cahnged in php 5 yet ?
 [2004-06-22 12:07 UTC] Toppi at kacke dot de
Hm prolly it is cause 7 is no valid level.
Seems its set to kinda (0) then.
But a fatal error should be displayed tho...

Dunno since years 7 makes me happy :)
Im sorry then !

seems its more a thing of error_reporting()
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Sep 11 03:01:28 2024 UTC