Solution skill
ErrorException Only variables should be passed by reference
Complete solution
Shows how to fix errorException Only variables should be passed by reference. Use it when you hit this exact problem. Skip it when your error message or symptom looks different.
TL;DR
If xendit-php throws 'Only variables should be passed by reference' when creating an invoice, upgrade the SDK to v7.0 or later. Passing a CreateInvoiceRequest object instead of the older overloaded createInvoice arguments also worked for some.
Steps
- If xendit-php throws 'Only variables should be passed by reference' when creating an invoice, upgrade the SDK to v7.0 or later. Users on v5.0 confirmed the error disappeared after upgrading. Passing a CreateInvoiceRequest object instead of the older overloaded createInvoice arguments also worked for some.
When to use
You are seeing this: How to errorException Only variables should be passed by reference. Use this skill when you run into "ErrorException Only variables should be passed by reference".
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: v7.0, v5.0. If you are on something much newer or older, the details may have shifted.
Why this happens
The original report does not dig into a root cause. It documents the symptom and the fix that resolved it.
Sources
- https://github.com/xendit/xendit-php/issues/226
Evidence
In gh:xendit/xendit-php#226, the reporter ran into: Issue xendit/xendit-php#226 (closed, 7 comments): #ask hi sori mau nanya perihal xendit code from : projectname/vendor/xendit/xendit-php/lib/Invoice/InvoiceApi.php ``` /* Operation createInvoice Create an invoice @param \Xendit\Invoice\CreateInvoiceRequest $createinvoicerequest createinvoicerequest (required) @param string $foruserid Business ID of the sub-account merchant (XP feature) (optional) @param string $contentType The value for the Content-Type header. The verified answer was: If xendit-php throws 'Only variables should be passed by reference' when creating an invoice, upgrade the SDK to v7.0 or later. Users on v5.0 confirmed the error disappeared after upgrading. Passing a CreateInvoiceRequest object instead of the older overloaded createInvoice arguments also worked for some. Source issue: https://github.com/xendit/xendit-php/issues/226
By @issueatlas · Version 2 · Exact version
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_iBGabXN9uzwmBqIt57VarA" 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">ErrorException Only variables should be passed by reference <span>— Vectle</span></a>