Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

laravel-helpers is outdated and causes errors on .../admin/flights/create #1180

Closed
ollimaz opened this issue May 11, 2021 · 21 comments · Fixed by #1192 or #1193
Closed

laravel-helpers is outdated and causes errors on .../admin/flights/create #1180

ollimaz opened this issue May 11, 2021 · 21 comments · Fixed by #1192 or #1193
Labels
Milestone

Comments

@ollimaz
Copy link
Contributor

ollimaz commented May 11, 2021

Describe the bug
Old version of sebastiaanluca/laravel-helpers causes errors. Can't run composer install and https://royalevest.de/admin/flights/create returns an error

Version
latest dev

To Reproduce
Steps to reproduce the behavior:

  1. Go to 'Admin'
  2. Click on 'Flights'
  3. Click on 'Add Flight'

Error on composer install:
- sebastiaanluca/laravel-helpers is locked to version 6.0.0 and an update of this package was not requested.
- sebastiaanluca/laravel-helpers 6.0.0 requires php ^7.3 -> your php version (8.0.5) does not satisfy that requirement.
Other error:
Unsupported operand types: array & int

`if (!function_exists('in_mask')) {

/**

 * Return true/false if a value exists in a mask

 *

 * @param $mask

 * @param $value

 *

 * @return bool

 */

function in_mask($mask, $value)

{

    return ($mask & $value) === $value;

}

}`

@FatihKoz
Copy link
Contributor

your php version (8.0.5) does not satisfy that requirement.

As far as I know, phpvms does not support php8 (yet). Though the developer was working on it, but we are still limited to php 7.3 and 7.4 series but not 8.

This may be the root cause of the error you are facing.

@nabeelio
Copy link
Owner

Yep, I'm still waiting on a couple of upstream libraries to include PHP 8 support. Though, I will look again and probably get rid of those libraries if I can for PHP 8 support.

@nabeelio nabeelio added the bug label May 11, 2021
@nabeelio nabeelio added this to the 7.0.0 milestone May 11, 2021
@nabeelio
Copy link
Owner

Please try the latest dev. I removed the library that was holding back PHP 8 compatibility

@ollimaz
Copy link
Contributor Author

ollimaz commented May 12, 2021

Yes the installation with composer is working now. But there are still errors when trying to create a new flight at https://....net/admin/flights/create

@nabeelio
Copy link
Owner

Can you supply the logs/those errors?

@FatihKoz
Copy link
Contributor

#1156 has some more info about the issue, even a flare share link (caused by php8 / operand type)

@oudrun was using php8 when he faced that error, recently switched back to 7.4.xx series I think.

ollimaz added a commit to ollimaz/phpvms that referenced this issue May 19, 2021
Closes nabeelio#1180 and nabeelio#1156. But now the script isn't beeing loaded
@ollimaz
Copy link
Contributor Author

ollimaz commented May 19, 2021

Well I think I fixed that issue. But now the script isn't beeing loaded, because the script is made for the edit fields.blade

@FatihKoz
Copy link
Contributor

FatihKoz commented May 19, 2021 via email

@ollimaz
Copy link
Contributor Author

ollimaz commented May 19, 2021

No it seems that the days are saved in a mask. The enum sets monday to a 1 and sunday is representing a 64. The days acutally arent saved in an array, they are saved in an int. The in_mask operation makes a bitwise comparison. So 127 represents all days beeing selected. In PHP 7 an empty array was representing an 0 and a bitwise operation was successful. Since in PHP8 they change that its important to set it to 0 or null.
1 = 1 monday
2 = 10 Tuesday
4 = 100 Wednesday
8 = 1000 Thursday
16 = 10000 Friday
...

Soo
1000101
Represents Monday, Wednesday and Sunday beeing selected.

The sripts aren loading because only the edit.blade.php imports them. The create.blade.pho in /resources/views/admin/flights doesnt.

Edit: Thats why this function in_mask is beeing used for the selection

@FatihKoz
Copy link
Contributor

Yes, you are right, my mistake sorry ... I just thought that you are returning 0 for all, in fact you were returning 0 only for the create view :)

@nabeelio
Copy link
Owner

It's happening only under PHP 8? I need to install PHP 8 and see if I can duplicate it

@nabeelio
Copy link
Owner

Pushed a couple of fixes, see if that helps

@ollimaz
Copy link
Contributor Author

ollimaz commented May 19, 2021

Yes. For me this happend in PHP8 before we had no issues with that or maybe an extension had overwritten that function 🤷‍♂️

@ollimaz
Copy link
Contributor Author

ollimaz commented May 19, 2021

The error has been cleaned. Thank you @nabeelio

But there is still the issue with no scripts beeing loaded. They are only loaded in
phpvms/resources/views/admin/flights/edit.blade.php and not in
phpvms/resources/views/admin/flights/create.blade.php

@nabeelio
Copy link
Owner

I don't know what "no scripts being loaded" means. Is there an error? Example? Screenshots?

@ollimaz
Copy link
Contributor Author

ollimaz commented May 19, 2021

This is how it looks. No date picker and no fancy days selector
grafik

This is how it looks when editing and how it should look like:
grafik

@nabeelio
Copy link
Owner

Is this on the default skin? And what's in the error console?

@ollimaz
Copy link
Contributor Author

ollimaz commented May 19, 2021

Jep. Its the default skin! Well there is no error. In Edit.blade.php at line 31 the scripts are included in Create.blade.php they aren't

Edit: fixed the links

@ollimaz
Copy link
Contributor Author

ollimaz commented May 19, 2021

I think this is what causes this "error" but this is just a shot. Idk

@nabeelio
Copy link
Owner

I see what you mean now. Thanks for pointing that out. Pushing a new update to dev.

@ollimaz
Copy link
Contributor Author

ollimaz commented May 19, 2021

Thanks. Jep I didn't know how to explain it in a better way than showing the lines :| Thank you

nabeelio added a commit that referenced this issue May 19, 2021
Closes #1180 and #1156. But now the script isn't beeing loaded

Co-authored-by: Nabeel S <nabeelio@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
3 participants