TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

Members
Stats
  • Total Posts: 196,004
  • Total Topics: 21,330
  • Online today: 468
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 0
  • Guests: 111
  • Total: 111

PHP Blocs are broken -- SMF 1.1.11 / TP 1.0b5

Started by chronosis, April 03, 2010, 12:41:31 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

chronosis

It seems that whenever you attempt to save a PHP bloc now, it is attempting to escape the enitre body of the bloc.  PHP code.... and this results in a completely non-functional bloc.  The only way I've found to get around this is to edit the database records for the bloc directly.   But this sorta circumvents the whole point of having TinyPortal.

Here is an example of what's happening:

This is some sample bloc that is what I type into the body...

...
//Display it all, with one piece of code?
echo "\n\n";
echo "<script type=\"text/javascript\" src=\"/overlib.js\"><!-- overLIB (c) Erik Bosrup --></script>\n";
echo "<div id=\"overDiv\" style=\"background-color: #000; border-color: #FFF; color: #FFF; position:absolute; visibility:hidden; z-index:1000;\"></div>\n";

foreach ($zonevar as $zoneVal)
{
if ($status[$zoneVal] == 1)
{
$strOut = "";

foreach($$zoneVal as $value)
{
$normal_mode = ($value['1'] == 1) ? "<span " . $Ndead . ">N</span>" : "<span " .$Nlive . ">N</span>";
$strOut = $strOut . "<div " . $boss . ">";

if($value['2'] == '0')
{
...


Here's what TinyPortalBeta5 is doing to the same bloc of code when it saves it:

//Display it all, with one piece of code?
echo \"\\n\\n\";
echo \"<script type=\\\"text/javascript\\\" src=\\\"/overlib.js\\\"><!-- overLIB (c) Erik Bosrup --></script>\\n\";
echo \"<div id=\\\"overDiv\\\" style=\\\"background-color: #000; border-color: #FFF; color: #FFF; position:absolute; visibility:hidden; z-index:1000;\\\"></div>\\n\";

foreach ($zonevar as $zoneVal)
Ã,«
if ($status[$zoneVal] == 1)
Ã,«
$strOut = \"\";

foreach($$zoneVal as $value)
Ã,«
$normal_mode = ($value[\'1\'] == 1) ? \"<span \" . $Ndead . \">N</span>\" : \"<span \" .$Nlive . \">N</span>\";
$strOut = $strOut . \"<div \" . $boss . \">\";

if($value[\'2\'] == \'0\')
Ã,«
$strOut = $strOut . \"<span \" . $Hlive . \">H</span>\";
Ã,»


Why are PHP blocs being parsed like this?

Xarcell


chronosis

That's correct. I upgraded, and none of my existing blocs are broken.  It's only when I attempt to go in and edit them that there is a problem.

Xarcell

Did you uninstall Beta 4 First? before installing beta 5?

chronosis

No.  I followed the instructions for upgrading beta 4 to beta 5.   There was no mention of uninstalling Beta 4. 

Should I have uninstalled beta 4 first?

Xarcell

Quote from: chronosis on April 03, 2010, 01:20:21 AM
No.  I followed the instructions for upgrading beta 4 to beta 5.   There was no mention of uninstalling Beta 4. 

Should I have uninstalled beta 4 first?

It does say uninstall previous versions. Yes, you should have uninstalled beta 4 first.

Lonewood

Actually, the instructions I saw when installing were to only uninstall versions prior to 1.0.4 - if you were running 1.0.4, then you could just use the package manager.

HOWEVER,  I upgraded from 1.0.3b and yes, I did uninstall first before installing the new version.

I am having the exact same problem described as above.

When I type in or copy/paste code into a php block, it changes the { to << and inserts lots of additional \\\ characters which essentially break the block.

This is only affecting one block for me at the moment but it is an important one.

cheers
Leah

Lonewood

Quote from: chronosis on April 03, 2010, 12:41:31 AM
IThe only way I've found to get around this is to edit the database records for the bloc directly.   But this sorta circumvents the whole point of having TinyPortal.

Thank you - I have been tearing my hair out over this and didnt think to just edit the record directly.  It doesnt solve the problem but at least I have been able to get the block working again until I work out what has gone wrong with the TP upgrade.

Apart from this one glitch, all else looks good.

cheers
Leah

chronosis

And actually, yes. I went back to look.  The instructions do say explicitly that you can install version 1.0b5 overtop of 1.0b4 using the package manager.  Which is exactly what I did.

Quote
How to install/upgrade?

Just use the package manager and it will find the old TP files, it will happily upgrade from TP beta4 - but from earlier versions you will need to un-install those first, then re-install beta5.

Note that TP is still considered as beta and it may still contain bugs. Make backups before attempting upgrade or install of TinyPortal.

In fact I had the package manager handle downloading the package and installing it as well.   So, I don't buy that this is an upgrade issue, exactly. 

This looks like a legitimate break due to the tables already existing in the database, or the files already existing in the directory tree. 

In either case it looks like you'd have to remove the data tables and files for tiny portal and then install the new version fresh. Which is really undesirable, since I've got many blocs and articles I'll have to migrate into the new version and recreate by hand.

lurkalot

Quote from: Xarcell on April 03, 2010, 01:38:30 AM
Quote from: chronosis on April 03, 2010, 01:20:21 AM
No.  I followed the instructions for upgrading beta 4 to beta 5.   There was no mention of uninstalling Beta 4. 

Should I have uninstalled beta 4 first?

It does say uninstall previous versions. Yes, you should have uninstalled beta 4 first.

QuoteFrom news page.

How to install/upgrade?

Just use the package manager and it will find the old TP files, it will happily upgrade from TP 1.0 betas - but from earlier versions you will need to un-install those first, then re-install beta5.

Tried this myself, and i couldn't access my home page after the upgrade.  As it was a fresh install of smf 1.1.11 and tp 1.04 beta on my test site I though this would be the best time to try it.   ???

This website is proudly hosted on Crocweb Cloud Website Hosting.