Re: PHP package issues

  • From: "Brian G." <drakain@xxxxxxxxx>
  • To: Antti Kantee <pooka@xxxxxx>
  • Date: Sun, 12 Jul 2015 23:04:11 -0400

In this case, all the name spaces are loaded by the PHP package manager
(and I can verify it is all put together correctly).

It's truly strange as I'm able to change where the error is, if there is
one at all. If I remove all the newlines from the PHP files then these
parse errors disappear, and when I re-introduce them they come back in
different ways. Only when executing the file however. Linting always passes.

On Sun, Jul 12, 2015 at 8:46 PM, Antti Kantee <pooka@xxxxxx> wrote:

On 13/07/15 00:00, Brian G. wrote:

Hey everyone, I'm trying to get up and running with rumprun-packages/php
and I've hit a bit of a roadblock.

I'm able to launch the demo site provided in standalone mode, however,
when
I try to load in a larger PHP application (uses namespace, calls to
__FILE__ and other language features) I receive parse errors.

When running the application on a traditional system I do not encounter
any
issues like this, even when trying to recreate configuration conditions.


Just guessing, but do you have e.g. AnnotationRegistry available on your
host system, but not present in the rumprun guest? If not, should you
somehow attempt to include it under /data (or wherever) on the guest?

In the code there is one file that looks like this:


<?php

use Doctrine\Common\Annotations\AnnotationRegistry;
use Composer\Autoload\ClassLoader;

/**
* @var ClassLoader $loader
*/
$loader = require __DIR__.'/../vendor/autoload.php';

AnnotationRegistry::registerLoader(array($loader, 'loadClass'));

return $loader;


This file has no linting errors, but when I browse to it, I receive this
error:

*Parse error*: syntax error, unexpected '::registerLoader(a' in
*/data/www/symfony_demo/vendor/autoload.php* on line *10*


An error like that makes me believe that "AnnotationRegistry" is not
recognized as an identifier, and backtracking makes me believe that "use
Doctrine\...\AnnotationRegistry" fails.




--
-Brian G.

Other related posts: