Preg_match(): missing closing parenthesis - compilation

A plugin is generating the following error:
Got error 'PHP message: PHP Warning: preg_match(): Compilation failed: missing closing parenthesis at offset 946 - DeferJS.php on line 78
The line of code that generates the error:
if ( preg_match( '#(' . $exclude_defer_js . ')#i', $tag['url'] ) ) {
Thanks for any help

$exclude_defer_js must contain special characters.
Use preg_quote:
if ( preg_match( '#' . preg_quote($exclude_defer_js, '#') . '#i', $tag['url'] ) ) {

Related

How to build ICU4C 70.1 on HP UX platform?

I want to build ICU4C code for HP UX platform .
ICU4C repo -> https://github.com/unicode-org/icu/tree/release-70-1.
HP-UX version that i am using -
HP-UX B.11.31 U ia64 ,
aCC compiler version that i am using -
HP C/aC++ B3910B A.06.29
I tried +std=c++11 and -AA option with aCC like ->
aCC -DU_ATTRIBUTE_DEPRECATED= -D_REENTRANT -D_THREAD_SAFE -DU_HAVE_ELF_H=1 -DU_HAVE_STRTOD_L=0 -I../common +std=c++11 -w +O2 +Ofltacc +check=stack -AA +DD64 -mt -AA -Wc,-ansi_for_scope,on +W740 +W749 +W823 +W4232 -DVXPSP_CCFLAGS -c +Z -o stubdata.o stubdata.cpp
But when i am building stubdata.cpp file from icu stubdata project its giving me error related to unique_ptr as -
"../common/unicode/localpointer.h", line 238: error #2283: qualified name is not allowed explicit LocalPointer(std::unique_ptr<T> &&p)
"../common/unicode/localpointer.h", line 238: error #2018: expected a ")"
explicit LocalPointer(std::unique_ptr<T> &&p)
^
"../common/unicode/localpointer.h", line 239: error #2028: expression must
have a constant value
: LocalPointerBase<T>(p.release()) {}
^
"../common/unicode/localpointer.h", line 238: error #2771: "explicit" is not
allowed
explicit LocalPointer(std::unique_ptr<T> &&p)
^
"../common/unicode/localpointer.h", line 239: error #2065: expected a ";"
: LocalPointerBase<T>(p.release()) {}
^
"../common/unicode/localpointer.h", line 413: error #2283: qualified name is
not allowed
explicit LocalArray(std::unique_ptr<T[]> &&p)
^
"../common/unicode/localpointer.h", line 413: error #2018: expected a ")"
explicit LocalArray(std::unique_ptr<T[]> &&p)
^
"../common/unicode/localpointer.h", line 414: error #2028: expression must
have a constant value
: LocalPointerBase<T>(p.release()) {}
^
"../common/unicode/localpointer.h", line 413: error #2771: "explicit" is not
allowed
explicit LocalArray(std::unique_ptr<T[]> &&p)
^
"../common/unicode/localpointer.h", line 414: error #2065: expected a ";"
: LocalPointerBase<T>(p.release()) {}
^
"../common/unicode/udata.h", line 434: error #2283: qualified name is not
allowed
U_DEFINE_LOCAL_OPEN_POINTER(LocalUDataMemoryPointer, UDataMemory, udata_close);
^
"../common/unicode/udata.h", line 434: error #2018: expected a ")"
U_DEFINE_LOCAL_OPEN_POINTER(LocalUDataMemoryPointer, UDataMemory, udata_close);
^
"../common/unicode/udata.h", line 434: error #2040: expected an identifier
U_DEFINE_LOCAL_OPEN_POINTER(LocalUDataMemoryPointer, UDataMemory, udata_close);
^
"../common/unicode/udata.h", line 434: error #2079: expected a type specifier
U_DEFINE_LOCAL_OPEN_POINTER(LocalUDataMemoryPointer, UDataMemory, udata_close);
^
"../common/unicode/udata.h", line 434: error #2771: "explicit" is not allowed
U_DEFINE_LOCAL_OPEN_POINTER(LocalUDataMemoryPointer, UDataMemory, udata_close);
^
"../common/unicode/udata.h", line 434: error #2065: expected a ";"
U_DEFINE_LOCAL_OPEN_POINTER(LocalUDataMemoryPointer, UDataMemory, udata_close);
^
16 errors detected in the compilation of "stubdata.cpp".
It seems like aCC compiler don't have support for this C++ 11 feature unique_ptr .
Also i tried to run a sample standalone program having unique_ptr , but its not able to compile . Whereas other c++11 features like nullptr / range based for loop etc are compiled with aCC compiler on HP .
Any suggestions?

PHP phar install on FreeBSD (phar.so not found)

Dedicated server -
FreeBSD 8.2 -
amd64 -
Apache/2.2.21 -
PHP/5.3.9
I am trying of install the dependency manager for php composer, but composer needs the extension "phar".
Try
curl -sS https://getcomposer.org/installer | php
Get
The phar extension is missing.
Install it or recompile php without --disable-phar
In php.ini and extensions.ini extension=phar.so not found. Add line, but file search phar.so has not brought results.
php -i and php -m show extension phar not installed
Try
cd /usr/ports/archivers/php53-phar && make install clean
Get
php53-phar: No such file or directory
I think command portsnap fetch update delete old /usr/ports/archivers/php53-phar directory
Try
cd /usr/ports/archivers/php5-phar && make install clean
Get meny errors like
Unknown modifier 't'
Unknown modifier 't'
"/usr/ports/Mk/bsd.php.mk", line 267: Malformed conditional (defined(_POSTMKINCLUDED) && ${USE_PHP:tl} != "yes") "/usr/ports/archivers/php5-phar/../../lang/php5/Makefile", line 208: if-less endif Unknown modifier 't'
Unknown modifier 't'
Unknown modifier 't'
Unknown modifier 't'
"/usr/ports/Mk/bsd.php.mk", line 267: Malformed conditional (defined(_POSTMKINCLUDED) && ${USE_PHP:tl} != "yes") Unknown modifier 't'
Unknown modifier 't'
Unknown modifier 't'
Unknown modifier 't'
Unknown modifier 't'
Unknown modifier 't'
"/usr/ports/Mk/bsd.sites.mk", line 1049: Malformed conditional (!empty(_PERL_CPAN_ID) && ${_PERL_CPAN_FLAG:tl} == "cpan") Unknown modifier 't'
Unknown modifier 't'
Unknown modifier 't'
"/usr/ports/Mk/bsd.port.mk", line 2948: warning: Missing closing parenthesis for defined() Unknown modifier 't'
"/usr/ports/Mk/bsd.port.mk", line 2948: Malformed conditional (((!defined(OPTIONS_DEFINE) && !defined(OPTIONS_SINGLE) && !defined(OPTIONS_MULTI)) && !defined(OPTIONS_GROUP) && !defined(OPTIONS_RADIO) || defined(CONFIG_DONE_${PKGBASE:tu}) || defined(PACKAGE_BUILDING) || defined(BATCH))) "/usr/ports/Mk/bsd.port.mk", line 2950: if-less endif Unknown modifier 't'
Unknown modifier 't'
Unknown modifier 't'
Unknown modifier 't'
Unknown modifier 't'
Unknown modifier 't'
Unknown modifier 't'
Unknown modifier 't'
Unknown modifier '-'
"/usr/ports/Mk/bsd.port.mk", line 4358: Need an operator Unknown modifier '-'
"/usr/ports/Mk/bsd.port.mk", line 4358: Need an operator Unknown modifier '-'
"/usr/ports/Mk/bsd.port.mk", line 4358: Need an operator Unknown modifier '-'
"/usr/ports/Mk/bsd.port.mk", line 4358: Need an operator Unknown modifier '-'
"/usr/ports/Mk/bsd.port.mk", line 4358: Need an operator Unknown modifier '-'
"/usr/ports/Mk/bsd.port.mk", line 4358: Need an operator Unknown modifier '-'
"/usr/ports/Mk/bsd.port.mk", line 4358: Need an operator Unknown modifier '-'
"/usr/ports/Mk/bsd.port.mk", line 4358: Need an operator Unknown modifier 't'
Unknown modifier 't'
"/usr/ports/Mk/bsd.port.mk", line 4903: warning: Missing closing parenthesis for target() "/usr/ports/Mk/bsd.port.mk", line 4903: warning: Missing closing parenthesis for target() Unknown modifier 't'
Unknown modifier 't'
Unknown modifier 't'
Unknown modifier 't'
Unknown modifier 't'
Unknown modifier 't'
Unknown modifier 't'
Unknown modifier 't'
Unknown modifier 't'
8 open conditionals:
at line 5785 (evaluated to true)
at line 5785 (evaluated to true)
at line 5785 (evaluated to true)
at line 5785 (evaluated to true)
at line 5785 (evaluated to true)
at line 5785 (evaluated to true)
at line 4903 (evaluated to true)
at line 4903 (evaluated to true) make: fatal errors encountered -- cannot continue
This version for PHP 5.4?
How do I install the phar extension on PHP 5.3.9?
PHP 5.3 isn't officially supported in FreeBSD ports anymore, as well as FreeBSD 8.x itself.
Your options are:
Obtain ports tree for FreeBSD 8.x. portsnap won't do, use svn to
checkout FreeBSD ports tree on right branch/revision.
Compile phar from source. As this is just extension, it shouldn't be
too hard.

syntax error, unexpected T_ENCAPSED_AND_WHITESPACE in pagination.php

When going to the website I get the following error:
syntax error, unexpected T_ENCAPSED_AND_WHITESPACE in /libraries/joomla/pagination/pagination.php on line 701
The line 701 is as follows:
$data->end->link = JRoute::_($params . '&' . $this->prefix . 'limitstart

warning if(ereg error first then other error

Here is my original code listed below.
if(ereg($pattern,strtolower($this->get_domain())) && !ereg("^-|-$",strtolower($this->get_domain())) && !preg_match("/--/",strtolower($this->get_domain()))){
This is the error
Deprecated: Function ereg() is deprecated in
Then I replaced the ereg with preg_match below. I receive this error
if(preg_match($pattern,strtolower($this->get_domain())) && !preg_match("^-|-$",strtolower($this->get_domain())) && !preg_match("/--/",strtolower($this->get_domain()))){
Warning: preg_match() [function.preg-match]: No ending delimiter '^'
found in
I tried to to put / before the ^ and after the $ but still no luck. May I get some assistance from someone who might know how to fix this error.
Add delimiters to your regexes:
$pattern = "/^[a-z".$idn."0-9\-]{3,}$/";// same for "/^[a-z0-9\-]{3,}$/"
// here __^ and here __^
if(preg_match($pattern, strtolower($this->get_domain())) &&
!preg_match("/^-|-$/",strtolower($this->get_domain())) &&
// __^ __^
!preg_match("/--/", strtolower($this->get_domain()))){

how i can solve this error "A PHP Error was encountered"?

Please give some idea. how to solve the error?
echo "<td class='bold'>Race Category<span class='star'>*</span></td>";
$array_all=array('name'=>'race_category','value'=>$s_race_category,'type'=>'RACE_CATEGORY','style'=>"class='selectbox'",'javascript'=>'','default'=>'');
echo "<td>";
echo $this->model_students->getAll($array_all);
echo "</td>";
The error:
A PHP Error was encountered
Severity: Notice
Message: Undefined variable: s_race_category
Filename: templates/forms.php
Line Number: 46
A PHP Error was encountered
Severity: Notice
Message: Undefined variable: s_programme
Filename: templates/forms.php
Line Number: 124
The severity says "Notice", meaning they won't break your page but they indicate something else. In this case you probably haven't defined your variables before you use them.
try assigning a value to the variables like:
$s_race_category = "";
$s_programme = "";
You are seeing these notices because of the PHP error reporting level, you can read more about it here

Resources