Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Config error #6

Open
SvanThuijl opened this issue Aug 12, 2015 · 20 comments
Open

Config error #6

SvanThuijl opened this issue Aug 12, 2015 · 20 comments

Comments

@SvanThuijl
Copy link

Hey Guys,

I have bene trying to figure this out by myself but I can't.

In my local development environment I have this plugin working perfectly but when deploying there is an issue. I get these errors.
[Wed Aug 12 18:44:37.429070 2015] [:error] [pid 30427] [client 190.88.209.114:13186] PHP Warning: array_filter() expects parameter 1 to be array, null given in /home/project/laravel/config/propel.php on line 83, referer: http://www.project.com/
[Wed Aug 12 18:44:37.429163 2015] [:error] [pid 30427] [client 190.88.209.114:13186] PHP Warning: array_map(): Argument #2 should be an array in /home/project/laravel/config/propel.php on line 84, referer: http://www.project.com/

I thinks the issue comes from the order laravel has in loading the config files. By adding the line below to the config files I found out that propel.php is loaded before database.php in the production environment. Locally this is the other way around.

echo 'Loaded: ' . microtime(true) . ': ' . FILE . '
';

Result on production:
Loaded: 1439398148.1305: /home/project/laravel/config/propel.php
Loaded: 1439398148.1313: /home/project/laravel/config/database.php

Result local:
Loaded: 1439398248.01: /Users/SvanThuijl/PhpstormProjects/laravel/config/database.php
Loaded: 1439398248.02: /Users/SvanThuijl/PhpstormProjects/laravel/config/propel.php

Does anybody know how to solve this issue?

@SCIF
Copy link
Owner

SCIF commented Aug 13, 2015

@SvanThuijl , hi!

Do you use .env in production? What version of framework do you use? The most seems like you collided laravel/framework#6096 issue or something similar.

@SvanThuijl
Copy link
Author

My framework version is 5.1.10 and I do use .env to configure everything.

I have "solved" this issue by renaming the file to "propel..php" for now.

@Big-Shark
Copy link
Collaborator

Do you use artisan config:cache? If yes, please run php artisan config:cache again.

@SvanThuijl
Copy link
Author

I did not do anything to the cache configuration so I don't think so.

When I try this I already get the errors because the propel config fails. Renaming the file and execute this command does not solve the issue.

@SCIF
Copy link
Owner

SCIF commented Aug 14, 2015

@SvanThuijl , you can use php artisan propel:config:convert and it must solve your issue. But it must be rerun on each database config update. I can't reproduce that bug so i can only suggest workarounds :( Provide please trace of debug_print_backtrace() placed in propel.php config to help reproduce or understand root of that bug.

@SvanThuijl
Copy link
Author

-bash-4.1$ php artisan propel:config:convert
PHP Warning: array_filter() expects parameter 1 to be array, null given in /home/dognailtri/laravel/config/propel.php on line 75
PHP Warning: array_map(): Argument #2 should be an array in /home/dognailtri/laravel/config/propel.php on line 76

[ErrorException]
Undefined index: adapter

-bash-4.1$

@SCIF
Copy link
Owner

SCIF commented Aug 16, 2015

@SvanThuijl , hmm, i digged config loading bootstrapper and seems like it's rarely your system behavior. You can use workaround. Add in your config/propel.php before all return:

if (app()->make('config')->has('database')) {

and next text to the end of file:

} else {
    return [];
}

@SCIF
Copy link
Owner

SCIF commented Aug 16, 2015

Hmm. It will not solve issue (it will replace error happening, but it will be still broken). We need to reread config in ServiceProvider somehow.... @SvanThuijl , let me one more day to think.

SCIF added a commit to propelorm/PropelLaravel that referenced this issue Aug 17, 2015
@SCIF
Copy link
Owner

SCIF commented Aug 17, 2015

@SvanThuijl , i tried to fix it by a little hack. Try dev version please. You can follow migration guide

@SvanThuijl
Copy link
Author

Thanks for the effort.

Your migration manual is not correct. The dev-master has no PropelIntegrationServiceProvider but I configured the GeneratorServiceProvider and RuntimeServiceProvider. This doe snot solve the issue.

@SCIF
Copy link
Owner

SCIF commented Aug 17, 2015

@SvanThuijl , did you changed composer.json repo for package and did you composer update (i forget to add that command)?

@SvanThuijl
Copy link
Author

Yes I did.
https://github.com/propelorm/PropelLaravel/tree/master/src
No PropelIntegrationServiceProvider there. It's only in dev.

I also just noticed the command line tool is not fixed with renaming the file. The config is not loaded at all when I try to run php artisan propel:migration:diff The output for that is below.

  [RuntimeException]                
  Unable to write the "" directory  


  [Symfony\Component\Filesystem\Exception\IOException]  
  Failed to create ""

@SCIF
Copy link
Owner

SCIF commented Aug 18, 2015

@SvanThuijl , hm, i thought that composer dev-master must pull latest HEAD. May be it's incorrect.

Try to explicitly point commit:

"propel/propel-laravel": "dev-master#68a1d0edc784a89fe8853672425cd6198dd83aa1"

and update.

@SvanThuijl
Copy link
Author

Composer doesn't update anything at all after changing this.

@SCIF
Copy link
Owner

SCIF commented Aug 21, 2015

@SvanThuijl , can you provide config/propel.php (without passwords, hosts or any other sensitive data) and archived vendor/propel/propel-laravel dir? I simulated your case and my changes fixed it.

SCIF added a commit to propelorm/PropelLaravel that referenced this issue Aug 25, 2015
@SCIF
Copy link
Owner

SCIF commented Aug 25, 2015

@SvanThuijl , i hope that i totally fixed your issue. Can you install latest propel/propel-laravel composer package at dev-master?

@SvanThuijl
Copy link
Author

Got a machine crash and couldn't/didn't work for a while. I'll get back to this asap.

@SvanThuijl
Copy link
Author

Problem still persists. Do you have a private contact option? I'll give you access to my install so you can test on my production server.

@SCIF
Copy link
Owner

SCIF commented Sep 11, 2015

@SvanThuijl , feel free to write emails to scif-1986 [at] ya.ru or use skype: scif-1986

@xdom
Copy link

xdom commented Sep 14, 2015

Had the same issue and the fix works perfectly, thus by using

"propel/propel-laravel": "dev-develop"

in my composer.json as the fixes are in develop branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants