Skip to content

Commit

Permalink
Merge pull request #52 from fabianwennink/4.x
Browse files Browse the repository at this point in the history
Release version 4.0.4
  • Loading branch information
fabianwennink authored Jan 28, 2025
2 parents a001176 + 18b0d13 commit fd53c2c
Show file tree
Hide file tree
Showing 24 changed files with 41 additions and 32 deletions.
4 changes: 2 additions & 2 deletions .github/ISSUE_TEMPLATE/1_bug_report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ body:
attributes:
label: IconCaptcha version
description: Please specify the version of the package that you are using.
placeholder: "e.g. 4.0.3"
placeholder: "e.g. 4.0.4"
validations:
required: true
- type: input
id: version-php
attributes:
label: PHP version
description: Please specify the version of PHP you are using.
placeholder: e.g. 8.2.0
placeholder: e.g. 8.4.0
validations:
required: true
- type: dropdown
Expand Down
4 changes: 2 additions & 2 deletions .github/ISSUE_TEMPLATE/2_blank_issue.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ body:
attributes:
label: IconCaptcha version
description: Please specify the version of the package that you are using.
placeholder: "e.g. 4.0.3"
placeholder: "e.g. 4.0.4"
validations:
required: true
- type: input
id: version-php
attributes:
label: PHP version
description: Please specify the version of PHP you are using.
placeholder: e.g. 8.2.0
placeholder: e.g. 8.4.0
validations:
required: true
- type: textarea
Expand Down
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@

All notable changes will be documented in this file. Only changes starting at IconCaptcha 2.0.2 have been recorded.

## 4.0.4 - January 23, 2025
Release: [View tag 4.0.4](https://github.com/fabianwennink/IconCaptcha-PHP/releases/tag/4.0.4)

### Fixed
- Fixed a compatibility issue with PHP 8.4 caused by a deprecation warning for "implicitly marked nullable parameters", which was breaking the code.

For a full list of commits and changes, please refer to the [full commit changelog](https://github.com/fabianwennink/IconCaptcha-PHP/compare/4.0.3...4.0.4).

## 4.0.3 - Dec 19, 2023
Release: [View tag 4.0.3](https://github.com/fabianwennink/IconCaptcha-PHP/releases/tag/4.0.3)

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
</p>

<p align="center">
<a href="https://github.com/fabianwennink/IconCaptcha-PHP/releases"><img src="https://img.shields.io/badge/version-4.0.3-orange.svg?style=flat-square" alt="Version" /></a>
<a href="https://github.com/fabianwennink/IconCaptcha-PHP/releases"><img src="https://img.shields.io/badge/version-4.0.4-orange.svg?style=flat-square" alt="Version" /></a>
<a href="https://packagist.org/packages/fabianwennink/iconcaptcha"><img src="https://img.shields.io/packagist/v/fabianwennink/iconcaptcha.svg?style=flat-square" alt="Latest Version on Packagist" /></a>
<a href="https://fabianwennink.nl/projects/IconCaptcha/license"><img src="https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square" alt="License" /></a>
<a href="https://paypal.me/nlgamevideosnl"><img src="https://img.shields.io/badge/support-PayPal-lightblue.svg?style=flat-square" alt="Support via PayPal" /></a>
Expand Down
4 changes: 2 additions & 2 deletions assets/client/css/iconcaptcha.min.css

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions assets/client/js/iconcaptcha.min.js

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions examples/forms/ajax-form.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<!DOCTYPE HTML>
<html lang="en">
<head>
<title>IconCaptcha v4.0.3 - By Fabian Wennink</title>
<title>IconCaptcha v4.0.4 - By Fabian Wennink</title>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=11" />
<meta name="author" content="Fabian Wennink © <?= date('Y') ?>" />
Expand All @@ -38,7 +38,7 @@
<div class="shields">
<div class="shields-row">
<a href="https://github.com/fabianwennink/IconCaptcha-PHP/releases" target="_blank" rel="noopener">
<img src="https://img.shields.io/badge/version-4.0.3-orange.svg?style=flat-square" alt="Version 4.0.3"/>
<img src="https://img.shields.io/badge/version-4.0.4-orange.svg?style=flat-square" alt="Version 4.0.4"/>
</a>
<a href="https://github.com/fabianwennink/IconCaptcha-PHP/blob/master/LICENSE" target="_blank" rel="noopener">
<img src="https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square" alt="MIT license" />
Expand Down Expand Up @@ -96,6 +96,7 @@
Icons made by <a href="https://blendicons.com" class="link-underline" target="_blank" rel="nofollow noopener">BlendIcons</a>.
</small>
</p>
<p><small>Running PHP <?= phpversion(); ?></small></p>
</div>
</div>

Expand Down
2 changes: 1 addition & 1 deletion examples/forms/ajax/ajax-submit.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
if ($validation->success()) {
echo '<b>Captcha:</b> The form has been submitted!';
} else {
echo '<b>Captcha:</b> Validation failed with error code:' . $validation->getErrorCode();
echo '<b>Captcha:</b> Validation failed with error code: ' . $validation->getErrorCode();
}
} else {
echo '<b>Captcha:</b> No data posted!';
Expand Down
5 changes: 3 additions & 2 deletions examples/forms/regular-form.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
<!DOCTYPE HTML>
<html lang="en">
<head>
<title>IconCaptcha v4.0.3 - By Fabian Wennink</title>
<title>IconCaptcha v4.0.4 - By Fabian Wennink</title>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=11" />
<meta name="author" content="Fabian Wennink © <?= date('Y') ?>" />
Expand All @@ -58,7 +58,7 @@
<div class="shields">
<div class="shields-row">
<a href="https://github.com/fabianwennink/IconCaptcha-PHP/releases" target="_blank" rel="noopener">
<img src="https://img.shields.io/badge/version-4.0.3-orange.svg?style=flat-square" alt="Version 4.0.3" />
<img src="https://img.shields.io/badge/version-4.0.4-orange.svg?style=flat-square" alt="Version 4.0.4" />
</a>
<a href="https://github.com/fabianwennink/IconCaptcha-PHP/blob/master/LICENSE" target="_blank" rel="noopener">
<img src="https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square" alt="MIT license" />
Expand Down Expand Up @@ -119,6 +119,7 @@
Icons made by <a href="https://blendicons.com" class="link-underline" target="_blank" rel="nofollow noopener">BlendIcons</a>.
</small>
</p>
<p><small>Running PHP <?= phpversion(); ?></small></p>
</div>
</div>

Expand Down
5 changes: 3 additions & 2 deletions index.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!DOCTYPE HTML>
<html lang="en">
<head>
<title>IconCaptcha v4.0.3 - By Fabian Wennink</title>
<title>IconCaptcha v4.0.4 - By Fabian Wennink</title>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=11" />
<meta name="author" content="Fabian Wennink © <?= date('Y') ?>" />
Expand All @@ -20,7 +20,7 @@
<div class="shields">
<div class="shields-row">
<a href="https://github.com/fabianwennink/IconCaptcha-PHP/releases" target="_blank" rel="noopener">
<img src="https://img.shields.io/badge/version-4.0.3-orange.svg?style=flat-square" alt="Version 4.0.3" />
<img src="https://img.shields.io/badge/version-4.0.4-orange.svg?style=flat-square" alt="Version 4.0.4" />
</a>
<a href="https://github.com/fabianwennink/IconCaptcha-PHP/blob/master/LICENSE" target="_blank" rel="noopener">
<img src="https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square" alt="MIT license" />
Expand Down Expand Up @@ -63,6 +63,7 @@
Icons made by <a href="https://blendicons.com" class="link-underline" target="_blank" rel="nofollow noopener">BlendIcons</a>.
</small>
</p>
<p><small>Running PHP <?= phpversion(); ?></small></p>
</div>
</div>

Expand Down
2 changes: 1 addition & 1 deletion src/Challenge/Challenge.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public function __construct($storage, array $options)
* @param string $widgetId The widget identifier.
* @param string|null $challengeId The challenge identifier.
*/
public function initialize(string $widgetId, string $challengeId = null): Challenge
public function initialize(string $widgetId, ?string $challengeId = null): Challenge
{
// Get the visitor's current IP address.
$ipAddress = Utils::getIpAddress($this->options['ipAddress']);
Expand Down
2 changes: 1 addition & 1 deletion src/Challenge/Hooks/InvalidHookException.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class InvalidHookException extends Exception
* @param string $path The path of the non-existing file.
* @inheritDoc
*/
public function __construct(string $hook, string $message = null, int $code = 0, Throwable $previous = null)
public function __construct(string $hook, ?string $message = null, int $code = 0, ?Throwable $previous = null)
{
if ($message === null) {
$message = "Hook \"$hook\" is invalid. A hook must be a class implementing the necessary interface.";
Expand Down
4 changes: 1 addition & 3 deletions src/Challenge/Image/AbstractImageGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -148,12 +148,10 @@ public function generate(string $iconPath, string $placeholderPath)
}

// Call the image generation hook, if provided.
$placeholder = Hook::call(
return Hook::call(
'generation', GenerationHookInterface::class, 'generate',
$this->session, $this->options, $placeholder, $placeholder
);

return $placeholder;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/Challenge/ValidationResult.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ final class ValidationResult
* @param bool $success
* @param string|null $errorCode
*/
public function __construct(bool $success, string $errorCode = null)
public function __construct(bool $success, ?string $errorCode = null)
{
$this->success = $success;
$this->errorCode = $errorCode;
Expand Down
2 changes: 1 addition & 1 deletion src/Challenge/Validator.php
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ public function validate(array $request): ValidationResult
* @return bool TRUE if the captcha session token matches the given tokens or if the token option is disabled,
* FALSE if the captcha session token does not match the given tokens.
*/
public function validateToken(string $payloadToken, string $headerToken = null): bool
public function validateToken(string $payloadToken, ?string $headerToken = null): bool
{
// Only validate if the token option is enabled.
if (!empty($this->options['token'])) {
Expand Down
2 changes: 1 addition & 1 deletion src/Exceptions/FileNotFoundException.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class FileNotFoundException extends Exception
* @param string $path The path of the non-existing file.
* @inheritDoc
*/
public function __construct(string $path, string $message = null, int $code = 0, Throwable $previous = null)
public function __construct(string $path, ?string $message = null, int $code = 0, ?Throwable $previous = null)
{
if ($message === null) {
$message = "File \"$path\" could not be found.";
Expand Down
2 changes: 1 addition & 1 deletion src/Request.php
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ private function validateToken(array $payload): bool
}

/**
* Create a error message string for the token validation error.
* Create an error message string for the token validation error.
*/
private function tokenError(): void
{
Expand Down
2 changes: 1 addition & 1 deletion src/Session/Drivers/KeyValueSession.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class KeyValueSession extends Session
* @param string $widgetId The captcha widget identifier.
* @param string|null $challengeId The captcha challenge identifier.
*/
public function __construct(KeyValueStorageInterface $storage, array $options, string $ipAddress, string $widgetId, string $challengeId = null)
public function __construct(KeyValueStorageInterface $storage, array $options, string $ipAddress, string $widgetId, ?string $challengeId = null)
{
parent::__construct($options, $ipAddress, $widgetId, $challengeId);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class SessionDataParsingFailedException extends Exception
*
* @inheritDoc
*/
public function __construct(Throwable $previous = null)
public function __construct(?Throwable $previous = null)
{
$message = 'Failed to parse the data of a SessionData instance.';

Expand Down
2 changes: 1 addition & 1 deletion src/Session/Session.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ abstract class Session implements SessionInterface
* @param string $widgetId The widget unique identifier.
* @param string|null $challengeId The challenge unique identifier.
*/
public function __construct(array $options, string $ipAddress, string $widgetId, string $challengeId = null)
public function __construct(array $options, string $ipAddress, string $widgetId, ?string $challengeId = null)
{
$this->options = $options;
$this->maxIdentifierTries = (int)$options['options']['identifierTries'];
Expand Down
2 changes: 1 addition & 1 deletion src/Session/SessionFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class SessionFactory
* @return PDOSession|KeyValueSession|SessionInterface|mixed The generated session instance.
* @throws InvalidArgumentException If the configuration contains an invalid driver.
*/
public static function create($storage, string $driver, array $options, string $ipAddress, string $widgetId, string $challengeId = null): SessionInterface
public static function create($storage, string $driver, array $options, string $ipAddress, string $widgetId, ?string $challengeId = null): SessionInterface
{
if (!isset($driver)) {
throw new InvalidArgumentException('A session driver must be specified.');
Expand Down
2 changes: 1 addition & 1 deletion src/Token/AbstractToken.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ protected function generate(): string
* @param $headerToken string|null The token sent with the request as a header. Can be empty in certain requests.
* @return bool TRUE if the token(s) match the stored token, FALSE if it/they don't.
*/
protected function compareToken(string $storedToken, string $payloadToken, string $headerToken = null): bool
protected function compareToken(string $storedToken, string $payloadToken, ?string $headerToken = null): bool
{
// If the token is empty, the token was never requested.
if (empty($storedToken)) {
Expand Down
2 changes: 1 addition & 1 deletion src/Token/IconCaptchaToken.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public function get(): string
/**
* @inheritDoc
*/
public function validate(string $payloadToken, string $headerToken = null): bool
public function validate(string $payloadToken, ?string $headerToken = null): bool
{
$sessionToken = $this->retrieve();

Expand Down
2 changes: 1 addition & 1 deletion src/Token/TokenInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,5 @@ public function get(): string;
* value will be checked against the captcha token.
* @return bool TRUE if the captcha token matches the given tokens, FALSE if it does not match.
*/
public function validate(string $payloadToken, string $headerToken = null): bool;
public function validate(string $payloadToken, ?string $headerToken = null): bool;
}

0 comments on commit fd53c2c

Please sign in to comment.