Summary
The FacebookAds\PII_DATA_TYPE class ships in php/capi-param-builder/src/model/Constants.php, but the package's PSR-4 autoload maps FacebookAds\ → php/capi-param-builder/src/. Under PSR-4 the class must live in php/capi-param-builder/src/PII_DATA_TYPE.php. Because the filename doesn't match the class name, Composer cannot autoload it (optimized or not), and class_exists('FacebookAds\PII_DATA_TYPE') returns false.
This breaks facebook/php-business-sdk 25.0.2, which added capi-param-builder-php ^1.3.1 as a dependency and calls FacebookAds\PII_DATA_TYPE::EMAIL (etc.) inside UserData::normalize(). Any app sending a server-side Conversions API event fatals.
Environment
facebook/capi-param-builder-php: 1.3.1 (latest)
facebook/php-business-sdk: 25.0.2
- Composer: 2.9.5, PHP: 8.4
Reproduction
composer require facebook/capi-param-builder-php:1.3.1
php -r "require 'vendor/autoload.php'; var_dump(class_exists('FacebookAds\\PII_DATA_TYPE'));"
# bool(false) <- expected: true
Downstream, via the SDK:
composer require facebook/php-business-sdk:25.0.2
php -r "require 'vendor/autoload.php'; (new FacebookAds\Object\ServerSide\UserData())->setEmails(['a@b.com'])->normalize();"
# PHP Fatal error: Uncaught Error: Class "FacebookAds\PII_DATA_TYPE" not found
Expected
FacebookAds\PII_DATA_TYPE autoloads, class_exists(...) returns true, and UserData::normalize() succeeds.
Actual
The class never autoloads; the SDK fatals.
Root cause
PSR-4 requires the file path to match the fully-qualified class name. class FacebookAds\PII_DATA_TYPE sits in src/model/Constants.php instead of src/PII_DATA_TYPE.php. Other FacebookAds\-namespaced classes in src/util/ and src/piiUtil/ appear to have the same mismatch and are likely also unautoloadable.
Suggested fixes (any one)
-
Move PII_DATA_TYPE into src/PII_DATA_TYPE.php (one class per PSR-4-correct file), and do the same for the other subdirectory classes.
-
Add a classmap autoload entry alongside the PSR-4 entry so Composer maps the subdirectory classes regardless of filename:
"autoload": {
"psr-4": { "FacebookAds\\": "php/capi-param-builder/src/" },
"classmap": ["php/capi-param-builder/src/model/", "php/capi-param-builder/src/util/", "php/capi-param-builder/src/piiUtil/"]
}
Running composer dump-autoload --strict-psr on the package surfaces the violation.
Summary
The
FacebookAds\PII_DATA_TYPEclass ships inphp/capi-param-builder/src/model/Constants.php, but the package's PSR-4 autoload mapsFacebookAds\→php/capi-param-builder/src/. Under PSR-4 the class must live inphp/capi-param-builder/src/PII_DATA_TYPE.php. Because the filename doesn't match the class name, Composer cannot autoload it (optimized or not), andclass_exists('FacebookAds\PII_DATA_TYPE')returnsfalse.This breaks
facebook/php-business-sdk25.0.2, which addedcapi-param-builder-php ^1.3.1as a dependency and callsFacebookAds\PII_DATA_TYPE::EMAIL(etc.) insideUserData::normalize(). Any app sending a server-side Conversions API event fatals.Environment
facebook/capi-param-builder-php: 1.3.1 (latest)facebook/php-business-sdk: 25.0.2Reproduction
Downstream, via the SDK:
Expected
FacebookAds\PII_DATA_TYPEautoloads,class_exists(...)returnstrue, andUserData::normalize()succeeds.Actual
The class never autoloads; the SDK fatals.
Root cause
PSR-4 requires the file path to match the fully-qualified class name.
class FacebookAds\PII_DATA_TYPEsits insrc/model/Constants.phpinstead ofsrc/PII_DATA_TYPE.php. OtherFacebookAds\-namespaced classes insrc/util/andsrc/piiUtil/appear to have the same mismatch and are likely also unautoloadable.Suggested fixes (any one)
Move
PII_DATA_TYPEintosrc/PII_DATA_TYPE.php(one class per PSR-4-correct file), and do the same for the other subdirectory classes.Add a
classmapautoload entry alongside the PSR-4 entry so Composer maps the subdirectory classes regardless of filename:Running
composer dump-autoload --strict-psron the package surfaces the violation.