Re: PHP package issues

  • From: Martin Lucina <martin@xxxxxxxxxx>
  • To: drakain@xxxxxxxxx
  • Date: Mon, 13 Jul 2015 22:31:17 +0200

On 2015-07-13 05:04, Brian G. wrote:

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.

I'm guessing here, but the PHP package we build for rumprun-packages is built with --disable-all (disables all language extensions) and with essentially no php.ini. If you build PHP on Linux with the same configure options and run the standalone server, do you get the same error?

Also, as Antti writes later in the thread it'd be useful if you could post a minimal test case -- I guess you're using Symfony? In that case a Symfony "Hello, World" should trigger the problem.

I'll be packing tomorrow and travelling Wednesday but should be able to take a look at this later in the week.

Martin


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.




Other related posts: