RW 7.1 beta PHP preview

What has changed in terms of previewing pages with PHP in the latest beta? I spent hours thinking that I broke my CMS somehow. Turns out it was just the new 7.1 beta was the actual problem. I am not 100% certain what the error was for. I looked at the internal web server logs and it showed nothing helpful for errors.

@joeworkman Can you try re-starting and see if that helps…

FYI: Nothing has changed in relation to the preview, so it should just work.

We are also experiencing problems with PHP in RW 7.1.
I’m still trying to find where the actual problem is.

Can you send me over an email file that shows the issue - dan@realmacsoftware.com :slight_smile:

After some tests, it seems that PHP global variables cannot be accessed inside a class function.
Same exact code works in RW 7.0.4 and below.

I’ve just found the problem.
We use require() function to import functions and variables from an external file.
Variables scope is now changed and variables cannot be accessed.
Changing require() to include() in our code fixes the problem.

As said, same code works correctly in RW 7.0.4 and below, so something has definitely changed on your side.

Note: PHP require() function is identical to include() except error handling upon failure.
When you are working with mandatory files, require() is preferred.

Digging into how RW PHP web server is launched, I’ve noticed that the PHP script you use to launch it has changed from RW 7.0.4 to 7.1.0.

The following lines are not in latest version.

function rw_require($path) {
    if (file_exists($path)) {
        require($path);
    }
    else {
        $fh = fopen('php://stderr','w') or die($php_errormsg);
        fwrite($fh, "ERROR Ignoring missing file:$path\n");
        fclose($fh);
    }
}

function rw_require_once($path) {
    if (file_exists($path)) {
        require_once($path);
    }
    else {
        $fh = fopen('php://stderr','w') or die($php_errormsg);
        fwrite($fh, "ERROR Ignoring missing file:$path\n");
        fclose($fh);
    }
}

You win the prize today!

Not yet, unfortunately.
Even after adding missing lines above to RW 7.1 web launcher, the problem is not fixed.
I guess it’s something deeper.

@rob @joeworkman can you sling us a sample project that shows the issue? dan@realmacsoftware.com

If we have that we can get it fixed asap.

Changing require to include has fixed Total CMS for me…

1 Like

Just download RapidCart Pro, create a page and make sure a valid email address is entered in Customization > Settings > Email > From field.
Then preview the page.

Email address is exported in a external PHP file that’s required by main page.

RW 7.1 doesn’t correctly import the required file while RW 7.0.4 and below do.

@rob or you could just send me a project that shows the issue… :wink:

Here’s a link.

Just open the project and preview it.

Thanks for this, we think we have a fix for this now - should be out in the next 7.1 beta, due later today or tomorrow.

Cheers,

Dan

1 Like

I confirm RapidWeaver 7.1 Beta 3 just released fixes the problem.