Wordpress: Rest Routes plugin compatibility issues - wordpress

I am using Rest Routes plugin for building custom endpoints for WP Rest API. This plugin is tested for compatibility for upto WordPress versioin 4.5.9. I'm using WordPress version 4.6.6 on my localhost and the plugin works fine. I'm able to create custom endpoints. But when I install this plugin in the live server, where I'm using the same version of wordpress, 4.6.6, the plugin doesn't get activated, showing me an error:
Parse error: syntax error, unexpected '[' in /nfs/c07/h03/mnt/109306/domains/lrp.magikbox.biz/html/wp-content/plugins/rest-routes/inc/filters/wprr-filter-post_type.php on line 92

The error is generating from $post_type_arr = []; raised by [ of post type filter. It seems the Array Initialization Construct: [] is the cause of the error. I tried recreating your error with my production server running PHP 7 but Rest Routes activated successfully. I have checked your website: http://lrp.magikbox.biz/ it runs on PHP 5.3.29, sadly short Array Initialization Construct [] only works for PHP 5.4+ - see here.
Check your development server (your localhost) it is certainly running PHP 5.4+. As a solution either consider changing your host to one that supports PHP 5.4 and above or use WP Rollback plugin and roll back the plugin to its early 2014 version when PHP 5.3.29 was released.

Related

Nextjs 13 beta vercel static build error using Wordpress GraphQL

I faced a problem while creating static pages in Next JS with GraphQL requsts using fetch.
I've created page where I render over 100 list of data and also created static dynamic pages for those items using generateStaticParams function provided by Next.
Local build was done without any issues but when I deployed it to vercel, build crashed.
I am wondering if the problem is somewhere in WordPress.
To check it I replaced those static pages with https://jsonplaceholder.typicode.com/ - free fake API.
And with that API everything works fine.
Error that appeared during vbercel build:
I would be grateful if someone could help me with this.
Thanks :)
I tried different API to check if this error will also happen, but everything worked fine.
My operating system: Windows 11
Node version: 18.12
Next version: 13.1.6
The issue appears to be with using fetch in Server Components.
You can either use axios OR inside next.config.js set:
module.exports = {
experimental: {
enableUndici: true
}
}

Drupal apc module

I have deployed drupal site on my dev env and I can view the frontend of the site. The Site pages are cached using APC server cache module installed on drupal.
The Issue is that I'm not able to clear the cache using Admin Console of Drupal CMS because after login I get the error -
Fatal error: Call to undefined function apc_delete() in C:\xampp\htdocs\nrdrupaldev\sites\all\modules\apc\drupal_apc_cache.inc on line 289
As the Admin is not accessible due to the above error I tried to disable the module directly from the Database using this query -
UPDATE system SET status='0' WHERE name='apc'
After this I also disabled the module from settings.php by removing its config settings.
But this gave me a series of errors and warnings see below image ![enter image description here][1]
First thing to check is your PHP version. APC no longer works in PHP 5.5+ so you will need the APCu extension.
If you are getting an error stating that a function that belongs to APC is not defined it's safe to say that the extension is not being loaded.
I have not used the APC Drupal module for some time as I has switched my caching needs to Redis but I believe it was updated to support APCu.

display blank page in production

Currently working on Symfony2, I'm trying to make my website work on a server on production environment.
But I get a blank page, it's OK on developpement environment.
Some things I saw :
No log file on app/logs
No specific error on Apache error log
With Firebug, I see a HTTP Error 500 for GET /web/.
Any ideas?
I've seen this happen if you use {{ dump(var) }} and the var has nested arrays. Try removing any dump, and if that does not work, tryign removing any variables you are using in twig to display a static page.
You may want to manually delete the prod cache and install assets again for prod mode. See Symfony Production Checklist for a list of basic steps with D and E covering the cache and assets.

Symfony2: $_POST variables are empty on deployment

I'm currently working on symfony2 projects. Each time, the deployment process is a real pain in the back (even with the cookbook advices).
I have this strange feature that I can't explain. My post variables are always empty in some bundles of symfony 2, no matter how I access them ($_POST['foo'] or request->get('foo')). This feature is online only. On my local server, it works perfectly well.
Example 1: coresphere console bundle
I'm using the coresphere console bundle to run command line on my ovh remote server. But the bundle commands were never working (no matter what my installation was) ie my post variables were always empty causing each command to crash. I thought that may be an error in some of my other installed bundles was causing the post variables of the console bundle to be empty. So I installed it on an empty symfony2 project (I even removed Acme and of course I tested that everything was working on my local server before uploading the project). The console still didn't work. My only solution (a bad one though) was to hack the javascript console.js of the bundle and transform the post request into get request. It then worked fine. At this stage I thought: "ok may be the problem comes from ajax post request on ovh?"
Example2: A home made bundle for a project
I build a bundle for a project. In this project I don't use ajax post request at all. And still, my post variables are always empty (I remind that locally, everything works just smoothly). For this bundle I'm using FOSUserBundle with HWIOAuthBundle for authentication (if it has anything to do with that?)
Summary
I'm clueless about what is going on and I would like to have some sort of track to follow. Just as a reminder: I'm using an OVH shared server with the performance package. I can use git up there. But I can't really use console command (even in ssh). So that's why I'm using the coresphere console bundle.
Thank you for your help.
I got a solution for my home made bundle:
The problem was coming from my routing.yml file (in app/config). I was using fosjsrouting and it seems that the routing of fosjsrouting needs to be called at the very end of the routing.yml file (in app/config).
See below:
app/config/routing.yml:
... and at the very end:
fos_js_routing:
resource: "#FOSJsRoutingBundle/Resources/config/routing/routing.xml"
However, I still don't understand the problem with the coresphere bundle. This doesn't solve it.

Error in Exposed Filter with AJAX in Drupal View

I'm receiving an error when i try to filter a Drupal view using a regular exposed filter with AJAX(autosubmit).
An error occured while attempting to process /views/ajax:
Object [object Window] has no method 'indexOf'
This is what i've done:
Clear all the cache, run cron and update.php
Views, ctools and drupal core were out-of-date, so i update them and run update.php
Check that the view had Ajax enabled.
Test if using Better Exposed Filters worked, din't work.
Install JQuery Update module and enable it, din't work either.
Create another exposed filters(by date, type, title) same error.
Something important to mention is that the filters works in the View Preview.
The view is very simple, the only thing it does is show a list of events (event content type) and i want to filter the content by the restaurant (wich is a select list of the content type) and that error is been shown.
This is the spects:
Drupal Core: 7.19
Views Module: 7.x-3.5
PHP Version: 5.3.18
Apache2.2.22
MySQL 5.1.66
Using Acquia Dev Desktop stack on Windows.
Thanks in advance
This is the result code when i export the view:
File Code, Click Here
Try to enable clean URLS. This worked with me.

Resources