: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
* @param string $ifragment
protected function set_fragment($ifragment) {
if ($ifragment === null) {
$this->ifragment = $this->replace_invalid_with_pct_encoding($ifragment, '!$&\'()*+,;=:@/?');
$this->scheme_normalization();
* Convert an IRI to a URI (or parts thereof)
* @param string|bool $iri IRI to convert (or false from {@see \WpOrg\Requests\Iri::get_iri()})
* @return string|false URI if IRI is valid, false otherwise.
protected function to_uri($iri) {
$non_ascii = implode('', range("\x80", "\xFF"));
while (($position += strcspn($iri, $non_ascii, $position)) < $strlen) {
$iri = substr_replace($iri, sprintf('%%%02X', ord($iri[$position])), $position, 1);
protected function get_iri() {
if (!$this->is_valid()) {
if ($this->scheme !== null) {
$iri .= $this->scheme . ':';
if (($iauthority = $this->get_iauthority()) !== null) {
$iri .= '//' . $iauthority;
if ($this->iquery !== null) {
$iri .= '?' . $this->iquery;
if ($this->ifragment !== null) {
$iri .= '#' . $this->ifragment;
protected function get_uri() {
return $this->to_uri($this->get_iri());
* Get the complete iauthority
protected function get_iauthority() {
if ($this->iuserinfo === null && $this->ihost === null && $this->port === null) {
if ($this->iuserinfo !== null) {
$iauthority .= $this->iuserinfo . '@';
if ($this->ihost !== null) {
$iauthority .= $this->ihost;
if ($this->port !== null) {
$iauthority .= ':' . $this->port;
* Get the complete authority
protected function get_authority() {
$iauthority = $this->get_iauthority();
if (is_string($iauthority)) {
return $this->to_uri($iauthority);