@@ -128,21 +128,16 @@ private function initialize(): void
128128 }
129129 }
130130
131- // process meta metadata
132- if (isset ($ nf ['META ' ])) {
133- $ now = time ();
134- // expire section variables
135- foreach ($ nf ['META ' ] as $ section => $ metadata ) {
136- if (is_array ($ metadata )) {
137- foreach ($ metadata as $ variable => $ value ) {
138- if (!empty ($ value ['T ' ]) && $ now > $ value ['T ' ]) {
139- if ($ variable === '' ) { // expire whole section
140- unset($ nf ['META ' ][$ section ], $ nf ['DATA ' ][$ section ]);
141- continue 2 ;
142- }
143- unset($ nf ['META ' ][$ section ][$ variable ], $ nf ['DATA ' ][$ section ][$ variable ]);
144- }
131+ // expire section variables
132+ $ now = time ();
133+ foreach ($ nf ['META ' ] ?? [] as $ section => $ metadata ) {
134+ foreach ($ metadata ?? [] as $ variable => $ value ) {
135+ if (!empty ($ value ['T ' ]) && $ now > $ value ['T ' ]) {
136+ if ($ variable === '' ) { // expire whole section
137+ unset($ nf ['META ' ][$ section ], $ nf ['DATA ' ][$ section ]);
138+ continue 2 ;
145139 }
140+ unset($ nf ['META ' ][$ section ][$ variable ], $ nf ['DATA ' ][$ section ][$ variable ]);
146141 }
147142 }
148143 }
@@ -292,12 +287,7 @@ public function getIterator(): \Iterator
292287 $ this ->start ();
293288 }
294289
295- if (isset ($ _SESSION ['__NF ' ]['DATA ' ])) {
296- return new \ArrayIterator (array_keys ($ _SESSION ['__NF ' ]['DATA ' ]));
297-
298- } else {
299- return new \ArrayIterator ;
300- }
290+ return new \ArrayIterator (array_keys ($ _SESSION ['__NF ' ]['DATA ' ] ?? []));
301291 }
302292
303293
@@ -312,21 +302,11 @@ public function clean(): void
312302 }
313303
314304 $ nf = &$ _SESSION ['__NF ' ];
315- if (isset ($ nf ['META ' ]) && is_array ($ nf ['META ' ])) {
316- foreach ($ nf ['META ' ] as $ name => $ foo ) {
317- if (empty ($ nf ['META ' ][$ name ])) {
318- unset($ nf ['META ' ][$ name ]);
319- }
305+ foreach ($ nf ['META ' ] ?? [] as $ name => $ foo ) {
306+ if (empty ($ nf ['META ' ][$ name ])) {
307+ unset($ nf ['META ' ][$ name ]);
320308 }
321309 }
322-
323- if (empty ($ nf ['META ' ])) {
324- unset($ nf ['META ' ]);
325- }
326-
327- if (empty ($ nf ['DATA ' ])) {
328- unset($ nf ['DATA ' ]);
329- }
330310 }
331311
332312
0 commit comments