1

I run this code:

var_dump(stripos($virtualhost[1], "cold="));
echo '----------------------<br>';
var_dump($virtualhost[1]);

And I get the following result:

bool(false)
----------------------<br>
string(206) "<virtual-mta vmta1-cold=\"\">
bla-bla-bla\"

As you can see, the first var_dump directly contradicts the second. What can this be connected with, and how to avoid or circumvent this?

UPD (closer to reality): <virtual-mta vmta1-cold=""> <domain *=""> dkim-sign yes dkim-algorithm rsa-sha256 max-msg-rate 1000000/d max-cold-virtual-mta-msg 1000000/d </domain> smtp-source-host there is a certain IP there is a certain domain </virtual-mta>

  • __Nope__ https://3v4l.org/jjIML – u_mulder Oct 20 '19 at 16:35
  • Is there something in the fact it says `string(206)`? – Nigel Ren Oct 20 '19 at 16:36
  • There are some Unicode characters that look similar, but aren't actually the same. – Barmar Oct 20 '19 at 16:48
  • About similar characters: No, I copied a piece of output directly into the code, and that didn’t change anything. – Roman Balakirev Oct 20 '19 at 17:18
  • About content of string(206): dkim-sign yes dkim-algorithm rsa-sha256 max-msg-rate 1000000/d max-cold-virtual-mta-msg 1000000/d smtp-source-host there is a certain IP there is a certain domain – Roman Balakirev Oct 20 '19 at 17:29
  • Make an echo bin2hex($virtualhost[1]); and check if there is also contain 636f6c643d (for cold=). – jspit Oct 21 '19 at 06:45
  • It is very strange! bin2hex($virtualhost[1]) displays a hex in which there is no value 636f6c643d. However, if you echo $virtualhost[1] itself, then copy the output, paste it into the code and process it with bin2hex, then the hex will contain this value. But I need to process the value from $virtualhost[1]. How is the situation usually corrected in such cases? – Roman Balakirev Oct 21 '19 at 08:54

1 Answers1

0

For those who are experiencing a similar problem.

In my case, perhaps the point was that I got my array from the contents of the file, which, in turn, was received from the ssh-stream. Here's what I did: I saved this file to local hosting and opened it in notepad. And I saw that the contents of the file are different from my output!

Where I have <virtual-mta vmta1-cold=""> There was a local file <virtual-mta vmta1-cold> ... and a few more differences.

My goal was to identify the paragraphs, where after vmta comes this 'cold'. Then I decided to start from the contents of the local file and instead of looking for the cold= fragment I started looking for the -cold> fragment. And it worked.