Skip to content

params sub-arrays will get ignored, if they are *not contiguous* #60

@nekromoff

Description

@nekromoff

I have been bumping into this weird edge-case, where Brevo API would ignore sent params sub-array and send empty for-loop emails back.

The bug in Brevo API is this:

If a contiguous array is provided, Brevo correctly processes it via for loop, e.g.:

array:2 [▼ 
  "QUESTIONS" => array:6 [▼
    0 => array:8 [▶]
    1 => array:8 [▶]
    2 => array:8 [▶]
    3 => array:8 [▶]
    4 => array:8 [▶]
    5 => array:8 [▶]
  ]
  "TOTAL" => 6
]

However, if non-contiguous array is provided (array with gaps), Brevo incorrectly ignores this array in for loop, e.g.:

array:2 [▼ 
  "QUESTIONS" => array:6 [▼
    0 => array:8 [▶]
    1 => array:8 [▶]
    2 => array:8 [▶]
    3 => array:8 [▶]
    5 => array:8 [▶]
  ]
  "TOTAL" => 6
]

However, this is absolutely syntax-correct array in PHP.

Ayayay, Brevo!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions