php-serialize icon indicating copy to clipboard operation
php-serialize copied to clipboard

scope () and strict false do not seem to be working?

Open chorton opened this issue 2 years ago • 2 comments

I have a php serialized classes that I need to unserialize in my nodejs app. When I unserialize with unserialize(message, { scope: {}, strict: false }); I am still gettin the following error: AssertionError [ERR_ASSERTION]: Class App\Models\Account\Service not found in given scope

chorton avatar Apr 01 '24 20:04 chorton

Same issue. Not sure how to add such a class to the scope 🤔

jesper-bylund avatar Jul 31 '24 09:07 jesper-bylund

Hi @chorton and @jesper-bylund. Based on the code snippet shared, it seems you are not passing in the arguments correctly. Instead of combining scope and strict into a single object, we have to pass them separately.

It would look like this: unserialize(message, {}, {strict: false})

Please try the above and let me know how it goes

steelbrain avatar Jul 31 '24 09:07 steelbrain