Page 1 of 1
Server side validation (regular expression) syntax error, unexpected '/'
Posted: Tue Jan 24, 2023 9:37 pm
by andyrav
Got a issue with "syntax error, unexpected '/'"
the line is
$this->useCustomOCP->addMethod("getServerValidateArguments", fn() => /^[10]+$/);
I dont have any validation on the field.
do you know what i should check for?
thanks
Re: syntax error, unexpected '/'
Posted: Wed Jan 25, 2023 9:14 am
by mobhar
Are you using the older project in the latest PHPMaker version?
Re: syntax error, unexpected '/'
Posted: Wed Jan 25, 2023 1:37 pm
by arbei
As said in the docs on Arguments (Server-side):
If Regular Expression, arguments must be the pattern to search for, as a single or double quoted string.
Re: Server side validation (regular expression) syntax error, unexpected '/'
Posted: Thu Jan 26, 2023 2:09 am
by philmills
I had something similar to this a few days ago, syntax error failed on a slash /
I found I hadn't enabled all required extensions in php.ini.
Also I regenerated all code and updated composer, after that the error went away.