Hi there, it seems like there’s an issue with the templates.dat file, an error occurs during the unserialize step:
Notice: unserialize(): Error at offset 547525 of 625326 bytes in /var/www/storiad.tdgrid.com/public_html/wp-content/plugins/bb-plugin/classes/class-fl-builder-model.php on line 4169
To complicate matters, this error only happens on our staging server. When developing locally, the templates show up as expected. From my googling, it looks like this might be something with character encodings or something?
Do you have a fix for this issue? Maybe a future version could just use JSON and json_decode() instead of serializing? In the meantime I’d like to get this working on our staging site so the client can start working with templates.
Sorry to hear about this problem. Searched through the forums and there was one guy who had the same problem as this but was no longer responding. Do you think you can share temp admin access to the staging site as well as FTP access so our lead dev can check? You can post the details here using the private reply option below.
We’re encountering the same error, although with a different offset: Notice: unserialize(): Error at offset 279624 of 625314 bytes in /[…]/web/app/plugins/beaver-builder-pro-version/classes/class-fl-builder-model.php on line 4180
Plugin version: 1.6.4.6
PHP version: 5.5.30
Edit: One possible reason might be encoding issues, resulting in wrong string lengths. We’re still investigating.
The problem is caused by Git’s line break conversion. In several configurations Git will convert \r\n line endings to \n upon commit.
If possible, we’d recommend the use of Unix-style line endings throughout all files, or at least using JSON as suggested by Nathan Tyler (since the serialized data only contains primitives anyway).
Edit: We solved the issue on our end by adding a .gitattributes to the beaver-builder plugin directory, containing the following line: data/templates.dat binary
Thanks for looking into this! Is this happening because you are keeping Beaver Builder under version control in your project? I’m just curious if you think us adding a .gitattributes file would help or if you think it should be done on a per project basis.
Yes, the problem is caused by Git’s text conversion, as mentioned earlier.
I think the .gitattributes file would definitely help as this one is an error that is hard to spot and debug. Your templates.dat needs to be treated as binary data, and as such should be protected from Git’s automatic text conversion.
The only real alternative would be to use JSON, where changing the line breaks from CRLF to LF won’t break the data integrity.