Zend Weekly Summaries Issue #192

July 12, 2004


TLK: Memory leaks and PHP 5
BUG: file_get_contents()
TLK: Apache 2 fastcgi
TLK: sapi_flush() behaviour in PHP 4.3
FIX: 5.0-dev memory setting on win32 snaps
REQ: New language construct
NEW: SQLite 2.8.14 embedded
FIX: ‘Gready’ reads II
FIX: alloca() campaign ends
TLK: handling extended object properties
NEW: MySQL 4.1.3 support

TLK: Memory leaks and PHP 5

Following Andi Gutman’s decision to disable ZEND_MM following the memory
management problems last week, Rasmus Lerdorf suggested that anyone with the ability
and means to do so should put PHP 5 HEAD through some serious road tests with
Valgrind over the coming days. Sterling Hughes promptly requested, and was given,
shell access to a 32-bit Linux box for this purpose. Marcus Börger reported a few
minor leaks in his ZTS build that he diagnosed in this way, but if these were
reproduced in non-ZTS builds there was no mention of it on the public list.

Short version: Stable door, horse, bolt..

BUG: file_get_contents()

Andi, as PHP 5 Release Master, asked whether anyone else had any outstanding
contributions or ‘showstopper’ bugs to report, as he intended rolling PHP 5.0.0 by
the end of the week. Naturally there was a flurry of responses to this as everyone
mailed in a request that their favourite bug report should get some attention. The
most interesting of these was Curt Zirzow’s report that
file_get_contents() was completely broken on his system – not least
because nobody backed him up.

Curt also produced a patch to fix another of those reports, in which
exec() output array behaviour had changed unannounced somewhere between
PHP 4 and PHP 5.

Short version: Mystery bug appears out of nowhere – but only on one

TLK: Apache 2 fastcgi

Qingfeng Pan submitted a CVS account request, citing his Apache 2 fastcgi module
as the reason for wanting php.net karma. This sparked an unusually long discussion,
with Qingfeng’s work being
evaluated by a number of people and winning him a fair number of fans. In the end
the team agreed that the module should be presented as an Apache module rather than
as a PHP module, as it would get wider use there and could be adapted to other
languages as well as to PHP. They therefore advised Qingfeng Pan to take his work to
apache.org rather than to php.net.

Short version: A nicer form of fastcgi should turn up soon-ish as an
Apache 2 module.

TLK: sapi_flush() behaviour in PHP 4.3

George Schlossnagle came very close to overstepping the line between development
and the funny place when he started emailing himself mid-week.

Exhibit A:

Poking through the output buffering code, it seems like the only way
to force a sapi_flush() is to have implicit_flush set to true. Is this
correct? Is this intended? It seems like ob_flush() should trigger
sapi_flush(), at least if you're at the top level of buffers.

Exhibit B:

In answer to my own questions (thanks Zeev):

'Yes.', 'Yes.', and 'Use flush().'

Short version: It’s less embarrassing to try IRC before reaching
for your mail-client.

FIX: 5.0-dev memory setting on win32 snaps

Peter Rendl wrote in to say that the default memory limit was far too low in
win32 snapshots, causing PEAR builds to fail. He also reported being unable to
re-set it. Edin Kadribasic replied that this wasn’t possible, given that the memory
limit isn’t set in the win32 snapshot builds. Peter gave some evidence that the
memory limit was indeed being set. Edin promptly fixed the configure script that was
causing the issue.

Short version: If PEAR won’t build on win32, try a PHP

REQ: New language construct

Marc Richards opened Pandora’s Box when he submitted a simple enquiry as to the
fate of a feature request made by Jason Garber back in April. The proposed construct
would make it easier for PHP coders to check whether a variable is set, and assign a
default value when it is not.

Following over 60 emails on the subject, Marc then achieved the Golden Email
Award for this week with his "http://www.zend.com/lists/php-dev/200407/msg00232.html">summary of
the situation
. Everyone that already had stated his or her view, stated it in
greater depth in response to this mail. It was Adam Trachtenberg who pointed out
that we were into a bikeshed() discussion
at this stage. General laughter broke up the thread.

Short version: It’ll probably be called default()..

NEW: SQLite 2.8.14 embedded

Derrell Lipman’s one-man campaign to have PHP’s embedded SQLite library upgraded
before the 5.0.0 release bore fruit on Saturday, when Wez Furlong finally had enough
‘spare time’ to clean up and commit the new version. Derrell had also been in touch
with the SQLite developers, and brought the welcome news that the PHP teams’ changes
to the embedded library had been incorporated into SQLite’s own source. This
willingness to synchronize development should make it far less of an issue for the
PHP team to upgrade the embedded library on future occasions – let’s hope that it
stays, and that Derrell is equally happy to liaise between the teams another

Short version: Thanks Wez, Derrell and the SQLite team!

FIX: ‘Gready’ reads II

The ongoing saga of greedy reads further impacted Wez’s spare time. Standard
files weren’t happy with being read as though they were non-standard files (e.g.
urls) following his ‘gready read’ fix last week. Wez reverted the read behaviour for
standard files to be ‘gready’ and left everything else with his original
packet-based solution.

Short version: The file, the whole file, and nothing but the

FIX: alloca() campaign ends

Ilia Alshanetsky finally completed his one-man effort to clean up internal
alloca() usage following his discovery
a few weeks ago
that the function was unsafe in certain situations and could create
a stack overflow all too easily. Essentially, this unglamorous piece of work has made
several PHP 5 extensions a lot less liable to crash PHP than they were before.

Short version: Nice one, Ilia!

TLK: handling extended object properties

Rob Richards ran up against the problem of not being able to read properties in
extended objects. Unlike everyone else who hit this issue and backed off muttering
‘Zend Engine problem’, Rob actually had a good try at diagnosing the root of it
before mailing the list. Marcus suggested that it might come down to a trivial
oversight, and asked Rob if he could cook up a patch. Rob obliged with a patch that
supplied a fix in his own situation, but was wary over applying it as he felt he
didn’t know enough about engine internals to be certain it was a correct fix. Zeev
Suraski agreed with him that it was indeed a ‘fake fix’, and also confirmed that
there is a catch 22 situation whereby the internal function
get_ptr_ptr() needs to return NULL in order for the
properties to be read correctly, but must not be allowed to return

As Zeev was mulling over ideas about how to break this deadlock, Dominik del
Bondio wrote in to the list to draw attention to a "http://bugs.php.net/bug.php?id=28444">bug report detailing a
problem with standard classes that, he claimed, Rob’s patch also resolved. Rob
himself was quick to point out that a good solution for his own issue would not in
fact help with the standard class problem at all.

Short version: It’s trickier than it looks.

NEW: MySQL 4.1.3 support

Georg Richter committed a bunch of patches to support MySQL’s latest beta release
via the PHP 5 mysqli extension on Wednesday. Edin updated the win32 libraries over
the weekend to bring them into line with the new release.

Short version: If ext/mysqli stopped working for you lately, you need
to upgrade to 4.1.3.

Comments are closed.