Merge "Unify HTMLForm message handling"
[lhc/web/wiklou.git] / includes / htmlform / HTMLFormField.php
index a5d994d..380b11d 100644 (file)
@@ -117,8 +117,8 @@ abstract class HTMLFormField {
                        $tmp = $m[1];
                }
                if ( substr( $tmp, 0, 2 ) == 'wp' &&
-                       !isset( $alldata[$tmp] ) &&
-                       isset( $alldata[substr( $tmp, 2 )] )
+                       !array_key_exists( $tmp, $alldata ) &&
+                       array_key_exists( substr( $tmp, 2 ), $alldata )
                ) {
                        // Adjust for name mangling.
                        $tmp = substr( $tmp, 2 );
@@ -139,7 +139,7 @@ abstract class HTMLFormField {
                        $data = $alldata;
                        while ( $keys ) {
                                $key = array_shift( $keys );
-                               if ( !is_array( $data ) || !isset( $data[$key] ) ) {
+                               if ( !is_array( $data ) || !array_key_exists( $key, $data ) ) {
                                        continue 2;
                                }
                                $data = $data[$key];
@@ -1097,4 +1097,14 @@ abstract class HTMLFormField {
        protected function getMessage( $value ) {
                return Message::newFromSpecifier( $value )->setContext( $this->mParent );
        }
+
+       /**
+        * Skip this field when collecting data.
+        * @param WebRequest $request
+        * @return bool
+        * @since 1.27
+        */
+       public function skipLoadData( $request ) {
+               return !empty( $this->mParams['nodata'] );
+       }
 }