Problem with new While action

Wappler Version : 2.3.2
Operating System :

Expected behavior

Adding the new While action shouldn’t affect existing server action files


Actual behavior

Some exising action files no longer work correctly


How to reproduce

I’m not sure exactly what triggers this, but if you try running a number of your existing action files which include conditions, you will probably find this error:
**Parse error** : syntax error, unexpected 'while' (T_WHILE), expecting identifier (T_STRING) in ...

Eg, this action file toggles the status of a record. I probably use it for most tables in a CRUD system. It no longer works - failing with the error above.


If I comment out this section of \dmxConnectLib\modules\core.php:


all is well again.

(I couldn’t get the new while loop to work, but that’s not such a problem at the moment)

In case it helps, if I run core.php directly in the browser, I get:

**Fatal error** : Class 'lib\core\Module' not found in **/home/..mypath../dmxConnectLib/modules/core.php** on line **9**

This issue causes problems generally on the site I’m working on - not just with a few server actions. It’s not a problem as long as the problem code is commented out. I’m not sure of the circumstances when these files are automatically updated/replace. That could be problematic.

Can you try removing the dmxConnectLib folder locally, then save your server action and then uploading manually the newly created dmxConnectLib folder to the server?

Thanks Teodor, but unfortunately that didn’t work.

I closed Wappler - using the Windows tray quit option - and deleted the folder dmxConnectLib. After saving one of the server action file affected, the folder was recreated, but the problem is the same.

I can’t seem to be able to recreate this locally, using the same steps in a server action.

Does this happen to this server action only?

What is the PHP version on your server where you get the error? We should probably rename the action method to something else when some PHP versions don’t like while as method name.

Great - that’s fixed it.

I had forgotten I had set WAMP to use PHP 5.6 when working on old site. I changed it to 7.2 and the problem is fixed. On the server I had created a subdomain for temporary use and it was using the default PHP 5.6 too. I’ve changed it to 7.2 and it’s all working fine now.

We should look which PHP versions we will support with Wappler, at this moment we say it is PHP 5.4, but the new while action requires at least PHP 7.

It is difficult to constantly updating code to support the latest version and keep support for the older versions.

I suppose you could run a poll to get some idea. Having 7.0 as the minimum is fine from my point of view.