Closed edermartins closed 5 years ago
Hello,
Is it possible that
$this->street[count($this->street)-1]
is a local amendment that you have made before? Because the repo i have already has
$this->street[count($this->street)] = htmlspecialchars($street, ENT_COMPAT, "UTF-8");
No change necessary.
The purpose of this function is that it counts from 0 to 2, so after filling, $street[0], $street[1] and $street[2] should be filled. If i change the code to
count($this->street) <= 3
then it would also fill $street[3], which is not intended.
I have tested the current code, without amendmends, using this test routine:
$postal = new \Metaregistrar\EPP\eppContactPostalInfo();
$postal->addStreet('Street 1');
$postal->addStreet('Street 2');
$postal->addStreet('Street 3');
$streets = $postal->getStreets();
var_dump($streets);
Result is as intended:
array(3) {
[0]=>
string(8) "Street 1"
[1]=>
string(8) "Street 2"
[2]=>
string(8) "Street 3"
}
Adding street number 4 gives me this:
Metaregistrar\EPP\eppException: Cannot add more then 3 street names to postal info
Sorry for that, I did a pull and the code is there. I am adding an extension for Brazil NicBR registrar.
The code for addStreet do not add the first line in the array and add only 2 lines in the array. It need to be changed to:
Changes:
if ((is_array($this->street)) && (count($this->street) < 3))
toif ((is_array($this->street)) && (count($this->street) <= 3))
$this->street[count($this->street)-1]
to$this->street[count($this->street)]