Skip to content

php artisan optimize error #629

@dfeng

Description

@dfeng

Let me first preface this by saying I've tried to understand the whole idea of autoload (basically, lazy loading of classes), but I'm not too sure about how the internals work. Onto the problem.

I'm on the develop branch (L4 - Beta 3). I have mcrypt.

When I run php artisan optimize (which produces the compiled.php), I get the following error in the php error logs:

Cannot redeclare class Illuminate\Support\Contracts\ArrayableInterface in /Applications/MAMP/htdocs/l4-app/bootstrap/compiled.php on line 9470

Everything works when there isn't a compiled.php in the bootstrap folder, so I'm guessing it's something to do with the way autoload.php is doing a require twice?

I've played around with that file, and I put print_r(get_declared_classes()); after require __DIR__.'/../vendor/autoload.php';, and the only interesting classes were

... [142] => Illuminate\Database\Eloquent\Model [143] => LaravelBook\Ardent\Ardent )

which I'm assuming are the only two classes that are loaded (rather than autoloaded). Then, it fails on the require $compiled.

My composer.json file looks something like this:

 {
    "require": {
        "laravel/framework": "4.0.*",
        "zizaco/confide": "dev-master",
        "zizaco/entrust": "dev-master",
        "laravelbook/ardent": "dev-master",
        "anahkiasen/former": "dev-agnostic",
        "bigelephant/presenter": "dev-master"
    },
    "autoload": {
        "classmap": [
            "app/commands",
            "app/controllers",
            "app/models",
            "app/libraries",
            "app/presenters",
            "app/database/migrations",
            "app/database/seeds",
            "app/tests/TestCase.php"
        ]
    },
    "scripts": {
        "post-update-cmd": "php artisan optimize"
    },
    "minimum-stability": "dev"
}

Thanks for your help! In the meantime, I'll keep to the sub-optimal solution.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions