serialize a large array in PHP?

前端 未结 13 2084
死守一世寂寞
死守一世寂寞 2021-01-04 06:11

I am curious, is there a size limit on serialize in PHP. Would it be possible to serialize an array with 5,000 keys and values so it can be stored into a cache?

I am

13条回答
  •  误落风尘
    2021-01-04 06:46

    Nope, there is no limit and this:

    set_time_limit(0);
    ini_set('memory_limit ', -1);
    
    unserialize('s:2000000000:"a";');
    

    is why you should have safe.mode = On or a extension like Suhosin installed, otherwise it will eat up all the memory in your system.

提交回复
热议问题