[OWASP_PHPSEC] Namespace

Abbas Naderi abiusx at owasp.org
Sun Jul 28 13:20:00 UTC 2013


The name resolution under namespaces is, that PHP will search your name in current namespace and all its ascendants, respectively. So if you miss phpsec\time(), it will go for php's time().
-A
______________________________________________________________
Notice: This message is digitally signed, its source and integrity are verifiable.
If you mail client does not support S/MIME verification, it will display a file (smime.p7s), which includes the X.509 certificate and the signature body.  Read more at Certified E-Mail with Comodo and Thunderbird in AbiusX.com

On Mordad 6, 1392, at 2:51 PM, Sven Rautenberg <sven at rtbg.de> wrote:

> Yes, they do. Currently all your classes are in the same namespace, and
> will interfere with each other if defined.
> 
> But this will only happen if the code has been included. Or is going to
> be autoloaded... (see issue #29 why this cannot currently be used).
> 
> But even if autoloading would be implemented, you still cannot autoload
> simple functions, only classes.
> 
> Regards,
> Sven
> 
> Am 28.07.2013 12:10, schrieb rahul chaudhary:
>> Hello All,
>> 
>> I have this weird doubt...basic doubt.
>> 
>> So two files that share a namespace, do they also share functions defined
>> under that namespace ?
>> 
>> e.g.:
>> time.php defines function time() in namespace phpsec
>> 
>> now in another file say testTime.php which is in same namespace, phpsec,
>> can't I directly use this time function using \phpsec\time(). Do, I have to
>> first use require_once("time.php") to call this function \phpsec\time()
>> 
>> 
>> 
>> _______________________________________________
>> OWASP_PHP_Security_Project mailing list
>> OWASP_PHP_Security_Project at lists.owasp.org
>> https://lists.owasp.org/mailman/listinfo/owasp_php_security_project
>> 
> 
> _______________________________________________
> OWASP_PHP_Security_Project mailing list
> OWASP_PHP_Security_Project at lists.owasp.org
> https://lists.owasp.org/mailman/listinfo/owasp_php_security_project

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.owasp.org/pipermail/owasp_php_security_project/attachments/20130728/be7c3aef/attachment.html>


More information about the OWASP_PHP_Security_Project mailing list