2009/8/22 Szczepan Hołyszewski <webmaster@xxxxxxxxxxxxxx>: > Hello! > > I am almost certain I am hitting some kind of bug. All of a sudden, array() > stops returning an empty array and starts returning something weird. The weird > thing behaves as NULL in most circumstances (e.g. gettype() says NULL), > except: > > $foo=array(); // <-- weird thing returned > $foo[]="bar"; > > causes "Fatal error: [] operator not supported for strings", which is different > from the regular behavior of: Hi there, Without seeing the actual code, it's hard to say what the problem is. However, I'd be pretty surprised if you've actually run into a bug in PHP--I would first suspect a bug in your code. No offense intended--that's just how it usually plays out. :) What it looks like to me is that something is causing $foo to be a string before the '$foo[] = "bar";' line is encountered. What do you get if you put a gettype($foo); just before that line? > $foo=null; > $foo[]="bar"; // <-- $foo simply becomes an array > > The problem is not limited to one place in code, and indeed before the fatal > caused by append-assignment I get several warnings like "array_diff_key(): > Argument #1 is not an array", where the offending argument receives a result of > array(). This would appear to support my suspicion, but try inserting the gettype($foo) (or better, var_export($foo);) just before one of the lines which triggers the error, and post the results. Can you post the code in a .zip file or online somewhere? If not, that's cool, but it will probably make it harder to help you track it down if you can't. Regards, Torben > The effect is not random, i.e. it always breaks identically when the same > script processes the same data. However I was so far unable to create a > minimal test case that triggers the bug. My script is rather involved, and > here are some things it uses: > > - Exceptions > - DOM to-fro SimpleXML > - lots of multi-level output buffering > > Disabling Zend Optimizer doesn't help. Disabling Zend Memory Manager is > apparently impossible. Memory usage is below 10MB out of 128MB limit. > > Any similar experiences? Ideas what to check for? Workarounds? > > From phpinfo(): > > PHP Version: > 5.2.9 (can't easily upgrade - shared host) > > System: > FreeBSD 7.1-RELEASE-p4 FreeBSD 7.1-RELEASE-p4 #0: Wed Apr 15 15:48:43 UTC 2009 > amd64 > > Configure Command: > './configure' '--enable-bcmath' '--enable-calendar' '--enable-dbase' '--enable- > exif' '--enable-fastcgi' '--enable-force-cgi-redirect' '--enable-ftp' '-- > enable-gd-native-ttf' '--enable-libxml' '--enable-magic-quotes' '--enable- > maintainer-zts' '--enable-mbstring' '--enable-pdo=shared' '--enable-safe-mode' > '--enable-soap' '--enable-sockets' '--enable-ucd-snmp-hack' '--enable-wddx' > '--enable-zend-multibyte' '--enable-zip' '--prefix=/usr' '--with-bz2' '--with- > curl=/opt/curlssl/' '--with-curlwrappers' '--with-freetype-dir=/usr/local' '-- > with-gd' '--with-gettext' '--with-imap=/opt/php_with_imap_client/' '--with- > imap-ssl=/usr/local' '--with-jpeg-dir=/usr/local' '--with-libexpat- > dir=/usr/local' '--with-libxml-dir=/opt/xml2' '--with-libxml-dir=/opt/xml2/' > '--with-mcrypt=/opt/libmcrypt/' '--with-mhash=/opt/mhash/' '--with-mime-magic' > '--with-mysql=/usr/local' '--with-mysql-sock=/tmp/mysql.sock' '--with- > mysqli=/usr/local/bin/mysql_config' '--with-openssl=/usr/local' '--with- > openssl-dir=/usr/local' '--with-pdo-mysql=shared' '--with-pdo-sqlite=shared' > '--with-pgsql=/usr/local' '--with-pic' '--with-png-dir=/usr/local' '--with- > pspell' '--with-snmp' '--with-sqlite=shared' '--with-tidy=/opt/tidy/' '--with- > ttf' '--with-xmlrpc' '--with-xpm-dir=/usr/local' '--with-xsl=/opt/xslt/' '-- > with-zlib' '--with-zlib-dir=/usr' > > Thanks in advance, > Szczepan Holyszewski > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php