syntax error, unexpected '&&' (T_BOOLEAN_AND), expecting ')' in opencart when clicking on customer - opencart2.x

No idea what it means as am not a developer. I do have access to a HTML editor (DW) so could change if told what to do.
I get this error when I click on customer in my admin Opencart.
Parse error: syntax error, unexpected '&&' (T_BOOLEAN_AND), expecting ')' in /var/sites/p/proteinporridgewales.co.uk/public_html/cart/admin/controller/customer/customer.php on line 1105
Thanks in advance

Its a mistake in opencart 2.2.0.0. THey have updated their master repository. You can also do this directly. Here is the solved line 1105 of admin/controller/customer/customer.php
Replace with this line
} elseif (($custom_field['type'] == 'text' && !empty($custom_field['validation']) && $custom_field['location'] == 'address') && !filter_var($this->request->post['custom_field'][$custom_field['custom_field_id']], FILTER_VALIDATE_REGEXP, array('options' => array('regexp' => $custom_field['validation'])))) {
You can visit this for more details.

parentheses in the wrong place ... change
!empty($custom_field['validation'] && $custom_field['location'] == 'address'))
to
!empty($custom_field['validation']) && $custom_field['location'] == 'address')

I have figure out the problem, it is the problem with the "else if" part on error line 1105, which I have removed, just have lived the if statement leaving the closing brackets.
so that I have get rid of the error and can able to see the customer page.

Related

Odd ANTLR4 error handling behavior with very simply (trivial) behavior

Given the below super simple grammar:
ddlStatement
: defineStatement
;
defineStatement
: 'define' tableNameToken=Identifier ';'?
;
and the input "add 1 to bob"
I would expect to get an error. However, the parser matches the "defineStatement" rule with a missing "define" token. The following Listener will fire
#Override
public void exitDefineStatement(DDLParser.DefineStatementContext ctx) {
log.info(MessageFormat.format("Defining {0}", ctx.tableNameToken.getText()));
}
and log "Defining add".
I can assign 'define' to a variable and test that variable for NULL but that seems like work I shouldn't have to do.
BTW if the grammar becomes more complete - specifically with the addition of alternatives to the ddlStatement rule - error handling works as I would expect.
This ANTLR's error recovery in action.
In many cases, it's VERY beneficial for ANTLR to assume either a missing token, or ignore a token, if it allows parsing to continue. The missing "define" token should have been reported as an error.
Without this capability, ANTLR would frequently get "stumped" at the first sign of problems. With this, ANTLR is saying "Well, if I assume X, then I can make sense of your input. So I'm assuming X and reporting that as an error so I can continue on.
(Filling a few details to get this to build)
grammar Test
;
ddlStatement: defineStatement;
defineStatement: 'define' tableNameToken = Identifier ';'?;
Identifier: [a-zA-Z]+;
Number: [0-9]+;
WS: [ \r\n\t]+ -> skip;
if I run antlr on this and compile the Java output. The following command:
echo "add 1 to bob" | grun Test ddlStatement -gui
yields the error:
line 1:0 missing 'define' at 'add'
and produces the parse tree:
The highlighted node is the error node in the tree.
The reason it stops after "add" is that input (assuming a missing "define", would be a ddlStatement
ANTLR will stop processing input once it has recognized your stop rule.
To get it to "pay attention" to the entire input, add an EOF token to your start rule:
grammar Test
;
ddlStatement: defineStatement EOF;
defineStatement: 'define' tableNameToken = Identifier ';'?;
Identifier: [a-zA-Z]+;
Number: [0-9]+;
WS: [ \r\n\t]+ -> skip;
gives these errors:
line 1:0 missing 'define' at 'add'
line 1:4 mismatched input '1' expecting {<EOF>, ';'}
and this tree:

React/Node/Express/Webpack -A valid React element (or null) must be returned

link to source code: https://github.com/manster829/MernStackT
I keep getting the error message: Uncaught Error: BugTable.render(): A valid React element (or null) must be returned. You may have returned undefined, an array or some other invalid object.
I have no idea why, I thought this might have something to do with ES6 or my syntax, but I can't get it. Anyone have any ideas? Thanks :)
This is kind of silly but you need to move you ( next to your return statement, otherwise you actually return undefined and break out of the function. When you don't have anything next to a return statement javascript assumes you mean to simply return ...
Try this in BugTable.js:
return (
<div>The list of bugs as a table would come here.</div>
);

htdig: htsearch returns no results in command line

htdig 3.1.6 (http://www.htdig.org/) allows you to search html within your site.
When I run /var/www/html/my_htdig/cgi/htsearch -v -d -c /var/www/html/my_htdig/htdig/conf/htdig.conf
It returns "No matches were found for 'whatever'"
There are only index.html and test.html under /var/www/html/my_htdig, so it should be able to index them.
Any ideas on why it is not working?
I have looked at the source code, it turns out there a bug.
timet_enddate always equals -1, which preventing search result returns. I made the following change and the search result is able to show up.
In htsearch/Display.cc line, around line 1412
// code added by Mike Grommet for date search ranges
// check for valid date range. toss it out if it isn't relevant.
// I find a bug, timet_enddate === -1, so here is a hack
if(timet_enddate <= 0) {
// Bug
}
else {
if(thisRef->DocTime() < timet_startdate ||
thisRef->DocTime() > timet_enddate)
{
delete thisMatch;
delete thisRef;
continue;
}
}
I doubt anyone would like to checkout this old project, but I make it complied on Ubuntu 15.04: https://github.com/kenpeter/htdig

Ternary operator error with include () function [closed]

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.
Closed 10 years ago.
include ( $_GET['p'] == 'home') ? 'pages/home.php' : NULL;
gives the error:
Notice: Undefined index: p in /var/www/index.php on line 38
Warning:
require(): Filename cannot be empty in /var/www/index.php on line 38
Fatal error: require(): Failed opening required ''
(include_path='.:/usr/share/php:/usr/share/pear') in
/var/www/index.php on line 38
I understand the undefined index, but why am I getting the other errors? This line:
include ( !isset($_GET['p'])) ? 'pages/home.php': NULL;
works fine. Note that the first code will work fine in an if statement (apart from the undefined index, which I understand)
include expects a string that represents the path to the file that is to be included. So NULL will get converted to string that results in an empty string. And consequently including a file referenced by an empty string results in a warning.
Simply use an if instead:
if (!isset($_GET['p'])) {
include 'pages/home.php';
}
Please don't do that! Try something like this instead:
(isset($_GET['p']) && $_GET['p'] === 'home') ? include 'pages/home.php' : '';

what does pam_unix : bad username mean?

Can anybody please tell me what does this error mean.And when will this appear. I tried googling, but with no result. Please point me to the correct document to understand this error.
This error is triggered by the following code in the pam_unix module (source: Linux-PAM-0.99.5):
if (name == NULL || !isalnum(*name))
the name == NULL would be triggered by a programmatic error in the use of the PAM protocol where the username variable is not being set as part of the pam conversation.
The second reason, and probably the most interesting is that the first character of the username is required to be an alpha-num i.e the character must be one of A-Z, a-z or 0-9. Accented characters are not accepted.
A newer version of Linux-PAM (as seen from the fedorahosted source of pam_unix.c) says:
if (name == NULL || name[0] == '-' || name[0] == '+')
Which means that it only rejects the - and + characters - i.e. it is less strict than the older source.

Resources