Hi,
Has anyone here experienced this PHP notice from Recaptcha?
[06-Feb-2023 22:38:49 Asia/Taipei] PHP Notice: Undefined index: g-recaptcha-response in /home/{MyRoot}/{MySite}/includes/hooks/shop/siteWide/addRecaptcha.php on line 32
The following ones should not be related, but they keep appearing in my error log as well:
[06-Feb-2023 23:47:11 Asia/Taipei] PHP Notice: Undefined index: link in /home/{MyRoot}/{MySite}/includes/system/versioned/1.0.7.other/1.0.7.12/product.php on line 52
[07-Feb-2023 09:02:58 Asia/Taipei] PHP Notice: Trying to access array offset on value of type null in /home/{MyRoot}/{MySite}/includes/system/versioned/1.0.7.other/1.0.7.12/product_builder.php on line 98
Phoenix 1.0.8.20 / PHP 7.4. Thanks in advance for any help to suppress these notices (or potential issues).
Eddy
PHP Notice: Recaptcha | Undefined Index
-
ecartz
- Core Team
- Posts: 3084
- Joined: Tue Nov 05, 2019 6:02 pm
- Phoenix Version:
- Has thanked: 4 times
- Been thanked: 208 times
Re: PHP Notice: Recaptcha | Undefined Index
This says that there is no products_description row for that language and product. If you need help with which language and product, you could try https://stackoverflow.com/a/1159235/6660678 :
Code: Select all
function process_error_backtrace($errno, $errstr, $errfile, $errline, $errcontext) {
if(!(error_reporting() & $errno))
return;
switch($errno) {
case E_WARNING:
case E_USER_WARNING:
case E_STRICT:
case E_NOTICE:
case E_USER_NOTICE:
$type = 'warning';
$fatal = false;
break;
default:
$type = 'fatal error';
$fatal = true;
break;
}
$trace = array_reverse(debug_backtrace());
array_pop($trace);
if(php_sapi_name() == 'cli') {
echo 'Backtrace from ' . $type . ' \'' . $errstr . '\' at ' . $errfile . ' ' . $errline . ':' . "\n";
foreach($trace as $item)
echo ' ' . (isset($item['file']) ? $item['file'] : '<unknown file>') . ' ' . (isset($item['line']) ? $item['line'] : '<unknown line>') . ' calling ' . $item['function'] . '()' . "\n";
} else if (ini_get('display_errors')) {
echo '<p class="error_backtrace">' . "\n";
echo ' Backtrace from ' . $type . ' \'' . $errstr . '\' at ' . $errfile . ' ' . $errline . ':' . "\n";
echo ' <ol>' . "\n";
foreach($trace as $item)
echo ' <li>' . (isset($item['file']) ? $item['file'] : '<unknown file>') . ' ' . (isset($item['line']) ? $item['line'] : '<unknown line>') . ' calling ' . $item['function'] . '()</li>' . "\n";
echo ' </ol>' . "\n";
echo '</p>' . "\n";
}
if(ini_get('log_errors')) {
$items = array();
foreach($trace as $item)
$items[] = (isset($item['file']) ? $item['file'] : '<unknown file>') . ' ' . (isset($item['line']) ? $item['line'] : '<unknown line>') . ' calling ' . $item['function'] . '()';
$message = 'Backtrace from ' . $type . ' \'' . $errstr . '\' at ' . $errfile . ' ' . $errline . ': ' . join(' | ', $items);
error_log($message);
}
if($fatal)
exit(1);
}
set_error_handler('process_error_backtrace');This is saying that nothing has specified the link. I'm not sure about this one. Same debugging code as last time though.
Note: if you are using an add-on that puts the product name into the URL, then the last notice might cause this one. Because if it can't get the product name, then it may not be able to build the link.
This is saying that there is no g-recaptcha-response result in the POSTed form. Perhaps Google changed their API? Maybe it's time to switch to Maths Captcha.