PHP's serialize() function fails to store a good representation of an edited view under PHP 7 (inc. beta 3). It produces a serialized string but for some or other reason that string cannot be un-serialized again (it gives offset errors at un-serialization).
This makes it impossible to add new views or edit exiting ones (which were created originally under earlier PHP versions).
Strangely enough, no similar problem can be seen under PHP 5.6, only under PHP 7.
The functions where the problem is located:
ctools_object_cache_get() {..}
ctools_object_cache_set() {..}
No similar issue can be seen under PHP 7 & Drupal 8.
Any idea what might be going on here? Thanks.
Comment | File | Size | Author |
---|---|---|---|
#9 | views_object_PHP_7--beta-3.txt | 14.23 KB | W.M. |
#9 | views_object_PHP_5-6.txt | 14.23 KB | W.M. |
Comments
Comment #2
W.M. CreditAttribution: W.M. commentedComment #3
lsokolowski CreditAttribution: lsokolowski commentedalso got this problem with php 7 beta 3
Comment #4
bnobleman CreditAttribution: bnobleman at NobleProg commentedRelated:
https://www.drupal.org/node/2534298
Also, there is one issue submitted against unserialize function in php 7
====
Drupal Training in Beijing
http://www.nobleprog.cn/drupal-peixun
Comment #5
W.M. CreditAttribution: W.M. commentedUpdate:
I have tried to solve the issue by using an alternative to serialize(), namely igbinary_serialize() for PHP 7. Still cannot save / edit views but this alternative serialization library sheds more light on the original cause of the problem under PHP 7:
I get this error message when I try to save or edit a view:
I hope this information helps us to solve the issue.
Comment #6
EclipseGc CreditAttribution: EclipseGc commentedI don't have a good way to test php7 right now, let me take this up with the other ctools maintainers and have a conversation.
Comment #7
W.M. CreditAttribution: W.M. commented@EclipseGc
Thanks very much.
What I have noticed also under PHP 7 is that the view's object has a different structure than the one under PHP 5.6. Properties such as "attachment_before", "attachment_after", "build_info" were placed under PHP 7 at root view's object level rather than attached to particular displays.
I will happily test any patches / ideas and report results.
Comment #8
neclimdulThat's actually really helpful. I haven't looked at it but I am guessing its running into this change.
https://wiki.php.net/rfc/uniform_variable_syntax
Comment #9
W.M. CreditAttribution: W.M. commentedHere are two text files that contain the results of var_dump of the view's object before it gets serialized and stored inside ctools_object_cache table (i.e. while editing the view).
As can be seen some properties change position inside the view's object under the two different versions of PHP. For example:
PHP 5.6.12:
object(view)->built @ line 542
PHP 7.beta.3:
object(view)->built @ line 24
Importantly, while producing these two var_dumps I was doing the same exact change to the view: to set AJAX from off to on.
I also get this warning under PHP 7:
Deprecated function: Methods with the same name as their class will not be constructors in a future version of PHP; views_display has a deprecated constructor in require_once() (line 127 of C:\WWW\drupal\sites\all\modules\ctools\ctools.module).
I hope this information will prove helpful.
Comment #10
W.M. CreditAttribution: W.M. commentedProblem still can be seen under the latest PHP 7 release (7.0.0RC1). Saving a view fails with the warnings:
Comment #11
W.M. CreditAttribution: W.M. commentedThe issue/bug is discussed also here at PHP's bug reports:
https://bugs.php.net/bug.php?id=70187
Comment #12
W.M. CreditAttribution: W.M. commentedIssue fixed. The problem was due to a bug in PHP 7 source code. PHP team fixed the issue. The next preview release of PHP 7 should include the fix.
I can confirm that PHP-SRC as per today (custom local compilation under Linux) does not produce the above mentioned error, Views works fine now under current in-development PHP-7.
Comment #13
EclipseGc CreditAttribution: EclipseGc commentedThat's great, but perhaps we should consider filing a follow up that removes the non-__construct() style constructor methods in favor of real __construct methods?
Eclipse
Comment #14
heddn#2528736: Deprecating PHP4 style constructors was filed for #13.