Req #52297 [NEW]: visibility identifier namespace-protected
| From: | giorgio dot liscio at email dot it | Date: | Fri, 09 Jul 2010 00:56:36 +0000 |
| Subject: | Req #52297 [NEW]: visibility identifier namespace-protected | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-152234@lists.php.net to get a copy of this message | ||
From:
Operating system: all
PHP version: 5.3.2
Package: Class/Object related
Bug Type: Feature/Change Request
Bug description:visibility identifier namespace-protected
Description:
------------
hi, in php is missing a visibility identifier to protect methods and
properties inside the namespace
example:
namespace Oracle; // abstraction layer for Oracle
class Connection
{
// ociresource should be visible only in the namespace
// in php 5.3 the property is public to world
namespace-protected $ociresource;
public function __construct()
{
$this->ociresource = oci_connect();
}
public function query($sql)
{
return new Query($this, $sql);
}
}
class Query
{
public function __construct(Connection $con, $sql)
{
$x = oci_parse($con->ociresource, $sql); // $ociresource is
accessible only in this namespace
oci_execute($x);
}
}
----
suggested visibility identifier:
namespace-private
(if namespace is \Test\Abc\ the method/property is only accessible
within \Test\Abc\)
namespace-protected
(if namespace is \Test\Abc\ the method/property can be accessible
within \Test\Abc\ and, for example \Test\Abc\Foo\ )
--
Edit bug report at http://bugs.php.net/bug.php?id=52297&edit=1
--
Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=52297&r=trysnapshot52
Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=52297&r=trysnapshot53
Try a snapshot (trunk): http://bugs.php.net/fix.php?id=52297&r=trysnapshottrunk
Fixed in SVN: http://bugs.php.net/fix.php?id=52297&r=fixed
Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=52297&r=needdocs
Fixed in release: http://bugs.php.net/fix.php?id=52297&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=52297&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=52297&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=52297&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=52297&r=support
Expected behavior: http://bugs.php.net/fix.php?id=52297&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=52297&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=52297&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=52297&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=52297&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=52297&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=52297&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=52297&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=52297&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=52297&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=52297&r=mysqlcfg