Seems like the post() method of FluentLogger can not handle numeric arrays

Open
#60 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
45/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
php

Research direction

Start at FluentLogger::post and follow how the Entity is constructed and serialized. Reproduce the behavior with arrays using numeric indices, then determine whether the conversion belongs in post() or the Entity path. Done means numeric-indexed posted data is handled correctly and the behavior is covered by an appropriate test.

Written by the indexing model from the issue text.

Description

This problem was costing me some time to find that only string indicies in the array are allowed:

/**
     * send a message to specified fluentd.
     *
     * @param string $tag
     * @param array  $data
     * @return bool
     *
     * @api
     */
    public function post($tag, array $data)
    {
        $entity = new Entity($tag, $data);

        return $this->postImpl($entity);
    }

I do now know the exact reason for this behaviour, but can you please just apply PHPs strval() function for posted arrays with numeric indicies?

If this problem does not result from the library (I am not 100% sure) please sorry for bothering the wrong implementors ;-)

Dominant language
PHP
Stars
218
Forks
58
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from fluent/fluent-logger-php

All issues in fluent/fluent-logger-php

Similar issues

More PHP issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.