From b16b349f4114742fdf5b6bd8925eac92530362ac Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 29 Jan 2025 00:27:39 +0000 Subject: [PATCH 1/3] Update psr/container requirement from ^1.0 to ^1.0 || ^2.0 Updates the requirements on [psr/container](https://github.com/php-fig/container) to permit the latest version. - [Release notes](https://github.com/php-fig/container/releases) - [Commits](https://github.com/php-fig/container/compare/1.0.0...2.0.2) --- updated-dependencies: - dependency-name: psr/container dependency-type: direct:production ... Signed-off-by: dependabot[bot] --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index ff68a94..50effb0 100644 --- a/composer.json +++ b/composer.json @@ -44,7 +44,7 @@ "require": { "php": ">=7.4.0", "gin0115/dice": "4.1.*", - "psr/container": "^1.0", + "psr/container": "^1.0 || ^2.0", "pinkcrab/hook-loader": "^1.1", "pinkcrab/function-constructors": "0.2.*" }, From 3730c0c7f46ca84b03bbd31be5b0c1efc9092827 Mon Sep 17 00:00:00 2001 From: Glynn Quelch Date: Thu, 11 Dec 2025 23:08:30 +0000 Subject: [PATCH 2/3] remove the attempt to resolve dot nations in base view paths and removed matching test --- src/Services/View/PHP_Engine.php | 1 - tests/Unit/View/Test_PHP_Engine.php | 40 ++++++++++++++--------------- 2 files changed, 20 insertions(+), 21 deletions(-) diff --git a/src/Services/View/PHP_Engine.php b/src/Services/View/PHP_Engine.php index fa46f38..97df556 100644 --- a/src/Services/View/PHP_Engine.php +++ b/src/Services/View/PHP_Engine.php @@ -217,7 +217,6 @@ private function maybe_resolve_dot_notation( string $filename ): string { * @throws Exception */ private function verify_view_path( string $path ): string { - $path = $this->maybe_resolve_dot_notation( $path ); $path = rtrim( $path, '/' ) . '/'; if ( ! \is_dir( $path ) ) { diff --git a/tests/Unit/View/Test_PHP_Engine.php b/tests/Unit/View/Test_PHP_Engine.php index 9ad0966..0c666b4 100644 --- a/tests/Unit/View/Test_PHP_Engine.php +++ b/tests/Unit/View/Test_PHP_Engine.php @@ -38,7 +38,7 @@ class Test_PHP_Engine extends WP_UnitTestCase { * * @return void */ - public function setUp() : void { + public function setUp(): void { parent::setUp(); $this->view = new PHP_Engine( FIXTURES_PATH . '/views/' ); } @@ -164,7 +164,9 @@ public function test_adds_trailing_slash_to_view_path(): void { $view->render( '/hello.php', array( 'hello' => 'Hello World' ) ); } - /** @testdox An exception should be thrown if the engine attempts to render a component with setting the compiler. */ + /** + * @testdox An exception should be thrown if the engine attempts to render a component with setting the compiler. +*/ public function test_throws_exception_if_component_not_set(): void { $this->expectException( Exception::class ); $this->expectExceptionMessage( 'No component compiler passed to PHP_Engine' ); @@ -191,20 +193,12 @@ public function test_can_render_path_using_dot_notation_with_extension(): void { ); } - /** @testdox It should be possible to define the base path for view using dot notation. */ - public function test_can_set_base_path_using_dot_notation(): void { - $this->expectOutputString( 'foo' ); - $view = new PHP_Engine( \dirname( __DIR__, 2 ) . '.Fixtures.views.' ); - $view->render( - 'sub_path.template', - array( 'variable' => 'foo' ), - View::PRINT_VIEW // Optional as print view is default. - ); - } - /** @testdox It should be possible to use filepaths with or without the .php extensions */ + /** + * @testdox It should be possible to use filepaths with or without the .php extensions +*/ public function test_can_render_path_with_or_without_php_extension(): void { - function() { + function () { $this->expectOutputString( 'foo' ); $this->view->render( 'sub_path.template', @@ -221,7 +215,9 @@ function() { ); } - /** @testdox It should be possible to access the base_path from the engine. */ + /** + * @testdox It should be possible to access the base_path from the engine. +*/ public function test_can_get_base_path(): void { $path = FIXTURES_PATH . '/views/'; $this->assertEquals( @@ -230,7 +226,9 @@ public function test_can_get_base_path(): void { ); } - /** @testdox By default view_models should be printed, unless false is passed as the param for $print */ + /** + * @testdox By default view_models should be printed, unless false is passed as the param for $print +*/ public function test_view_models_print_by_default(): void { $this->expectOutputString( 'partial_value' ); $this->view->view_model( @@ -241,7 +239,9 @@ public function test_view_models_print_by_default(): void { ); } - /** @testdox By default the partial() method should print the view, unless false is passed as the param for $prinr */ + /** + * @testdox By default the partial() method should print the view, unless false is passed as the param for $prinr +*/ public function test_returns_partial_from_template(): void { $this->expectOutputString( 'rendered partial using PHPEngine->partial()' ); $this->view->partial( @@ -250,11 +250,11 @@ public function test_returns_partial_from_template(): void { ); } - /** @testdox Any path passed as a view, should be trimmed for all whitespace. */ + /** + * @testdox Any path passed as a view, should be trimmed for all whitespace. +*/ public function test_view_path_is_trimmed(): void { $this->expectOutputString( 'Hello World' ); $this->view->render( ' hello ', array( 'hello' => 'Hello World' ) ); } - - } From 513e6c72c47dfb742e8905b31352fc1e99fd4ad8 Mon Sep 17 00:00:00 2001 From: Glynn Quelch Date: Thu, 11 Dec 2025 23:13:51 +0000 Subject: [PATCH 3/3] bumped --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 28be660..62d48e0 100644 --- a/README.md +++ b/README.md @@ -363,6 +363,7 @@ http://www.opensource.org/licenses/mit-license.html ## Change Log ## +* 2.1.1 - Remove the attempt to resolve dot notation in the base view path of the PHP_Engine, as this was causing issues when servers have . in folder names. * 2.1.0 - Updated to WP6.6, changed PHPCS rules and added a number of new helpers to App_Config. * App_Config::asset_url() - Returns the full URL to an asset. * App_Config::asset_path() - Returns the full path to an asset.