RE: [PHP-DEV] a way to fix the import issue

2007-10-04 Thread Dmitry Stogov
In your example : "new Exception" refer to "Blah::Exception" and will fail if such class doesn't exists. "import Blah::Exception" creates an alias with short name "Exception" only for current file (it doesn't creates "Foo::Exception") May be I didn't understood the question. :) Thanks. Dmitry

Re: [PHP-DEV] Class Posing

2007-10-04 Thread Timm Friebe
Hi, public function foo() { $bar= new Bar; [...] } When I want to test the foo() method, I want to stub out the usage of the Bar class, for example, and have Bar::doSomething() return a pre-configured value instead of performing its normal operation. This is where you'd star

[PHP-DEV] RE : [PHP-DEV] [PATCH] in_class_exists() for detecting __autoload() called by class_exists() and interface_exists()

2007-10-04 Thread P
> From: Stanislav Malyshev [mailto:[EMAIL PROTECTED] > > But how would you know the class is missing? Maybe next > loader in chain > would find it. IMO, the point, here, is that, if the requested class starts with 'PEAR2', by convention, this name space is reserved and cannot be resolved by an

Re: [PHP-DEV] a way to fix the import issue

2007-10-04 Thread Gregory Beaver
Dmitry Stogov wrote: > In your example : > > namespace Foo; > import Blah::Exception; > $a = new Exception; > ?> > > "new Exception" refer to "Blah::Exception" and will fail if such class > doesn't exists. > > "import Blah::Exception" creates an alias with short name "Exception" only > for curr

Re: [PHP-DEV] [PATCH] in_class_exists() for detecting __autoload() called by class_exists() and interface_exists()

2007-10-04 Thread Benjamin Schulz
Hi, What about __class_exists() and SPL_register_class_exists_handler()? One could suppose the classloader (the one that implements __autoload) knows if a class exists (as in: is registered within the classloader or the class-file exists) without loading it and maybe the class that calls c

Re: [PHP-DEV] substr/array_slice in []

2007-10-04 Thread Andrei Zmievski
So it's okay to discuss implementation of esoteric features like class posing, but something as basic as a string/array slice operation still gets a knee-jerk reaction? Double standards my friends, double standards.. -Andrei Stanislav Malyshev wrote: Here's much better reason: PHP is not the k

[PHP-DEV] how declare protected array property at internal class properly

2007-10-04 Thread Denis Gabaidulin
How can i do subj ? I try make this with follwoing code: declare prop: zend_declare_property_null(ns_ce_ ## my_class, "prop", strlen("prop"), , ZEND_ACC_PROTECTED TSRMLS_CC); at constructor: zval *prop; /* init */ prop = zend_read_property(Z_OBJCE_P(getThis()), getThis(), "prop", strlen("pr

Re: [PHP-DEV] how declare protected array property at internal class properly

2007-10-04 Thread Michael Wallner
Denis Gabaidulin wrote: > How can i do subj ? > at constructor: > > zval *prop; > > /* init */ > prop = zend_read_property(Z_OBJCE_P(getThis()), getThis(), "prop", > strlen("prop",), 1 TSRMLS_CC); > > array_init(prop); zval *prop; MAKE_STD_ZVAL(prop); array_init(prop); zend_update_property(Z_

Re: [PHP-DEV] how declare protected array property at internal class properly

2007-10-04 Thread Denis Gabaidulin
On 10/5/07, Michael Wallner <[EMAIL PROTECTED]> wrote: > > zval *prop; > MAKE_STD_ZVAL(prop); > array_init(prop); > zend_update_property(Z_OBJCE_P(getThis()), getThis(), > ZEND_STRS("prop")-1, prop TSRMLS_CC); > zval_ptr_dtor(&prop); > > IIRC complex types for internal zvals was on some eng

Re: [PHP-DEV] substr/array_slice in []

2007-10-04 Thread Larry Garfield
On Tuesday 02 October 2007, Alexey Zakhlestin wrote: > On 10/1/07, Martin Alterisio <[EMAIL PROTECTED]> wrote: > > Sorry to bother, I have a few questions on this matter. > > How will this impact on the SPL ArrayAccess and related interfaces and > > objects? > > Will there be an interface to this f

Re: [PHP-DEV] a way to fix the import issue

2007-10-04 Thread Gregory Beaver
Dmitry Stogov wrote: > In your example : > > namespace Foo; > import Blah::Exception; > $a = new Exception; > ?> > > "new Exception" refer to "Blah::Exception" and will fail if such class > doesn't exists. > > "import Blah::Exception" creates an alias with short name "Exception" only > for curr

[PHP-DEV] Re: [PATCH] reserved words allowed as function/method names

2007-10-04 Thread Gregory Beaver
Patches added to http://bugs.php.net/28261, and I re-opened the bug. Greg Gregory Beaver wrote: > Hi, > > I spent a while tonight tinkering with the parser to try to figure out > how to allow it to use T_IMPORT as well as T_STRING for method names, > and quickly came to the conclusion that this

[PHP-DEV] get_namespace()

2007-10-04 Thread Michael Gauthier
With PHP 5.3 will there be a get_namespace($object) function equivalent to get_class($object)? -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] substr/array_slice in []

2007-10-04 Thread Alexey Zakhlestin
On 10/5/07, Larry Garfield <[EMAIL PROTECTED]> wrote: > Here's the question I see. Right now, does an ArrayAccess object work with > array_slice()? If so, then [2, 5] syntax would be just some nice syntactic > sugar. If not, then it becomes a powerful new feature, and implementing it > on norma

RE: [PHP-DEV] a way to fix the import issue

2007-10-04 Thread Dmitry Stogov
Hi Gregory, It seems, your bug report and patches are right. I'll look into them more careful little bit later. Thank you very much. Dmitry. > -Original Message- > From: Gregory Beaver [mailto:[EMAIL PROTECTED] > Sent: Friday, October 05, 2007 6:08 AM > To: Dmitry Stogov > Cc: 'Stanisla