Joomla! Discussion Forums



It is currently Thu Nov 26, 2009 6:45 pm (All times are UTC )

 


Forum rules

Forum Rules
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.



Post new topic Reply to topic  [ 3 posts ] 
Author Message
Posted: Sat Feb 23, 2008 4:35 pm 
Joomla! Intern
Joomla! Intern
Offline

Joined: Thu Nov 16, 2006 10:24 am
Posts: 85
Location: Pisa, Italy
I'm finalizing a plugin which needs PHP code to be input as a parameter to it. Obviously PHP code means that it contains all possible kinds of 'dangerous' symbols, like $,&,\n,| and so on.

Apparently the store process behaves perfectly and the code is stored, in an escaped form, with the plugin parameters in the DB. Then, when I load the data, either from inside the plugin code and from the admin interface, something breaks it and I get back just the last line, which is a very useful }.

I've tracked down the problem to JRegistryFormatINI::stringToObject() but there I'm stuck, because I have no idea of why ini.php lines 172 etc. are there. Why check for a '|' and then
Code:
$lines = explode('\n', $value)
if $value is already a line of something that has already been exploded that way (line 107), and so should contain no newlines?
Moreover, at that same line $lines seems to be used in a way which may brake the outer foreach loop (line 132). Can anybody help me with this? Thank you


Top
  E-mail  
 
Posted: Sun Feb 24, 2008 9:19 am 
Joomla! Intern
Joomla! Intern
Offline

Joined: Thu Nov 16, 2006 10:24 am
Posts: 85
Location: Pisa, Italy
I definitely think it is buggy.
  1. You can't save a string with '|'s and '\n's as it will be exploded as an array. In a strange manner though, it trats it something like a bi-dimensional array. It first splits the value by '\n's, then each line by '|'s, and then accumulates everything in a strange way, by the way unescaping those '\n's which can't be there since they were used as a line separator short above.
  2. and however, it uses $lines and $line for a foreach loop, which is nested inside another one which uses the same variable names with a different meaning. This is a typical bug.
  3. and by the way, even escaping '|' as '\|' is useless because the string matching is done with a simple strpos().
I really think that part should be rewritten: I can take charge, but I need to know what exactly it is supposed to do... It's totally unclear.


Top
  E-mail  
 
Posted: Wed Feb 27, 2008 10:52 am 
Joomla! Intern
Joomla! Intern
Offline

Joined: Thu Nov 16, 2006 10:24 am
Posts: 85
Location: Pisa, Italy
I posted a tracker item: http://joomlacode.org/gf/project/joomla/tracker/?action=TrackerItemEdit&tracker_item_id=9945


Top
  E-mail  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

Quick reply

 



Who is online

Users browsing this forum: No registered users and 14 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group