[OWASP_PHPSEC] Namespace

Sven Rautenberg sven at rtbg.de
Sun Jul 28 13:26:24 UTC 2013


Which is probably a bad thing because the PHP time function does not
expect to be called with any parameters, and code that uses
\phpsec\time() will break if that function is not available.

Regards,
Sven

Am 28.07.2013 15:20, schrieb Abbas Naderi:
> 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
> 
> 



More information about the OWASP_PHP_Security_Project mailing list