-
Notifications
You must be signed in to change notification settings - Fork 64
Description
Environment:
PHP Version: 8.x
SDK Version: 4.0.10
Issue: Massive deprecation warnings flooding debug logs
Description:
The Pipedrive PHP SDK (v4.0.10) generates thousands of deprecation warnings when used with PHP 8.x, causing debug log files to grow to 10MB+ in size within minutes. The warnings are related to JsonSerializable::jsonSerialize() return type declarations that are not compatible with PHP 8.x requirements.
Example Warnings:
PHP Deprecated: Return type of Pipedrive\Models\UserMe::jsonSerialize() should either be compatible with JsonSerializable::jsonSerialize(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /vendor/pipedrive/pipedrive/src/Models/UserMe.php on line 46
PHP Deprecated: Return type of Pipedrive\Models\BaseUserMe::jsonSerialize() should either be compatible with JsonSerializable::jsonSerialize(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /vendor/pipedrive/pipedrive/src/Models/BaseUserMe.php on line 237
PHP Deprecated: Return type of Pipedrive\Models\Language::jsonSerialize() should either be compatible with JsonSerializable::jsonSerialize(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /vendor/pipedrive/pipedrive/src/Models/Language.php on line 48
Impact:
- Debug log files grow exponentially (10MB+ per page load)
- Server disk space consumed rapidly
- Log monitoring systems overwhelmed
- Difficult to identify actual application errors among thousands of deprecation warnings
Expected Behavior:
The SDK should be compatible with PHP 8.x without generating deprecation warnings. Model classes implementing JsonSerializable should either:
- Declare proper return types: : mixed
- Use the #[\ReturnTypeWillChange] attribute as a temporary measure
Suggested Fix:
Update all model classes that implement JsonSerializable to include proper return type declarations:
// Before
public function jsonSerialize()
{
// ...
}
// After (Option 1 - Preferred for PHP 8.0+)
public function jsonSerialize(): mixed
{
// ...
}
// After (Option 2 - Temporary compatibility)
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
// ...
}
Workaround:
Currently suppressing E_DEPRECATED errors at the application level, but this is not ideal as it hides other legitimate deprecation warnings.
Screenshots:
[Attach your screenshots showing the debug.log file with thousands of deprecation warnings]
Additional Context:
This issue affects all PHP 8.x users and makes the SDK difficult to use in production environments where debug logging is enabled. A fix would greatly improve the developer experience and reduce server resource consumption.
