Bug 1326825

Summary: Application using assetic autoloader spams logs with no twig installed
Product: [Fedora] Fedora Reporter: James Hogarth <james.hogarth>
Component: php-AsseticAssignee: James Hogarth <james.hogarth>
Status: CLOSED CURRENTRELEASE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: james.hogarth, shawn
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-04-26 00:04:53 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description James Hogarth 2016-04-13 13:28:06 UTC
Description of problem:
Switching ownCloud over to the specific autoloader method at present and noted that Assetic is spamming the logs with:

Apr 13 12:55:56 localhost.localdomain httpd[11285]: {PHP} include_once(): Failed opening '/usr/share/php/Twig/autoload.php' for inclusion (include_path='/usr/share/owncloud/lib/private:/usr/share/owncloud/config:/usr/share/owncloud/3rdparty:/usr/share/owncloud/apps:/var/lib/owncloud/apps:/usr/share/owncloud/lib:.:/usr/share/pear:/usr/share/php:/usr/share/owncloud') at /usr/share/php/Assetic/autoload.php#28

The php-twig library is only a suggests, not a requires or recommends ... and although the autoloader does say @include_once the above gets spammed to the logs.

Version-Release number of selected component (if applicable):
php-Assetic-1.3.2-1.fc25.noarch

How reproducible:
Every time from an owncloud install from rawhide

Steps to Reproduce:
1. Install owncloud from this scratch build: http://koji.fedoraproject.org/koji/taskinfo?taskID=13645822
2. Follow the logs: journalctl -u httpd -f
3. Open open any owncloud pages and watch the error above appear many, many times.

Actual results:
Logged spammed

Expected results:
Nothing logged about the 'missing' php-twig

Additional info:
Remi did a little benchmarking and believes that  file_exists($foo) and require-once($foo)  is faster than doing @include_once($foo) anyway, plus that would avoid the unsilent error that appears to be ignoring the @

Comment 1 James Hogarth 2016-04-13 14:38:43 UTC
After discussion we're going to do this for optional includes rather than @include ...

foreach ([
        $vendor . '/Foo/Mandatory/autoload.php'    => true,
        $vendor . '/Bar/Optional/autoload.php'     => false,
        ] as $dep => $mandatory) {
        if ($mandatory || file_exists($dep)) require_once($dep);
}

Comment 2 Fedora Update System 2016-04-14 08:09:49 UTC
php-Assetic-1.3.2-3.fc24 has been submitted as an update to Fedora 24. https://bodhi.fedoraproject.org/updates/FEDORA-2016-661eb12ce9

Comment 3 Fedora Update System 2016-04-14 08:10:39 UTC
php-Assetic-1.3.2-3.fc23 has been submitted as an update to Fedora 23. https://bodhi.fedoraproject.org/updates/FEDORA-2016-aa2c4e5a81

Comment 4 Fedora Update System 2016-04-14 08:11:24 UTC
php-Assetic-1.3.2-3.fc22 has been submitted as an update to Fedora 22. https://bodhi.fedoraproject.org/updates/FEDORA-2016-e836555e16

Comment 5 Fedora Update System 2016-04-15 08:37:43 UTC
php-Assetic-1.3.2-3.fc24 has been pushed to the Fedora 24 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2016-661eb12ce9

Comment 6 Fedora Update System 2016-04-16 19:26:37 UTC
php-Assetic-1.3.2-3.fc23 has been pushed to the Fedora 23 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2016-aa2c4e5a81

Comment 7 Fedora Update System 2016-04-16 19:27:44 UTC
php-Assetic-1.3.2-3.fc22 has been pushed to the Fedora 22 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2016-e836555e16

Comment 8 Fedora Update System 2016-04-18 17:25:46 UTC
php-Assetic-1.3.2-3.fc24 has been pushed to the Fedora 24 stable repository. If problems still persist, please make note of it in this bug report.

Comment 9 Fedora Update System 2016-04-25 22:21:48 UTC
php-Assetic-1.3.2-3.fc22 has been pushed to the Fedora 22 stable repository. If problems still persist, please make note of it in this bug report.

Comment 10 Fedora Update System 2016-04-25 23:54:27 UTC
php-Assetic-1.3.2-3.fc23 has been pushed to the Fedora 23 stable repository. If problems still persist, please make note of it in this bug report.

Comment 11 James Hogarth 2016-04-26 00:04:53 UTC
pushed stable and no longer spams logs