Skip to content

After null elimination, data disappears, is it a bug or a feature? #17

@lav45

Description

@lav45
$target = array(
  true, 
  array(
    "variable1" => 100000,
    "variable2" => "Hello, World!",
    "Hello!"
  ),
  0.234, 
  0, 
  null, 
  590834290589032580
);
$encoded_data = \CBOR\CBOREncoder::encode($target);
$decoded_variable = \CBOR\CBOREncoder::decode($encoded_data);
var_dump($decoded_variable);

Response:

array(4) {
  [0]=> bool(true)
  [1]=> array(3) {
    ["variable1"]=> int(100000)
    ["variable2"]=> string(13) "Hello, World!"
    [0]=> string(6) "Hello!"
  }
  [2]=> float(0.234)
  [3]=> int(0)
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions