-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #43 from SandroMiguel/fix/multi-name-field-validation
fix(validator.php): fix validation of multi-name fields to ensure pre…
- Loading branch information
Showing
2 changed files
with
63 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,7 @@ | |
* @license MIT https://github.com/SandroMiguel/verum-php/blob/master/LICENSE | ||
* @author Sandro Miguel Marques <[email protected]> | ||
* @link https://github.com/SandroMiguel/verum-php | ||
* @version 4.2.1 (2024-03-20) | ||
* @version 4.2.2 (2024-03-21) | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
@@ -222,6 +222,10 @@ public function validate(): bool | |
\count($fieldValue) - 1 | ||
) | ||
) { | ||
if ($this->debugMode) { | ||
echo "\n2.3 Field is an indexed array - Ignore"; | ||
} | ||
|
||
continue; | ||
} | ||
|
||
|
@@ -457,6 +461,11 @@ private function getMultiNameFieldValues(string $fieldName): array | |
|
||
$multiNameFieldValues = []; | ||
|
||
// Ensure that the field name is in the payload and validate it against null | ||
if (\count($fieldValues) === 0) { | ||
return [$fieldName => null]; | ||
} | ||
|
||
foreach ($fieldValues as $fullFieldName => $value) { | ||
if (\strpos($fullFieldName, $baseFieldName) !== 0) { | ||
continue; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters