Permalink
Browse files

- Bug #17317 Invalid periods in mailbox not marked as invalid

- Added Makefile for tests


git-svn-id: http://svn.php.net/repository/pear/packages/Mail/trunk@307486 c90b9560-bf6c-de11-be94-00142212c4b1
  • Loading branch information...
1 parent 28f9797 commit a1ef6b7dd1c9755f55940d9819b0546f461488cc Aleksander Machniak committed Jan 14, 2011
Showing with 33 additions and 1 deletion.
  1. +5 −1 Mail/RFC822.php
  2. +1 −0 package.xml
  3. +8 −0 tests/Makefile
  4. +19 −0 tests/bug17317.phpt
View
@@ -888,7 +888,7 @@ function _validateLocalPart($local_part)
$words = array();
// Split the local_part into words.
- while (count($parts) > 0){
+ while (count($parts) > 0) {
$words[] = $this->_splitCheck($parts, '.');
for ($i = 0; $i < $this->index + 1; $i++) {
array_shift($parts);
@@ -897,6 +897,10 @@ function _validateLocalPart($local_part)
// Validate each word.
foreach ($words as $word) {
+ // word cannot be empty (#17317)
+ if ($word === '') {
+ return false;
+ }
// If this word contains an unquoted space, it is invalid. (6.2.4)
if (strpos($word, ' ') && $word[0] !== '"')
{
View
@@ -35,6 +35,7 @@
<license uri="http://www.opensource.org/licenses/bsd-license.php">BSD Style</license>
<notes>
Fixed Bug #18109: New "pipelining" parameter for SMTP backend never used [alec]
+Fixed Bug #17317: Invalid periods in mailbox not marked as invalid [alec]
</notes>
<contents>
<dir baseinstalldir="/" name="/">
View
@@ -0,0 +1,8 @@
+
+clean:
+ rm -f *.log *.php *.diff *.exp *.out
+
+
+
+test:
+ cd .. && pear run-tests tests/*.phpt && cd tests;
View
@@ -0,0 +1,19 @@
+--TEST--
+Mail_RFC822::parseAddressList invalid periods in mail address
+--FILE--
+<?php
+require "Mail/RFC822.php";
+
+$result[] = Mail_RFC822::parseAddressList('.name@example.com');
+$result[] = Mail_RFC822::parseAddressList('name.@example.com');
+$result[] = Mail_RFC822::parseAddressList('name..name@example.com');
+
+foreach ($result as $r) {
+ if (is_a($r, 'PEAR_Error')) {
+ echo "OK\n";
+ }
+}
+--EXPECT--
+OK
+OK
+OK

0 comments on commit a1ef6b7

Please sign in to comment.