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

Timber killing site load when installed as a dependency of the whole site instead of the composer.json of a theme #991

Closed
stewarty opened this issue May 11, 2016 · 10 comments
Labels
has-patch needs-info Need more info on this issue in order to properly investigate

Comments

@stewarty
Copy link

Expected behavior

Timber not to kill a site loading

Actual behavior

Following error on page view

Fatal error: Uncaught Error: Call to undefined function Timber\is_admin() in /vagrant/vendor/timber/timber/lib/Timber.php:61 Stack trace: #0 /vagrant/vendor/timber/timber/lib/Timber.php(49): Timber\Timber->test_compatibility() #1 /vagrant/vendor/timber/timber/init.php(5): Timber\Timber->__construct() #2 /vagrant/vendor/composer/autoload_real.php(54): require('/vagrant/vendor...') #3 /vagrant/vendor/composer/autoload_real.php(45): composerRequire38245ed637a44f902e4cbd66fc63b950('/vagrant/vendor...') #4 /vagrant/vendor/autoload.php(7): ComposerAutoloaderInit38245ed637a44f902e4cbd66fc63b950::getLoader() #5 /vagrant/public/wp-config.php(99): include('/vagrant/vendor...') #6 /vagrant/public/wordpress/wp-load.php(42): require_once('/vagrant/public...') #7 /vagrant/public/wordpress/wp-admin/admin.php(31): require_once('/vagrant/public...') #8 /vagrant/public/wordpress/wp-admin/index.php(10): require_once('/vagrant/public...') #9 {main} thrown in /vagrant/vendor/timber/timber/lib/Timber.php on line 61

Steps to reproduce behavior

Install timber at the composer.json in the root of a WordPress project, not in the composer.json of a theme

What version of WordPress, PHP and Timber are you using?

WordPress 4.5.2, PHP 7, Timber 1.01 -->

How did you install Timber? (for example, from GitHub, Composer/Packagist, WP.org?)

composer require timber/timber

@connorjburton
Copy link

There has been another report of this, where do you require the autoloader.php?

And what is your setup that you can't require it in the theme?

Thanks!

@connorjburton connorjburton added the needs-info Need more info on this issue in order to properly investigate label May 11, 2016
@connorjburton
Copy link

Hi, can you please try the fix in #997 (you should be able to do require timber/timber:dev-cjb-autoload-root)

@jarednova
Copy link
Member

@stewarty I merged @connorjburton's changes into master — can you give the newest version a test to confirm that it solves your issue?

@PhilippBaschke
Copy link
Contributor

dev-master at packagist still points to b5d15a6 (before patch) for me. What's the best way to install the patched version?

@chrisgherbert
Copy link

You can require a specific commit: "timber/timber": "dev-master#7ae6337f1811b2a274dc43c6434e48b464ec7746"

@stewarty
Copy link
Author

stewarty commented Jun 1, 2016

@connorjburton No luck I'm afraid.

Fatal error: Uncaught Error: Call to undefined function Timber\is_admin() in /vagrant/vendor/timber/timber/lib/Timber.php:63 Stack trace: #0 /vagrant/vendor/timber/timber/lib/Timber.php(51): Timber\Timber->test_compatibility() #1 /vagrant/vendor/timber/timber/init.php(5): Timber\Timber->__construct() #2 /vagrant/vendor/composer/autoload_real.php(54): require('/vagrant/vendor...') #3 /vagrant/vendor/composer/autoload_real.php(45): composerRequire38245ed637a44f902e4cbd66fc63b950('/vagrant/vendor...') #4 /vagrant/vendor/autoload.php(7): ComposerAutoloaderInit38245ed637a44f902e4cbd66fc63b950::getLoader() #5 /vagrant/public/wp-config.php(99): include('/vagrant/vendor...') #6 /vagrant/public/wordpress/wp-load.php(42): require_once('/vagrant/public...') #7 /vagrant/public/wordpress/wp-blog-header.php(13): require_once('/vagrant/public...') #8 /vagrant/public/index.php(13): require('/vagrant/public...') #9 {main} thrown in /vagrant/vendor/timber/timber/lib/Timber.php on line 63

"timber/timber": "dev-master#7ae6337f1811b2a274dc43c6434e48b464ec7746",

Autoload.php is required in wp-config.php before wp-settings.php

include(dirname( FILE ) . "/../vendor/autoload.php");
require_once(ABSPATH . 'wp-settings.php');

@jarednova
Copy link
Member

@stewarty — where are you calling autoloader.php? I want to try to re-create your setup locally to see if I can get the same error

@stewarty
Copy link
Author

stewarty commented Jun 1, 2016

@jarednova I can send you the project as it is if you'd like?

@jarednova
Copy link
Member

@stewarty that'd be awesome! jared@upstatement.com

@connorjburton
Copy link

Moving this to #979 as they are the same issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
has-patch needs-info Need more info on this issue in order to properly investigate
Projects
None yet
Development

No branches or pull requests

5 participants