Wixel / GUMP

A fast, extensible & stand-alone PHP input validation class that allows you to validate any data
https://wixelhq.com
MIT License
1.17k stars 341 forks source link

Helpers Class Not Found #310

Closed netz0 closed 4 years ago

netz0 commented 4 years ago

I had an older GUMP version running fine. But it seems the latest versions gives me errors.

The examples folder is gone (was on older versions) and I'm using the same code for testing:

require "GUMP/gump.class.php";

$data = array(
    'username'         => "myusername",
    'password'         => "mypassword",
    'password_confirm' => "mypassword",
);

$is_valid = GUMP::is_valid($data, array(
    'username'         => 'required|alpha_numeric',
    'password'         => 'required|max_len,100|min_len,6',
    'password_confirm' => 'equalsfield,password',
));

if($is_valid === true) {
    // continue
} else {
    print_r($is_valid);
}

Fatal error: Uncaught Error: Class 'GUMP\EnvHelpers' not found in /home/dev/GUMP/gump.class.php:160 Stack trace: #0 /home/dev/GUMP/gump.class.php(61): GUMP->__construct() #1 /home/dev/GUMP/gump.class.php(178): GUMP::get_instance() #2 /home/dev/test.php(14): GUMP::is_valid(Array, Array, Array) #3 {main} thrown in /home/dev/GUMP/gump.class.php on line 160

The scr folder, lang and everything else inside the GUMP folder. Everything as included directly from the latest zip release.

Do I need to load the new version in another way or does it have to keep a specific folder name?

filisko commented 4 years ago

Just include the file (require_once, include...) or start using composer.

netz0 commented 4 years ago

I do use composer. Makes no difference.

filisko commented 4 years ago

then you don't need to laod GUMP manually (require_once)

netz0 commented 4 years ago

then you don't need to laod GUMP manually (require_once)

I tried both ways, manually or with the auto loader. I have no idea why its not working for me while the old version worked fine on the same box. I will try to research my test server since for some reason it does not like something about the new lang folder that was not in previous releases.

It seems its trying to load something related to the language file and it cannot find the proper class.

filisko commented 4 years ago
  1. Start a totally new project.
  2. Install GUMP with composer.
  3. Try your validations with your language
VivekMoyal28 commented 3 years ago

I was also facing this issue and i have used the require_once '../vendor/autoload.php'; before the Gump class and its working fine