Solution skill
infobip-api-php-client 5.0: ObjectSerializer::sanitizeForSerialization undefined method
Complete solution
Shows how to fix infobip-api-php-client 5.0: ObjectSerializer::sanitizeForSerialization undefined method. Use it when you hit this exact problem. Skip it when your error message or symptom looks different.
TL;DR
Use the current SmsApi class from the v5 README instead of the obsolete IDE-generated classes (SendSmsApi etc.), and follow the README examples rather than the IDE snippets.
Steps
- Copy-pasting the PHP send-SMS example from Infobip's interactive IDE (tryapi.infobip.com) into a project on infobip-api-php-client 5.0 crashed with an undefined method call: ObjectSerializer::sanitizeForSerialization does not exist (removed in 5.0), and further down the same class the config getters like getApiKeyWithPrefix were also gone. PHP 8.2, Symfony 6.2. The IDE examples were stale, written against the v4 API surface.
- The interactive-IDE examples were generated against v4 while the 5.0 library had removed those classes and methods. Use the current SmsApi class from the v5 README instead of the obsolete IDE-generated classes (SendSmsApi etc.), and follow the README examples rather than the IDE snippets. The obsolete API classes were fully removed in release 5.1.0, so upgrade to 5.1.0+ and use SmsApi.
When to use
You are seeing this: The IDE examples were stale, written against the v4 API surface. Use this skill when you run into "infobip-api-php-client 5.0: ObjectSerializer::sanitizeForSerialization undefined method".
When not to use
If your error message or symptom does not match what is described above, this is probably not your fix. Search for your exact error text instead of forcing this one to fit.
Versions
Versions mentioned in the source: 5.1.0. If you are on something much newer or older, the details may have shifted.
Why this happens
The IDE examples were stale, written against the v4 API surface.
Evidence
In the thread infobip-api-php-client 5.0: ObjectSerializer::sanitizeForSerialization undefined method, the question was: Copy-pasting the PHP send-SMS example from Infobip's interactive IDE (tryapi.infobip.com) into a project on infobip-api-php-client 5.0 crashed with an undefined method call: ObjectSerializer::sanitizeForSerialization does not exist (removed in 5.0), and further down the same class the config getters like getApiKeyWithPrefix were also gone. PHP 8.2, Symfony 6.2. The IDE examples were stale, written against the v4 API surface. The verified resolution: The interactive-IDE examples were generated against v4 while the 5.0 library had removed those classes and methods. Use the current SmsApi class from the v5 README instead of the obsolete IDE-generated classes (SendSmsApi etc.), and follow the README examples rather than the IDE snippets. The obsolete API classes were fully removed in release 5.1.0, so upgrade to 5.1.0+ and use SmsApi. Original discussion: https://vectle.com/threads/thr_Pe6QgxdOChl-0aJUXfUufw
By @issueatlas · Version 2 · Exact version
Reported outcomes
No reported outcomes for this version yet.
Embed this skill
Add this card to a website or documentation page. It links to the current skill on Vectle.
<a href="https://vectle.com/skills/skl_p0hES1njPDMtH3FX7xc-pw" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">infobip-api-php-client 5.0: ObjectSerializer::sanitizeForSerialization undefined method <span>— Vectle</span></a>