-
-
Notifications
You must be signed in to change notification settings - Fork 506
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
Fatal Error: Uncaught Error: Class 'Timber\Timber' not found after update from 0.22.6 to 1.5.2 #1581
Comments
I think this has to do with Timber being namespaced now (see releases/tag/1.0.0-rc3). You can solve the issue by using See new doc "Reference" section for a list of all available classes : https://timber.github.io/docs/reference/ |
Is that true for things like I'll give that a try though and report back. Thanks! |
yup, it seems that documentation, as well as the starter theme, still refers to 0.* versions. You can move from class MySite extends TimberSite { to class MySite extends Timber\Site { |
Wow, ok thanks. @jarednova what would be the best way to submit a change for that documentation page? As a followup on namespacing (forgive me, it's a newer concept to me) does that also apply to the {% for item in TimberPost(featured) %}
{%- include "foo.twig" with {
"foo": bar,
"bar": foo
}
-%} Be changed to: {% for item in Timber\Post(featured) %}
{%- include "foo.twig" with {
"foo": bar,
"bar": foo
}
-%} |
Twig function names didn't change. See here : https://github.com/timber/timber/blob/master/lib/Twig.php#L52 |
@gsalkin Documentation for the reference is auto-generated from the DocBlocks of the PHP files. So to change the examples for Line 17 in f566b4c
There are still a lot of areas where the documentation has to be completed, especially in the class reference. So pull requests are very welcome! 😊 |
Good to know. Strangely, the Timber starter theme is using the old, non-namespaced version of timber functions like |
@drskullster By the by, updating with Namespacing does not seem to have worked. Still same errors. Are ALL references to For example: I guess I'm confused my old non-namespaced functions are still working on the VM but not in the staging environment. Is there a possibility this is related to an issue in my deployment process? |
@gsalkin yes, every time you're using the class Timber you'll have to namespace it. An alternative would be to insert a use Timber\Timber;
use Timber\Post;
use Timber\Site;
...
Timber::get_context();
...
class MySite extends Site {}
...
new Post(); As a side note, if you're feeling nostalgic about the old class names you could do something like : use Timber\Post as TimberPost;
...
new TimberPost(); |
@drskullster very helpful, thanks. Still find it strange that documentation and the starter theme haven't been updated with this namespacing change. Makes it hard to accurately replicate code. @jarednova @gchtr is there something I'm missing here? |
Expected behavior
I recently began the upgrade procedure for updating from 0.22.6 to the current release 1.5.2. I've made the necessary changes to continue to support Routes; removed deprecated methods etc. My site loads fine on a local machine (VM running CentOS 7.2 w/ nginx and PHP 7)
Actual behavior
On my staging server, the site will not load and instead posts the following errors:
Steps to reproduce behavior
Happens on site load.
What version of WordPress, PHP and Timber are you using?
WordPress 4.8.2 with PHP 7.0.23 and Timber 1.5.2
How did you install Timber? (for example, from GitHub, Composer/Packagist, WP.org?)
I tried updating Timber two ways. First used Composer and Packagist but saw this old issue #1308 where there can be issues from updating Timber via Composer. Did a revert of my
composer.json
and tried installing via the plugin updater. Still having the same issues.The text was updated successfully, but these errors were encountered: