News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

Error in post.php

Started by Rohan_, July 25, 2011, 12:55:22 PM

Previous topic - Next topic

Rohan_

Hello,

In my Error Log I see

Undefined index: icon
File: /home/mydomain/public_html/Sources/Post.php
Line: 1615

But postings are fine.. what is causing this ?
Proud To Be An Indian

All Colours Sam

Whats on that line?  can you attach that file here.
Oh, wouldn't it be great if I *was* crazy? ...then the world would be okay
Suki

Rohan_

I have attached it.. please check
Proud To Be An Indian

MrPhil

Here's the line in question:
'icon' => preg_replace('~[\./\\\\*\':"<>]~', '', $_POST['icon']),
The error message says that there is no "icon" element in the POST data. If that is something reasonable (i.e., not an error condition itself), it could be fixed:
'icon' => preg_replace('~[\./\\\\*\':"<>]~', '', (isset($_POST['icon'])? $_POST['icon'], '')),

Before you do that, the preg_replace search pattern looks a bit odd. It's looking for a single character chosen from:
  \.  -> a literal period  .
/    -> a forward slash  /
\\   -> a backslash  \
\\   -> another backslash  \     ? why ?
*   -> a star  *
\'   -> an apostrophe/single quote  '
:    -> a colon  :
"    -> a quotation mark  "
<   -> a left angle bracket  <
>   -> a right angle bracket  >

I'm wondering if there is an extra backslash in the list, and the intent was to escape (unnecessarily) the * like this: \*
'icon' => preg_replace('~[\./\\\*\':"<>]~', '', $_POST['icon']),

In fact, I think you can remove more of the backslashes:
'icon' => preg_replace('~[./\\*\':"<>]~', '', $_POST['icon']),

I have no idea if this has any bearing on the original problem...

Advertisement: