From bb4b1ccd06dc013852d5166580a61ce0aab43e0a Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 18 Oct 2026 14:51:02 +0000 Subject: [PATCH 1/3] Compatibility with phpBB 3.1 - 3.3 and PHP 8.x - Declare the $user property in the listener (dynamic properties are deprecated in PHP 8.2) - Tests: use @before instead of setUp() (PHPUnit 4 - 9 compatible), add compat trait for assertContains - phpunit.xml.dist: drop options removed in newer PHPUnit - Version check now points to the phpBB.com customisation database (PR #16) - Exclude CI and dev files from export archives (PR #15) Co-Authored-By: Claude Sonnet 5.5 Claude-Session: https://claude.ai/code/session_01AXek2CuiLeFBsgjo8BdEU1 --- .gitattributes | 1 + README.md | 2 +- composer.json | 7 ++++--- composer.phar | Bin 1103856 -> 1103841 bytes event/listener.php | 1 + phpunit.xml.dist | 3 +-- tests/compat.php | 22 ++++++++++++++++++++++ tests/event/listener_base.php | 8 ++++++-- tests/functional/install_test.php | 6 ++++-- 9 files changed, 40 insertions(+), 10 deletions(-) create mode 100644 tests/compat.php diff --git a/.gitattributes b/.gitattributes index afd8788..88549d1 100644 --- a/.gitattributes +++ b/.gitattributes @@ -3,6 +3,7 @@ tests/ export-ignore travis/ export-ignore +.github/ export-ignore .gitattributes export-ignore .travis.yml export-ignore build.xml export-ignore diff --git a/README.md b/README.md index 90a773b..315e46b 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# phpBB 3.1 or later Extension - gn36 - Customize first post edit permissions +# phpBB 3.1, 3.2 and 3.3 Extension - gn36 - Customize first post edit permissions This Extension allows differenciating editing permissions for the first post. It also allows bypassing the max edit time setting for the first or all posts on a per-forum basis. If you use other extensions that change users edit permissions, please check thoroughly whether they still work correctly in combination with this extension. diff --git a/composer.json b/composer.json index e8b3fff..94fdf8c 100644 --- a/composer.json +++ b/composer.json @@ -25,9 +25,10 @@ "phpbb/phpbb" : ">=3.1.3-RC1" }, "version-check" : { - "host" : "phpbb.gn36.de", - "directory" : "/extensions/vinfo", - "filename" : "phpbb-ext-hookup.json" + "host" : "www.phpbb.com", + "directory" : "/customise/db/extension/gn36_firstpostedit", + "filename" : "version_check", + "ssl" : true } } } diff --git a/composer.phar b/composer.phar index d1ec833d41b06250a1b086aa3a783c10f0da82b4..7cc51cf6bbffb9d80a7f1b8e836a2db10c4f74ae 100644 GIT binary patch delta 244 zcmeyc-udBr=MCqWo6j@1pJ!$SVkRI4u~~qa6^Pk@m>q~YfS41AxwfBY=3cdEd(|@T zS+dhbk8qpwb149UO>t^+X;EfLrQP({Biu66tB!ETPrr49Thib{)1 zJoD1>?Lgd=)PmH!l+?WBN)Q)Gpv1AbI5jsZ2WYC(QSRlMP_tm_5z=5oVZuOT+C`6X V12GQ}^8zs+5c6*rJtlBl5CCo4R%`$O delta 234 zcmaF3-uc6N=MCqW8F`z}F}DM0AZ7w$5Ss;vS%H`hh}nUd1Bf|+m}~nvX6{vswwEvC zo-NDBJ6-4qx49rMmjV#j6sIPa7G;)H+VM`0IKnLhlr1^J9nS@k1 @@ -18,7 +17,7 @@ ./tests/functional - ./tests/functional/ + ./tests/functional/ diff --git a/tests/compat.php b/tests/compat.php new file mode 100644 index 0000000..671eb68 --- /dev/null +++ b/tests/compat.php @@ -0,0 +1,22 @@ +assertThat($haystack, $this->stringContains($needle), $message); + } +} diff --git a/tests/event/listener_base.php b/tests/event/listener_base.php index 510c469..aa2e30f 100644 --- a/tests/event/listener_base.php +++ b/tests/event/listener_base.php @@ -17,10 +17,14 @@ class listener_base extends \phpbb_test_case /** * Set up test environment + * + * Uses @before instead of overriding setUp(), as setUp(): void is required + * by PHPUnit 8+ (phpBB 3.3) but a return type is a syntax error on PHP < 7.1 (phpBB 3.1/3.2). + * + * @before */ - public function setUp() + public function set_up_mocks() { - parent::setUp(); $this->auth = $this->getMockBuilder('\phpbb\auth\auth')->getMock(); $this->user = $this->getMockBuilder('\phpbb\user') ->disableOriginalConstructor() diff --git a/tests/functional/install_test.php b/tests/functional/install_test.php index 9078124..c0b9079 100644 --- a/tests/functional/install_test.php +++ b/tests/functional/install_test.php @@ -15,6 +15,8 @@ */ class install_test extends \phpbb_functional_test_case { + use \gn36\firstpostedit\tests\compat; + static protected function setup_extensions() { return array('gn36/firstpostedit'); @@ -24,13 +26,13 @@ public function test_validate_posting() { // Check whether we can still call posting.php in edit mode (even though login prevents any useful use) $crawler = self::request('GET', 'posting.php?mode=edit&f=2&p=1'); - $this->assertContains('Username', $crawler->filter('dt')->text()); + $this->assertTextContains('Username', $crawler->filter('dt')->text()); } public function test_validate_viewtopic() { // Check whether we can still call viewtopic.php without errors $crawler = self::request('GET', 'viewtopic.php?f=2&p=1'); - $this->assertContains('Welcome', $crawler->filter('h2')->text()); + $this->assertTextContains('Welcome', $crawler->filter('h2')->text()); } } From 57db52e946020e57aeb7771754c1e237e3241b82 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 18 Oct 2026 14:51:07 +0000 Subject: [PATCH 2/3] Restore composer.phar (accidental line-ending change) Co-Authored-By: Claude Sonnet 5.5 Claude-Session: https://claude.ai/code/session_01AXek2CuiLeFBsgjo8BdEU1 --- composer.phar | Bin 1103841 -> 1103856 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/composer.phar b/composer.phar index 7cc51cf6bbffb9d80a7f1b8e836a2db10c4f74ae..d1ec833d41b06250a1b086aa3a783c10f0da82b4 100644 GIT binary patch delta 234 zcmaF3-uc6N=MCqW8F`z}F}DM0AZ7w$5Ss;vS%H`hh}nUd1Bf|+m}~nvX6{vswwEvC zo-NDBJ6-4qx49rMmjV#j6sIPa7G;)H+VM`0IKnLhlr1^J9nS@k1q~YfS41AxwfBY=3cdEd(|@T zS+dhbk8qpwb149UO>t^+X;EfLrQP({Biu66tB!ETPrr49Thib{)1 zJoD1>?Lgd=)PmH!l+?WBN)Q)Gpv1AbI5jsZ2WYC(QSRlMP_tm_5z=5oVZuOT+C`6X V12GQ}^8zs+5c6*rJtlBl5CCo4R%`$O From ad376fc9e123d43519989a1ee31660eac49ad2f6 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 18 Oct 2026 14:51:28 +0000 Subject: [PATCH 3/3] Treat composer.phar as binary to stop phantom line-ending changes Co-Authored-By: Claude Sonnet 5.5 Claude-Session: https://claude.ai/code/session_01AXek2CuiLeFBsgjo8BdEU1 --- .gitattributes | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitattributes b/.gitattributes index 88549d1..0b85410 100644 --- a/.gitattributes +++ b/.gitattributes @@ -9,3 +9,4 @@ travis/ export-ignore build.xml export-ignore composer.phar export-ignore phpunit.xml.dist export-ignore +composer.phar binary