The momentum operator is usually defined as
$$\hat p = -i \hbar \frac d {dx}$$
The eigenfunctions of this operator are plane waves
$$\tag{1} \label{1} \psi_p(x) = A \exp\left(\frac{i p x}{\hbar}\right)$$
and they are not square-integrable, i.e.
$$\int_{\mathbb R} | \psi_p(x)|^2 dx = \infty$$
therefore, it is usually said that a free particle with a well-defined momentum is a physical impossibility.
But we have considered a case in which the wavefunction $\psi$ can extend from $-\infty$ to $\infty$. In general, the wavefunction $\psi$ should satisfy the following conditions:
$$\tag{2} \label{2} \psi \in C^0 (\mathbb R)$$ $$\tag{3} \label{3} \int_\mathbb{R} | \psi(x)|^2 dx = 1$$
In the case of an infinite square-well potential
$$V(x) = 0 \ \ \ \text{if} \ x \in [0,L]$$ $$V(x) = \infty \ \ \ \text{if} \ x \notin [0,L]$$
we usually require that
$$\tag{4} \label{4} \psi(x) = 0 \ \ \ \text{if} \ x \notin [0,L]$$
so that \ref{2} implies
$$\tag{5} \label{5} \psi(L)=\psi(0)=0$$
But by applying \ref{5} to \ref{1}, we obtain
$$\tag{6} \label{6} e^{ipL/\hbar}=1=0$$
which is clearly absurd and cannot be valid.
However, in this article the authors introduce a self-adjoint extension of the operator $\hat p$ (which they call $P_\theta$) by replacing \ref{5} with
$$\tag{7}\label{7} \psi(L)=e^{i \theta} \psi(0)$$
from which they obtain the "momentum eigenfunctions"
$$\tag{8} \label{8} \phi_n(x,\theta) = \frac 1 {\sqrt{L}} \exp \left(2 i \pi \nu \frac x L \right), \ \ \ \nu = n + \frac{\theta}{2 \pi}, \ \ \ n \in \mathbb Z$$
They conclude with the remark
For a particle in a box, it is often argued that the “physical” wave function should continuously vanish on the walls $x = 0$ and $x = L$, ensuring that the presence probability vanishes continuously for $x ≤0$ and for $x ≥ L$. One should realize that the continuity of the measurable quantity
$$ Pr(0 ≤ x ≤ u) = \int_0^u |\phi(x)|^2 dx, \ \ \ u \in[0,L] $$ is ensured as soon as the integral $\int_0^L |\phi(x)|^2 dx $ does converge and does not require any continuity property of $\phi(x)$. Specializing this remark to the eigenfunctions of $P_\theta$ we observe that $|\phi_n(x,\theta)|^2$ does not vanish continuously at $x=0$ but nevertheless the physical quantity $$Pr(0 ≤ x ≤ u) = \frac{u}{L}$$ vanishes continuously, as it should, for $u \to 0$.
They also say that the Heisenberg inequlity is not valid for the "momentum eigenfunctions" of Eq. \ref{8}, and indeed we would obtain
$$\sigma_p = 0$$ $$\sigma_x = \frac{L}{\sqrt {12}}$$
From a mathematical point of view, their reasoning is more or less clear to me: if we replace \ref{5} with \ref{7} and restrict ourselves to the interval $[0,L]$, it is possible to extend the momentum operator, making it self-adjoint, and to introduce eigenfunctions for this extended version. But is this reasoning physically meaningful?
In particular, what about the value of the wavefunction outside the interval $[0,L]$? Also, what about the Heisenberg inequality? Is the fact that it is not valid acceptable from a physical point of view?
Update
I don't understand if the authors are implying that the wave function is set to $0$ for $x \notin [0,L]$; if this was the case, shouldn't we have the problem that $Pr(0\leq x \leq u)$ is discontinuous at $u=L$?