Re: [gentoo-user] reading php file code in text editor
On 23 Jun 2010, at 07:18, Mick wrote: I am looking at some php files which are causing parsing errors in Drupal, like: = Warning: Unexpected character in input: ' in /var/www/htdocs/sites/all/themes/fusion/fusion_core/template.php on line 178 Warning: Unexpected character in input: ' in /var/www/htdocs/sites/all/themes/fusion/fusion_core/template.php on line 178 Warning: Unexpected character in input: ' in /var/www/htdocs/sites/all/themes/fusion/fusion_core/template.php on line 178 = and so on. When I view the file using a text editor I see a number of lines which are shown as binary characters ... should it be like this? = $dimensions = !empty($node-height) !empty($node-width) !empty($node-length); // Hide dimensions if empty $vars['fusion_uc_dimensions'] = ($dimensions) ? drupal_render($node-content['dimensions']) : ''; if ($vars['fusion_uc_dimensions'] == '') { unset($node-content['dimensions']); } $list_price = !empty($node-list_price) $node-list_price 0; ^...@^@^...@^@^...@^@^...@^@^...@^@^...@^@^...@^@^...@^@^...@^@^...@^@^...@^@^...@^@^...@^@^...@^@^...@^@^...@^@^...@^@^...@^@^...@^@^...@^@^...@^@^...@^@^...@^@^...@^@^...@^@^...@^@^...@^@^...@^@^...@^@^...@^@^...@^@^...@^@^...@^@^...@^@^...@^@^...@^@^...@^@^...@^@^...@^@^...@^@^...@^@^...@^@^...@^@^...@^@^...@^@^...@^@^...@^@^...@^@^...@^@^...@^@^...@^@^...@^@^...@^@^...@^@^...@^@^...@^@^...@^@^...@^@^...@^@^...@^@^...@^@^...@^@^...@^@^...@^@^...@^@^...@^@^...@^@^...@^@^...@^@^...@^@^...@^@^...@^@^...@^@^...@^@^...@^@^...@^@^...@^@^...@^@^...@^@^...@^@^...@^@ = I think it might be most useful if you gave us a complete copy of one of these files, as an attachment. If they're security-sensitive, send us just an extract which shows the sample (cut using something like `head foo | tail bar`). Where did these files come from? Did you download a fusion theme from the Drupal website? Stroller.
Re: [gentoo-user] reading php file code in text editor
Stroller wrote: On 23 Jun 2010, at 07:18, Mick wrote: I am looking at some php files which are causing parsing errors in Drupal, like: = Warning: Unexpected character in input: ' in /var/www/htdocs/sites/all/themes/fusion/fusion_core/template.php on line 178 Warning: Unexpected character in input: ' in /var/www/htdocs/sites/all/themes/fusion/fusion_core/template.php on line 178 Warning: Unexpected character in input: ' in /var/www/htdocs/sites/all/themes/fusion/fusion_core/template.php on line 178 = and so on. When I view the file using a text editor I see a number of lines which are shown as binary characters ... should it be like this? = $dimensions = !empty($node-height) !empty($node-width) !empty($node-length); // Hide dimensions if empty $vars['fusion_uc_dimensions'] = ($dimensions) ? drupal_render($node-content['dimensions']) : ''; if ($vars['fusion_uc_dimensions'] == '') { unset($node-content['dimensions']); } $list_price = !empty($node-list_price) $node-list_price 0; ^...@^@^...@^@^...@^@^...@^@^...@^@^...@^@^...@^@^...@^@^...@^@^...@^@^...@^@^...@^@^...@^@^...@^@^...@^@^...@^@^...@^@^...@^@^...@^@^...@^@^...@^@^...@^@^...@^@^...@^@^...@^@^...@^@^...@^@^...@^@^...@^@^...@^@^...@^@^...@^@^...@^@^...@^@^...@^@^...@^@^...@^@^...@^@^...@^@^...@^@^...@^@^...@^@^...@^@^...@^@^...@^@^...@^@^...@^@^...@^@^...@^@^...@^@^...@^@^...@^@^...@^@^...@^@^...@^@^...@^@^...@^@^...@^@^...@^@^...@^@^...@^@^...@^@^...@^@^...@^@^...@^@^...@^@^...@^@^...@^@^...@^@^...@^@^...@^@^...@^@^...@^@^...@^@^...@^@^...@^@^...@^@^...@^@^...@^@^...@^@^...@^@ See this line here with all the ^@, delete it, or better yet comment it out, and see if it runs the same, it is not part of the php file, so maybe it was dumped during a refactoring session or the like. regards, Roundyz
Re: [gentoo-user] reading php file code in text editor
Mick wrote: On 23 June 2010 13:48, roun...@hotmail.ru wrote: Stroller wrote: On 23 Jun 2010, at 07:18, Mick wrote: I am looking at some php files which are causing parsing errors in Drupal, like: @^...@^@^...@^@^...@^@^...@^@^...@^@^...@^@^...@^@^...@^@^...@^@^...@^@^@ See this line here with all the ^@, delete it, or better yet comment it out, and see if it runs the same, it is not part of the php file, so maybe it was dumped during a refactoring session or the like. Thanks guys, I've tried all sort of 'fixes' like trying to add escape characters, using closing tags, completely deleting the null symbols and what not, but loading the page in drupal still causes similar parsing errors although not always at the last line. The files in question are attached in this message. When looking at them with a hex editor I see this: 27b0 20 7d 0d 0a 20 20 20 20 24 6c 69 73 74 5f 70 72 | }.. $list_pr| 27c0 69 63 65 20 3d 20 21 65 6d 70 74 79 28 24 6e 6f |ice = !empty($no| 27d0 64 65 2d 3e 6c 69 73 74 5f 70 72 69 63 65 29 20 |de-list_price) | 27e0 26 26 20 24 6e 6f 64 65 2d 3e 6c 69 73 74 5f 70 | $node-list_p| 27f0 72 69 63 65 20 3e 20 30 3b 20 20 20 20 20 20 20 |rice 0; | 2800 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 || * 6170 00 00 00 00 00 00 00 00 || 6178 It is the last 5 lines that seem to cause the problem. Any idea why they are shown as binary in text editors (using vim, or less)? PS. I just looked at earlier (stable) versions of these files here: http://drupal.org/project/skinr and here: http://drupal.org/project/fusion and they do not have the binary characters at the end - so this could well be a problem with the development versions. I'll try the stable versions when I get home and report back. You could use split to chop of the last 5 lines -- Regards, Roundyz
Re: [gentoo-user] reading php file code in text editor
On 23 Jun 2010, at 13:22, Mick wrote: ... I've tried all sort of 'fixes' like trying to add escape characters, using closing tags, completely deleting the null symbols and what not, but loading the page in drupal still causes similar parsing errors although not always at the last line. The files in question are attached in this message. Well, I can confirm that these file show the same symptoms on vim here, so it's not totally a bug with your text editor. First step should perhaps be to report the bug to Drupal themselves. I get the same garbage using vim here on my Mac, but interestingly not if I open the file in TextEdit (like Notepad). In vim the files both seem to terminate in this junk, and it kinda seem like vim doesn't want to scroll down properly when it encounters it. In TextEdit I do see a handful of blank spaces at the end of template.php, and if I delete these then reopen in vim, the garbage is gone. I would be glad to send you copies of both files fixed, but I suspect the files are truncated, and that that would leave stuff missing - the ^...@^@^...@^@^@ has been written over the real content, I think. Stroller.
Re: [gentoo-user] reading php file code in text editor
On 06/23/10 08:22, Mick wrote: PS. I just looked at earlier (stable) versions of these files here: http://drupal.org/project/skinr [...] and they do not have the binary characters at the end - so this could well be a problem with the development versions. Perhaps it was just a corrupt download. I grabbed skinr-6.x-1.x-dev.tar.gz, and the skinr.module file was fine. (I assume you got the same one, as the cvs $Id:$ is identical to the one you posted.)
Re: [gentoo-user] reading php file code in text editor
On 23 June 2010 21:06, Vincent Launchbury vinc...@doublecreations.com wrote: On 06/23/10 08:22, Mick wrote: PS. I just looked at earlier (stable) versions of these files here: http://drupal.org/project/skinr [...] and they do not have the binary characters at the end - so this could well be a problem with the development versions. Perhaps it was just a corrupt download. I grabbed skinr-6.x-1.x-dev.tar.gz, and the skinr.module file was fine. (I assume you got the same one, as the cvs $Id:$ is identical to the one you posted.) Guys thanks for your help. I thought of a corrupt download too, but couldn't explain that happening more than once with different files. Then I noticed a pattern developing ... If the download took place on a ntfs partition (used to share files with a MSWindows OS) and then transfered over to reiserfs where Gentoo and the drupal server lives, well, all these phenomena of corrupt files seem to take place. I cannot honestly explain this! Why is it that if the download and unzipping takes place using ntfs-3g on the said ntfs partition the php files get corrupted? This is what mount shows: /dev/sda9 on /mnt/VideoDrive type fuseblk (rw,nosuid,nodev,noatime,allow_other,blksize=4096) Probably I did something wrong ... will keep an eye out for similar errors in the future, because I just tried this again and there does not seem to be a problem with it now. Thanks for your help and sorry for the noise. -- Regards, Mick