Method decode_value()

Method decode_value

mixed decode_value(string(8bit) coded_value, void|Codec|int(-1) codec)


Decode a value from the string coded_value.

Parameter coded_value

Value to decode.

Parameter codec

Codec to use when encoding objects and programs.

Parameter trace

String.Buffer to contain a readable dump of the value.

Parameter debug

Debug level. Only available when the runtime has been compiled --with-rtl-debug.

This function takes a string created with encode_value() or encode_value_canonic() and converts it back to the value that was coded.

If codec is specified, it's used as the codec for the decode. If none is specified, then one is instantiated through master()->Decoder(). As a compatibility fallback, the master itself is used if it has no Decoder class. If codec is the special value -1, then decoding of types, functions, programs and objects is disabled.


Decoding a coded_value that you have not generated yourself is a security risk that can lead to execution of arbitrary code, unless codec is specified as -1.

See also

encode_value(), encode_value_canonic()