Posted by rfay on December 12, 2008 at 2:15pm
9 followers
Jump to:
| Project: | Views Custom Field |
| Version: | 5.x-1.0-beta1 |
| Component: | Code |
| Category: | task |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed (won't fix) |
Issue Summary
If I put a largish block of code in a views_customfield element, then save the view, the entire block of code is silently discarded. No error message is given. I can demonstrate this in any view. (Drupal 5.13, Views 5.x-1.6)
For example, this piece of code results in the discard behavior. If I click save after putting this in the field, the field will be empty when I edit the view.
<?php
print "hi there";
print "hi there";
print "hi there";
print "hi there";
print "hi there";
print "hi there";
print "hi there";
print "hi there";
print "hi there";
print "hi there";
print "hi there";
print "hi there";
print "hi there";
print "hi there";
print "hi there";
print "hi there";
print "hi there";
print "hi there";
print "hi there";
print "hi there";
print "hi there";
print "hi there";
print "hi there";
print "hi there";
print "hi there";
?>
Comments
#1
Currently I don't have much time; I'll look into it next week.
#2
I'm seeing the same problem. Not sure what's up.
#3
The PHP code is saved to the Options field of view_tablefield database table in the serialized manner.
The Options field is defined as varchar(255), this means that it has maximum length of 255 characters.
So, the problem is due to limitation of the length of database field, in which evaluated PHP code is stored.
#4
I won't work on the D5 version until the D6 version is stable.
patches are welcome though.
#5
Now that there's a stable version, would you be willing to look at this?
#6
The D5 version on drupal.org is still the same as when this was submitted (5.x-1.0-beta1), and it still fails the exact same test.
@infernix: I don't understand what you mean "now that's there's a stable version". It's the same version.
D6 (6.x-1.0) seems to work fine. It does not exhibit this bug.
#7
The introduction to this says "largish block of code". The limit is actually around 225 bytes which is about 3 lines of code.
This makes the module of limited value for those of us tied to Drupal 5 for whatever reason.
Chris
#8
Just write a function in a file like template.php and call it in the Custom Field form.
#9
bump...subscribing
is anyone from the maintainers working on this...i bet it's not so much hassle
#10
I got around this problem by changing the field data type for the
`options`field in the`view_tablefield`table toLONGTEXT.ALTER TABLE `db_name`.`view_tablefield` MODIFY COLUMN `options` LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL;This does not seem to have had any effect on my pre-existing views, although I took a backup of the table before altering it as a precaution.
This problem lies more with the Views module for Drupal 5 than the Views Custom Field module, as this table is generated by the Views module. The maintainers obviously did not expect the
`options`field to play host to data exceeding 255 characters. The Views Custom Field module for Drupal 6 overcomes this character limitation problem because Views for Drupal 6 stores the entire structure of a view as aBLOBin the`view_php`field in the`views_view`table.This issue would have to be raised with the maintainers of the Views module for Drupal 5 to change the default data type of the
`options`field in the`view_tablefield`table toLONGTEXT. However, it is not difficult to resolve this issue yourself with a quick table alteration.(Tested using Views Custom Field 5.x-1.0-beta1 and Views 5.x-1.6)
#11
D5 version is no longer supported (wasn't for a long time to be honest).