AnotherRedisDesktopManager icon indicating copy to clipboard operation
AnotherRedisDesktopManager copied to clipboard

Laravel serialize的对象无法被unserialize

Open robin-dongbin opened this issue 2 years ago • 13 comments

OS

Mac

VERSION

1.5.8

ISSUE DESCRIPTION

在php中直接写代码是可以反序列化的 image image

robin-dongbin avatar Sep 07 '22 05:09 robin-dongbin

试了一下,目前用的包php-serialize不能直接unserialize类对象,只能array,string这种基础的,也有其他包,但只能反序列化成普通对象,没有类名的概念了,比如 $a = new stdClass(); $a->p = 1; $a序列化存起来,js再反解析成{p: 1}这种,不过即要采取这种方案的话,那就不能编辑了,只读模式展示

qishibo avatar Sep 07 '22 07:09 qishibo

因为回不去了

qishibo avatar Sep 07 '22 07:09 qishibo

可以使用自定义脚本的方式,视图下拉框最下面有个自定义脚本,里面写个php命令,等价于每次都执行php文件,比如这样 xxx.php

$str = $argv[1];
var_dump(unserialize($str));

qishibo avatar Sep 07 '22 07:09 qishibo

其实也不需要编辑,能不能判断一下在这种情况下只读模式展示也可以?

robin-dongbin avatar Sep 08 '22 03:09 robin-dongbin

试了一下你说的方法报错没权限

/bin/sh: /Users/ice/cli/unserialize.sh: Permission denied

robin-dongbin avatar Sep 08 '22 03:09 robin-dongbin

手动执行命令没问题的话再填到Another里,你的sh文件前面加#!/bin/bash头了么,不一定是sh文件,直接执行php文件也可以

qishibo avatar Sep 08 '22 04:09 qishibo

直接执行php文件也是报一样的错

robin-dongbin avatar Sep 08 '22 06:09 robin-dongbin

看看你脚本配置和脚本内容

qishibo avatar Sep 08 '22 06:09 qishibo

我就复制的你的..

robin-dongbin avatar Sep 08 '22 06:09 robin-dongbin

参考这个 https://gitee.com/qishibo/AnotherRedisDesktopManager/issues/I4VE1A

qishibo avatar Sep 08 '22 07:09 qishibo

弄出来了,感谢

robin-dongbin avatar Sep 09 '22 03:09 robin-dongbin

能不能判断一下在这种情况下只读模式展示也可以?如果不可以的话就关闭issue了,个人感觉只读模式展示,总比直接报错解析失败的好

robin-dongbin avatar Sep 09 '22 03:09 robin-dongbin

感觉最好有个类似var_dump的包,能显示类名的,我再找找看

qishibo avatar Sep 09 '22 11:09 qishibo

支持了 image

qishibo avatar May 23 '24 02:05 qishibo