|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2003-12-01 02:13 UTC] sniper@php.net
[2003-12-01 03:26 UTC] ipa at beta dot lt
[2003-12-01 03:56 UTC] derick@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Nov 03 02:00:02 2025 UTC |
Description: ------------ Sockets' socket_read() left 8 bytes in memory. Example configure: './configure' '--enable-versioning' '--enable-memory-limit' '--with-layout=GNU' '--with-zlib-dir=/usr' '--disable-all' '--with-regex=php' '--disable-cli' '--enable-ctype' '--with-dom=/usr/local' '--with-gd' '--enable-gd-native-ttf' '--enable-gd-jis-conv' '--with-freetype-dir=/usr/local' '--with-jpeg-dir=/usr/local' '--with-png-dir=/usr/local' '--with-xpm-dir=/usr/local' '--with-mysql=/usr/local' '--enable-overload' '--with-pcre-regex=yes' '--enable-posix' '--enable-session' '--enable-sockets' '--enable-tokenizer' '--with-expat-dir=/usr/local' '--enable-xml' '--with-zlib=yes' '--with-apxs2=/usr/local/sbin/apxs' '--with-imap=/usr/local' '--with-imap-ssl=/usr/local' '--prefix=/usr/local' 'i386-portbld-freebsd4.8' but reproducable on linux too. Reproduce code: --------------- function foo(){ $socket = socket_create (AF_INET, SOCK_STREAM, 0); $result = socket_connect ($socket, gethostbyname ('www.example.com'), 80); $in = "HEAD / HTTP/1.0\r\n\r\n"; socket_write ($socket, $in, strlen ($in)); while ($out = socket_read ($socket, 2048)) { /* .. */ } socket_close ($socket); } foo(); echo memory_get_usage() . "<br>"; foo(); echo memory_get_usage() . "<br>"; foo(); echo memory_get_usage() . "<br>"; Expected result: ---------------- xxxxx bytes. xxxxx bytes. xxxxx bytes. Actual result: -------------- xxxxx bytes. xxxxx + 8 bytes. xxxxx + 16 bytes. ... xxxxx + (n * 8) bytes.