0

This is very strange issue.
I have a running website which has no problem with me or any one i know.
but one of my clients told me that he have a strange codes so i asked him for a screen shot and here it's

error with set_flashdata

The code where this happen

$this->session->set_flashdata(array('success_msg' =>'Some message'));
redirect(base_url());

Redirect didn't happen and user get a content of his local cookie into the browser like what's in image , he uses Firefox and windows as os .

A gain I can't re produce this issue and he told me that happen to him every time he visit this page !

Any idea ?

Samy Massoud
  • 4,295
  • 2
  • 35
  • 48
  • is your client using a different language than you are? locale? etc; for their browser etc; What browser, also with the changed `set_flashdata()` are they still experiencing the issue. One last one, how much data do you have in your session? [Cookies can only hold 4KB](http://stackoverflow.com/a/15740581/158014) of data (if you use encryption this reduces your size!) – Jakub Jan 13 '14 at 20:54
  • @Jakub no he uses the same language as i use , and cookie hold less than 1kb of data , again this works for every one else and i will check removing set_flashdata() option with him. – Samy Massoud Jan 13 '14 at 21:05
  • looks like its trying to parse it as an image? is the header correct? – tomexsans Jan 13 '14 at 23:42
  • @tomexsans it shows this message and didn't redirect to any where , even though i have a code in between redirect and set flash data that insert record to database , this code work perfect again what make me crazy i have never seen this issue although i have tested the same page on many computers ! – Samy Massoud Jan 14 '14 at 08:23

2 Answers2

1

Set the Session Flash Data as above

$this->session->set_flashdata('updateprofile','Your Profile has been Updated');

to print this data in the view use

<?php if($this->session->flashdata('updateprofile')): echo $this->session->flashdata('updateprofile'); endif;?>

saurabh kamble
  • 1,510
  • 2
  • 25
  • 42
0

you have a syntax error: miss )
Isn't necessary to use array in this case
try to change this:

$this->session->set_flashdata(array('success_msg' =>'Some message');

to this

$this->session->set_flashdata('success_msg','Some message');

make sure error reporting is enabled, or try placing the following at the top of your index.php.

error_reporting(E_ALL | E_WARNING | E_NOTICE);
ini_set('display_errors', TRUE);
Alessandro Minoccheri
  • 35,521
  • 22
  • 122
  • 171