php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #36174 PHP 5 should treat 'var' as 'public'
Submitted: 2006-01-26 22:30 UTC Modified: 2006-01-27 00:39 UTC
Votes:4
Avg. Score:4.0 ± 1.7
Reproduced:3 of 4 (75.0%)
Same Version:2 (66.7%)
Same OS:3 (100.0%)
From: mike at scrapegoat dot com Assigned:
Status: Wont fix Package: Feature/Change Request
PHP Version: 5.1.2 OS: any
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: mike at scrapegoat dot com
New email:
PHP Version: OS:

 

 [2006-01-26 22:30 UTC] mike at scrapegoat dot com
Description:
------------
I am amazed that PHP5 does not treat 'var' as if it was the same 'public'.

I am so sick of trying to maintain two sets of code for PHP4 and PHP5 all because PHP4 uses 'var' in my classes and PHP5 wants 'public', 'private' or 'protected'

I would love to see 'var' be treated an alias for 'public'

Reproduce code:
---------------
class test
{
	var $info;

	function test( $info )
	{
		$this->info = $info;
	}
}

Expected result:
----------------
This should be the same as:
class test
{
	public $info;

	function test( $info )
	{
		$this->info = $info;
	}
}

Actual result:
--------------
error/exception is thrown

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-01-26 22:50 UTC] helly@php.net
That was discussed enough and declined
 [2006-01-26 23:18 UTC] mike at scrapegoat dot com
You have got to be kidding!

This was declined?!?!

I have a HUGE codebase that I need to maintain in both PHP4 and PHP5. In almost all cases the ONLY difference I have is the fact that I must change 'var' to 'public' and back again.

So what you are telling me is that I MUST maintain 2 sets of code when the only difference is var and public?

I have to make code fixed in TWO sets of code because you don't want to provide a USEFULL correction to the language?

What a joke!

This is such a simple thing to add. All it needs to be is an alias and then my code and hundreds if not thousands of developers lives would be eaiser and conversion from PHP4 to PHP5 would be more enticing to others.

PLEASE!!!! Please rethink this. This is such a small change and will have such a HUGE impact on developers!!!
 [2006-01-27 00:39 UTC] derick@php.net
It's just an E_STRICT warning which you very easily can turn off.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Jul 05 18:01:32 2024 UTC