Admin Data Table and rows starting with numbers cause problems
Started by teppo, May 22 2012 02:11 AM
bug
7 replies to this topic
#1
Posted 22 May 2012 - 02:11 AM
For some reason Admin Data Table breaks when you insert a row which starts with number. See attached screenshot -- link doesn't show up and instead it's URL is printed out as plain text. Screenshot is from (unmodified) admin/users, but I'm seeing same strange behavior when adding rows to custom made Admin Data Table too.
So far I've tested this with 2.1 and 2.2 and I'm seeing same bug in both.
Can anyone else produce this or is there something wrong with my PW installation(s)?
So far I've tested this with 2.1 and 2.2 and I'm seeing same bug in both.
Can anyone else produce this or is there something wrong with my PW installation(s)?
#2
Posted 22 May 2012 - 04:56 AM
I can't reproduce this. Works all as it should.
But I think you're missing the "setEncodeEntities" setting.
But I think you're missing the "setEncodeEntities" setting.
$dt = $this->modules->get("MarkupAdminDataTable");
$dt->setEncodeEntities(false);
...
@somartist | modules created | support me, flattr my work flattr.com
#3
Posted 22 May 2012 - 06:01 AM
@soma, actually I failed to explain this properly. It's not enough that name starts with a number, it must BE a number.
As far as I can see, this seems to be caused by function "row" of MarkupAdminDataTable.module, more specificly this check:
So unless I'm missing something, 123 (username in this test) isn't a string (is_string($k) === false) and because of that link isn't created (and name is dumped.) Right?
As far as I can see, this seems to be caused by function "row" of MarkupAdminDataTable.module, more specificly this check:
if(is_string($k)) {
// Associative arrays get converted to:
// Anchor Text => URL
$v = "<a href='$v'>" . $this->encode($k) . "</a>";
} else {
$v = $this->encode($v);
}
So unless I'm missing something, 123 (username in this test) isn't a string (is_string($k) === false) and because of that link isn't created (and name is dumped.) Right?
#4
Posted 22 May 2012 - 06:42 AM
Ah, sorry I didn't get it that's on user list.
You're right, user names with only numbers breaks the output.
In DataTable, if a row array entry is a key=value, where value would be a url, it will be outputed as link automaticly...
This is the code that does it on user list in ProcessPageType.module :
So you're right. Even though the key should be a (string) it doesn't work with a number.
You're right, user names with only numbers breaks the output.
In DataTable, if a row array entry is a key=value, where value would be a url, it will be outputed as link automaticly...
$row["username"] = "edit/?=123";
This is the code that does it on user list in ProcessPageType.module :
foreach($fieldNames as $name) {
if(!$n) $row[(string)$page->get($name)] = "edit/?id={$page->id}";
else $row[] = $this->renderListFieldValue($name, $page->get($name));
$n++;
}So you're right. Even though the key should be a (string) it doesn't work with a number.
@somartist | modules created | support me, flattr my work flattr.com
#6
Posted 22 May 2012 - 08:36 AM
I have this same problem as well. All my user names are numbers.
#7
Posted 22 May 2012 - 11:01 AM
Despite that number being typecast to a string, it looks like PHP actually typecasts it back to an integer if the string contains only digits, when creating an array index. I found that I could get PHP to keep it as a string if I appended a non-digit character to the end of it (space). I just committed the update, so this issue should be fixed. Since this PHP typecasting behavior is a little unexpected, I'm just hoping the behavior is the same across PHP versions. Let me know if you find there is still an issue.
Also tagged with one or more of these keywords: bug
Community Support →
General Support →
Multiple Image Bug (When using API) [RESOLVED]Started by Hani, 21 Jan 2013 |
|
|
||
Community Support →
General Support →
Bug in ProcessPageType (dev branch)Started by teppo, 15 Nov 2012 |
|
|
||
bug
Community Support →
General Support →
Drag 'n drop uploading generates duplicate filesStarted by apeisa, 08 May 2012 |
|
|
||
Community Support →
General Support →
Datefield bug?Started by onjegolders, 03 May 2012 |
|
|
||
Community Support →
General Support →
Small bug, when autocompleting titlesStarted by onjegolders, 20 Apr 2012 |
|
|
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users













