php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #47748 creating class variable outside class definition
Submitted: 2009-03-22 18:20 UTC Modified: 2009-03-22 18:35 UTC
From: tompotts at itsosbroadband dot co dot uk Assigned:
Status: Not a bug Package: Class/Object related
PHP Version: 5.2.9 OS: W2k/Linux
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: tompotts at itsosbroadband dot co dot uk
New email:
PHP Version: OS:

 

 [2009-03-22 18:20 UTC] tompotts at itsosbroadband dot co dot uk
Description:
------------
Seem to be able to extend instances outside class definition

Reproduce code:
---------------
class one{
 public $vars;
}
$inst=new one;
$inst->newvar="should make error";
print $inst->newvar;


Expected result:
----------------
An error where the class is modified externally to its definition.

Actual result:
--------------
allows instance to be extended willynilly.
Not sure if this is language feature by design - doesnt feel right to my  view of OO.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-03-22 18:35 UTC] derick@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sat Jul 12 16:01:33 2025 UTC