Skip to content

Commit a56b664

Browse files
committed
Merge branch '4.0' into 'main'
2 parents e5a40fa + e711096 commit a56b664

File tree

4 files changed

+27
-12
lines changed

4 files changed

+27
-12
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,12 @@ This is a log of major user-visible changes in each phpMyFAQ release.
4040
- migrated from Webpack to Vite v7 (Thorsten)
4141
- migrated from Jest to Vitest v3 (Thorsten)
4242

43+
### phpMyFAQ v4.0.14 - 2025-11-15
44+
45+
- fixed security vulnerability (Thorsten)
46+
- updated third party dependencies (Thorsten)
47+
- fixed bugs (Thorsten)
48+
4349
### phpMyFAQ v4.0.13 - 2025-10-03
4450

4551
- fixed security vulnerability (Thorsten)

phpmyfaq/src/phpMyFAQ/Mail.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -277,19 +277,22 @@ private function setEmailTo(array &$target, string $targetAlias, string $address
277277
* @param string $targetAlias Alias Target alias.
278278
* @param string $address User e-mail address.
279279
* @param string|null $name Username (optional).
280-
* @throws Exception
281280
* @return bool True if successful, false otherwise.
282281
*/
283282
private function addEmailTo(array &$target, string $targetAlias, string $address, ?string $name = null): bool
284283
{
285284
// Check
286285
if (!self::validateEmail($address)) {
287-
throw new Exception('"' . $address . '" is not a valid email address!');
286+
$this->configuration->getLogger()->error('"' . $address . '" is not a valid email address!');
287+
return false;
288288
}
289289

290290
// Don't allow duplicated addresses
291291
if (array_key_exists($address, $target)) {
292-
throw new Exception('"' . $address . '" has been already added in ' . $targetAlias . '!');
292+
$this->configuration
293+
->getLogger()
294+
->error('"' . $address . '" has been already added in ' . $targetAlias . '!');
295+
return false;
293296
}
294297

295298
if (isset($name)) {

tests/bootstrap.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,23 @@
3434
define('PMF_CONFIG_DIR', dirname(__DIR__) . '/tests/content/core/config');
3535
define('PMF_CONTENT_DIR', dirname(__DIR__) . '/tests/content');
3636

37-
const PMF_LOG_DIR = __DIR__ . '/logs';
37+
const PMF_LOG_DIR = __DIR__ . '/logs/phpmyfaq.log';
3838
const PMF_TEST_DIR = __DIR__;
3939
const IS_VALID_PHPMYFAQ = true;
4040

4141
$_SERVER['HTTP_HOST'] = 'localhost';
4242
$_SERVER['SERVER_NAME'] = 'localhost';
4343

44+
// Ensure test log destination exists as a writable file for Monolog
45+
$logDirectory = dirname(PMF_LOG_DIR);
46+
if (!is_dir($logDirectory)) {
47+
mkdir($logDirectory, 0777, true);
48+
}
49+
50+
if (!file_exists(PMF_LOG_DIR)) {
51+
touch(PMF_LOG_DIR);
52+
}
53+
4454
require PMF_ROOT_DIR . '/content/core/config/constants.php';
4555

4656
//

tests/phpMyFAQ/MailTest.php

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,7 @@ public function testSetFromWithValidAddress(): void
5757

5858
public function testSetFromWithInvalidAddress(): void
5959
{
60-
$this->expectException(Exception::class);
61-
$this->mail->setFrom('invalid-email');
60+
$this->assertFalse($this->mail->setFrom('invalid-email'));
6261
}
6362

6463
public function testValidateEmailWithValidAddress(): void
@@ -102,8 +101,7 @@ public function testAddCcWithValidAddress(): void
102101

103102
public function testAddCcWithInvalidAddress(): void
104103
{
105-
$this->expectException(Exception::class);
106-
$this->mail->addCc('invalid-email');
104+
$this->assertFalse($this->mail->addCc('invalid-email'));
107105
}
108106

109107
/**
@@ -117,8 +115,7 @@ public function testAddToWithValidAddress(): void
117115

118116
public function testAddToWithInvalidAddress(): void
119117
{
120-
$this->expectException(Exception::class);
121-
$this->mail->addTo('invalid-email');
118+
$this->assertFalse($this->mail->addTo('invalid-email'));
122119
}
123120

124121
public function testGetDateWithValidTimestamp(): void
@@ -199,8 +196,7 @@ public function testSetReplyToWithValidAddress(): void
199196

200197
public function testSetReplyToWithInvalidAddress(): void
201198
{
202-
$this->expectException(Exception::class);
203-
$this->mail->setReplyTo('invalid-email');
199+
$this->assertFalse($this->mail->setReplyTo('invalid-email'));
204200
}
205201

206202
public function testSafeEmailWithSafeEmailEnabled(): void

0 commit comments

Comments
 (0)