php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #49512 Not follow the Ooop's law
Submitted: 2009-09-09 12:44 UTC Modified: 2009-09-09 12:57 UTC
From: binay dot kumar at osvin dot biz Assigned:
Status: Not a bug Package: *Programming Data Structures
PHP Version: 5.2.10 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: binay dot kumar at osvin dot biz
New email:
PHP Version: OS:

 

 [2009-09-09 12:44 UTC] binay dot kumar at osvin dot biz
Description:
------------
<?php 
class xyz
{
	
	public function getName($id)
	{
		return $id;
	}
}
xyz::getName(1);
?>

## in the above class i can access the class xyz method by "::", however i have not created the instance of the class.

by the oop's law , we can access a method by this way,method defined as static method. its working fine in both case either create a object of the class or by "::" to access.
can please describe me the things because its not following the oop's law.


Regards
Binay Kumar



Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-09-09 12:57 UTC] sjoerd@php.net
Thank you for your bug report.

You should indeed use the static keyword if you want to call a method without creating an object instance. However, PHP allows it and generates an E_STRICT warning. This is meant to work like this, therefore this is not a bug.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 16 16:01:28 2024 UTC