NotionCommotion Posted December 27, 2020 Share Posted December 27, 2020 Is this a mistake in the documentation? I am running PHP7.4 and get warning: unserialize() expects parameter 2 to be array, bool given. Quote Either an array of class names which should be accepted, false to accept no classes, or true to accept all classes. If this option is defined and unserialize() encounters an object of a class that isn't to be accepted, then the object will be instantiated as __PHP_Incomplete_Class instead. Omitting this option is the same as defining it as true: PHP will attempt to instantiate objects of any class. Quote Link to comment https://forums.phpfreaks.com/topic/311931-passing-options-to-unserialize/ Share on other sites More sharing options...
kicken Posted December 27, 2020 Share Posted December 27, 2020 Sounds like you are doing unserialize($data, false); But what you need to do is unserialize($data, ['allowed_classes' => false]); Quote Link to comment https://forums.phpfreaks.com/topic/311931-passing-options-to-unserialize/#findComment-1583464 Share on other sites More sharing options...
NotionCommotion Posted December 27, 2020 Author Share Posted December 27, 2020 49 minutes ago, kicken said: Sounds like you are doing unserialize($data, false); But what you need to do is unserialize($data, ['allowed_classes' => false]); Ah, good to know the documentation is right. Thanks Quote Link to comment https://forums.phpfreaks.com/topic/311931-passing-options-to-unserialize/#findComment-1583467 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.