Running into "array_merge(): Argument #2 is not an array" on re-render
See original GitHub issueDescribe the bug
Trying to use Sprig with the mailchimp-subscribe plugin.
Expected behaviour
The submission works but I think when Sprig tries to re-render it hits an error.
Screenshots
Versions
- Plugin version: 1.0.0-beta.13
- Craft version: 3.5.8
Here is what our component looks like:
{% set subscribeResponse =
mailchimpSubscribe is defined
and mailchimpSubscribe.action == 'subscribe'
? mailchimpSubscribe : null %}
{% if subscribeResponse and subscribeResponse.success %}
<p>You’ve been subscribed!</button>
{% else %}
<form
class="newsletter-form"
sprig
s-method="post"
s-action="mailchimp-subscribe/audience/subscribe">
{{ csrfInput() }}
{% if subscribeResponse and not subscribeResponse.success %}
<p>An error occured: {{ subscribeResponse.message }}</p>
{% endif %}
<label for="first_name">First Name</label>
<input
type="text"
name="merge_fields[FNAME]"
placeholder="First Name"
{% if subscribeResponse and not subscribeResponse.success %}value="{{ subscribeResponse.values.FNAME ?? '' }}"{% endif %}
/>
<label for="last_name">Last Name</label>
<input
type="text"
name="merge_fields[LNAME]"
placeholder="Last Name"
{% if subscribeResponse and not subscribeResponse.success %}value="{{ subscribeResponse.values.LNAME ?? '' }}"{% endif %}
/>
<label for="email"{% if subscribeResponse and subscribeResponse.errorCode=='1000' %} class="error"{% endif %}>Email:</label>
<input
id="email"
type="text"
name="email"
placeholder="Email"
{% if subscribeResponse and not subscribeResponse.success %}value="{{ subscribeResponse.values.email ?? '' }}"{% endif %}
required
/>
<button type="submit" class="btn">
Join the Newsletter!¡
</button>
</form>
{% endif %}
Issue Analytics
- State:
- Created 3 years ago
- Comments:10
Top Results From Across the Web
How do I resolve "array_merge argument is not an array"?
I'm trying to resolve it but I'm not sure what else to try. Here is the code that I an executing: $config =...
Read more >Fatal Core Error when updating to PHP8
Running WP 6.03 Switched from PHP7.4 to PHP8.0 and get “WordPress Critical ... TypeError: array_merge(): Argument #2 must be of type array, null...
Read more >Vuex add item to array
It's based on a very simple idea that manages an array (or Vuex store optionally) with multiple loading states. users = Object.
Read more >PHP array_merge() Function
PHP array_merge() Function ; Merge two arrays into one array: · $a1= ; Merge two associative arrays into one array: · $a1= ·...
Read more >array_merge - Manual
arrays. Variable list of arrays to merge. ... If called without any arguments, returns an empty array. ... Example #2 Simple array_merge() example....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Seems to be working just great. Thanks for your fast response time on this!
Great, I’ll try that out! Sorry I couldn’t be more helpful in debugging this.