# pop3 patch

- Thread: https://externals.io/message/31999
- Original archive: https://news-web.php.net/php.internals/31999
- Started by BuildSmart on 2007-08-31T14:26:32+00:00
- Messages: 6
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #31999 — BuildSmart — 2007-08-31T14:26:32+00:00

URL: https://externals.io/message/31999#31999

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

A quick fix to get pop3 working in PHP6, there might be a better way  
but this solution seemed to work with the least amount of changes,  
tested in 4.3.10, 4.4.0, 5.1.6, 5.2.3 and 6.0.0-dev all of which worked.

link:
http://daleenterprise.com/pop3.diff

diff file:
diff -Naur ext/pop3.orig/pop3.c ext/pop3/pop3.c
- --- ext/pop3.orig/pop3.c	2006-10-11 20:23:48.000000000 -0400
+++ ext/pop3/pop3.c	2007-08-31 10:21:21.000000000 -0400
@@ -1,8 +1,8 @@
/*
     
+----------------------------------------------------------------------+
- -  | PHP Version  
4                                                        |
+  | PHP Version 4, 5,  
6                                                  |
     
+----------------------------------------------------------------------+
- -  | Copyright (c) 1997-2004 The PHP  
Group                                |
+  | Copyright (c) 1997-2007 The PHP  
Group                                |
     
+----------------------------------------------------------------------+
    | This source file is subject to version 3 of the PHP  
license,         |
    | that is bundled with this package in the file LICENSE, and  
is        |
@@ -14,9 +14,10 @@
     
+----------------------------------------------------------------------+
    | Authors:    Marco Tabini  
<marcot@tabini.ca>                          |
    |             Ilia Alshanetsky  
<ilia@php.net>                          |
+  |             Dale Walsh  
<buildsmart@daleenterprise.com>               |
     
+----------------------------------------------------------------------+
- -  $Id: pop3.c,v 1.21 2006/10/12 00:23:48 iliaa Exp $
+  $Id: pop3.c,v 1.22 2007/08/31 09:23:48 iliaa Exp $
*/
#ifdef HAVE_CONFIG_H
@@ -42,7 +43,7 @@
/* {{{ Internal macros */
- -#define POP3_VERSION "1.0.2"
+#define POP3_VERSION "1.0.3"
#define POP3_RESOURCE_NAME	"POP3 Library Session"
#define POP3_FETCH_SESSION(session, session_container)	\
@@ -100,7 +101,11 @@
	char buffer[2048];
	size_t fetch_len;
+#if `PHP_MAJOR_VERSION` > 4
+	if (!php_stream_get_line(stream, ZSTR(buffer), sizeof(buffer) - 1,  
&fetch_len)) {
+#else
	if (!php_stream_get_line(stream, buffer, sizeof(buffer) - 1,  
&fetch_len)) {
+#endif
		php_error_docref(NULL TSRMLS_CC, E_ERROR, "I/O Error when receiving  
data from the server");
	}
@@ -583,7 +588,11 @@
	do {
		zval *row;
+#if `PHP_MAJOR_VERSION` > 4
+		if (!php_stream_gets(stream, ZSTR(pop3_return_val), sizeof 
(pop3_return_val) - 1)) {
+#else
		if (!php_stream_gets(stream, pop3_return_val, sizeof 
(pop3_return_val) - 1)) {
+#endif
			php_error_docref(NULL TSRMLS_CC, E_WARNING, "POP3: Unable to  
retrieve message list");
			zval_dtor(return_value);
			RETURN_FALSE;
@@ -643,7 +652,11 @@
	do {
+#if `PHP_MAJOR_VERSION` > 4
+		if (!php_stream_gets(stream, ZSTR(pop3_return_val), sizeof 
(pop3_return_val) - 1)) {
+#else
		if (!php_stream_gets(stream, pop3_return_val, sizeof 
(pop3_return_val) - 1)) {
+#endif
			php_error_docref(NULL TSRMLS_CC, E_WARNING, "POP3: Unable to  
retrieve message list");
			zval_dtor(return_value);
			RETURN_FALSE;
@@ -758,7 +771,11 @@
	length = 0;
	do {
+#if `PHP_MAJOR_VERSION` > 4
+		if (!php_stream_get_line(stream, ZSTR(pop3_return_val), sizeof 
(pop3_return_val) - 1, &fetch_len)) {
+#else
		if (!php_stream_get_line(stream, pop3_return_val, sizeof 
(pop3_return_val) - 1, &fetch_len)) {
+#endif
			efree(result);
			php_error_docref(NULL TSRMLS_CC, E_WARNING, "POP3: I/O failure  
reading from server");
			RETURN_FALSE;

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.2 (Darwin)

iD8DBQFG2CUZ0hzWbkf0eKgRAljEAKCWQLRmOxgDjx7RvxUiQQlMypHxQwCeMpuy
UVPNfP/veKki0uZKlVodriQ=
=c0Vr
-----END PGP SIGNATURE

---

## #32001 — Jani Taskinen — 2007-08-31T14:57:58+00:00

URL: https://externals.io/message/31999#32001 · In reply to: #31999

This is not the list your looking for..try the pecl list instead:
http://pecl.php.net/support.php#lists

--Jani


> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> A quick fix to get pop3 working in PHP6, there might be a better way  
> but this solution seemed to work with the least amount of changes,  
> tested in 4.3.10, 4.4.0, 5.1.6, 5.2.3 and 6.0.0-dev all of which worked.
> 
> link:
> http://daleenterprise.com/pop3.diff
> 
> diff file:
> diff -Naur ext/pop3.orig/pop3.c ext/pop3/pop3.c
> - --- ext/pop3.orig/pop3.c	2006-10-11 20:23:48.000000000 -0400
> +++ ext/pop3/pop3.c	2007-08-31 10:21:21.000000000 -0400
> @@ -1,8 +1,8 @@
> /*
>      
> +----------------------------------------------------------------------+
> - -  | PHP Version  
> 4                                                        |
> +  | PHP Version 4, 5,  
> 6                                                  |
>      
> +----------------------------------------------------------------------+
> - -  | Copyright (c) 1997-2004 The PHP  
> Group                                |
> +  | Copyright (c) 1997-2007 The PHP  
> Group                                |
>      
> +----------------------------------------------------------------------+
>     | This source file is subject to version 3 of the PHP  
> license,         |
>     | that is bundled with this package in the file LICENSE, and  
> is        |
> @@ -14,9 +14,10 @@
>      
> +----------------------------------------------------------------------+
>     | Authors:    Marco Tabini  
> <marcot@tabini.ca>                          |
>     |             Ilia Alshanetsky  
> <ilia@php.net>                          |
> +  |             Dale Walsh  
> <buildsmart@daleenterprise.com>               |
>      
> +----------------------------------------------------------------------+
> - -  $Id: pop3.c,v 1.21 2006/10/12 00:23:48 iliaa Exp $
> +  $Id: pop3.c,v 1.22 2007/08/31 09:23:48 iliaa Exp $
> */
> #ifdef HAVE_CONFIG_H
> @@ -42,7 +43,7 @@
> /* {{{ Internal macros */
> - -#define POP3_VERSION "1.0.2"
> +#define POP3_VERSION "1.0.3"
> #define POP3_RESOURCE_NAME	"POP3 Library Session"
> #define POP3_FETCH_SESSION(session, session_container)	\
> @@ -100,7 +101,11 @@
> 	char buffer[2048];
> 	size_t fetch_len;
> +#if `PHP_MAJOR_VERSION` > 4
> +	if (!php_stream_get_line(stream, ZSTR(buffer), sizeof(buffer) - 1,  
> &fetch_len)) {
> +#else
> 	if (!php_stream_get_line(stream, buffer, sizeof(buffer) - 1,  
> &fetch_len)) {
> +#endif
> 		php_error_docref(NULL TSRMLS_CC, E_ERROR, "I/O Error when receiving  
> data from the server");
> 	}
> @@ -583,7 +588,11 @@
> 	do {
> 		zval *row;
> +#if `PHP_MAJOR_VERSION` > 4
> +		if (!php_stream_gets(stream, ZSTR(pop3_return_val), sizeof 
> (pop3_return_val) - 1)) {
> +#else
> 		if (!php_stream_gets(stream, pop3_return_val, sizeof 
> (pop3_return_val) - 1)) {
> +#endif
> 			php_error_docref(NULL TSRMLS_CC, E_WARNING, "POP3: Unable to  
> retrieve message list");
> 			zval_dtor(return_value);
> 			RETURN_FALSE;
> @@ -643,7 +652,11 @@
> 	do {
> +#if `PHP_MAJOR_VERSION` > 4
> +		if (!php_stream_gets(stream, ZSTR(pop3_return_val), sizeof 
> (pop3_return_val) - 1)) {
> +#else
> 		if (!php_stream_gets(stream, pop3_return_val, sizeof 
> (pop3_return_val) - 1)) {
> +#endif
> 			php_error_docref(NULL TSRMLS_CC, E_WARNING, "POP3: Unable to  
> retrieve message list");
> 			zval_dtor(return_value);
> 			RETURN_FALSE;
> @@ -758,7 +771,11 @@
> 	length = 0;
> 	do {
> +#if `PHP_MAJOR_VERSION` > 4
> +		if (!php_stream_get_line(stream, ZSTR(pop3_return_val), sizeof 
> (pop3_return_val) - 1, &fetch_len)) {
> +#else
> 		if (!php_stream_get_line(stream, pop3_return_val, sizeof 
> (pop3_return_val) - 1, &fetch_len)) {
> +#endif
> 			efree(result);
> 			php_error_docref(NULL TSRMLS_CC, E_WARNING, "POP3: I/O failure  
> reading from server");
> 			RETURN_FALSE;
> 
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.2.2 (Darwin)
> 
> iD8DBQFG2CUZ0hzWbkf0eKgRAljEAKCWQLRmOxgDjx7RvxUiQQlMypHxQwCeMpuy
> UVPNfP/veKki0uZKlVodriQ=
> =c0Vr
> -----END PGP SIGNATURE-----
> 
-- 
Make me happy: http://pecl.php.net/wishlist.php/jani

---

## #32002 — BuildSmart — 2007-08-31T15:20:43+00:00

URL: https://externals.io/message/31999#32002 · In reply to: #32001

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Funny but I was told to just publish my patches here and the  
appropriate person would pick up the info however, anything not  
directly included with the php distro will be submitted to the pecl  
list.



> This is not the list your looking for..try the pecl list instead:
> http://pecl.php.net/support.php#lists
>
> --Jani
>
> 
> > […]
> -- 
> Make me happy: http://pecl.php.net/wishlist.php/jani

- -- BuildSmart


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.2 (Darwin)

iD8DBQFG2DHL0hzWbkf0eKgRAu0uAKDUCTnRdj8AAYhCbie7lokYfPk6HQCg3LC4
tasr3uWrqVYsCurpJcTGbqs=
=/4Ed
-----END PGP SIGNATURE

---

## #32005 — Antony Dovgal — 2007-08-31T21:11:04+00:00

URL: https://externals.io/message/31999#32005 · In reply to: #31999

> +#if `PHP_MAJOR_VERSION` > 4
> +	if (!php_stream_get_line(stream, ZSTR(buffer), sizeof(buffer) - 1,  
> &fetch_len)) {
> +#else

Are you sure PHP > 4 has ZSTR() macro ?

-- 
Wbr, 
Antony Dovgal

---

## #32006 — BuildSmart — 2007-09-01T02:15:12+00:00

URL: https://externals.io/message/31999#32006 · In reply to: #32005

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1



> 
> > […]
>
> Are you sure PHP > 4 has ZSTR() macro ?

That should have been "PHP_MAJOR_VERSION > 5".

Unfortunately due to "-undefined suppress" it doesn't catch the  
error, however, forcing "-undefined dynamic_lookup" solves this  
problem and is the preferred flag, simply setting an environment  
variable resolve this.

> -- 
> Wbr,
> Antony Dovgal

- -- Dale
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.2 (Darwin)

iD8DBQFG2Msw0hzWbkf0eKgRAiwEAJ47DZ7FMe2MtcUEucSHSojrQ1KKtQCaAwBz
gyC4FPfzpXSu5WwqXCSkwXM=
=8Ak5
-----END PGP SIGNATURE

---

## #32007 — Pierre — 2007-09-01T09:12:15+00:00

URL: https://externals.io/message/31999#32007 · In reply to: #32002

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Funny but I was told to just publish my patches here and the
> appropriate person would pick up the info however, anything not
> directly included with the php distro will be submitted to the pecl
> list.

I told you that pecl packages have their own development list and
their own issues tracker. The best way to contact the maintainers is
to post a bug with a link to the patch. Alternatively you can post it
as well on the pecl-dev list.

Posting patches to the issues tracker works as well for php. It is the
best way to do not lost them in the mailing list archive and to be
sure that a developer will review it.

Thanks for your work anyway! :)

Cheers,
--Pierre
