[GH-ISSUE #1895] IntrospectionProcessorTests: $expect and $actual are the same object by reference. #812

Closed
opened 2026-03-04 03:00:52 +03:00 by kerem · 0 comments
Owner

Originally created by @healsdata on GitHub (Jun 19, 2024).
Original GitHub issue: https://github.com/Seldaek/monolog/issues/1895

Monolog version 2

Three tests in IntrospectionProcessorTest (testLevelTooLow, testLevelEqual, testLevelHigher) aren't actually testing anything. Because $expected = $input is a reference, the changes made to $expected['extra'] are made to $input and carried forward to $actual. You can demonstrate this by adding a return $record at the immediate start of InstrospectionProcessor::__invoke -- the tests still pass despite bypassing all the code.

I have a PR for this I'll open in a few minutes.

Originally created by @healsdata on GitHub (Jun 19, 2024). Original GitHub issue: https://github.com/Seldaek/monolog/issues/1895 Monolog version 2 Three tests in IntrospectionProcessorTest (testLevelTooLow, testLevelEqual, testLevelHigher) aren't actually testing anything. Because `$expected = $input` is a reference, the changes made to `$expected['extra']` are made to $input and carried forward to $actual. You can demonstrate this by adding a `return $record` at the immediate start of `InstrospectionProcessor::__invoke` -- the tests still pass despite bypassing all the code. I have a PR for this I'll open in a few minutes.
kerem 2026-03-04 03:00:52 +03:00
  • closed this issue
  • added the
    Bug
    label
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/monolog#812
No description provided.