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

2007-10-02 Thread Gregory Beaver
Hi again, The attached patches for PHP 5.3 and PHP 6 add in_class_exists(). The function is intended to be used in __autoload(). The following test script demonstrates its usage: outputting: bool(false) bool(false) bool(true) bool(false) The purpose is to allow an autoload handler to detect

Re: [PHP-DEV] Class Posing

2007-10-02 Thread Sebastian Bergmann
Stanislav Malyshev schrieb: > lot of implications what have unintended - i.e. how typehints are > supposed to work with this? How reflection and autoloading would work? Typehints continue working because of the restriction that applies to this mechanism (see other mail(s)). Reflection{Class|Ob

Re: [PHP-DEV] Class Posing

2007-10-02 Thread Sebastian Bergmann
David Zülke schrieb: > would it be possible to overload final classes? Of course. We are not changing the class declaration (compile-time) but intercept the object creation (run-time). -- Sebastian Bergmann http://sebastian-bergmann.de/ GnuPG Key: 0xB85B5D69 / 27A7 2B1

Re: [PHP-DEV] Class Posing

2007-10-02 Thread Sebastian Bergmann
Stanislav Malyshev schrieb: > Thanks, will look at these. I'm extremely uncomfortable with engine > change that would allow "new Foo" produce an object that is not Foo. The restriction "A class may only pose as one of its direct or indirect superclasses." I mentioned ensures that "new Foo"

Re: [PHP-DEV] Class Posing

2007-10-02 Thread Sebastian Bergmann
Jared Williams schrieb: > I think they end up using the dependency injection pattern. Of course you can argue that the code was badly {designed|written} in the example I showed and should be refactored before testing. More often than not, though, you cannot do this (3rd party code, for example

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

2007-10-02 Thread Gregory Beaver
Gregory Beaver wrote: > === > RCS file: /repository/php-src/run-tests.php,v > retrieving revision 1.226.2.37.2.35 > diff -u -r1.226.2.37.2.35 run-tests.php > --- run-tests.php 14 Sep 2007 15:28:03 - 1.226.2.37.2.35 > +++

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

2007-10-02 Thread Gregory Beaver
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 causes way more trouble than it is worth. However, in a moment of inspiration, I realized that a minor chan

Re: [PHP-DEV] PHP taint support: first results

2007-10-02 Thread Wietse Venema
David Wang: [ Charset ISO-8859-1 unsupported, converting... ] > On 10/2/07, Wietse Venema <[EMAIL PROTECTED]> wrote: > > Low-level implementation > > > > > > Taint support is implemented with some of the unused bits in the > > zval data structure. The zval is the PHP equiva

Re: [PHP-DEV] PHP taint support: first results

2007-10-02 Thread David Wang
On 10/2/07, Wietse Venema <[EMAIL PROTECTED]> wrote: > Low-level implementation > > > Taint support is implemented with some of the unused bits in the > zval data structure. The zval is the PHP equivalent of a memory > cell. Besides a type (string, number etc.) and value, e

[PHP-DEV] PHP taint support: first results

2007-10-02 Thread Wietse Venema
A while ago I posted a proposal to add support for tainted variables to PHP, to alert programmers at run-time when they make the common mistake of using uncleansed input with include, echo, system, open, etc. A copy of the original post can be found on-line, for example, at http://marc.info/?l=php-

Re: [PHP-DEV] Class Posing

2007-10-02 Thread Stanislav Malyshev
Problem is the cost of setting up these, by registering implementations, performing reflection and so on is expensive especially considering the stateless nature of PHP. Thanks, will look at these. I'm extremely uncomfortable with engine change that would allow "new Foo" produce an object that

RE: [PHP-DEV] Class Posing

2007-10-02 Thread Jared Williams
I think they end up using the dependency injection pattern. http://www.picocontainer.org/ java implementation with a PHP port. http://sourceforge.net/projects/phemto/ is a more lightweight PHP implementation. Its README http://phemto.cvs.sourceforge.net/phemto/phemto/README?revision=1.1.1.1&vi

Re: [PHP-DEV] Re: namespaces: import name conflicts with defined class

2007-10-02 Thread Stanislav Malyshev
But how to know in advance, e.g. think about other libraries, which public classes possibly exist? Isn't this problematic then? That should be simple - if you write library using namespaces, no public classes would exist except for the internal ones :) By "public" I of course mean "belonging

Re: [PHP-DEV] Re: namespaces: import name conflicts with defined class

2007-10-02 Thread Stanislav Malyshev
But how to know in advance, e.g. think about other libraries, which public classes possibly exist? Isn't this problematic then? That should be simple - if you write library using namespaces, no public classes would exist except for the internal ones :) -- Stanislav Malyshev, Zend Software Arc

Re: [PHP-DEV] Class Posing

2007-10-02 Thread Stanislav Malyshev
Stubs / Mock Objects !== Unit Tests. Class Posing allows for better stubs / mock objects which in turn are tools to write better unit tests. OK, I see that. The question is - does any of the known unit test systems use mock objects? Does it do that in the language that doesn't allow "new Fo

Re: [PHP-DEV] Class Posing

2007-10-02 Thread Sebastian Bergmann
Stanislav Malyshev schrieb: > As far as I know, Java has unit tests but doesn't allow replacing > classes. How does it work in Java? Stubs / Mock Objects !== Unit Tests. Class Posing allows for better stubs / mock objects which in turn are tools to write better unit tests. -- Sebastian Bergma

Re: [PHP-DEV] Re: namespaces: import name conflicts with defined class

2007-10-02 Thread Markus Fischer
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi, Greg Beaver wrote: > Benjamin Schulz wrote: >> Of course i want to refer to my own exception in my application or >> framework as "Exception", and of course i want to use it without >> prefixes (import myStuff::Exception AS MyStuffException), i wo

Re: [PHP-DEV] Re: namespaces: import name conflicts with defined class

2007-10-02 Thread Stanislav Malyshev
I wouldn't actually recommend using such code. If you have Foo::Exception just use Foo::Exception - it's short enough :) -- Stanislav Malyshev, Zend Software Architect [EMAIL PROTECTED] http://www.zend.com/ (408)253-8829 MSN: [EMAIL PROTECTED] -- PHP Internals - PHP Runtime Development

Re: [PHP-DEV] link to exceptions in autoload thread?

2007-10-02 Thread Greg Beaver
Marcus Boerger wrote: > Hello Gregory, > > I don't recall any particular thread but Andi once explained why a few > things are instable when exceptions are pending. Some of that is no longer > the case so maybe it is time to reinvestigate the whole issue of pending > exceptions. But maybe that w

[PHP-DEV] Re: namespaces: import name conflicts with defined class

2007-10-02 Thread Greg Beaver
Benjamin Schulz wrote: > Hi all, > > import Foo::Bar AS DomDocument; > import Foo::Exception; > import MyStuff::Dom::XsltProcessor; > > Result in a "Fatal error: Import name '...' conflicts with defined class" > Of course i want to refer to my own exception in my application or > framework as "Ex

Re: [PHP-DEV] T_IMPORT vs. T_USE

2007-10-02 Thread Giedrius D
Same here. On 10/2/07, Ford, Mike <[EMAIL PROTECTED]> wrote: > On 02 October 2007 07:16, Sebastian Nohn wrote: > > > Andi Gutmans wrote: > > > Hi Johannes, > > > Our preference would be to stick to "import" because I > > think the perception many will have of "use" is that it also > > includes fil

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

2007-10-02 Thread Jeff Griffiths
Antony Dovgal wrote: On 01.10.2007 16:32, Ilia Alshanetsky wrote: This was not on the table and the time of the 5.3 discussion, I for one think its a bit too much magic. Yeah, too Perl-ish for me. Actually, it's a lot like Python list slicing, which is a great feature and a clear enough sy

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

2007-10-02 Thread Stanislav Malyshev
The minutes of the Paris meeting committed to implementing this for PHP 6, and it's a much-needed feature (IMHO, of course!). If you're Much needed for what? What can be done with it that can't be easily done with other means? going to start arguing against what looks very much like a firm d

Re: [PHP-DEV] Class Posing

2007-10-02 Thread Stanislav Malyshev
Like I said before, the factory and singleton patterns are just example applications of this mechanism. Right, but I'd like to see why we *need* it - i.e. what it allows to do that other things don't. I'm afraid that we might have a case of featuritis here (not meaning this specific proposal

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

2007-10-02 Thread Antony Dovgal
On 01.10.2007 21:39, Ford, Mike wrote: > On 01 October 2007 13:46, Antony Dovgal wrote: > >> On 01.10.2007 16:32, Ilia Alshanetsky wrote: >> > This was not on the table and the time of the 5.3 discussion, I for >> > one think its a bit too much magic. >> >> Yeah, too Perl-ish for me. >> > > Ple

Re: [PHP-DEV] Solaris and getcwd()

2007-10-02 Thread Rob Thompson
Right. This does appear to be a "chicken or the egg" issue. Also, turns out (b) below is only the shell caching your last successful cd and spitting it back, not the result of a successful getcwd() call. So really, with Solaris, there is not even any chicken ;) Would it be reasonable to catch

Re: [PHP-DEV] Class Posing

2007-10-02 Thread Sebastian Bergmann
Stanislav Malyshev schrieb: > This looks like factory pattern. What's wrong with implementing it as > factory? Like I said before, the factory and singleton patterns are just example applications of this mechanism. What I want to use them for in PHPUnit is improving the Mock Objects system.

Re: [PHP-DEV] Class Posing

2007-10-02 Thread Stanislav Malyshev
Earlier this year, Johannes implemented class posing for PHP as follows: This looks like factory pattern. What's wrong with implementing it as factory? However, to make this a viable mechanism that can be used in tools such as PHPUnit (for which I could really use this functionality)

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

2007-10-02 Thread Ford, Mike
On 01 October 2007 13:46, Antony Dovgal wrote: > On 01.10.2007 16:32, Ilia Alshanetsky wrote: > > This was not on the table and the time of the 5.3 discussion, I for > > one think its a bit too much magic. > > Yeah, too Perl-ish for me. > Please stop this. The minutes of the Paris meeting comm

RE: [PHP-DEV] Re: VS 2005 Support for 5.3?

2007-10-02 Thread Andi Gutmans
I definitely think it's worth another go. VS 2005 binaries are significantly faster than VC 6 (at least last time I checked). We can also help out a bit with issues as we've tackled some of them already. Andi > -Original Message- > From: Rob Richards [mailto:[EMAIL PROTECTED] > Sent: Tues

Re: [PHP-DEV] VS 2005 Support for 5.3?

2007-10-02 Thread Stanislav Malyshev
Off the top of your head, what side effects do you already anticipate, specifically? Also, I think Rich makes a good point about the "free" Microsoft VS2005 Express Edition, but I don't know how much more of a pain it would be to target that, or if it would cause long-term issues or detriment

Re: [PHP-DEV] VS 2005 Support for 5.3?

2007-10-02 Thread Stanislav Malyshev
One important thing we forgot to discuss is to drop VS6 support fin 5.3 and finally move to VS2005. As far as I know, non-CL builds are not supported at all right now, and for CL builds it works with both - is there anything should be done for VS2005? -- Stanislav Malyshev, Zend Software Arc

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

2007-10-02 Thread Martin Alterisio
2007/10/2, Alexey Zakhlestin <[EMAIL PROTECTED]>: > > 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 fu

RE: [PHP-DEV] Class Posing

2007-10-02 Thread Jared Williams
Ideally think I'd prefer it finer grained... interface A { } class AImpl implements A { } register('A', function() { return new AImpl(); }); register('Foo', function() { return new Bar(); }); $foo = new Foo(); $a = new A(); Would also require fun

[PHP-DEV] Re: VS 2005 Support for 5.3?

2007-10-02 Thread Rob Richards
Hi Pierre, Going forward this might be a good idea, but there needs to be a good amount of testing. I have ran into an issue recently running apps built with VS 2005 using dynamically linked libraries built with older versions due to different runtime linking, which did make me think of this s

RE: [PHP-DEV] T_IMPORT vs. T_USE

2007-10-02 Thread Ford, Mike
On 02 October 2007 07:16, Sebastian Nohn wrote: > Andi Gutmans wrote: > > Hi Johannes, > > Our preference would be to stick to "import" because I > think the perception many will have of "use" is that it also > includes files (just based on some other languages). I don't know much about "other la

Re: [PHP-DEV] Class Posing

2007-10-02 Thread Sebastian Bergmann
Richard Quadling schrieb: > You're code looks like a factory. Is that your intention? Maybe > __factory would be a more obvious name? The application of this mechanism is not limited to implementing factories and singletons. -- Sebastian Bergmann http://sebastian-bergm

Re: [PHP-DEV] Class Posing

2007-10-02 Thread Sebastian Bergmann
Guilherme Blanco schrieb: > Altho I found this idea really interesting, I have a suggestion for > it. Instead of use a function to handle new overloads, I suggest a > magic method, something like __new. __new() was what I initially proposed to Johannes but IIRC there were some performance implic

Re: [PHP-DEV] VS 2005 Support for 5.3?

2007-10-02 Thread Daniel Brown
> On 02/10/2007, Pierre <[EMAIL PROTECTED]> wrote: > > Hi, > > > > One important thing we forgot to discuss is to drop VS6 support fin > > 5.3 and finally move to VS2005. > > > > It has a couple of side effects but it is a one time job and should > > make our life easier on windows from 5.3 and up.

Re: [PHP-DEV] VS 2005 Support for 5.3?

2007-10-02 Thread Richard Quadling
On 02/10/2007, Pierre <[EMAIL PROTECTED]> wrote: > Hi, > > One important thing we forgot to discuss is to drop VS6 support fin > 5.3 and finally move to VS2005. > > It has a couple of side effects but it is a one time job and should > make our life easier on windows from 5.3 and up. > > Comments? >

Re: [PHP-DEV] Class Posing

2007-10-02 Thread Richard Quadling
On 02/10/2007, David Zülke <[EMAIL PROTECTED]> wrote: > would it be possible to overload final classes? > > - David > > > Am 02.10.2007 um 11:32 schrieb Sebastian Bergmann: > > > From [1]: > > > >Objective-C permits a class to wholly replace another class > > within a > >program. The repla

Re: [PHP-DEV] Class Posing

2007-10-02 Thread David Zülke
would it be possible to overload final classes? - David Am 02.10.2007 um 11:32 schrieb Sebastian Bergmann: From [1]: Objective-C permits a class to wholly replace another class within a program. The replacing class is said to "pose as" the target class. All messages sent to the

Re: [PHP-DEV] Class Posing

2007-10-02 Thread Guilherme Blanco
Hi Sebastian and PHP list, That's a very interesting idea and I'd use it too. Yesterday night I was developing a set of classes that it could apply this idea too. Altho I found this idea really interesting, I have a suggestion for it. Instead of use a function to handle new overloads, I suggest

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

2007-10-02 Thread Alexey Zakhlestin
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 functionality? > If so, how will ranges be passed through to thi

[PHP-DEV] namespaces: import name conflicts with defined class

2007-10-02 Thread Benjamin Schulz
Hi all, import Foo::Bar AS DomDocument; import Foo::Exception; import MyStuff::Dom::XsltProcessor; Result in a "Fatal error: Import name '...' conflicts with defined class" Of course i want to refer to my own exception in my application or framework as "Exception", and of course i want to us

[PHP-DEV] VS 2005 Support for 5.3?

2007-10-02 Thread Pierre
Hi, One important thing we forgot to discuss is to drop VS6 support fin 5.3 and finally move to VS2005. It has a couple of side effects but it is a one time job and should make our life easier on windows from 5.3 and up. Comments? Cheers, --Pierre -- PHP Internals - PHP Runtime Development Ma

Re: [PHP-DEV] [PATCH] Proposal for fixing bug #40501

2007-10-02 Thread Jani Taskinen
I recommend AFTER. I myself tend to fix ws automatically..and then later trying to commit ws/cs fixes separately is PITA. So first fix the real problem then fix any ws/cs. :) --Jani On Tue, 2007-10-02 at 11:26 +0200, Marcus Boerger wrote: > Hello David, > > Monday, October 1, 2007, 11:36:19 PM,

[PHP-DEV] Class Posing

2007-10-02 Thread Sebastian Bergmann
From [1]: Objective-C permits a class to wholly replace another class within a program. The replacing class is said to "pose as" the target class. All messages sent to the target class are then instead received by the posing class. There are several restrictions on which classes c

Re: [PHP-DEV] link to exceptions in autoload thread?

2007-10-02 Thread Marcus Boerger
Hello Gregory, I don't recall any particular thread but Andi once explained why a few things are instable when exceptions are pending. Some of that is no longer the case so maybe it is time to reinvestigate the whole issue of pending exceptions. But maybe that would result in an exception stack

Re: [PHP-DEV] [PATCH] Proposal for fixing bug #40501

2007-10-02 Thread Marcus Boerger
Hello David, Monday, October 1, 2007, 11:36:19 PM, you wrote: > Hi internals, > once again a proposal for a bugfix. > This time concerning http://bugs.php.net/bug.php?id=40501. > As the standard escape character is \\ , but the RFC says ", I added a > optional escape character to the function

Re: [PHP-DEV] Solaris and getcwd()

2007-10-02 Thread Antony Dovgal
On 02.10.2007 04:11, Rob Thompson wrote: > I've been trying to find out some reason why the getcwd() PHP function > fails under some situations under Solaris. Particularly, when some > component of the file path looks like: d--x--x--x (no read perms). This > appears to be a security feature that