@@ -827,35 +827,42 @@ public function getUserAgent()
827827 */
828828 public function getOldInput (string $ key )
829829 {
830- // If the session hasn't been started, or no
831- // data was previously saved, we're done.
832- if (empty ($ _SESSION ['_ci_old_input ' ])) {
830+ // If the session hasn't been started, we're done.
831+ if (! isset ($ _SESSION )) {
832+ return null ;
833+ }
834+
835+ // Get previously saved in session
836+ $ old = session ('_ci_old_input ' );
837+
838+ // If no data was previously saved, we're done.
839+ if ($ old === null ) {
833840 return null ;
834841 }
835842
836843 // Check for the value in the POST array first.
837- if (isset ($ _SESSION [ ' _ci_old_input ' ] ['post ' ][$ key ])) {
838- return $ _SESSION [ ' _ci_old_input ' ] ['post ' ][$ key ];
844+ if (isset ($ old ['post ' ][$ key ])) {
845+ return $ old ['post ' ][$ key ];
839846 }
840847
841848 // Next check in the GET array.
842- if (isset ($ _SESSION [ ' _ci_old_input ' ] ['get ' ][$ key ])) {
843- return $ _SESSION [ ' _ci_old_input ' ] ['get ' ][$ key ];
849+ if (isset ($ old ['get ' ][$ key ])) {
850+ return $ old ['get ' ][$ key ];
844851 }
845852
846853 helper ('array ' );
847854
848855 // Check for an array value in POST.
849- if (isset ($ _SESSION [ ' _ci_old_input ' ] ['post ' ])) {
850- $ value = dot_array_search ($ key , $ _SESSION [ ' _ci_old_input ' ] ['post ' ]);
856+ if (isset ($ old ['post ' ])) {
857+ $ value = dot_array_search ($ key , $ old ['post ' ]);
851858 if ($ value !== null ) {
852859 return $ value ;
853860 }
854861 }
855862
856863 // Check for an array value in GET.
857- if (isset ($ _SESSION [ ' _ci_old_input ' ] ['get ' ])) {
858- $ value = dot_array_search ($ key , $ _SESSION [ ' _ci_old_input ' ] ['get ' ]);
864+ if (isset ($ old ['get ' ])) {
865+ $ value = dot_array_search ($ key , $ old ['get ' ]);
859866 if ($ value !== null ) {
860867 return $ value ;
861868 }
0 commit comments