Re: [ZEND-ENGINE-CVS] cvs: ZendEngine2 / zend_API.c zend_compile.c /tests ns_063.phpt

[email protected] (Dmitry Stogov)
Newsgroups php.internals,php.zend-engine.cvs
Message-ID <[email protected]>
It's just simple to make constructors work in the same way in namespaces 
and out of them. It would be difficult to explain why the first script 
prints "ok" and the second doesn't.

<?php
class Foo {
	function Foo() {
		echo "ok\";
	}
}
new Foo();
?>

<?php
namesapce Bar;
class Foo {
	function Foo() {
		echo "ok\";
	}
}
new Foo();
?>

I think, we must support old-style constructors for both cases or remove 
them at all, but as I said removing them would break a lot of old 
(non-namesapced) code.

Thanks. Dmitry.

Derick Rethans wrote:
> On Mon, 5 May 2008, Dmitry Stogov wrote:
> 
>> As we didn't drop this support yet, and it didn't work in namespaces by
>> mistake I've fixed it to work in the same way as without namespaces.
>>
>> Removing this support won't give any speedup (except of compilation speed),
>> but might break a lot of code.
> 
> How can it break existing code? It's only on issue if a class is part of 
> a namespace, and existing code doesn't have namespaces. So it *can't* be 
> breaking old code.
> 
> regards,
> Derick
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.