We just switched our website over to a new server. There is a part of my PHP software that pulls out a serialized data value from the MySQL table, and puts it into a variable, and then it's supposed to unserialize().
I never had this issue on any other servers (and this exact code is used on many different servers..), but I'm getting an issue where the value fails to unserialize - it returns false (blank).
HOWEVER, if I copy the exact value, put it into another $var, and then unserialize($var) it, it works perfectly fine into an array... they are the exact same values. One works, the other doesn't.
Check out the following link to visualize what I mean..
http://paulmasoumi.com/admin/test.php
And the PHP code on this page is:
<?
include 'start.php';
$var = 'a:8:{i:0;s:0:"";i:1;s:11:"New Listing";i:2;s:11:"Just Listed";i:3;s:9:"New Price";i:4;s:17:"Exclusive Listing";i:5;s:12:"Just Reduced";i:6;s:31:"Great Price!;Showroom Condition";i:7;s:42:"Featured In;Dream Homes of Canada Magazine";}';
echo 'Echoing $var:<br />';
echo $var;
echo '<br />';
echo 'Echoing $settings[\'remarksdisplay\'] retrieved from mysql database field:<br />';
echo $settings['remarksdisplay'];
echo '<br />';
echo '<br />';
echo 'When you run print_r(unserialize($var)):<br />';
print_r(unserialize($var));
echo '<br />';
echo 'When you run print_r(unserialize($settings[\'remarksdisplay\'])):<br />';
print_r(unserialize($settings['remarksdisplay']));
echo '<br />';
echo '<br />';
echo 'When you run IF statement to see if $settings[\'remarksdisplay\']==$var:<br />';
if($settings['remarksdisplay']==$var) {echo "EQUAL";} else {echo 'not equal';}
?>
I've also checked the server settings regarding the serialize() and unserialize() functions...
Check out these two settings: http://www.paulmasoumi.com/admin/phpinfo.php http://demo.brixwork.com/admin/phpinfo.php
Settings involving serialization of strings, magic quotes etc. are all identical.
What am I missing???