|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2006-08-12 16:44 UTC] nlopess@php.net
[2020-02-07 06:11 UTC] phpdocbot@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2026 The PHP GroupAll rights reserved. |
Last updated: Sat Jun 20 20:00:01 2026 UTC |
Description: ------------ The dox say ..."The PHP 4 method of declaring a variable with the var keyword is no longer valid for PHP 5 objects. For compatibility a variable declared in php will be assumed with public visibility, and a E_STRICT warning will be issued." The following code would expect to generate the appropriate warning ... Reproduce code: --------------- <?php class myc_class { var $ttt; public $pub; protected $prot; private $priv; public function __construct() { $this->ttt = 1; } public function test() { echo "$this->ttt\n"; } } $x = new myc_class(); $x->test(); var_dump($x); // Prove E_STRICT is working. echo mktime(); ?> Expected result: ---------------- An E_STRICT warning about var being public. E_STRICT is active within php.ini as mktime() generates this message. Actual result: -------------- 1 object(myc_class)#1 (4) { ["ttt"]=> int(2) ["pub"]=> NULL ["prot:protected"]=> NULL ["priv:private"]=> NULL } Strict Standards: mktime() : You should be using the time() function instead in D:\Data\Web Sites\Quick Scripts\public_html\EE Scripts\ppp_problem.php on line 23 1153404753