Jessie Hernandez wrote: > Hi Greg, > > How is this different from my original proposal > (http://news.php.net/php.internals/34097, > http://news.php.net/php.internals/34097)? > >
The patch committed only affects non-namespaced code, your proposal affected all code. In other words, this always works: <?php namespace Foo; include 'blah.php'; use Blah::Closure; $a = new Closure(); ?> whereas this: <?php include 'blah.php'; use Blah::Closure; $a = new Closure(); ?> had the potential to fail with fatal error without code change on upgrade to a newer PHP version that creates the "Closure" class. The committed patch addresses only this shortcoming, and changes nothing else. In other words, this: <?php namespace Foo; $a = new Exception('hi'); var_dump(get_class($a)); ?> still prints "Exception" and not "Foo::Exception". Additionally, unlike your proposal, all existing namespace tests still pass with the behavior change. 2 new tests were added, 1 to test the relaxed behavior, and 1 to test that this next example is a fatal error because definition of Foo::Closure is in the same file as the "use Blah::Closure": <?php namespace Foo; include 'blah.php'; class Closure{} use Blah::Closure; // unqualified name "Closure" is already taken, fatal error. ?> Greg -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php