#StackBounty: #php #laravel #redis #laravel-5.4 #laravel-echo Laravel Echo never recieving event

Bounty: 50

For whatever reason, I cannot receive any data on my client side from laravel echo. I am using laravel-echo-server (socket.io), redis broadcaster, and redis queues. As far as I can tell, they are all functional. I’ll take you through how I set it up for testing. First I created a UserCreated event:

class UserCreated implements ShouldBroadcast
    use Dispatchable, InteractsWithSockets, SerializesModels;

    public $user;

    public function __construct($user)
        $this->user = $user;

    public function broadcastOn()
        return new Channel('user-created');

    public function broadcastAs()
        return 'user.created';

Then, to test this event, I created a CreateUser command:

class CreateUser extends Command
    protected $signature = 'create:user {username}';

    protected $description = 'Create a new user!';

    public function __construct()

    public function handle()
        $user = ChatterUser::create([
            'name' => $this->argument('username'),
            'email' => uniqid() . '@gmail.com',
            'password' => bcrypt('secret')
        event(new ChatterEventsUserCreated($user));

Finally, here is my laravel-echo-server.json:

    "authEndpoint": "/broadcasting/auth",
    "authHost": "chatter.dev",
    "database": "redis",
    "databaseConfig": {
        "redis": {
            "port": "6379",
            "host": "localhost"
    "port": 6001,
    "protocol": "http",
    "sslCertPath": "",
    "sslKeyPath": "",
    "socketio": {}

Next I ran php artisan queue:listen, and laravel-echo-server start. They both ran without error.
To make sure that the server worked, I did php artisan create:user Bob123.
It was successful. The queue returned this (in console):

[2017-06-01 01:28:27] Processing: ChatterEventsUserCreated
[2017-06-01 01:28:27] Processed:  ChatterEventsUserCreated

And the laravel-echo-server returned this (in console):

CHANNEL user-created

So, to get the data I sent with the user, I created a Vue component, with a echo listener in the mounted function. Here’s my component:

</div> </template> export default { mounted() { console.log('Component mounted.'); window.Echo.channel('user-created') .listen('.user.created', (data) => { console.log(data); }); }, data(){ return { messages: [] } } }

When I refreshed my webpage, Component mounted was logged to the console so I’m certain that it loaded. But, for whatever reason, when I send the CreateUser command, the data is not logged into the browsers console.

Here is everything that you might point out:

I changed my broadcast driver to redis in my .env



I also uncommented the BroadcastingServiceProvider in the app.php config.

I can’t think of anything else right now that you might point out that I have done, but if I remember any others I will update the question.

Thanks for any help.

Note: I’m not familiar with Redis, so currently I’m leaning towards that being my problem. Simply adding predispredis as a dependency simply doesn’t feel like that’s all I have to do. Hopefully this note helps.


As suggested, I tried running redis-server before I ran laravel-echo-server. This is what was returned in the console:

vagrant@homestead:~/Code/Chatter$ redis-server
16342:C 01 Jun 05:45:38.066 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf
16342:M 01 Jun 05:45:38.067 * Increased maximum number of open files to 10032 (it was originally set to 1024).
16342:M 01 Jun 05:45:38.067 # Creating Server TCP listening socket *:6379: bind: Address already in use

I assume this means that the redis server was running, so I guess homestead starts it automatically by default.

Get this bounty!!!

#StackBounty: #mysql #php #mariadb #deadlock Why are my deadlocks not shown by SHOW ENGINE INNODB STATUS;?

Bounty: 50

I have a MariaDB (5.5.41) cluster made of 2 nodes configured as master-slave. All reads and writes are sent to the same node.

I have been investigating some deadlock issues for a few weeks.

On a regular basis, my PHP application returns Message: SQLSTATE[40001]: Serialization failure: 1213 Deadlock found when trying to get lock; try restarting transaction.

I used to be able to run SHOW ENGINE INNODB STATUS; and would see that last deadlock, but for some reason, after a small irrelevant configuration change (changing innodb_buffer_pool_instances from 1 to 19), and a reboot of both nodes, doing a SHOW ENGINE INNODB STATUS; will not show any deadlock.

However, if I connect with my mysql client and manually create transactions resulting in a deadlock, the status command does show the deadlock.

I tried playing innodb_print_all_deadlocks ON and OFF. Nothing shows in the mysql-error.log, except for my manually triggered deadlock.

Why are the deadlocks created by my PHP application not showing anymore?

Get this bounty!!!

#StackBounty: #javascript #php #file-upload #dropzone.js Cannot send more than 4 files with dropzone

Bounty: 100

This is weird…

I can send 0, 1, 2, 3, 4 files with dropzone but cannot send 5 or more..

I suppose I am correctly defining the options here:

Dropzone.options.myDropzone = {
    url: "action.php",
    autoProcessQueue: false,
    uploadMultiple: true,
    parallelUploads: 6,
    maxFilesize: 5, 
    maxFiles: 6,
    addRemoveLinks: true,
    paramName: 'userfile',
    acceptedFiles: 'image/*',
    dictMaxFilesExceeded: 'Too many files! Maximum is {{maxFiles}}',

    // The setting up of the dropzone
    init: function() {
        dzClosure = this; // Makes sure that 'this' is understood inside the functions below.
        // for Dropzone to process the queue (instead of default form behavior):
        document.getElementById("submit-form").addEventListener("click", function(e) {
            // Make sure that the form isn't actually being sent.
            // If the user has selected at least one file, AJAX them over.
            if (dzClosure.files.length !== 0) {
                // dzClosure.options.autoProcessQueue = true;
            // Else just submit the form and move on.
            } else {
        // send all the form data along with the files:
        this.on("sendingmultiple", function(data, xhr, formData) {
            formData.append("name", $("#name").val());
            formData.append("email", $("#email").val());
        this.on("sucessmultiple", function(files, response) {
            // dzClosure.options.autoProcessQueue = false;
            $(location).attr('href', 'message_sent.html')

I say correctly because when I drag more than 6 files I see the error message: Too many files! Maximum is 6

Does this boundary make any sense in the source code?

Some more details:
a simplified version of my form is as follows

<form id="foorm" method="post" action="action.php" enctype="multipart/form-data">
    <input type="text" id="name" name="name" required>
    <input type="email" id="email" name="email" required>
    <div class="dropzone" id="myDropzone">
    <button type="submit" name="submit-form" id="submit-form">Send!</button>

and my action.php starts with displaying json_encode($_FILES); and json_encode($_POST);

and they are as expected when sending less than 4 files and are [] when sending 5 or more


It seems that I can upload 5 or more if they are smaller in size! Can this be anything else than a bug on dropzone? (honest question)

Get this bounty!!!

#StackBounty: #magento-1.9 #php #csv #inventory #import-script Multiple Inventory slots for Different warehouses

Bounty: 50

I have found a great script that allows for quick inventory updating via a php script, and it does work well. I am able to just go by SKU, quantity, and set each as is_in_stock.

My question then becomes, we have two main warehouses, call them Main and West, would it be possibly to add a secondary inventory slot to each product, and via the same script with few adjustments, be able to upload two different values for each warehouse?

Implementation of the display would be simple enough as currently it is just:

$qty = (int) Mage::getModel('cataloginventory/stock_item')->loadByProduct($_product)->getQty();
if ($qty<=0) { ?>


<?php } else { ?>    

//Echo Quantity
<?php echo $qty; } ?>

<?php endif; ?>

And adding another slot could turn into (what I assume) just $qty_secondary with similar loading format.

As a side note, I see the work it goes through with each product, is it as optimized as it could be? It was created back in 2010, and I imagine a lot of things have changed since then and it could be changed for the better I’m sure.

System: Magento & PHP 5.6

Get this bounty!!!

#StackBounty: #php How does "array_diff_ukey" function in php evaluate the arguments?

Bounty: 50

I executed the following code and its result made me confused! I pass two arrays and a function named “myfunction” as arguments to array_diff_ukey function. myfunction have been called 13 times (while it should be called at most 9 times) and the more amazing is that it compares the keys of the same array, too. In both column of the output, I saw the key “e” while only the second array has it (the fact is true for the other keys).

function myfunction($a,$b)
    echo $a . "   ".$b."<br>";
    if ($a===$b)
        return 0;
    return ($a>$b)?1:-1;



Screenshot and eval.in

Get this bounty!!!

#StackBounty: #php #arrays #json #string #shopify Creating multiple metafields with different key showing Error

Bounty: 50

I want to Create multiple Meta fields with different key but it displaying me following error:

‘metafield’ => ‘expected Array to be a Hash’,

This is my code:

    $prodcut_variant = array(

             'key'=>'Os Purchases',
             'key'=>'Stock Status',


$request_update = $shopify('POST /admin/products/{#ID}/metafields.json',array(),$prodcut_variant);

Get this bounty!!!

#StackBounty: #php #mongodb #function #php-mongodb PHP MongoDB – Use of the aggregate command without the cursor option is deprecated. …

Bounty: 300

I have updated mongo and now in the log the following error appears:
Use of the aggregate command without the cursor option is deprecated

Mongo says that I should put a second REQUIRED parameter to aggregate function, because my current usage is deprecated.

I currently use the following code PHP (now is deprecated):


And return this format:

    "xxxx":{ ...

To not use an deprecated code I add the new second parameter (but I do not understand what to put):

$this->db->{$collection}->aggregate($options, array('cursor' => array('batchSize' => 1)));

And this returns the same information but varies the initial structure:

"xxxxxx":{ ...

After the update Mongo forces me to change the way I read the data.
I don’t understand what value I should put in that second parameter called “cursor”…

What should I put in that second parameter?
Can I set a default value without altering the structure of results?


Get this bounty!!!

#StackBounty: #php #wordpress #woocommerce WordPress Woocommrece try on service for product

Bounty: 50

I am developing a eCommerce site and my client want to product on rent functionality.

for e.g :- On Add To Cart page a product has delivery + return date on add to cart page

Suppose i have select date from 24 to 28 and I would product on try on specific date so when I add to cart product then trial product also added with charge.

E.g Screenshot attached:

enter image description here

Get this bounty!!!