pug-php/ci-pug-engine

Jade namespace is no longer available

Closed this issue · 4 comments

I get the following error thrown from pug-php because class_exists('Jade\Jade') returns true:

An uncaught Exception was encountered

Type:        InvalidArgumentException
Message:     Jade namespace is no longer available, use Pug instead.
Filename:    /Users/iegner/Code/apc-called/vendor/pug-php/pug/src/Jade/Jade.php
Line Number: 9

Backtrace:
	File: /Users/iegner/Code/apc-called/vendor/ci-pug/ci-pug/src/Jade.php
	Line: 32
	Function: __construct

	File: /Users/iegner/Code/apc-called/vendor/ci-pug/ci-pug/src/Jade.php
	Line: 51
	Function: settings

	File: /Users/iegner/Code/apc-called/application/controllers/Delivery.php
	Line: 43
	Function: view

	File: /Users/iegner/Code/apc-called/public/index.php
	Line: 333
	Function: require_once

In my composer file : "ci-pug/ci-pug": "1.3.0"

I can't find any reference to Jade in my own source. I have use Pug; in my controller and the line that throws the error is $view = $this->view('start', $data, true);

composer show outputs:

ci-pug/ci-pug                           1.3.0   HAML-like template engine for CodeIgniter
codeigniter/framework                   3.1.6   The CodeIgniter framework
doctrine/instantiator                   1.1.0   A small, lightweight utility to instantiate objects in PHP ...
js-phpize/js-phpize                     1.11.2  Convert js-like syntax to standalone PHP code.
js-phpize/js-phpize-phug                1.1.7   Convert js-like syntax to standalone PHP code.
mikey179/vfsStream                      v1.1.0 
myclabs/deep-copy                       1.7.0   Create deep copies (clones) of your objects
nodejs-php-fallback/nodejs-php-fallback 1.3.0   Allow you to call node.js module or scripts throught PHP an...
phpdocumentor/reflection-common         1.0.1   Common reflection classes used by phpdocumentor to reflect ...
phpdocumentor/reflection-docblock       4.1.1   With this component, a library can provide support for anno...
phpdocumentor/type-resolver             0.4.0  
phpspec/prophecy                        v1.7.2  Highly opinionated mocking framework for PHP 5.3+
phpunit/php-code-coverage               4.0.8   Library that provides collection, processing, and rendering...
phpunit/php-file-iterator               1.4.2   FilterIterator implementation that filters files based on a...
phpunit/php-text-template               1.2.1   Simple template engine.
phpunit/php-timer                       1.0.9   Utility class for timing
phpunit/php-token-stream                2.0.1   Wrapper around PHP's tokenizer extension.
phpunit/phpunit                         5.7.0   The PHP Unit Testing framework.
phpunit/phpunit-mock-objects            3.4.4   Mock Object library for PHPUnit
phug/ast                                0.1.0  
phug/compiler                           0.5.10 
phug/dependency-injection               1.3.2  
phug/event                              0.1.0  
phug/formatter                          0.5.30 
phug/lexer                              0.5.13 
phug/parser                             0.5.6  
phug/phug                               0.1.8  
phug/reader                             0.2.0  
phug/renderer                           0.2.15 
phug/util                               0.4.12 
psr/http-message                        1.0.1   Common interface for HTTP messages
pug-php/pug                             3.0.0   HAML-like template engine for PHP 5.3
sebastian/code-unit-reverse-lookup      1.0.1   Looks up which function or method a line of code belongs to
sebastian/comparator                    1.2.4   Provides the functionality to compare PHP values for equality
sebastian/diff                          1.4.3   Diff implementation
sebastian/environment                   2.0.0   Provides functionality to handle HHVM/PHP environments
sebastian/exporter                      2.0.0   Provides the functionality to export PHP variables for visu...
sebastian/global-state                  1.1.1   Snapshotting of global state
sebastian/object-enumerator             2.0.1   Traverses array structures and object graphs to enumerate a...
sebastian/recursion-context             2.0.0   Provides functionality to recursively process PHP variables
sebastian/resource-operations           1.0.0   Provides a list of PHP built-in functions that operate on r...
sebastian/version                       2.0.1   Library that helps with managing the version number of Git-...
symfony/polyfill-mbstring               v1.6.0  Symfony polyfill for the Mbstring extension
symfony/yaml                            v3.3.10 Symfony Yaml Component
vlucas/phpdotenv                        v2.4.0  Loads environment variables from `.env` to `getenv()`, `$_E...
webmozart/assert                        1.2.0   Assertions to validate method input/output with nice error ...

composer --version outputs:

Composer version 1.5.2 2017-09-11 16:59:25

Hi, I'm so sorry, this check was in the wrong order. Can you update to ci-pug 1.3.1 and re-try?

That seems to work. I do now get another error when I run phpunit but I imagine it's unrelated:

An uncaught Exception was encountered

Type:        Error
Message:     Call to undefined method Jade\Compiler::getEscapedValue()
Filename:    /Users/iegner/Code/apc-called/application/cache/jade/wwC7G3mAqA90Umd5tV69Raql4-A-iEJ5PQ4azkraoo4.php
Line Number: 5767

Backtrace:
	File: /Users/iegner/Code/apc-called/application/cache/jade/wwC7G3mAqA90Umd5tV69Raql4-A-iEJ5PQ4azkraoo4.php
	Line: 5802
	Function: {closure}

	File: /Users/iegner/Code/apc-called/vendor/phug/renderer/src/Phug/Renderer/Adapter/FileAdapter.php
	Line: 70
	Function: include

	File: /Users/iegner/Code/apc-called/vendor/phug/renderer/src/Phug/Renderer/Adapter/FileAdapter.php
	Line: 71
	Function: call_user_func

	File: /Users/iegner/Code/apc-called/vendor/phug/renderer/src/Phug/Renderer.php
	Line: 280
	Function: displayCached

	File: /Users/iegner/Code/apc-called/vendor/phug/util/src/Phug/Util/SandBox.php
	Line: 38
	Function: Phug\{closure}

	File: /Users/iegner/Code/apc-called/vendor/phug/renderer/src/Phug/Renderer/AbstractAdapter.php
	Line: 30
	Function: __construct

	File: /Users/iegner/Code/apc-called/vendor/phug/renderer/src/Phug/Renderer.php
	Line: 285
	Function: captureBuffer

	File: /Users/iegner/Code/apc-called/vendor/phug/util/src/Phug/Util/SandBox.php
	Line: 38
	Function: Phug\{closure}

	File: /Users/iegner/Code/apc-called/vendor/phug/renderer/src/Phug/Renderer.php
	Line: 294
	Function: __construct

	File: /Users/iegner/Code/apc-called/vendor/phug/renderer/src/Phug/Renderer.php
	Line: 397
	Function: callAdapter

	File: /Users/iegner/Code/apc-called/vendor/pug-php/pug/src/Pug/Pug.php
	Line: 140
	Function: renderFile

	File: /Users/iegner/Code/apc-called/vendor/pug-php/pug/src/Pug/Pug.php
	Line: 204
	Function: renderFileWithPhp

	File: /Users/iegner/Code/apc-called/vendor/pug-php/pug/src/Pug/Pug.php
	Line: 211
	Function: call_user_func

	File: /Users/iegner/Code/apc-called/vendor/ci-pug/ci-pug/src/Jade.php
	Line: 70
	Function: renderFile

	File: /Users/iegner/Code/apc-called/application/controllers/Delivery.php
	Line: 43
	Function: view

	File: /Users/iegner/Code/apc-called/application/tests/Bootstrap.php
	Line: 332
	Function: require_once

	File: /Users/iegner/Code/apc-called/vendor/phpunit/phpunit/src/Util/Fileloader.php
	Line: 56
	Function: include_once

	File: /Users/iegner/Code/apc-called/vendor/phpunit/phpunit/src/Util/Fileloader.php
	Line: 38
	Function: load

	File: /Users/iegner/Code/apc-called/vendor/phpunit/phpunit/src/TextUI/Command.php
	Line: 913
	Function: checkAndLoad

	File: /Users/iegner/Code/apc-called/vendor/phpunit/phpunit/src/TextUI/Command.php
	Line: 738
	Function: handleBootstrap

	File: /Users/iegner/Code/apc-called/vendor/phpunit/phpunit/src/TextUI/Command.php
	Line: 129
	Function: handleArguments

	File: /Users/iegner/Code/apc-called/vendor/phpunit/phpunit/src/TextUI/Command.php
	Line: 118
	Function: run

	File: /Users/iegner/Code/apc-called/vendor/phpunit/phpunit/phpunit
	Line: 52
	Function: main

Clearing the cache seems to fix this. I'll re-open if I get any more problems

Indeed, Jade namespace should no longer appear in your cached templates. I recommend you to always clean the cache before running tests (use the bootstrap option of phpunit to call a PHP file before tests).