Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 398569 - dev-lang/php-5.3.9 has problems with stream_get_line()
Summary: dev-lang/php-5.3.9 has problems with stream_get_line()
Status: RESOLVED WORKSFORME
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Server (show other bugs)
Hardware: AMD64 Linux
: Normal normal (vote)
Assignee: PHP Bugs
URL: https://github.com/davidpersson/beans...
Whiteboard:
Keywords: REGRESSION
Depends on:
Blocks:
 
Reported: 2012-01-11 18:19 UTC by Alexander Haensch
Modified: 2012-01-23 13:40 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alexander Haensch 2012-01-11 18:19:53 UTC
It looks like that the new php version has a problem with talking to beanstalkd on a local socket.

example code:
$packet = stream_get_line($this->_connection, 16384, "\r\n");

see:
$packet = stream_get_line($this->_connection, 16384, "\r\n");

Reproducible: Always

Steps to Reproduce:
1. Start to talk with beanstalkd 
2. Wait for Timeout
3.
Actual Results:  
operation needs more than 60s

Expected Results:  
operation should be done in less than a second
Comment 1 Alexander Haensch 2012-01-11 18:20:29 UTC
URL of the code:

https://github.com/davidpersson/beanstalk/blob/master/src/Socket/Beanstalk.php#L190
Comment 2 Ole Markus With (RETIRED) gentoo-dev 2012-01-12 10:42:37 UTC
To simplify things (I have no idea what beanstalkd is) I created (copied) this script to test stream_get_line. It is working as expected for me on php 5.3.9.

<?php
$fp = fsockopen("www.google.com", 80, $errno, $errstr, 30);
if (!$fp) {
    echo "$errstr ($errno)<br />\n";
} else {
    $out = "GET / HTTP/1.1\r\n";
    $out .= "Host: www.google.com\r\n";
    $out .= "Connection: Close\r\n\r\n";
    fwrite($fp, $out);
    while (!feof($fp)) {
        echo stream_get_line($fp, 128);
    }
    fclose($fp);
}
Comment 3 Ole Markus With (RETIRED) gentoo-dev 2012-01-22 20:11:31 UTC
As I received no further feedback, I am closing this one as worksforme. Please reopen if a simple example of how to reproduce this bug is found.
Comment 4 alexander haensch 2012-01-23 11:40:26 UTC
(In reply to comment #3)
> As I received no further feedback, I am closing this one as worksforme. Please
> reopen if a simple example of how to reproduce this bug is found.

There is a bug filed at PHP and at beanstalkd.
Today a patch was submitted here:

svn diff http://svn.php.net/repository/php/php-src/branches/PHP_5_3/main/streams/streams.c@322581 http://svn.php.net/repository/php/php-src/branches/PHP_5_3/main/streams/streams.c@322582

How can i put an additional .patch file into the php-patchset file? I'm always getting errors:

***** 016_all_stream_get_line.patch *****
PWD: /var/tmp/portage/dev-lang/php-5.3.9-r1/work/php-5.3.9

=========================================

PATCH COMMAND:  patch -p0 -g0 -E --no-backup-if-mismatch < '/var/tmp/portage/dev-lang/php-5.3.9-r1/work/5.3.9/generic/016_all_stream_get_line.patch'

=========================================
can't find file to patch at input line 4
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|diff -u a/ext/curl/streams.c b/ext/curl/streams.c
|--- a/ext/curl/streams.c   (Revision 322581)
|+++ b/ext/curl/streams.c   (Revision 322582)
--------------------------
No file to patch.  Skipping patch.
1 out of 1 hunk ignored
Comment 5 alexander haensch 2012-01-23 11:46:20 UTC
The bugs can be found here:

https://bugs.php.net/bug.php?id=60719

https://github.com/kr/beanstalkd/issues/88
Comment 6 Ole Markus With (RETIRED) gentoo-dev 2012-01-23 12:06:25 UTC
The easiest way is to drop the patch into /etc/portage/patches/dev-lang/php/
Comment 7 alexander haensch 2012-01-23 13:40:31 UTC
Thanks. 
The patch applied fine from the /etc.. dir
I will test the patch against 5.3.9 soon an report if it worked.