php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #38160 var is no longer raising E_STRICT
Submitted: 2006-07-20 14:13 UTC Modified: 2006-08-12 16:44 UTC
Votes:2
Avg. Score:5.0 ± 0.0
Reproduced:2 of 2 (100.0%)
Same Version:2 (100.0%)
Same OS:1 (50.0%)
From: RQuadling at GMail dot com Assigned:
Status: Closed Package: Documentation problem
PHP Version: Irrelevant OS: Windows XP SP2
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: RQuadling at GMail dot com
New email:
PHP Version: OS:

 

 [2006-07-20 14:13 UTC] RQuadling at GMail dot com
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

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-08-12 16:44 UTC] nlopess@php.net
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.

Thank you for the report, and for helping us make our documentation better.


 [2020-02-07 06:11 UTC] phpdocbot@php.net
Automatic comment on behalf of nlopess
Revision: http://git.php.net/?p=doc/en.git;a=commit;h=1531f5bc773f0730133bc3fc46ae068ecc2edb78
Log: fix #38160: 'var' no longer produces a E_STRICT warning
 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Sat Jun 20 17:00:01 2026 UTC