DataDog/dd-trace-php

[Bug]: Using --ini option duplicate "export=" declaration|"

dam1r89 opened this issue · 2 comments

Bug report

Steps to reproduce:
docker run --rm -it webdevops/php-nginx:8.3 bash

curl -LO https://github.com/DataDog/dd-trace-php/releases/latest/download/datadog-setup.php
mkdir /opt/datadog_trace_php
php datadog-setup.php --php-bin=all --enable-appsec --enable-profiling --install-dir /opt/datadog_trace_php/install_dir --extension-dir /opt/datadog_trace_php/php_ext --ini /opt/datadog_trace_php/98-ddtrace.ini

To test it run php -c /opt/datadog_trace_php/98-ddtrace.ini -v

PHP version

8.3.10

Tracer or profiler version

1.2.0

Installed extensions

[PHP Modules]
amqp
apcu
bcmath
bz2
calendar
Core
ctype
curl
date
dom
excimer
exif
FFI
fileinfo
filter
ftp
gd
gettext
gmp
hash
iconv
imagick
imap
intl
ionCube Loader
json
ldap
libxml
mbstring
memcached
mongodb
mysqli
mysqlnd
openssl
opentelemetry
pcntl
pcre
PDO
pdo_mysql
pdo_pgsql
pdo_sqlite
pgsql
Phar
posix
protobuf
random
readline
redis
Reflection
session
shmop
SimpleXML
soap
sockets
sodium
SPL
sqlite3
standard
sysvmsg
sysvsem
sysvshm
tokenizer
vips
xml
xmlreader
xmlrpc
xmlwriter
xsl
Zend OPcache
zip
zlib

[Zend Modules]
Zend OPcache
the ionCube PHP Loader

Output of phpinfo()

No response

Upgrading from

No response

Hey @dam1r89,
thanks for filling this bug report, I can reproduce your issue:

PHP Warning:  Module "ddtrace" is already loaded in Unknown on line 0
PHP Warning:  Module "datadog-profiling" is already loaded in Unknown on line 0
PHP Warning:  Module "ddappsec" is already loaded in Unknown on line 0
PHP 8.3.10 (cli) (built: Aug  1 2024 19:31:18) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.3.10, Copyright (c) Zend Technologies
    with the ionCube PHP Loader v13.3.1, Copyright (c) 2002-2024, by ionCube Ltd.
    with Zend OPcache v8.3.10, Copyright (c), by Zend Technologies
    with ddtrace v1.2.0, Copyright Datadog, by Datadog
    with datadog-profiling v1.2.0, Copyright Datadog, by Datadog
    with ddappsec v1.2.0, Copyright Datadog, by Datadog

The problem is the combination of --ini and --extension-dir, I created #2789 to fix this behaviour.
For all PHP binaries that Datadog extension get installed, we check if the corresponding extension = .. does exist in the given INI file. In case we do not find it, we add it. In this particular case the line was there, but matched against the default value, being ddtrace or datadog-profiling or ddappsec, without the path given with the --extension-dir argument.