I am unable to replicate this on my v7.7.1 test site under PHP 7.2.10. Additionally, I was unable to replicate this at UBBDev on v7.7.2 and PHP 5.4.45.
Steps: 1 Open the custom code page in the control panel and save 2 open the file via FTP (cache_builders/custom/) and see the code properly displayed 3 save the custom code via the CP again 4 open the file again and it still appears as expected
What version of UBB.threads are you running? Is your custom island coding following the example formatting, including the body eof lines? Do you have any modifications installed? What version of UBB.threads are you running? What is the content of the Custom Island that keeps being updated with additional coding?
The eof tags are required by the ubb scripts not php persay. The eof tags have nothing to do with php. That is the reason for the comment line to not change them.
And yes you can use php and or html between the eof tags.
If you would just insert them back in and clean up the extra php close tags . Save and close. I think it would resolve your delimma.
PS, don't forget to make sure all the extra blank line feeds outside of the eof tags are deleted also
Last edited by Ruben; 02/05/201912:03 PM. Reason: Added comment
Blue Man Group There is no such thing as stupid questions. Just stupid answers
See the attached image to see what I'm talking about please. It's not EOF tags. It's closing PHP tags. A new one gets added each time you view and save so you end up with this situation shown in the image.
Hmmm I don't see the ability to attach an image here. I'll use a link to an image then...
Today they call you "crazy". Tomorrow they call you "ahead of your time".
I can only reproduce this error WHEN the $body EOF declaration is missing, which is required for any custom island to work; if you restore your file and follow the guidelines within the file, as Ruben suggested (and as the system states to NOT change the lines) and it'll process the file properly.
Originally Posted by Gizmo
Is your custom island coding following the example formatting, including the body eof lines?
The issue is that you've removed coding that clearly states not to remove (/* DO NOT CHANGE THE LINE BELOW */ and /* DO NOT CHANGE THE LINE ABOVE */; both of which being the EOF lines). As $body is a requirement for Custom Islands to parse, this is not a bug. A stock Custom Island generates coding as:
Code
/* PHP CODE HERE, IF NECESSARY */
/* DO NOT CHANGE THE LINE BELOW */
$body = <<<EOF
Body of the custom box here
EOF;
/* DO NOT CHANGE THE LINE ABOVE */
See the attached image to see what I'm talking about please. It's not EOF tags. It's closing PHP tags. A new one gets added each time you view and save so you end up with this situation shown in the image.
Hmmm I don't see the ability to attach an image here. I'll use a link to an image then...
It happens because the eof tags are missing. Again this has nothing to do with actual php tags. The script looks for the eof tags when saving and creates a proper php file. Without the extra php closing tags. But you will need to clean them up after you restore the default code with the eof tags as noted above. You may need to save it twice after edits to clean it completely.
I don't understand why it is so difficult for you to at least try it as suggested. It is still missing the required format. It will save you and everyone else headaches.
It will continue to add a closing tag every time you save it till you add back the default code completely period.
Last edited by Ruben; 02/18/20194:56 PM. Reason: Added comment.
Blue Man Group There is no such thing as stupid questions. Just stupid answers
1) There are no longer the "DO NOT CHANGE THE LINE BELOW" and "DO NOT CHANGE THE LINE ABOVE" lines in UBBthreads 7.7:
Code
/* PHP CODE HERE */
/* BODY HERE */
$body = <<<EOF
EOF;
2) It will try to fix the code only if you edit the custom island (editcustomisland.php) but there are not any attempts to fix the code while updating the island with doeditcustomisland.php. So basically, you can publish any broken code you want with doeditcustomisland.php.
A possible solution:
Replace the entire code that cause this problem (editcustomisland.php):
/* PHP CODE HERE */
/* BODY HERE */
$body = <<<EOF
EOF;
Since at least 753 (oldest build I have loaded on my file server); the system generates new islands as the expected:
Code
/* PHP CODE HERE, IF NECESSARY */
/* DO NOT CHANGE THE LINE BELOW */
$body = <<<EOF
Body of the custom box here
EOF;
/* DO NOT CHANGE THE LINE ABOVE */
Note that this would only affect new installs, as a basic upgrade step is to not upload the folder.
All examples of the Custom Islands at UBBDev or on UBBWiki all reference the later. But, as previously mentioned, you'll still need to add the body eof coding to your CI.
We'll look at updating the default comments on the stock Custom Islands, to bring them in line with how the system generates new entries.
I just went through all the versions. It appears the notation about don't delete was omitted after version 7.3.1 going forward.. Starting with version 7.4 October 16, 2008
In fact version 7.3.1 only has the notation in portal box 1.php. I only looked in the default 10 portal box files so I assume that is when this started.
Last edited by Ruben; 02/19/20191:36 PM. Reason: Added comment
Blue Man Group There is no such thing as stupid questions. Just stupid answers
I did a little more research and found out that the EOF; and ?> issue was introduced in UBB.threads 7.2.0
UBB.threads 7.0/7.1 used this cleanup code:
PHP Code
$line = trim($line);
if ($line == "<?php") continue;
if ($line == "?>") continue;
$line = htmlentities($line);
Basically, it goes through each line of the island and ignores lines with "<?php" and "?>".
However, the updated 7.2 code makes not much sense:
PHP Code
$line = trim($line);
if ($line == "<?php") continue;
if ($line == "?>" && $eof_found) continue;
if ($line == "EOF;") $eof_found = true;
$line = htmlentities($line);
This look like some unfinished change. It still ignores "<?php" but ignores "?>" only if there was previously ($eof_found = true;) a line with "EOF;".
Originally Posted by Gizmo
But, as previously mentioned, you'll still need to add the body eof coding to your CI.
This is working as well:
Code
$body = "Some output here";
after the format of $body doesn't matter. The only difference is that $body = <<<EOF .... EOF; is easier after there is no need to escape " with \". The problem here is the code in editcustomisland.php that was introduced in 7.2+