Giter Club home page Giter Club logo

acorn's Introduction

Acorn

Packagist Downloads Laravel v10 Build Status Follow Roots

Laravel components for WordPress plugins and themes

Website    Documentation    Releases    Community

Sponsors

Acorn is an open source project and completely free to use. If you've benefited from our projects and would like to support our future endeavors, please consider sponsoring Roots.

KM Digital Carrot WordPress.com Worksite Safety

Overview

Acorn is a framework for integrating Laravel within WordPress.

Supported components

Component Support Notes
illuminate/bus 🟢
illuminate/cache 🟢
illuminate/collections 🟢
illuminate/conditionable 🟢
illuminate/config 🟢
illuminate/console 🟢
illuminate/container 🟢
illuminate/contracts 🟢
illuminate/database 🟢
illuminate/encryption 🟢
illuminate/events 🟢
illuminate/filesystem 🟢
illuminate/hashing 🟢
illuminate/http 🟢
illuminate/log 🟢
illuminate/macroable 🟢
illuminate/pipeline 🟢
illuminate/queue 🟢
illuminate/routing 🟢
illuminate/session 🟢
illuminate/support 🟢
illuminate/validation 🟢
illuminate/view 🟢
Additional components  
Component Support Notes
illuminate/auth 🔴
illuminate/broadcasting 🔴
illuminate/cookie 🔴
illuminate/mail 🔴
illuminate/notifications 🔴
illuminate/pagination 🔴 Available via Log1x/pagi
illuminate/redis 🔴
illuminate/testing 🔴
illuminate/translation 🔴

Getting Started

See the Acorn installation documentation.

Stay Connected

acorn's People

Contributors

broskees avatar dependabot-preview[bot] avatar dependabot[bot] avatar dsturm avatar firescript avatar iniznet avatar joshuafredrickson avatar kellymears avatar knowler avatar log1x avatar mikeyzm avatar oskar-koli avatar ouun avatar owenvoke avatar plumthedev avatar qwp6t avatar retlehs avatar sammyhayman avatar sergiarias avatar stefanfisk avatar strarsis avatar szepeviktor avatar teppokoivula avatar tombroucke avatar tommica avatar tylerwiegand avatar ukeloop avatar valeravilks avatar will0 avatar wolfgangschaefer avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

acorn's Issues

Full Site Editing (FSE) support (frontend)

Description

Full Site Editing (FSE) with Sage 10 theme loads a blade template in frontend, no Website editor blocks are shown.

Steps to reproduce

  1. Ensure a Sage 10 theme is present and enabled.
  2. Enable Full Site Editing (FSE) support in the Sage 10 theme.
  3. Add some modifications to the Website editor.
  4. Add/edit a page (front page).
  5. Open the front page on frontend.
    Note that the site blocks from the Website editor are not loaded, instead the default blade-based template.

Expected behavior:
Frontend shows the blocks from website editor.

Actual behavior:
Frontend doesn't show the blocks from website editor, but the default blade template instead.

Reproduces how often:
Always.

Versions

1.16.1: 2021-07-30

Additional information

Latest Gutenberg plugin 11.7.1.

The previous code for adding compatibility for Full Site Editing (FSE) doesn't work (anymore):

// Sage 10 + Gutengberg Full Site Editing (FSE) template compatibility
// @see https://discourse.roots.io/t/sage-10-block-based-theme-support/17294/2?u=strarsis
add_filter('template_include', function ($template_file) {
    global $_wp_current_template_hierarchy;
    $_wp_current_template_hierarchy = array_map('basename', $_wp_current_template_hierarchy);
    return $template_file;
}, 19);

Upstream Loader & registration logic

Summary

Using annotations to register methods from Service classes to actions / filters.

Motivation

The idea is to allow you to declare a Service class and annotate its methods, then register said Service with the application container. When the app boots, it loops through all of its services and any with these annotations get registered with WordPress. I did an implementation of the Loader for an attempt at a similar framework to what Acorn is doing. I would be very interested in upstreaming this to Acorn, if you want it, but wanted to see if that's useful to you first.

Additional context

I posted about it on Discourse, and got a like from the OP but no explicit response, so it seems like there may be some interest so thought I'd flag it here.

public_path helper points to non-default Sage publicPath

Summary

The public_path() helper is pointing to the public directory in Sage which doesn't exist. I think we gotta either tie this into the asset manager or drop it. I’m leaning towards the latter since personally, I don't think public_path makes sense in the context of a WordPress theme or plugin since everything is public. On the other hand, Laravel Mix uses this terminology so that could be a reason to keep it.

Bug: Issue with Acorn Beta 5+ with Media Cloud plugin

Terms

Description

What's wrong?

On a new install of Trellis/Bedrock/Sage with and the roots/acorn beta 5 or higher, the Media Cloud plugin cannot be activated. with versions 4.2.36 and/or 4.2.37.

What have you tried?

I've tried all the standard troubleshooting. Only plugin active etc. etc... however I started going though the older Acorn versions after an hour or so of troubleshooting and found that beta.4 is the last release that works with this plugin.

What insights have you gained?

I believe something was removed (possibly from the dev requirements in acorn?) that might be affecting this specific plugin as it uses Illuminate packages.

Possible solutions

Possibly add back the dev dependencies?

Temporary workarounds

Downgrade acorn to beta.4 for activation of the plugin and use.

Steps To Reproduce

  1. Install new trellis/bedrock/sage
  2. Add media press pro plugin for install
  3. Try and activate with acorn-beta.5 or higher

Expected Behavior

The plugin should activate.

Actual Behavior

Error seen below.

Fatal error: Uncaught BadMethodCallException: Method whenEmpty does not exist.

in /srv/www/mademusicstudio.com/current/web/app/plugins/ilab-media-tools-premium/lib/mcloud-illuminate/support/Traits/Macroable.php:96 Stack trace: #0
/srv/www/mademusicstudio.com/current/web/app/themes/mademusicstudio/vendor/roots/acorn/src/Roots/Acorn/Bootloader.php(283): MediaCloud\Vendor\Illuminate\Support\Collection->__call('whenEmpty', Array) #1
/srv/www/mademusicstudio.com/current/web/app/themes/mademusicstudio/vendor/roots/acorn/src/Roots/Acorn/Bootloader.php(253): Roots\Acorn\Bootloader->findPath('app') #2
/srv/www/mademusicstudio.com/current/web/app/themes/mademusicstudio/vendor/roots/acorn/src/Roots/Acorn/Bootloader.php(206): Roots\Acorn\Bootloader->usePaths() #3
/srv/www/mademusicstudio.com/current/web/app/themes/mademusicstudio/vendor/roots/acorn/src/Roots/Acorn/Bootloader.php(181): Roots\Acorn\Bootloader->app() #4
/srv/www/mademusicstudio.com/current/web/wp/wp-includes/class-wp-hook.php(303): Roots\Acorn\Bootloader->__invoke('') #5
/srv/www/mademusicstudio.com/current/web/wp/wp-includes/class-wp-hook.php(327): WP_Hook->apply_filters(NULL, Array) #6
/srv/www/mademusicstudio.com/current/web/wp/wp-includes/plugin.php(470): WP_Hook->do_action(Array) #7
/srv/www/mademusicstudio.com/current/web/wp/wp-settings.php(556): do_action('after_setup_the...') #8
/srv/www/mademusicstudio.com/current/web/wp-config.php(9): require_once('/srv/www/mademu...') #9
/srv/www/mademusicstudio.com/current/web/wp/wp-load.php(55): require_once('/srv/www/mademu...') #10
/srv/www/mademusicstudio.com/current/web/wp/wp-admin/admin.php(34): require_once('/srv/www/mademu...') #11
/srv/www/mademusicstudio.com/current/web/wp/wp-admin/plugins.php(10): require_once('/srv/www/mademu...') #12 {main}
thrown in /srv/www/mademusicstudio.com/current/web/app/plugins/ilab-media-tools-premium/lib/mcloud-illuminate/support/Traits/Macroable.php on line 96

Relevant Log Output

No response

Versions

Sage 10.0.0-beta.2

WP_CLI not found in Tinkerwell

Summary

I have recently become enamored with a tool called Tinkerwell. It's like wp shell but in a GUI. It supports SSH and out of the box Wordpress support. I made a custom Bedrock driver for it with some difficulty, and though it functions with any normal Bedrock install (including with Sage 9), when I attempt to use it with Acorn, I am unable to without commenting out most of the Acorn/Bootstrap/Console.php file. So, I would suggest an additional context check for the $this->app->runningInConsole() to allow this functionality to be loaded on demand (only because it's causing an issue!)

If there's a way to just load WP_CLI in a way that doesn't output the error PLEASE just tell me and I'll add it into my Tinkerwell and call it a day! Thanks!

Motivation

I believe the configurability will allow other tools like this to co-exist peacefully with Acorn.

Additional context

Example of what a solution could look like (which is mostly a workaround, if WP_CLI can be loaded properly instead im all for it I just don't know much about it)
image

Tinkerwell's output when this "solution" is enacted
image

TInkerwell's output without this enacted
image

Bug: Roots\Acorn\Console\Kernel does not autoload commands from App\Console\Commands

Description

What's wrong?

Roots\Acorn\Console\Kernel does not autoload commands from App\Console\Commands.

What have you tried?

Adding a command to App\Console\Commands and then watching it be ignored.

What insights have you gained?

The kernel only loads commands that subclass Illuminate\Console\Commands\Command, but that class doesn't exist.

Possible solutions

This line should actually be use Illuminate\Console\Command;:

use Illuminate\Console\Commands\Command;

Temporary workarounds

🤷‍♀️

Steps To Reproduce

  1. Add a command to App\Console\Commands
  2. Run wp acorn
  3. See that it is missing

Expected Behavior

It should appear in the command list.

Actual Behavior

It does not.

Relevant Log Output

No response

Versions

99062b1

Php glob doesn't support globstart

Hi!
I found a bug in the filterThemeTemplates method:

/**
  * We use the exact same technique as WordPress core for detecting template files.
  *
  * Caveat: we go infinite levels deep within the views folder.
  *
  * @see \WP_Theme::get_post_templates()
  * @link https://github.com/WordPress/WordPress/blob/5.2.1/wp-includes/class-wp-theme.php#L1146-L1164
  */
 foreach ($this->files->glob("{$path}/**.php") as $full_path) {

The globstar(**), i.e. the double asterisk is not supported by php glob. And so the method is searching only in root and not in the subfolders, not allowing to use the conventional 'page-templates' folder.
As a workaround, the page-templates folder can be added to view config file but this will result in the post meta value 'my-template.blade.php' in place of 'page-templates/my-template.blade.php'.

Also i want to propose a secondary change, i.e. stripping the '.blade' suffix from the post template name, so that the resulting '_wp_page_template' meta value will be 'my-custom-template.php' instead of 'my-custom-template.blade.php'

Error Handler Broken

It looks like master is already on 2.0 now, which doesn't have this issue, but wanted to raise it in case there is to be a maintenance release of the 1.x series, and to let others know about it.

#58 was to add functionality to ignore certain classes of error, adding the following code:

/**
* Determine if the exception is in the ignore list.
*
* @param \Throwable $e
* @return bool
*/
protected function shouldntIgnore(Throwable $e)
{
return ! is_null(Arr::first($this->ignoredErrors, function ($type) use ($e) {
return $e instanceof $type;
}));
}

But from what I can see, this code doesn't work. It's checking if ErrorException is an instance of 'E_USER_DEPRECATED', which I don't believe will ever work. Something like:

$e->getSeverity() === constant($type)

is what I can come up with to get this to work as designed.

My workaround in a Sage 10 theme with Acorn v1.1.0 is to check if the Acorn error handler is the one registered, and if so, replace it with one that unconditionally throws an ErrorException

add_action('after_setup_theme', function () {
    $previous_handler = set_error_handler(null);

    // Check if the Acorn error handler was actually the one we just removed or not
    if (!empty($previous_handler[0]) && $previous_handler[0] instanceof \Roots\Acorn\Bootstrap\HandleExceptions) {
        set_error_handler(function ($level, $message, $file = '', $line = 0, $context = []) {
            throw new ErrorException($message, 0, $level, $file, $line);
        });
    } else {
        set_error_handler($previous_handler);
    }
}, 6);

Bug: A facade root has not been set.

Terms

Description

What's wrong?

Providers are skipped when they use a façade

What have you tried?

Registering a provider

What insights have you gained?

The issue is caused by load order of bootstrappers

Possible solutions

Fix the load order

Temporary workarounds

The following should work, but a fix will be pushed shortly so you can just wait for that if you want.

add_filter('acorn/bootstrap', fn () => [
    \Roots\Acorn\Bootstrap\CaptureRequest::class,
    \Roots\Acorn\Bootstrap\SageFeatures::class,
    \Roots\Acorn\Bootstrap\LoadConfiguration::class,
    \Roots\Acorn\Bootstrap\HandleExceptions::class,
    \Roots\Acorn\Bootstrap\RegisterFacades::class,
    \Roots\Acorn\Bootstrap\RegisterProviders::class,
    \Illuminate\Foundation\Bootstrap\BootProviders::class,
    \Roots\Acorn\Bootstrap\RegisterConsole::class,
]);

Steps To Reproduce

  1. composer require spatie/laravel-markdown
  2. wp acorn optimize:clear
  3. wp acorn package:discover
  4. Add markdown to a view file <x-markdown>## Hello world</x-markdown>
  5. Visit website

Expected Behavior

Should see rendered <h2>Hello world</h2>

Actual Behavior

Uggo error page

Relevant Log Output

[2022-01-23 18:29:20] development.WARNING: Skipping provider [Spatie\LaravelMarkdown\MarkdownServiceProvider] because it encountered an error. {"package":"spatie/laravel-markdown","provider":"Spatie\\LaravelMarkdown\\MarkdownServiceProvider","error":"A facade root has not been set.","help":"https://roots.io/docs/acorn/troubleshooting"}

Versions

Acorn v2.0.0-beta.8

Cannot run commands due to "Fatal error: Trait 'Illuminate\Console\Concerns\CreatesMatchingTest' not found"

Description

Cannot run any of the acorn commands due to missing Illuminate\Console\Concerns\CreatesMatchingTest.

Steps to reproduce

  1. Install dev-main in a WordPress project
  2. Run wp acorn

Expected behavior:

It should list the available commands.

Actual behavior:

Roots\Acorn\Bootstrap\RegisterConsole::bootstrap() throws an unhandled exception because Illuminate\Foundation\Console\ConsoleMakeCommand uses Illuminate\Console\Concerns\CreatesMatchingTest, which is not available.

Reproduces how often:

Always.

Versions

Since fe027f1.

Additional information

It looks to me like you forgot to copy the Contracts folder?

Console\Kernel does not load Laravel commands

Description

Roots/Acorn/Console/Kernel::load() only loads subclasses of Roots\Acorn\Console\Commands\Command. This causes subclasses of Laravel and third party commands to be skipped.

is_subclass_of($command, Command::class) &&

Steps to reproduce

  1. Subclass a laravel command into App\Console\Commands
  2. run wp acorn

Expected behavior: [What you expect to happen]

The command should be loaded.

Actual behavior: [What actually happens]

It is not.

Reproduces how often: [What percentage of the time does it reproduce?]

Always

Versions

919478f

Additional information

Is there any intended way of manually registering commands?

Routing on this beautiful framework

Hello, thank you for the efforts of the programmers of this framework, I have a suggestion for adding "router" to make this framework powerful, I've written a router inspired by Laravel that might be helpful.
here

  • Best regards

Symfony Error Handler broken

Description

The Symfony error handler is never rendering which leads to blank pages on errors when WP_ENV is not set to development

Steps to reproduce

  1. Set WP_ENV to "local"
  2. Trigger an error/exception

Expected behavior: Symfony error page

Actual behavior: Blank page

Reproduces how often: 100%

Versions

2.0.1

Error handler: incorrect bitwise comparison

Description

Note: acorn put the code of a previously deprecated package (on packagist) into its own repo.

There is a bug with the bitwise operation used in the condition to check for error_reporting as it doesn't work for disabled error_reporting or error_reporting without lower reporting levels:

if (error_reporting() & $level) {

with error_reporting set to 0 or E_ERROR | E_WARNING | E_PARSE in order to skip E_NOTICE PHP errors,
the error will still be thrown, shown and destroy the page markup at that point with injected "rich" error HTML.

Steps to reproduce

  1. Configure for lower or none error_reporting, e.g. for staging in config/environments/staging.php
  2. Trigger a PHP E_NOTICE message, e.g. an Undefined index error by accessing an undefined index of a PHP array:
    Note that these lower level PHP errors still cause a "rich" HTML error message, which shouldn't happen.

Expected behavior:
PHP errors with levels to be ignored.

Actual behavior:
PHP errors with levels to be ignored are still thrown.

Reproduces how often:
Always.

Versions

Bedrock:

### 1.15.3: 2021-03-12
* chore(deps): Bump roots/wordpress from 5.6.2 to 5.7 ([#578](https://github.com/roots/bedrock/pull/578))

Additional information

Related: #87

Call to undefined function Illuminate\Foundation\Console\base_path() when publishing

Description

[Description of the issue]

Steps to reproduce

  1. Clone Sage repo
  2. Install package which needs publishing with acorn (like generoi/sage-woocommerce, smarteist/sage-woocommerce)
  3. Try publishing files with wp acorn vendor:publish --tag="WooCommerce Templates"

Expected behavior:
Files should be copied over to my project

Actual behavior:
In VendorPublishCommand.php line 277:
Call to undefined function Illuminate\Foundation\Console\Roots\base_path()

Reproduces how often:
100%

Versions

2.0.0-alpha.0

Additional information

Issue can be resolved by replacing base_path() by \Roots\base_path() in the status() method in roots/acorn/src/Illuminate/Foundation/Console/VendorPublishCommand.php:275

[Discussion] Exception handler behaviour

The exception handler currently has some strange behavior:

  1. WP_DEBUG = true && WP_ENV = 'production' returns a blank page due to issues with Symfony handler. Also the Symfony handler is pretty useless for debugging. Not sure what's the best way to handle this.
  2. WP_DEBUG = false && WP_ENV = 'production' doesn't use an Exception Handler and prints PHP warnings/errors depending on WPs error_reporting setting. It returns more information than (1) which seems weird, as (1) is "debug mode".
  3. WP_DEBUG = false && WP_ENV = 'development': Is fine as it is.
  4. WP_DEBUG = true && WP_ENV = 'development' : Returns whoops which is also fine

Generally I think WP_DEBUG_DISPLAY would have been a better indicator whether to show an exception handler as it's already a standard within WordPress. But that probably would cause some issue with Sage?!

Acorn throws "Unable to detect application namespace"

Description

After developing Sage 10 project locally I deployed it on a server. Unfortunately this is shared hosting (for reasons beyond my control), so I know many restrictions apply.

The theme errors with an exception in vendor/roots/acorn/src/Acorn/Concerns/Application.php on line 749. Full error message is: Uncaught RuntimeException: Unable to detect application namespace

My access to logs is sadly restricted, so I can't say for sure what's causing this, but it happens sometimes with Laravel applications. Modifying vendor/roots/acorn/src/Acorn/Concerns/Application.php seems to resolve the issue by assigning a value to the $appPath variable on line 47 as per this thread on StackOverflow:

protected $appPath = __DIR__;

Steps to reproduce

  1. Deploy theme on server
  2. Activate theme
  3. WordPress sends a fatal error email

Expected behavior:
The theme should load successfully.

Actual behavior:
It throws a fatal error.

Reproduces how often: Not sure.

Versions

Latest version of Acorn, v1.0.6.
PHP 7.3.15 (fastcgi) on a shared Apache server.

Bug: Component inclusion results in "unexpected end of file" error

Terms

Description

Introductory note

I have changed the structure of Bedrock and Sage to have certain folders living in the root of my project. I'm not sure if this causes the issue. I used the official acorn config file config/view.php to configure these paths.

The relevant folder structure is:

app/
└── View/
    └── Components/
        └── Button.php
resources/
└── views/
    └── components/
        └── button.blade.php
public/
└── content/
    └── cache/
        └── acorn/
            └── framework/
                └── views/
                    └── 4ca871573b12f73731765c6cb8ca42b1b55175ac.php
.env
composer.json        # → Combined Bedrock & Sage composer.json file

What's wrong?

I have a custom component called "button" which I'm trying to include in my blade template. In my template I have the following blade component code:

/* Some HTML... */

<x-button>

/* Continued HTML... */

My component that lives in resources/views/components/button.blade.php only contains the following code:

<button>test</button>

Then in app/View/Components/Button.php I have the following:

<?php

namespace App\View\Components;

use Illuminate\View\Component;

class Button extends Component
{
    /**
     * Create a new component instance.
     *
     * @return void
     */
    public function __construct()
    {
    }

    /**
     * Get the view / contents that represent the component.
     *
     * @return \Illuminate\Contracts\View\View|\Closure|string
     */
    public function render()
    {
        return view('components.button');
    }
}

In the generated .php file I can see the following code in place of the button component:

/* Some HTML... */

<?php if (isset($component)) { $__componentOriginal065ae5da12ba8e75c6b4e84d90798c2fb812b940 = $component; } ?>
<?php $component = $__env->getContainer()->make(App\View\Components\Button::class, []); ?>
<?php $component->withName('button'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php $component->withAttributes([]); ?>

/* Continued HTML... */

It looks like the second if statement <?php if ($component->shouldRender()): ?> doesn't close. The remaining content of the file does continue afterwards.

Steps To Reproduce

  1. Create a new component using wp acorn make:component Button
  2. Include the component tag in a blade template file. <x-button>.
  3. Check the page where the button should display.

Expected Behavior

The component code should display properly without returning an error.

Actual Behavior

The generated component code does not include a closure for the if statement that's generated.

Relevant Log Output

Illuminate \ View \ ViewException (E_ERROR)
syntax error, unexpected end of file, expecting elseif (T_ELSEIF) or else (T_ELSE) or endif (T_ENDIF) (View: /home/vagrant/projects/example.com/resources/views/front-page.blade.php)

Versions

v2.0.0-beta.8

OptimizeCommand does not generate sames caches as OptimizeClearCommand clears

Description

OptimizeClearCommand calls:

  • view:clear
  • cache:clear
  • route:clear
  • config:clear
  • clear-compiled

OptimizeCommand however only calls:

  • cache:cache
  • route:cache

Steps to reproduce

  1. Look at https://github.com/roots/acorn/blob/919478fc71a02f0b1ff435e7d9b3f8bb2ac9ac74/src/Roots/Acorn/Console/Commands/OptimizeCommand.php
  2. Then look at https://github.com/roots/acorn/blob/919478fc71a02f0b1ff435e7d9b3f8bb2ac9ac74/src/Roots/Acorn/Console/Commands/OptimizeClearCommand.php
  3. Notice difference

Expected behavior: [What you expect to happen]

I'd expect optimize to optimize all applicable things.

Actual behavior: [What actually happens]

I only optimizes cache and route.

Reproduces how often: [What percentage of the time does it reproduce?]

Always.

Versions

919478f

Additional information

usort returning boolean deprecated

Description

when running wp acorn list:

In SummaryCommand.php line 117:
                                                                                                                               
  usort(): Returning bool from comparison function is deprecated, return an integer less than, equal to, or greater than zero

To solve, just change the usort in SummaryCommand to this:

            usort($commands, function ($a, $b) {
                return $a->getName() > $b->getName() ? 1 : -1;
            });

Steps to reproduce

wp acorn list

After updating Illuminate packages to 8.37 version application is broked

Im updated my packages with composer update` command, as usualy.
And after yhat - whole application is broked.
Everything worked fine before updating packages.

Here is the most recent stacktrace: https://prnt.sc/11plccz

`ErrorException thrown with message "Undefined index: url"

Stacktrace:
#24 ErrorException in /var/www/html/web/app/themes/zcci-theme/vendor/roots/acorn/src/Roots/Acorn/Assets/Manager.php:87
#23 Illuminate\Foundation\Bootstrap\HandleExceptions:handleError in /var/www/html/web/app/themes/zcci-theme/vendor/roots/acorn/src/Roots/Acorn/Assets/Manager.php:87
#22 Roots\Acorn\Assets\Manager:resolve in /var/www/html/web/app/themes/zcci-theme/vendor/roots/acorn/src/Roots/Acorn/Assets/Manager.php:66
#21 Roots\Acorn\Assets\Manager:manifest in /var/www/html/web/app/themes/zcci-theme/vendor/roots/acorn/src/Roots/Acorn/Assets/AssetsServiceProvider.php:22
#20 Roots\Acorn\Assets\AssetsServiceProvider:Roots\Acorn\Assets{closure} in /var/www/html/web/app/themes/zcci-theme/vendor/illuminate/container/Container.php:829
#19 Illuminate\Container\Container:build in /var/www/html/web/app/themes/zcci-theme/vendor/illuminate/container/Container.php:714
#18 Illuminate\Container\Container:resolve in /var/www/html/web/app/themes/zcci-theme/vendor/roots/acorn/src/Illuminate/Foundation/Application.php:841
#17 Illuminate\Foundation\Application:resolve in /var/www/html/web/app/themes/zcci-theme/vendor/illuminate/container/Container.php:652
#16 Illuminate\Container\Container:make in /var/www/html/web/app/themes/zcci-theme/vendor/roots/acorn/src/Illuminate/Foundation/Application.php:826
#15 Illuminate\Foundation\Application:make in /var/www/html/web/app/themes/zcci-theme/vendor/roots/acorn/src/Roots/Acorn/Application.php:304
#14 Roots\Acorn\Application:make in /var/www/html/web/app/themes/zcci-theme/vendor/roots/acorn/src/helpers.php:42
#13 Roots\app in /var/www/html/web/app/themes/zcci-theme/vendor/roots/acorn/src/helpers.php:67
#12 Roots\asset in /var/www/html/web/app/themes/zcci-theme/app/setup.php:21
#11 App{closure} in /var/www/html/web/wp/wp-includes/class-wp-hook.php:292
#10 WP_Hook:apply_filters in /var/www/html/web/wp/wp-includes/class-wp-hook.php:316
#9 WP_Hook:do_action in /var/www/html/web/wp/wp-includes/plugin.php:484
#8 do_action in /var/www/html/web/wp/wp-includes/script-loader.php:2027
#7 wp_enqueue_scripts in /var/www/html/web/wp/wp-includes/class-wp-hook.php:292
#6 WP_Hook:apply_filters in /var/www/html/web/wp/wp-includes/class-wp-hook.php:316
#5 WP_Hook:do_action in /var/www/html/web/wp/wp-includes/plugin.php:484
#4 do_action in /var/www/html/web/wp/wp-includes/general-template.php:3009
#3 wp_head in /var/www/html/web/app/themes/zcci-theme/index.php:7
#2 include in /var/www/html/web/wp/wp-includes/template-loader.php:106
#1 require_once in /var/www/html/web/wp/wp-blog-header.php:19
#0 require in /var/www/html/web/index.php:6
`

ViewServiceProvider::preflight() never called

I was playing around with the sage 10 branch and first thing I saw was warnings of the kind:

PHP Warning:  file_put_contents(.../acorn/cache/3ea2c06f9c61888a9945ac4a2e2619a24c0457da.php)

After some digging I found out about the preflight config in config/app.php but after enabling it warnings remained. Looks like Roots\Acorn\Application::bootProvider() first checks for boot() method and if it exists it just calls it in return while the preflight check comes after that but because Roots\Acorn\View\ViewServiceProvider provides the boot method the preflight is never called.

I would do a PR but I'm not entirely sure what approach is best since I'm not that much into the logic behind Application-ServiceProvider architecture. One would simply move the preflight check before boot is called or move it directly under the Service class itself.

view()->makeLoader() doesn't pass the variables/data

Description

Hello,

I have tried to pass some variables with view($file, $variables)->makeLoader();, but for some reason, variables are not available in $file.

Steps to reproduce

view($file, $variables)->makeLoader();

Versions

Bedrock with Sage 10.

Illuminate/database support?

Hi guys,

I'm looking into Wordpress MVC frameworks and am really liking the Bedrock/Sage/Acorn combo. I noticed illuminate/database was added in March 2019 but removed in Nov 2019. Just wondering what the reason for this was and if there are any issues using Eloquent with Acorn?

Also, does the Roots stack have any routing and middleware options? Or was that intentionally excluded in favour of doing it the Wordpress way?

Thanks :)

optimize command uses the cached config even after it has been cleared

Description

When running wp acorn optimize, the cached config is used even after clearing it. This causes the command for fail if for example the cached config contains paths that no longer exist. Running cache:clear before optimize works.

Steps to reproduce

  1. Run optimize
  2. Do as search-replace in /storage/framework/cache/data/config.php do replace the log paths with one that does not exist.
  3. Run optimize again

Expected behavior: [What you expect to happen]

The command would clear all caches, reload the config, and then generate new caches.

Actual behavior: [What actually happens]

The command would clear all caches, continues using the old cached config, and throws an unhandled exception when an invalid path is encountered.

Reproduces how often: [What percentage of the time does it reproduce?]

Every time.

Versions

PHP 7.4.3
Acorn v1.1.0
WordPress 5.5.3

Additional information

Here's the stack trace from the first error that happens for me. The stack trace printed on the console is different because it covers when the logger fails to initialise when trying to log this first exception.

Exception has occurred.
Symfony\Component\Finder\Exception\DirectoryNotFoundException: The "/srv/app/public-2/..//resources/views" directory does not exist.

Symfony\Component\Finder\Finder->in (/home/stefanfisk/projects/berghs/repo/vendor/symfony/finder/Finder.php:589)
Roots\Acorn\Console\Commands\ViewCacheCommand->bladeFilesIn (/home/stefanfisk/projects/berghs/repo/vendor/roots/acorn/src/Acorn/Console/Commands/ViewCacheCommand.php:66)
Roots\Acorn\Console\Commands\ViewCacheCommand->Roots\Acorn\Console\Commands\{closure:/srv/app/vendor/roots/acorn/src/Acorn/Console/Commands/ViewCacheCommand.php:34-36} (/home/stefanfisk/projects/berghs/repo/vendor/roots/acorn/src/Acorn/Console/Commands/ViewCacheCommand.php:35)
Illuminate\Support\Collection->each (/home/stefanfisk/projects/berghs/repo/vendor/illuminate/support/Traits/EnumeratesValues.php:202)
Roots\Acorn\Console\Commands\ViewCacheCommand->handle (/home/stefanfisk/projects/berghs/repo/vendor/roots/acorn/src/Acorn/Console/Commands/ViewCacheCommand.php:36)
Illuminate\Container\BoundMethod::Illuminate\Container\{closure:/srv/app/vendor/illuminate/container/BoundMethod.php:35-37} (/home/stefanfisk/projects/berghs/repo/vendor/illuminate/container/BoundMethod.php:36)
Illuminate\Container\Util::unwrapIfClosure (/home/stefanfisk/projects/berghs/repo/vendor/illuminate/container/Util.php:37)
Illuminate\Container\BoundMethod::callBoundMethod (/home/stefanfisk/projects/berghs/repo/vendor/illuminate/container/BoundMethod.php:93)
Illuminate\Container\BoundMethod::call (/home/stefanfisk/projects/berghs/repo/vendor/illuminate/container/BoundMethod.php:37)
Roots\Acorn\Application->call (/home/stefanfisk/projects/berghs/repo/vendor/illuminate/container/Container.php:596)
Roots\Acorn\Console\Commands\ViewCacheCommand->execute (/home/stefanfisk/projects/berghs/repo/vendor/illuminate/console/Command.php:134)
Roots\Acorn\Console\Commands\ViewCacheCommand->run (/home/stefanfisk/projects/berghs/repo/vendor/symfony/console/Command/Command.php:258)
Roots\Acorn\Console\Commands\ViewCacheCommand->run (/home/stefanfisk/projects/berghs/repo/vendor/illuminate/console/Command.php:121)
Roots\Acorn\Console\Commands\OptimizeCommand->runCommand (/home/stefanfisk/projects/berghs/repo/vendor/illuminate/console/Concerns/CallsCommands.php:56)
Roots\Acorn\Console\Commands\OptimizeCommand->call (/home/stefanfisk/projects/berghs/repo/vendor/illuminate/console/Concerns/CallsCommands.php:28)
Roots\Acorn\Console\Commands\OptimizeCommand->handle (/home/stefanfisk/projects/berghs/repo/vendor/roots/acorn/src/Acorn/Console/Commands/OptimizeCommand.php:29)
Illuminate\Container\BoundMethod::Illuminate\Container\{closure:/srv/app/vendor/illuminate/container/BoundMethod.php:35-37} (/home/stefanfisk/projects/berghs/repo/vendor/illuminate/container/BoundMethod.php:36)
Illuminate\Container\Util::unwrapIfClosure (/home/stefanfisk/projects/berghs/repo/vendor/illuminate/container/Util.php:37)
Illuminate\Container\BoundMethod::callBoundMethod (/home/stefanfisk/projects/berghs/repo/vendor/illuminate/container/BoundMethod.php:93)
Illuminate\Container\BoundMethod::call (/home/stefanfisk/projects/berghs/repo/vendor/illuminate/container/BoundMethod.php:37)
Roots\Acorn\Application->call (/home/stefanfisk/projects/berghs/repo/vendor/illuminate/container/Container.php:596)
Roots\Acorn\Console\Commands\OptimizeCommand->execute (/home/stefanfisk/projects/berghs/repo/vendor/illuminate/console/Command.php:134)
Roots\Acorn\Console\Commands\OptimizeCommand->run (/home/stefanfisk/projects/berghs/repo/vendor/symfony/console/Command/Command.php:258)
Roots\Acorn\Console\Commands\OptimizeCommand->run (/home/stefanfisk/projects/berghs/repo/vendor/illuminate/console/Command.php:121)
Illuminate\Console\Application->doRunCommand (/home/stefanfisk/projects/berghs/repo/vendor/symfony/console/Application.php:920)
Illuminate\Console\Application->doRun (/home/stefanfisk/projects/berghs/repo/vendor/symfony/console/Application.php:266)
Illuminate\Console\Application->run (/home/stefanfisk/projects/berghs/repo/vendor/symfony/console/Application.php:142)
Illuminate\Console\Application->run (/home/stefanfisk/projects/berghs/repo/vendor/illuminate/console/Application.php:93)
Roots\Acorn\Console\Kernel->handle (/home/stefanfisk/projects/berghs/repo/vendor/roots/acorn/src/Acorn/Console/Kernel.php:104)
Roots\Acorn\Bootstrap\Console->Roots\Acorn\Bootstrap\{closure:/srv/app/vendor/roots/acorn/src/Acorn/Bootstrap/Console.php:28-53} (/home/stefanfisk/projects/berghs/repo/vendor/roots/acorn/src/Acorn/Bootstrap/Console.php:47)
call_user_func:{phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Dispatcher/CommandFactory.php:100} (/usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Dispatcher/CommandFactory.php:100)
WP_CLI\Dispatcher\CommandFactory::WP_CLI\Dispatcher\{closure:phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Dispatcher/CommandFactory.php:95-102} (/usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Dispatcher/CommandFactory.php:100)
call_user_func:{phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Dispatcher/Subcommand.php:451} (/usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Dispatcher/Subcommand.php:451)
WP_CLI\Dispatcher\Subcommand->invoke (/usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Dispatcher/Subcommand.php:451)
WP_CLI\Runner->run_command (/usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php:371)
WP_CLI\Runner->run_command_and_exit (/usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php:394)
WP_CLI\Runner->start (/usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php:1160)
WP_CLI\Bootstrap\LaunchRunner->process (/usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Bootstrap/LaunchRunner.php:23)
WP_CLI\bootstrap (/usr/local/bin/wp/vendor/wp-cli/wp-cli/php/bootstrap.php:74)
include (/usr/local/bin/wp/vendor/wp-cli/wp-cli/php/wp-cli.php:27)
include (/usr/local/bin/wp/php/boot-phar.php:11)
{main} (/usr/local/bin/wp:4)

Differing PHP version requirements between dev and regular dependencies

Description

Because pestphp/pest-plugin-mock was added as a dev dependency, you can no longer install all dependencies on PHP 7, since that Pest plugin requires PHP 8, which means that you can --no-dev install on PHP 7.3+ but to develop Acorn itself you need PHP 8.
Was this intentional?

Steps to reproduce

  1. Clone the repo
  2. Use PHP 7 (7.4 for example) and composer install to install the Composer dependencies

Expected behavior:
The installation completes without errors.

Actual behavior:
Installation fails because pestphp/pest-plugin-mock requires PHP 8.

Reproduces how often:
Every time you use PHP 7 to install all dependencies

Versions

dev-main

composer.json extra.laravel.dont-discover is not respected

Description

The custom implementation of PackageManifest::packagesToIgnore() looks for dont-discover in installed.json, when it should actually be looking in composer.json.

return array_reduce($this->composerPaths, function ($ignore, $path) {

VS

if (! is_file($this->basePath.'/composer.json')) {

Steps to reproduce

  1. Add "dont-discover": ["*"] to composer.json
  2. Generate the package manifest
  3. Providers from ignored packages will still be included

Expected behavior:

The packages should be ignored.

Actual behavior:

The are included in the manifest

Reproduces how often:

100% of the time, it reproduces 100% of the time.

Versions

Current master (https://github.com/roots/acorn/tree/abee227452f480e77dccbeb987353dcc13c226cf).

Additional information

Release a version for 2.0.0

Thanks for the impressive work for v2.0.0! 👍

A nice little hint if it would be possible to release a new version for v2.0.0, or maybe a v2.0.0-beta or -rc if you're not confident enough for being production ready.

Thanks! ❤️

To-do

There's probably more, but right off the top of my head...

  • Flesh out the Sage and Sage\ViewFinder classes. (see tests)
  • Come up with method to address roots/sage#2116
  • Determine best way to maximize WooCommerce compatibility
  • Possibly refactor relationship between Manifest and Asset classes.
  • Finish writing unit tests
  • Test child theme support

Bug: Publishing assets in a config-less Sage 10 go into vendor

Steps To Reproduce

  1. Install latest Sage 10 dev-main
  2. composer require log1x/poet
  3. wp acorn vendor:publish --provider="Log1x\Poet\PoetServiceProvider"

Expected Behavior

Acorn creates a config folder inside of Sage and publishes the config there.

Actual Behavior

The config gets published into vendor/roots/acorn/config

Relevant Log Output

~/Sites/sage/web/app/themes/sage
❯ wp acorn vendor:publish --provider="Log1x\Poet\PoetServiceProvider"
Copied File [/vendor/log1x/poet/config/poet.php] To [/Users/brandon/Development/projects/acorn/config/poet.php]
Publishing complete.

Versions

dev-main

public_path() breaks because paths are not bound

Description

public_path() throws because paths (path.*) are not bound in the app container: https://github.com/roots/acorn/blob/master/src/helpers.php#L290

This might also cause problems with other Laravel code that expects the paths to be bound.

Steps to reproduce

Call public_path().

Expected behavior:

It should return the path.

Actual behavior:

It throws due to the missing binding.

Reproduces how often:

Every time.

Versions

Roots\Acorn:1.1.0

Additional information

N/A.

Bug: ExceptionHandler throws critical error in CLI while on production

Terms

Description

N/A

Steps To Reproduce

  1. Use latest Acorn and Sage 10
  2. Set your environment to production
  3. Run a command that would throw an error: wp acorn vendor:publish X

Expected Behavior

Screenshot

Actual Behavior

Screenshot

Relevant Log Output

~/Sites/sage/web/app/themes/sage
❯ wp acorn vendor:publish X
Fatal error: Uncaught Illuminate\Contracts\Container\BindingResolutionException: Target [Illuminate\Contracts\Debug\ExceptionHandler] is not instantiable. in /Users/brandon/Sites/sage/web/app/themes/sage/vendor/illuminate/container/Container.php:1093
Stack trace:
#0 /Users/brandon/Sites/sage/web/app/themes/sage/vendor/illuminate/container/Container.php(886): Illuminate\Container\Container->notInstantiable('Illuminate\\Cont...')
#1 /Users/brandon/Sites/sage/web/app/themes/sage/vendor/illuminate/container/Container.php(758): Illuminate\Container\Container->build('Illuminate\\Cont...')
#2 /Users/brandon/Development/projects/acorn/src/Illuminate/Foundation/Application.php(841): Illuminate\Container\Container->resolve('Illuminate\\Cont...', Array, true)
#3 /Users/brandon/Sites/sage/web/app/themes/sage/vendor/illuminate/container/Container.php(694): Illuminate\Foundation\Application->resolve('Illuminate\\Cont...', Array)
#4 /Users/brandon/Development/projects/acorn/src/Illuminate/Foundation/Application.php(826): Illuminate\Container\Container->make('Illuminate\\Cont...', Array)
#5 /Users/brandon/Sites/sage/web/app/themes/sage/vendor/illuminate/container/Container.php(1423): Illuminate\Foundation\Application->make('Illuminate\\Cont...')
#6 /Users/brandon/Development/projects/acorn/src/Illuminate/Foundation/Console/Kernel.php(366): Illuminate\Container\Container->offsetGet('Illuminate\\Cont...')
#7 /Users/brandon/Development/projects/acorn/src/Illuminate/Foundation/Console/Kernel.php(131): Illuminate\Foundation\Console\Kernel->reportException(Object(Symfony\Component\Console\Exception\RuntimeException))
#8 /Users/brandon/Development/projects/acorn/src/Roots/Acorn/Bootstrap/RegisterConsole.php(52): Illuminate\Foundation\Console\Kernel->handle(Object(Symfony\Component\Console\Input\StringInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#9 [internal function]: Roots\Acorn\Bootstrap\RegisterConsole->Roots\Acorn\Bootstrap\{closure}(Array, Array)
#10 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Dispatcher/CommandFactory.php(102): call_user_func(Object(Closure), Array, Array)
#11 [internal function]: WP_CLI\Dispatcher\CommandFactory::WP_CLI\Dispatcher\{closure}(Array, Array)
#12 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Dispatcher/Subcommand.php(491): call_user_func(Object(Closure), Array, Array)
#13 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(399): WP_CLI\Dispatcher\Subcommand->invoke(Array, Array, Array)
#14 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(422): WP_CLI\Runner->run_command(Array, Array)
#15 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(1194): WP_CLI\Runner->run_command_and_exit()
#16 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Bootstrap/LaunchRunner.php(23): WP_CLI\Runner->start()
#17 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/bootstrap.php(77): WP_CLI\Bootstrap\LaunchRunner->process(Object(WP_CLI\Bootstrap\BootstrapState))
#18 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/wp-cli.php(27): WP_CLI\bootstrap()
#19 phar:///usr/local/bin/wp/php/boot-phar.php(11): include('phar:///usr/loc...')
#20 /usr/local/bin/wp(4): include('phar:///usr/loc...')
#21 {main}
  thrown in /Users/brandon/Sites/sage/web/app/themes/sage/vendor/illuminate/container/Container.php on line 1093
Error: There has been a critical error on this website.Learn more about troubleshooting WordPress. There has been a critical error on this website.

Versions

dev-main

Wrong namespace for aliases in Application::registerCoreContainerAliases()

Description

There's a couple of aliases with incorrect namespace in

'assets.manifest' => \Acorn\Assets\Manifest::class,

Even when fixing them I was not able to make inject Illuminate\Filesystem\Filesystem after boot, but I didn't have time to debug that now.

Error handler throws Exception for notices

Description

Similar to other issues with the error handler:
the Error handler is too strict on throwing exceptions, returning the Whoops page as a response breaks many plugins' functionalities.

Steps to reproduce

  1. Cause 'Undefined Index' notice
  2. Get Error-page

Expected behavior:
Notice should be sent but code should not be interrupted

Actual behavior:
A Whoops-error page is returned and code is exited

Reproduces how often:
100%

Versions

2.0.0.alpha

Sage10 dev-master: open_basedir restriction in effect. File(/) is not within the allowed path

Description

On a fresh new theme of Sage 10 from dev-master when I deploy it to a live server (AWS EC2) using Trellis/Bedrock, then either activate it or preview it, you get this error:

production.ERROR: is_writable(): open_basedir restriction in effect. File(/) is not within the allowed path(s): (/srv/www/:/tmp) {"exception":"[object] (ErrorException(code: 0): is_writable(): open_basedir restriction in effect. File(/) is not within the allowed path(s):

Other non-sage themes work in this environment, and a fresh install of a sage9 theme works also. I can also turn off open_basedir, but that's not ideal. See full stack trace at bottom. I've tried disabling all plugins, still same error. Non sage plugins work, sage9 works.

Steps to reproduce

  1. create new theme: composer create-project roots/sage your-theme-name dev-master
  2. yarn, yarn build, checkin.
  3. integate into build-before.yml
  4. deploy to server
  5. go to wp admin > appearance > preview this theme OR activate and go to home page of theme

Expected behavior:
Expected theme to render

Actual behavior:
White screens with above error in storage/logs

Reproduces how often:
100% reproducible. tried on my custom theme and then a fresh install of dev-master

Versions

You can get this information from referencing CHANGELOG.md. Also, please include the OS and what version of the OS you're running.

Additional information

here's the full error, but it doesn't hint at why sage is doing this:

[2021-04-16 21:10:07] production.ERROR: is_writable(): open_basedir restriction in effect. File(/) is not within the allowed path(s): (/srv/www/:/tmp) {"userId":28,"exception":"[object] (ErrorException(code: 0): is_writable(): open_basedir restriction in effect. File(/) is not within the allowed path(s): (/srv/www/:/tmp) at /srv/www/servername/releases/20210416210751/web/wp/wp-admin/includes/misc.php:266)
[stacktrace]
#0 [internal function]: Illuminate\\Foundation\\Bootstrap\\HandleExceptions->handleError(2, 'is_writable(): ...', '/srv/www/into/r...', 266, Array)
roots/sage#1 /srv/www/servername/releases/20210416210751/web/wp/wp-admin/includes/misc.php(266): is_writable('/')
roots/sage#2 /srv/www/servername/releases/20210416210751/web/wp/wp-includes/class-wp-rewrite.php(1869): save_mod_rewrite_rules()
roots/sage#3 /srv/www/servername/releases/20210416210751/web/wp/wp-includes/class-wp-hook.php(292): WP_Rewrite->flush_rules(true)
roots/sage#4 /srv/www/servername/releases/20210416210751/web/wp/wp-includes/class-wp-hook.php(316): WP_Hook->apply_filters(NULL, Array)
roots/sage#5 /srv/www/servername/releases/20210416210751/web/wp/wp-includes/plugin.php(484): WP_Hook->do_action(Array)
roots/sage#6 /srv/www/servername/releases/20210416210751/web/wp/wp-settings.php(582): do_action('wp_loaded')
roots/sage#7 /srv/www/servername/releases/20210416210751/web/wp-config.php(9): require_once('/srv/www/servername/r...')
roots/sage#8 /srv/www/servername/releases/20210416210751/web/wp/wp-load.php(42): require_once('/srv/www/servername/r...')
roots/sage#9 /srv/www/servername/releases/20210416210751/web/wp/wp-blog-header.php(13): require_once('/srv/www/servername/r...')
roots/sage#10 /srv/www/servername/releases/20210416210751/web/index.php(6): require('/srv/www/servername/r...')
roots/sage#11 {main}
"} 

Feature Request: bundle()->dequeue

Terms

Summary

Function to dequeue loaded files (js / css)

Motivation

Why are we doing this?

Some pages should not have the JS / CSS used on the rest of the site (for example a redirection page for Internet Explorer on the front, or a style applied only to some pages and not to others in the back-office)

What is the expected outcome?

Do not load the JS / CSS

Potential conflicts / foreseeable issues

None ?

Additional Context

No response

View path generated nested component incorrect.

Description

When generating a nested component with command wp acorn make:component Inputs/Button the view path in the class is incorrect.

public function render()
{
    return $this->view('components.button');
}

Where it should be components.inputs.button.

Steps to reproduce

wp acorn make:component Inputs/Button

Expected behavior: [What you expect to happen]

public function render()
{
    return $this->view('components.inputs.button');
}

Actual behavior: [What actually happens]

public function render()
{
    return $this->view('components.button');
}

Reproduces how often: [What percentage of the time does it reproduce?]

100% of the time :)

Versions

Version 1.0.1.

Additional information

Might be upstream issue

[Sage 10 + Bedrock]: Incompatibility with EWWW Image Optimizer

Terms

Description

What's wrong?

Error is shown after EWWW Image Optimize plugin activation & cache clear. See error below.

What have you tried?

  • Retry a fresh installation (Bedrock + Sage 10)
  • Use a different Sage10 version (master & 10.0.0-beta2)
  • Reclear cache

What insights have you gained?

Possible solutions

Debug $packages variable :

// vendor/roots/acorn/src/Roots/Acorn/PackageManifest.php

            return collect($packages)->mapWithKeys(function ($package) use ($path) {
                if (!array_key_exists('name', $package)) {
                  print_r($package);
                  die();
                }
                return [
                    $this->format($package['name'], dirname($path, 2)) =>
                        $package['extra']['acorn'] ?? $package['extra']['laravel'] ?? []
                ];
            })->each(function ($configuration) use (&$ignore) {
                $ignore = array_merge($ignore, $configuration['dont-discover'] ?? []);
            })->reject(function ($configuration, $package) use ($ignore, $ignoreAll) {
                return $ignoreAll || in_array($package, $ignore);
            })->filter()->merge($all)->all();

This returns :

Array ( [require] => Array ( [lsolesen/pel] => 0.9.9 ) )

It's seems to be related to the composer.json file inside the plugin. Why the theme is loading it ?

Temporary workarounds

  • Use Bedrock + Sage 9 installation
  • Remove EWWW Image Optimize plugin

Steps To Reproduce

  1. Install Bedrock + Sage 10
  2. Install EWWW Image Optimizer with composer
  3. Activate plugin
  4. Remove cache folder

Expected Behavior

Don't have error

Actual Behavior

image

Relevant Log Output

No response

Versions

master & 10.0.0-beta2

New Roots/Acorn (Main/beta.2) breaks on Bootloader in combination with sage 10

Description

For the Sage 10 project we wanted to disable the escalation of notices to errors because some plugins still have notices. There is a fix implemented that works in the main branch of roots/acorn.

#100

When using the roots/acorn main branch, the error handler is working as expected again but the system gets a fatal error in the Bootloader.php.

When loading the app (Line 203, $app = $this->appClassName::getInstance();) the appClassName is Application but the Illuminate/Container is loaded. The next line is setBasePath but the Container does not contain this function.

When rewriting this line (For testing) to $app = new \Roots\Acorn\Application; the application works as expected.

Could you tell me what went wrong here? We would like to use the most recent version so we can change the behaviour of the Error handler.

I added a few screenshots of my changes and the information xDebug is giving me.

Hope to hear from you soon.

With kind regards,

Jochem

Steps to reproduce

  1. Checkout the sage 10 main branch
  2. run a composer require in the sage 10 folder on dev-main of the roots/acorn to update the roots/acorn package.
  3. Try to run any action in the installation

Expected behavior:

The line: $app = $this->appClassName::getInstance(); should get the instance of the appClassName. Not the container.

Actual behavior:

The line: $app = $this->appClassName::getInstance(); Got the Container class that does not have the function setBasePath.

Reproduces how often:

Every time.

Versions

Sage --> main branch
Roots/Acorn --> from beta to main branch. Alpha does not contain this error and has different code for getting the application:
$app = new $this->appClassName($basePath, $this->usePaths());

Additional information

Different code in Alpha branch
Found class in alpha branch
Found class in main branch
Value of appClassName in main branch
Testing fix main branch

If WP-CLI argument '--allow-root' is set, CLI isn't working

Description

This might be an edge case, but I thought it should be mentioned: While developing in an Local by Flywheel (3.3.0) environment, the wp acorn command(s) resulted in Command "acorn" is not defined.. This came from the fact that wp is aliased to wp --allow-root in this env.

Steps to reproduce

  1. Spin up site in Local by Flywheel
  2. Install Sage 10
  3. Run wp acorn

Expected behavior:
Lists all registered CLI commands for acorn.

Actual behavior:
Throws error Command "acorn" is not defined..

Reproduces how often:
100%

Versions

"roots/sage": "10.0.0-dev"
"roots/acorn": "dev-master" (58ec37c)

Additional information

As said, Local by Flywheel sets alias wp="wp --allow-root".

component created by default does not work

Description

On a fresh installation, if you create a component using the CLI, e.g. 'wp acorn make:component Hero', the class for the component does not work correctly, and throws an error.

Steps to reproduce

  1. create a new component via the CLI, e.g. 'wp acorn make:component Hero'
  2. add the component into a page template, e.g. ''
  3. on the page in which you inserted the component, you receive the error: Call to undefined function App\View\Components\view()

Expected behavior: The boilerplate code for the component should work without creating an error.

Actual behavior: Using the boilerplate code as generated will throw an error.

Reproduces how often: 100%

Versions

Acorn v2.0.0.-alpha.0, Sage v10.0.0dev, MacOS 11.4

Additional information

Fix: because the namespace on the Class file is incorrect. it is set to: Illuminate\View\Component, while it should be: Roots\Acorn\View\Component. Also the render() function is incorrect, on creation it is: return view('components.test') while it should be: return $this->view('components.test') (at least according to the included Alert component)

Changing this in ./src/Illuminate/Foundation/Console/stubs/view-component.stub gets it working, and the default component will be created just like the sample Alert component the theme provides.

I created a fork with this fix if you want the commit.

acorn/throw_error_exception Filter improvements

Hi,
I would propose two improvements:

  • pass the error level to the filter: apply_filters('acorn/throw_error_exception', true, $e, $level)
  • if the filter returns false, handleError should return false so other error handler can be used: if (apply_filters('acorn/throw_error_exception', true, $e)) { ... } else { return false; }

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.