X-Git-Url: https://git.mxchange.org/?p=core.git;a=blobdiff_plain;f=inc%2Fclasses%2Fmain%2Fclass_BaseFrameworkSystem.php;h=2e42a794b12018efe454f560730ca1a54d9e6d3a;hp=94c13b750e3af3ccf586a58f070cb36472aaaa4e;hb=9a2de3adcd917b49c9c5fa33095ccbc3a7032e9f;hpb=c20fc3e6a992d5fa6c511a40c04a7c801e09adf7 diff --git a/inc/classes/main/class_BaseFrameworkSystem.php b/inc/classes/main/class_BaseFrameworkSystem.php index 94c13b75..2e42a794 100644 --- a/inc/classes/main/class_BaseFrameworkSystem.php +++ b/inc/classes/main/class_BaseFrameworkSystem.php @@ -1997,12 +1997,12 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { //* DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput($fieldName.':
'.print_r($fieldArray, TRUE).'
'); // Convert dashes to underscore - $fieldName = $this->convertDashesToUnderscores($fieldName); + $fieldName2 = $this->convertDashesToUnderscores($fieldName); // Does the field exist? - if (isset($fieldArray[$fieldName])) { + if ($this->isFieldSet($fieldName)) { // Get it - $fieldValue = $fieldArray[$fieldName]; + $fieldValue = $fieldArray[$fieldName2]; } elseif (defined('DEVELOPER')) { // Missing field entry, may require debugging self::createDebugInstance(__CLASS__)->debugOutput('[' . __METHOD__ . ':' . __LINE__ . ']:fieldArray
=' . print_r($fieldArray, TRUE) . '
,fieldName=' . $fieldName . ' not found!'); @@ -2015,6 +2015,37 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { return $fieldValue; } + /** + * Checks if given field is set + * + * @param $fieldName Field name to check + * @return $isSet Whether the given field name is set + * @throws NullPointerException If the result instance is null + */ + public function isFieldSet ($fieldName) { + // Get result instance + $resultInstance = $this->getResultInstance(); + + // Is this instance null? + if (is_null($resultInstance)) { + // Then the user instance is no longer valid (expired cookies?) + throw new NullPointerException($this, self::EXCEPTION_IS_NULL_POINTER); + } // END - if + + // Get current array + $fieldArray = $resultInstance->current(); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('[' . $this->__toString() . ':' . __LINE__ . '] fieldName=' . $fieldName . ',fieldArray=
'.print_r($fieldArray, TRUE).'
'); + + // Convert dashes to underscore + $fieldName = $this->convertDashesToUnderscores($fieldName); + + // Determine it + $isSet = isset($fieldArray[$fieldName]); + + // Return result + return $isSet; + } + /** * Flushs all pending updates to the database layer *