|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2001-11-10 19:01 UTC] andrei@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Nov 01 02:00:01 2025 UTC |
I'm using str_replace to fill out mailing label templates with data from a database. When I came up with a record with empty string fields I got a seqfault. I've tracked the problem down to str_replace -- simplified in the following script. If you insert a space in $replaceArray['NAME'] or add a space at the end of $lines[0] after {name} it won't segfault. Note that the ADDRESS field has the same layout, but doesn't cause a segfault, however if I reduce the arrays to *just* the NAME fields, then it doesn't segfault either. Weirdness. <?php $searchArray = array ( "NAME" => "{name}", "ADDRESS" => "{address}" ); $replaceArray = array ( "NAME" => "", "ADDRESS" => "" ); $lines = array( "{name}", "{address}", "", "" ); $newlines = str_replace($searchArray, $replaceArray, $lines); print_r($lines); print("<br>\n"); print_r($newlines); print("<br>\n"); ?> On MacOSX I used this configuration: --with-xml \ --with-zlib \ --with-apxs=/usr/sbin/apxs \ --with-openssl \ --enable-trans-sid \ --with-pdflib=/Users/steve/build/pdflib/pdflib-4.0.1/bind/c \ --enable-shared=pdflib \ --with-mysql=/usr/local On Linux PPC (2.2.18) I used this configuration: --with-xml \ --with-zlib \ --with-apxs=/usr/sbin/apxs \ --with-openssl \ --enable-trans-sid \ --with-pdflib=/usr/local \ --enable-shared=pdflib \ --with-mysql=/usr \ --enable-openbase_module