Jump to content

WireArray/WireData serialization: exception when "name" is not overwritten explicitly?


chrizz
 Share

Recommended Posts

I am chasing a bug and it's driving me nuts ... I can't even localize the issue - in depth and I hope that someone might point me in the right direction here ...

I have a module which loads external data into a custom WireArray, holding custom WireData instances. This makes use of caching along with (de-)serialization. With PW 3.0.184 this approach worked perfectly fine but with the latest 3.0.246 I keep getting this exception: 

Quote

Exception: Serialization of 'PDO' is not allowed

For whatever reason serialization works as soon as I add a key named "name" and put in whatever value - even null is possible.

This code works fine as long as "name" is set explicitly. Once "name" is not set, an exception occurrs stating that PDO cannot be serialized. 

class testArr extends WireArray {
	public function __construct() { }
}

class testItm extends WireData {
	public function __construct() { }
}

$a = new testArr();

$i = new testItm();
// not setting "name" here leads to the above mentioned exception.
$i->set('name', null);
$a->add($i);

echo "<pre>".print_r(serialize($a->getArray()),true)."</pre>";

My happy guess: Some magic uses the "name" variable along with PDO unless it is not set explicitly (aka overwrite) in the latest PW version. 

Have a missed any important news? Any help is appreciated ... 

 

 

 

Edited by chrizz
Link to comment
Share on other sites

  • chrizz changed the title to WireArray/WireData serialization: exception when "name" is not overwritten explicitly?

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...