Parse error: syntax error, unexpected '-', expecting '('

When I try to activate mainWP child 4.1.5 on WP 5.7 that is also embedding mainWP admin I get this:

Fatal error
Parse error: syntax error, unexpected ‘-’, expecting ‘(’ /home/domain/mainwp/wp-content/plugins/mainwp-child/class/class-mainwp-utility.php(87) : eval()'d code on line 3

I read this Add your MainWP Dashboard as a Child - MainWP WordPress Management but i’m stuck at this step. It used to work before upgrading the WP 5.6 (I think)

Hi Guillaume,

thanks for reaching out.

I have reviewed logs on my test sites, but I can’t duplicate this error on our test sites.

However, since the problem comes from the eval() function, I am assuming that this error comes from your custom code snippet.

Do you use the Code Snippets extension? If yes, please review your activate snippets and check for the Parse error.

Thanks

As far as I know, we don’t use the custom code snippet plugin :frowning:

could it be related to MainWP Custom Dashboard Extension?

I don’t think that the Custom Dashboard extension could cause it. Just the MainWP Code Snippets Extension.

Can you please post the community system report from your MainWP Dashboard for review? The report is located in your Dashboard under Status → Server, on the top right of the page.

Be sure to use the button like the one below; this button hides all your private information:

image

Pressing the button auto-copies the report to your clipboard then just paste it in a reply here.


### Server Info                    Required                                               Detected                                     État     ###

MainWP Dashboard                   
Version de MainWP Dashboard        4.1.5.1                                                4.1.5.1                                      Ok          
MainWP Upload Directory            Writable                                               Writable                                     Ok          
Extensions MainWP                  
Boilerplate Extension              4.0.2.1                                                Licence d’API inactive                       Avertissement
MainWP Article Uploader Extension  4.0.1.1                                                API License Active                           Ok          
MainWP Bulk Settings Manager Extension4.0.2.1                                                Licence d’API inactive                       Avertissement
MainWP Custom Dashboard Extension  4.0.2                                                  Licence d’API inactive                       Avertissement
MainWP Custom Post Type            4.0.2                                                  API License Active                           Ok          
MainWP UpdraftPlus Extension       4.0.4                                                  API License Active                           Ok          
WordPress                          
WordPress Version                  >=3.6                                                  5.7                                          Ok          
WordPress Memory Limit             >=64M                                                  40M                                          Avertissement
MultiSite Disabled                 =true                                                  true                                         Ok          
Méthode fichier système            = direct                                               direct                                       Ok          
PHP                                
PHP Version                        >=5.6                                                  7.3.27                                       Ok          
PHP Safe Mode Disabled             =true                                                  true                                         Ok          
PHP Max Execution Time             >=30 seconds                                           165                                          Ok          
PHP Max Input Time                 >=30 seconds                                           -1                                           Ok          
PHP Memory Limit                   >=128M                                                 512M                                         Ok          
PCRE Backtracking Limit            >=10000                                                1000000                                      Ok          
PHP Upload Max Filesize            >=2M                                                   128M                                         Ok          
PHP Post Max Size                  >=2M                                                   130M                                         Ok          
SSL Extension Enabled              =true                                                  true                                         Ok          
SSL Warnings                       = empty                                                                                             Ok          
cURL Extension Enabled             =true                                                  true                                         Ok          
cURL Timeout                       >=300 seconds                                          60                                           Avertissement
cURL Version                       >=7.18.1                                               7.38.0                                       Ok          
cURL SSL Version                   >=OpenSSL/0.9.8l                                       OpenSSL/1.0.1t                               Ok          
PHP autorise les URLs fopen        OUI                                                    
Support PHP Exif                   OUI ( V7.3.)                                           
Support PHP IPTC                   OUI                                                    
Support PHP XML                    OUI                                                    
Fonctions PHP désactivées          _dyuweyrj4, _dyuweyrj4r, dl,                           
Extensions PHP chargées            Core, PDO, Phar, Reflection, SPL, SimpleXML, Zend OPcache, bcmath, bz2, calendar, cgi-fcgi, ctype, curl, date, dba, dom, exif, fileinfo, filter, ftp, gd, gettext, gmp, hash, iconv, imagick, imap, intl, ionCube Loader, json, libxml, mbstring, memcached, mongodb, mysqli, mysqlnd, openssl, pcre, pdo_mysql, pdo_pgsql, pdo_sqlite, pgsql, posix, pspell, redis, session, soap, sockets, sodium, sqlite3, standard, sysvmsg, sysvsem, sysvshm, tokenizer, wddx, xml, xmlreader, xmlrpc, xmlwriter, xsl, zip, zlib
MySQL                              
MySQL Version                      >=5.0                                                  5.7.32-log                                   Ok          
Mode MySQL                         NO_ZERO_IN_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
Encodage client MySQL              utf8mb4                                                
Server Info                        
Logiciel du serveur                Apache                                                 
Système d'exploitation             Linux                                                  
Architecture                       32		 bit                                               
Protocole du serveur               HTTP/1.1                                               
HTTPS                              OUI                                                    
Connexion automatique du serveur   Réponse du corps HTTP non espérée :                    
Agent utilisateur                  Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:86.0) Gecko/20100101 Firefox/86.0
Interface de passerelle            CGI/1.1                                                
Utilisation de la mémoire          45.64 MB                                               
Temps de la requête                1616611432                                             
Contenu accepté                    text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Jeu de caractère accepté pour le contenuIndisponible                                           
Réglages MainWP                    
Nombre de sites enfants            21                                                     
Utiliser WP-Cron                   Oui                                                    
Optimiser pour l’hébergement mutualisé ou les grands réseauxOui                                                    
Mise à jour quotidienne automatiqueDisabled                                               
Tolérance d’abandon d’extension/thème365                                                    
Nombre maximal d’articles à retourner400                                                    
Nombre maximal de pages à retourner50                                                     
Système de sauvegarde principale   Sauvegardes MainWP par défaut                          
Requêtes simultanées maximum       4                                                      
Délai minimum entre les requêtes   200                                                    
Requêtes simultanées maximum par IP1                                                      
Délai minimum entre les requêtes vers la même IP1000                                                   
Nombre maximum de requêtes de synchronisation simultanées                                                       
Requêtes maximum d’installation/mise à jour simultanées                                                       
Extensions activées                
Classic Editor                     1.6                                                    Actif                                        
Custom Login Page Customizer       2.1.2                                                  Actif                                        
Custom Post Type UI                1.8.2                                                  Actif                                        
Elementor                          3.1.4                                                  Actif                                        
Elementor Pro                      3.2.1                                                  Actif                                        
MainWP Child                       4.1.5                                                  Inactif                                      
MainWP Dashboard                   4.1.5.1                                                Actif                                        
Pods - Custom Content Types and Fields2.7.26                                                 Actif                                        
Redirection                        5.0.1                                                  Actif                                        
SupportCandy                       2.2.0                                                  Actif                                        
testplugins                        1.0                                                    Actif                                        
WordPress Importer                 0.7                                                    Actif                                        
WordPress Version Info             1.2.1                                                  Actif                                        
WP-Members                         3.3.8                                                  Actif                                        
Yada Wiki                          3.3                                                    Actif                                        
YOP Poll                           6.2.6                                                  Inactif                                      

Hi Guillaume,

Thanks for getting back to me.

I see that the Code Snippets extension is not in use.
But are you sure it wasn’t used in the past?

If you install this extension, do you see in the Snippets list if there are any custom snippet saved?

you’re right, I think we’ve tried Code Snippet in the past because we’re right now coding an add-on to mainWP. But I don’t see anything in /wp-content/plugins

image

nor in /wp-content/uploads

Do you advice an other distant folder?

Hi Guillaume,

thanks for getting back to me.

Even though you have uninstalled the extension, if you haven’t removed snippets that you used prior to that, they are still saved to the child sites.

It may be best to simply install the extension again and see what shows up. Once installed, you will be able to remove previously used snippets.

See here:

Or if easier, you can simply do it this way:

Hi Bogdan! Actually this issue was related to custom dashboard add-on where we still had unnecessary php and js code. Removing everything allowed to activate the child of itself.

Hi Guillaume,

thanks for letting us know.
I am happy to see that the problem is resolved.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.