Zeev Suraski wrote:
 > Tim,
> 
> Your analysis was correct until the last sentence - PHP surely does
> support arrays with more than 64K entries.  It just doesn't support the
> same entry being linked from more than 64K locations (which is much,
> much more rare occurrence).

Well yes, I was just stirring. It's more common than you might think though.
My own case was somewhat similar to this:

<?
class CacheEntry {
        var $name;
        var $stuff = array();

        function CacheEntry( $name ) {
                $this->name = $name;
        }
}

$cache = array();
for ( $i=0; $i<100000; $i++) {
        $cache[] = new CacheEntry( "Cache entry $i" );
}
?>

...which will segfault on exit due to the excess references to the empty
array object created for the initialisation of the unused member variable
$stuff. Generally speaking, arrays of objects with initialised but unused
member variables will cause problems. Our code (MediaWiki) has plenty of
such arrays, the reason we don't see this more often is because the arrays
usually contain less than 64K entries. The size of the arrays depend on user
input.

-- Tim Starling

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to