TechnicPack / TechnicSolder

PHP web app that brings differential updates to the Technic Launcher and Technic Platform
https://docs.solder.io/
Other
169 stars 167 forks source link

500 Errors when setting recommended/latest build #566

Closed tankerkiller125 closed 3 years ago

tankerkiller125 commented 8 years ago

I am getting 500 errors on any options inside the modpack version listings. The following errors are the JSON received with debug mode enabled. (With the name of the button above the JSON) and the URL strings sent.

Recommended: URL: recommended?modpack=2&recommended=0.1.0

{
    "error": {
        "type": "ErrorException",
        "message": "Creating default object from empty value",
        "file": "/var/www/TechnicSolder/app/controllers/ModpackController.php",
        "line": 652
    }
}

Latest: URL: latest?modpack=2&latest=0.1.0

{
    "error": {
        "type": "ErrorException",
        "message": "Creating default object from empty value",
        "file": "/var/www/TechnicSolder/app/controllers/ModpackController.php",
        "line": 665
    }
}

Published: URL: published?build=1&published=1

{
    "error": {
        "type": "ErrorException",
        "message": "Creating default object from empty value",
        "file": "/var/www/TechnicSolder/app/controllers/ModpackController.php",
        "line": 679
    }
}

Private: URL: private?build=1&private=1

{
    "error": {
        "type": "ErrorException",
        "message": "Creating default object from empty value",
        "file": "/var/www/TechnicSolder/app/controllers/ModpackController.php",
        "line": 689
    }
}

Some information about the server itself:

The version of Solder I'm using is the Dev-Master (I believe). I'd also like to note that no other Laravel applications I have had issues with this error.

skwerlman commented 8 years ago

I am unsure if solder is ready for PHP7; can you try to repro with PHP5.x?

tankerkiller125 commented 8 years ago

@skwerlman I think I might try fixing the issue then (I do PHP) and then pushing the fix if I find out that its a programming issue.

GenPage commented 8 years ago

@skwerlman @tankerkiller125 I've added PHP7 to the Solder build test cases. https://travis-ci.org/TechnicPack/TechnicSolder

GenPage commented 8 years ago

This error is most likely happening because it cannot find the modpack. The few lines before

case "recommended":
                $modpack = Modpack::find(Input::get('modpack'));
                $new_version = Input::get('recommended');
                $modpack->recommended = $new_version; <---- this is throwing an error because $modpack is most likely null
                $modpack->save();

@tankerkiller125 can you provide more context to the modpack in question, how it was created, etc

tankerkiller125 commented 8 years ago

Using php artisan tinker I can verify that the modpack number in the request is correct. As doing

Modpack::find(2)-toArray();

in tinker gets me the array from the MySQL and it does return data. In fact I can run everything inside those switches from tinker. It appears that Inputs are null or something along those lines.

coderobe commented 8 years ago

I'm having the same issue, using php artisan tinker as mentioned above i can also verify that the request modpack is in fact correct. The error responses are the same too. I'm on php 7.0.5 php -v output:

PHP 7.0.5 (cli) (built: Apr  2 2016 23:10:23) ( NTS )
Copyright (c) 1997-2016 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies
tankerkiller125 commented 8 years ago

I'm thinking it's because the variable type is not set ahead if time. I'm looking into it but I haven't had much time.

On Mon, Apr 18, 2016, 09:20 Robin B. notifications@github.com wrote:

I'm having the same issue, using php artisan tinker as mentioned above i can also verify that the request modpack is in fact correct. The error responses are the same too. I'm on php 7.0.5 php -v output:

PHP 7.0.5 (cli) (built: Apr 2 2016 23:10:23) ( NTS ) Copyright (c) 1997-2016 The PHP Group Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies

— You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub https://github.com/TechnicPack/TechnicSolder/issues/566#issuecomment-211376264

DevPGSV commented 8 years ago

Hi! $build = Build::find(Input::get('build')); The problem seems to be that Input::get('build') is not defined, so... it can't find the build.

I set up solder with php7. Then I changed to php5, and the problem is still there. As I don't know how to fix the issue, I decided to change that line to:

$build = Build::find(1);

And it works fine. As I only have 1 modpack.

I'm not sure... I guess Input::get is to get the data submited by the client. On trying to chatge the "published" status of the modpack, chrome sends this: build=1&published=1

Input::get('published') Correctly gets the value.... So.... I don't know why Input::get('build') doesn't work.