The following code will give you PHP Warnings: “Warning: array_key_exists(): The first argument should be either a string or an integer”
// $parts contains an array of values
$publicationId = floor($parts[0]);
if (array_key_exists($publicationId, $this->publisherPublicationMap)) {
    return $this->publisherPublicationMap[$publicationId];
The reason being that function “floor” returns value of “float”, which is not the expected value for the key of an array. To fix this, simply cast the value to integer:
$publicationId = (int) floor($parts[0]);
This is not obvious, but very easy fix. Hope this helps.

Leave a Reply

Your email address will not be published. Required fields are marked *