PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Saturday, January 1, 2022

[FIXED] An uncaught Exception was encountered when i click on forget password to send email

 January 01, 2022     codeigniter, php     No comments   

Issue

i am getting this error

An uncaught Exception was encountered Type: Error

Message: Call to undefined method CI_Form_validation::substr()

Filename: /home/thedevel/public_html/esports/new/system/libraries/Form_validation.php

Line Number: 1065

Backtrace:

File: /home/thedevel/public_html/esports/new/application/controllers/Login.php Line: 495 Function: run

File: /home/thedevel/public_html/esports/new/index.php Line: 275 Function: require_once

here is the code of

Filename: /home/thedevel/public_html/esports/new/system/libraries/Form_validation.php

Line Number: 1065

public function valid_email($email) {
        if (function_exists('idn_to_ascii') && defined('INTL_IDNA_VARIANT_UTS46') && $atpos = strpos($email, '@')) {
            $email = self::substr($email, 0, ++$atpos) . idn_to_ascii(self::substr($email, $atpos), 0, INTL_IDNA_VARIANT_UTS46);
        }
        return (bool) filter_var($email, FILTER_VALIDATE_EMAIL);
    }

Please help


Solution

Are you sure with the self::substr ? It should be this :

public function valid_email($email) {
        if (function_exists('idn_to_ascii') && defined('INTL_IDNA_VARIANT_UTS46') && $atpos = strpos($email, '@')) {
            $email = substr($email, 0, ++$atpos) . idn_to_ascii(substr($email, $atpos), 0, INTL_IDNA_VARIANT_UTS46);
        }
        return (bool) filter_var($email, FILTER_VALIDATE_EMAIL);
    }


Answered By - Lka
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing