[MacPorts] #32909: php5 5.3.9 Segmentation Fault 11 in call to array_intersect
MacPorts
noreply at macports.org
Mon Jan 16 18:53:12 PST 2012
#32909: php5 5.3.9 Segmentation Fault 11 in call to array_intersect
--------------------------------+-------------------------------------------
Reporter: dwilks@… | Owner: macports-tickets@…
Type: defect | Status: new
Priority: Normal | Milestone:
Component: ports | Version: 2.0.3
Keywords: | Port: php5
--------------------------------+-------------------------------------------
Spoiler: This has the same root cause as ticket#31590. I'm only
submitting this in case others run into clang-introduced segmentation
faults running their own php code rather than just when installing php-
related ports.
On a 64 bit lion machine
{{{
tracy-pc:~ dwilks$ uname -a
Darwin tracy-pc.win.intacct.com, intacct.com 11.2.0 Darwin Kernel Version
11.2.0: Tue Aug 9 20:54:00 PDT 2011; root:xnu-1699.24.8~1/RELEASE_X86_64
x86_64
}}}
In a reasonably fresh, clean, macports tree
{{{
tracy-pc:~ dwilks$ sudo port uninstall inactive
tracy-pc:~ dwilks$ sudo port -fp uninstall --follow-dependents installed
tracy-pc:~ dwilks$ sudo port clean all
}}}
With XCode 4.2 installed
With MacPorts configured to generate 32 bit binaries (not sure if this
matters)
{{{
tracy-pc:~ dwilks$ grep build_arch /opt/local/etc/macports/macports.conf
build_arch i386
}}}
Install php 5.3.9 (happened with the previous 5.3.8 too)
{{{
tracy-pc:~ dwilks$ sudo port install php5
---> Computing dependencies for php5
---> Dependencies to be installed: apache2 apr apr-util db46 expat
libiconv gperf sqlite3 libedit ncurses ncursesw openssl zlib pcre bzip2
perl5 perl5.12 gdbm gettext perl5 perl5 autoconf213 gawk readline m4 gsed
libtool automake autoconf help2man p5.12-locale-gettext libxml2 mhash
pkgconfig glib2 libffi xz
...
---> Staging php5 into destroot
Warning: php5 installs files outside the common directory structure.
---> Installing php5 @5.3.9_0+apache2
---> Activating php5 @5.3.9_0+apache2
You may need to update your php.ini for any changes that have been made
in this version of php. Compare /opt/local/etc/php5/php.ini with
/opt/local/etc/php5/php.ini-development (if this is a development server)
or
/opt/local/etc/php5/php.ini-production (if this is a production server).
}}}
Create a simple php script that calls array_intersect
{{{
<?php
$arr1 = array('a', 'b');
$arr2 = array('c', 'd');
echo "about to call array_intersect\n";
if (array_intersect($arr1, $arr2)) {
echo "Yes\n";
} else {
echo "No\n";
}
echo "all done\n";
}}}
And execute it
{{{
tracy-pc:~ dwilks$ /opt/local/bin/php -n -f ~/test.php
about to call array_intersect
Segmentation fault: 11
tracy-pc:~ dwilks$
}}}
Re-install php5 using llvm-gcc-4.2
{{{
tracy-pc:~ dwilks$ sudo port uninstall php5
Password:
---> Deactivating php5 @5.3.9_0+apache2
---> Cleaning php5
---> Uninstalling php5 @5.3.9_0+apache2
---> Cleaning php5
tracy-pc:~ dwilks$ sudo port clean php5
---> Cleaning php5
tracy-pc:~ dwilks$ sudo port install php5 configure.compiler=llvm-gcc-4.2
---> Computing dependencies for php5
---> Fetching archive for php5
---> Attempting to fetch php5-5.3.9_0+apache2.darwin_11.i386.tgz from
http://packages.macports.org/php5
---> Fetching php5
---> Verifying checksum(s) for php5
---> Extracting php5
---> Applying patches to php5
---> Configuring php5
---> Building php5
---> Staging php5 into destroot
Warning: php5 installs files outside the common directory structure.
---> Installing php5 @5.3.9_0+apache2
---> Activating php5 @5.3.9_0+apache2
You may need to update your php.ini for any changes that have been made
in this version of php. Compare /opt/local/etc/php5/php.ini with
/opt/local/etc/php5/php.ini-development (if this is a development server)
or
/opt/local/etc/php5/php.ini-production (if this is a production server).
}}}
And then run the same test
{{{
tracy-pc:~ dwilks$ /opt/local/bin/php -n -f ~/test.php
about to call array_intersect
No
all done
}}}
As a side note downloading php 5.3.9 and building from source worked
perfectly since it uses gcc which points to llvm-gcc-4.2.
--
Ticket URL: <https://trac.macports.org/ticket/32909>
MacPorts <http://www.macports.org/>
Ports system for Mac OS
More information about the macports-tickets
mailing list