\documentclass{article}
\usepackage{xepersian}
\makeatletter
\@ifpackageloaded{bidiftnxtra}{}{%
\let\FN@sf@@footnote\footnote
\let\FN@sf@@LTRfootnote\LTRfootnote
\let\FN@sf@@RTLfootnote\RTLfootnote
\def\footnote{\ifx\protect\@typeset@protect
\expandafter\FN@sf@@footnote
\else
\expandafter\FN@sf@gobble@opt
\fi
}
\def\LTRfootnote{\ifx\protect\@typeset@protect
\expandafter\FN@sf@@LTRfootnote
\else
\expandafter\FN@sf@gobble@opt
\fi
}
\def\RTLfootnote{\ifx\protect\@typeset@protect
\expandafter\FN@sf@@RTLfootnote
\else
\expandafter\FN@sf@gobble@opt
\fi
}
\edef\FN@sf@gobble@opt{\noexpand\protect
\expandafter\noexpand\csname FN@sf@gobble@opt \endcsname}
\expandafter\def\csname FN@sf@gobble@opt \endcsname{%
\@ifnextchar[%]
\FN@sf@gobble@twobracket
\@gobble
}
\def\FN@sf@gobble@twobracket[#1]#2{}
\let\FN@sf@@footnotemark\footnotemark
\def\footnotemark{\ifx\protect\@typeset@protect
\expandafter\FN@sf@@footnotemark
\else
\expandafter\FN@sf@gobble@optonly
\fi
}
\edef\FN@sf@gobble@optonly{\noexpand\protect
\expandafter\noexpand\csname FN@sf@gobble@optonly \endcsname}
\expandafter\def\csname FN@sf@gobble@optonly \endcsname{%
\@ifnextchar[%]
\FN@sf@gobble@bracket
{}%
}
\def\FN@sf@gobble@bracket[#1]{}
}
\makeatother
\begin{document}
\tableofcontents
\section{مقدمه\footnote{آزمایش}}
\end{document}