Log message #4201936

# At Username Text
# Sep 5th 2019, 21:27 dereuromark but in php5 the order of going in is reversed, messing this up.
# Sep 5th 2019, 21:27 dereuromark @ricksaccous the idea was to only switch order for mapped items, the others should stay as they are
# Sep 5th 2019, 21:27 dereuromark it is an actually quite sad story if you start looking for this behavior change in SO: https://stackoverflow.com/questions/44542089/usort-difference-php7-1-vs-php5-6
# Sep 5th 2019, 21:26 ricksaccous why are you using array_search, i suppose I'm a newb when it comes to this, but wouldn't you just want to let usort go through values as it pleases? and what if you have two values that are the same in the array
# Sep 5th 2019, 21:24 challgren Weird, I couldnt find anything in the change logs to indicate something changed with usort
# Sep 5th 2019, 21:22 dereuromark i hoped there is a cleaner way
# Sep 5th 2019, 21:22 dereuromark if php5 invert result..^^
# Sep 5th 2019, 21:22 dereuromark more correctly, the php5 is the one problematic, in php7 it works as expected.
# Sep 5th 2019, 21:22 dereuromark not in the example, but you can easily try it
# Sep 5th 2019, 19:54 ricksaccous do you think it would be useful to extend connectionManager to do something like that?
# Sep 5th 2019, 21:21 challgren But null isn’t even in your list
# Sep 5th 2019, 21:21 challgren 5.4>=
# Sep 5th 2019, 21:21 challgren Hmm weird
# Sep 5th 2019, 21:20 dereuromark 'null', 'string', 'array' should be 'string', 'array', 'null' but it also switches the non-mapped ones.
# Sep 5th 2019, 21:20 dereuromark Not sure how this can easily be solved.
# Sep 5th 2019, 21:19 dereuromark No, in PHP7 the order is switched, and that kills the whole thing :(
# Sep 5th 2019, 21:19 challgren Ohh well my guess is cause you were using short arrays
# Sep 5th 2019, 21:17 dereuromark @challgren I wanted to keep the [string, array] here.
# Sep 5th 2019, 21:17 ricksaccous @maymeow what does your entity look like after patch?
# Sep 5th 2019, 21:15 maymeow address php ``` protected $_accessible = [ 'user_id' => true, 'name' => true, 'street' => true, 'postcode' => true, 'user' => true, 'phone' => true, 'town' => true, 'authorized_persons' => true, 'posts' => true ]; ``` profile.php ``` protected $_accessible = [ 'user_id' => true, 'name' => true, 'user' => true ]; ```
# Sep 5th 2019, 21:15 challgren @dereuromark https://3v4l.org/CtY7X
# Sep 5th 2019, 21:14 maymeow but when i add `echo $this->Form->control('profile.name', ['label' => __('name')]);` it returns error about missing user_id in profile
# Sep 5th 2019, 21:13 slackebot has many addresses and i saving it with `$this->User->save(...)` nothing special
# Sep 5th 2019, 21:13 slackebot __('ZIP')]); echo $this->Form->control('addresses.0.town', ['label' => __('Town'), 'value' => '']); echo $this->Form->control('addresses.0.phone', ['label' => __('Phone number')]); echo $this->Form->control('addresses.0.authorized_persons', ['label' => __('Authorized persons for posts take')]); ?> </div> </div> ``` user
# Sep 5th 2019, 21:13 slackebot <div class="card-header"><?= __('Address information') ?></div> <div class="card-body"> <?php echo $this->Form->control('addresses.0.name', ['label' => __('Name and surname')]); echo $this->Form->control('addresses.0.street', ['label' => __('Street and house number')]); echo $this->Form->control('addresses.0.postcode', ['label' =>
# Sep 5th 2019, 21:13 maymeow @ricksaccous ``` </div> <div class="card-footer"> <?= $this->Form->button(__('Save'), ['class' => 'btn btn-success']) ?> <?= $this->Html->link(__('Cancel'), ['action' => 'index'], ['class' => 'btn btn-danger']) ?> </div> </div> </div> <div class="col-md-6"> <div class="card">
# Sep 5th 2019, 21:12 dereuromark Does anyone have an idea how I can fix a usort() callback that it works also in php7, not just in php5? https://3v4l.org/1k098
# Sep 5th 2019, 21:11 ricksaccous https://book.cakephp.org/3.0/en/orm/saving-data.html#saving-hasone-associations
# Sep 5th 2019, 21:10 maymeow for belongs to it was ` <?= $this->form->create('profile.user_name`)?>` but for hasone it return eror about `user_id has not default value` any ideas?
# Sep 5th 2019, 21:09 maymeow how to create form for has one association??
# Sep 5th 2019, 20:00 challgren You could write a script to check the tunnel if the port is open and if not restart the tunnel
# Sep 5th 2019, 20:00 ricksaccous cool, thanks for the ideas guys
# Sep 5th 2019, 20:00 challgren Thats what I would do
# Sep 5th 2019, 20:00 ricksaccous in case you have to restart the server
# Sep 5th 2019, 20:00 ricksaccous interesting, so maybe at most you'd have a server start up script to create the tunnel
# Sep 5th 2019, 19:59 admad i wouldn't put anything related to ssh tunneling in php :slightly_smiling_face:
# Sep 5th 2019, 19:58 ricksaccous lol okay, but if you were faced with that issue, what would you do?
# Sep 5th 2019, 19:58 admad you can do whatever you want in your custom connection class :slightly_smiling_face:
# Sep 5th 2019, 19:54 ricksaccous or whatever class ultimately makes the connection
# Sep 5th 2019, 19:53 ricksaccous when you connect
# Sep 5th 2019, 19:53 ricksaccous but it might be nice to check if tunnel was there, and if not create it