hhvm icon indicating copy to clipboard operation
hhvm copied to clipboard

Global namespaces

Open Swaagie opened this issue 14 years ago • 11 comments

Compiling PHP with the HHVM enabled does not parse global namespaces correctly, per example Silex::LazyUrlMatcher.

The matcher uses \Closure and uses 2 other local namespaces. The issue is resolved by explicitly defining local use \Closure.

There is an old Pull Request which seems (low C++ skills) to handle this case.

Swaagie avatar Oct 12 '12 20:10 Swaagie

HipHop VM does not support namespaces currently.

paroski avatar Oct 12 '12 21:10 paroski

Well it sort of does, as long as you define the by use, or it that just appearances? It does compile the hhbc then, but your saying it will brake down anyhow if you try to use the binary with hhvm?

Swaagie avatar Oct 12 '12 21:10 Swaagie

There was some support for namespaces added to HPHPc (the PHP->C++ compiler) a while ago, but I think there were some bugs and corner cases that it got wrong.

HHVM probably inherited some of this from HPHPc (since they share a lot of code), but we haven't done any testing at all to make sure namespaces actually work on HHVM. I wouldn't be surprised if some PHP code using namespaces happens to work, but it wouldn't be hard to come up with PHP code using namespaces that doesn't work. For example, PHP code that relies on the "fallback" semantics for functions and constants (http://php.net/manual/en/language.namespaces.fallback.php) probably won't work correctly.

paroski avatar Oct 12 '12 22:10 paroski

bump?

karpa13a avatar Nov 23 '12 09:11 karpa13a

We're closing out all bugs older than 2 months. http://www.hiphop-php.com/wp/?p=575

If this is still an issue, please re-open it, and in order of goodness:

  1. Give detailed repro steps
  2. Write a test case in hphp/tests/quick (run it with hphp/tests/run) and send the pull request
  3. Fix it in a pull request

ptarjan avatar May 13 '13 21:05 ptarjan

Namespace support is still a big feature request. Can this issue be re-opened?

dave1010 avatar Jun 04 '13 10:06 dave1010

@dave1010 did u check current git?

karpa13a avatar Jun 04 '13 11:06 karpa13a

I didn't, sorry. I had a look through the issues here and found nothing. A scan through the logs shows a fair bit of work on namespace support but I can't find a general status/feature support page or any related docs in the wiki. Next time I'll just build the source & try it ;-)

dave1010 avatar Jun 04 '13 15:06 dave1010

@dave1010 in general, everything works unless otherwise mentioned.

Can you create the doc you were expecting to find, so others won't have the same problem? It is a wiki after all.

ptarjan avatar Jun 04 '13 17:06 ptarjan

Does this mean namespaces work now? I'm interested in using hiphop with a Silex application.

ghost avatar Jun 04 '13 17:06 ghost

Yes. Please test it and open any issues you run into.

Sent from my iPhone

On Jun 4, 2013, at 10:40 AM, peachepe [email protected] wrote:

Does this mean namespaces work now? I'm interested in using hiphop with a Silex application.

— Reply to this email directly or view it on GitHub.

ptarjan avatar Jun 04 '13 18:06 ptarjan