Skip to content

Commit

Permalink
PHP 8.3
Browse files Browse the repository at this point in the history
  • Loading branch information
jack-worman committed Dec 15, 2023
1 parent 9ff20ae commit b4499e1
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
1 change: 1 addition & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ jobs:
php:
- "8.1"
- "8.2"
- "8.3"

env:
MYSQL_USER: "zftest"
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"description": "Monorepo for zf1s (Zend Framework 1) packages",
"license": "BSD-3-Clause",
"require": {
"php": "^8.1 || ^8.2",
"php": "^8.1 || ^8.2 || ^8.3",
"ext-ctype": "*",
"ext-dom": "*",
"ext-gd": "*",
Expand Down
23 changes: 11 additions & 12 deletions packages/zend-form/library/Zend/Form.php
Original file line number Diff line number Diff line change
Expand Up @@ -2260,13 +2260,12 @@ protected function _array_replace_recursive(array $into)
/**
* Validate the form
*
* @param array $data
* @throws Zend_Form_Exception
* @param array $value
* @return bool
*/
public function isValid($data)
public function isValid($value)
{
if (!is_array($data)) {
if (!is_array($value)) {
// require_once 'Zend/Form/Exception.php';
throw new Zend_Form_Exception(__METHOD__ . ' expects an array');
}
Expand All @@ -2276,24 +2275,24 @@ public function isValid($data)

if ($this->isArray()) {
$eBelongTo = $this->getElementsBelongTo();
$data = $this->_dissolveArrayValue($data, $eBelongTo);
$value = $this->_dissolveArrayValue($value, $eBelongTo);
}
$context = $data;
$context = $value;
/** @var Zend_Form_Element $element */
foreach ($this->getElements() as $key => $element) {
if (null !== $translator && $this->hasTranslator()
&& !$element->hasTranslator()) {
$element->setTranslator($translator);
}
$check = $data;
$check = $value;
if (($belongsTo = $element->getBelongsTo()) !== $eBelongTo) {
$check = $this->_dissolveArrayValue($data, $belongsTo);
$check = $this->_dissolveArrayValue($value, $belongsTo);
}
if (!isset($check[$key])) {
$valid = $element->isValid(null, $context) && $valid;
} else {
$valid = $element->isValid($check[$key], $context) && $valid;
$data = $this->_dissolveArrayUnsetKey($data, $belongsTo, $key);
$value = $this->_dissolveArrayUnsetKey($value, $belongsTo, $key);
}
}
/** @var Zend_Form_SubForm $form */
Expand All @@ -2302,10 +2301,10 @@ public function isValid($data)
&& !$form->hasTranslator()) {
$form->setTranslator($translator);
}
if (isset($data[$key]) && !$form->isArray()) {
$valid = $form->isValid($data[$key]) && $valid;
if (isset($value[$key]) && !$form->isArray()) {
$valid = $form->isValid($value[$key]) && $valid;
} else {
$valid = $form->isValid($data) && $valid;
$valid = $form->isValid($value) && $valid;
}
}

Expand Down

0 comments on commit b4499e1

Please sign in to comment.