Jump to content
Larry Ullman's Book Forums

Recommended Posts

When testing the login.php, get the following error:

Warning: require(classes/HTML_QuickForm2_Element_InputHidden.php): Failed to open stream: No such file or directory in C:\xampp\htdocs\includes\utilities.inc.php on line 6

Fatal error: Uncaught Error: Failed opening required 'classes/HTML_QuickForm2_Element_InputHidden.php' (include_path='.;C:\xampp\php\pear;C:/xmapp/php/pear/') in C:\xampp\htdocs\includes\utilities.inc.php:6 Stack trace: #0 [internal function]: class_loader('HTML_QuickForm2...') #1 C:\xampp\php\pear\HTML\QuickForm2\Loader.php(55): class_exists('HTML_QuickForm2...', true) #2 C:\xampp\php\pear\HTML\QuickForm2\Factory.php(154): HTML_QuickForm2_Loader::loadClass('HTML_QuickForm2...', NULL, true) #3 C:\xampp\php\pear\HTML\QuickForm2.php(88): HTML_QuickForm2_Factory::createElement('hidden', '_qf__loginForm', Array) #4 C:\xampp\htdocs\login.php(10): HTML_QuickForm2->__construct('loginForm') #5 {main} thrown in C:\xampp\htdocs\includes\utilities.inc.php on line 6

Using xampp, which I have reloaded two times to make sure that wasn't the issue and updated pear three times using the current go-pear.phar. Also get the same error from the book's code.

Link to comment
Share on other sites

Ugh, this is an annoying type of problem! Basically HTML QuickForm can't find the resources it needs, which either means they weren't installed OR they were installed but HTML QuickForm can't find them. If it's the latter, that's normally b/c the files weren't installed in the right location OR PHP isn't looking in the right location.

What steps did you take to install HTML QuickForm? 

Link to comment
Share on other sites

Larry, since it hasn't been 24 hours from my post I had to sign in with another user ID. In answer to your question:

Used xampp shell pear install (pear install QuickForm2-2.2.0). It appears to me that it finds the classes down to HTML/QuickForm2/. I have been struggling with this for over a week. At one point I even went into each source that is called (Node, Rule, etc.) and changed the path reference for the required files in each of the source to the actual path from the root directory down. Still didn't work. Thought that maybe it was a memory issue so changed the name of InputHidden.php to xInputHidden.php to see if it would error out on the next php object in the directory. Interestingly enough it came up with the same error.

This morning I tries moving the InputHidden.php up one directory where it appeared that other classes where being found, got the same results. Have also made sure that there isn't an ownership issue by changing full access to all users from the php directory down.

I have been trying to find a we to put a full trace on the execution to see where it is getting the class definitions and where it is erroring out. Any suggestions on that would be greatly appreciated. 

Link to comment
Share on other sites

Made post under B Mann to your question, see above.

This morning I uninstalled XAMPP and reinstalled. Also had to do a new pear install (php go-pear.phar) since the pear version in XAMPP still has curly braces for arrays that was eliminated in the current version of PHP that is installed with XAMPP. Reloaded the htdocs and mysql directory and launched localhost/index.php. Got the same error as before.

Link to comment
Share on other sites

Have determined that it is an issue with spl_autoload_register in the utilities.inc.php include file. QuickForms2\Loader.php loads the Quickform2 classes but doesn't use spl_autoload_register. It is mentioned in the comments of Loader.php (line 96 - 108). When I comment out the spl_autoload_register in utilities.inc.php the form loads but obviously get an error on $USER in the header.html and footer.html since they reference those when loaded.

Link to comment
Share on other sites

Found a hack that makes it work.

In the utilities.inc.php (Script 9.3) changed the class_loader;

From:

function class_loader($class) {
    require('classes/' . $class . '.php');
}

To:

function class_loader($class) {
    $findme = '_';
    $pos = strpos($class, $findme);

    if ($pos === false) {
      require('./classes/' . $class . '.php');
    } else {
        $file = str_replace("_", "/", $class);
        require($file . '.php');
    }
  }

This fixes the loading of QuickForm2 classes in PHP 8.0. 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...