elastic / elastic/apm-agent-php
Error event created even when using the @ operator (error suppression operator)
- Dominant language
- PHP
- Stars
- 268
- Forks
- 86
- PR merge metrics
- No merged PRs in 30d
Description
**Describe the bug**
An error event is created even when using the @ operator (error suppression operator, see https://www.php.net/manual/en/language.operators.errorcontrol.php).
**To Reproduce**
1. Run the container image created by building the following Dockerfile:
```Dockerfile
FROM php:8.0-cli
RUN curl -fsSL https://github.com/elastic/apm-agent-php/releases/download/v1.8.4/apm-agent-php_1.8.4_all.deb > /tmp/apm-agent.deb \
&& dpkg --install /tmp/apm-agent.deb
RUN echo " test.php
ENV ELASTIC_APM_LOG_LEVEL=DEBUG
CMD ["php", "test.php"]
```
2. Notice that the following string appears in the output:
```
[Elastic APM PHP Tracer] 2023-06-07 15:20:47.255375+00:00 [PID: 1] [TID: 1] [DEBUG] [Public-API] [Tracer.php:291] [onPhpError] Creating error event because error_reporting() includes its type... {"type":2,"error_reporting()":32767,"namespace":"Elastic\\Apm\\Impl","class":"Tracer","this":{"isRecording":true,"providedDependencies":{"clock":null,"configRawSnapshotSource":null,"eventSink":null,"logSink":null},"config":{"optNameToParsedValue":{"api_key":null,"async_backend_comm":true,"breakdown_metrics":true,"capture_errors":true,"dev_internal":null,"disable_instrumentations":null,"disable_send":false,"enabled":true,"environment":null,"hostname":null,"log_level":5,"log_level_stderr":null,"log_level_syslog":null,"non_keyword_string_max_length":10240,"profiling_inferred_spans_enabled":false,"profiling_inferred_spans_min_duration":0,"profiling_inferred_spans_sampling_interval":1000,"sanitize_field_names":{"type":"Elastic\\Apm\\Impl\\Util\\WildcardListMatcher","value_as_string":"password, passwd, pwd, secret, *key, *token*, *session*, *credit*, *card*, *auth*, set-cookie"},"secret_token":null,"server_timeout":30000,"service_name":null,"service_node_name":null,"service_version":null,"span_compression_enabled":true,"span_compression_exact_match_max_duration":50,"span_compression_same_kind_max_duration":0,"transaction_ignore_urls":null,"transaction_max_spans":500,"transaction_sample_rate":1,"url_groups":null,"verify_server_cert":true},"apiKey":null,"asyncBackendComm":true,"breakdownMetrics":true,"captureErrors":true,"devInternal":null,"devInternalParsed":{"dropEventAfterEnd":false,"dropEventsBeforeSendCCode":false,"gcCollectCyclesAfterEveryTransaction":false,"gcMemCachesAfterEveryTransaction":false},"disableInstrumentations":null,"disableSend":false,"enabled":true,"environment":null,"hostname":null,"logLevel":5,"logLevelStderr":null,"logLevelSyslog":null,"nonKeywordStringMaxLength":10240,"profilingInferredSpansEnabled":false,"profilingInferredSpansMinDuration":0,"profilingInferredSpansSamplingInterval":1000,"sanitizeFieldNames":{"type":"Elastic\\Apm\\Impl\\Util\\WildcardListMatcher","value_as_string":"password, passwd, pwd, secret, *key, *token*, *session*, *credit*, *card*, *auth*, set-cookie"},"secretToken":null,"serverTimeout":30000,"serviceName":null,"serviceNodeName":null,"serviceVersion":null,"spanCompressionEnabled":true,"spanCompressionExactMatchMaxDuration":50,"spanCompressionSameKindMaxDuration":0,"transactionIgnoreUrls":null,"transactionMaxSpans":500,"transactionSampleRate":1,"urlGroups":null,"verifyServerCert":true,"effectiveLogLevel":5},"currentTransactionId":"f6bbfddef2c2fbfb"}}
```
**Expected behavior**
When using the @ operator, no error event should be created.
Contributor guide
Assessment
This issue has not been assessed yet.