|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[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
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Oct 27 18:00:01 2025 UTC |
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 5Yes 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 ?