php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #30367 String concat causes segmentation fault
Submitted: 2004-10-08 18:07 UTC Modified: 2004-10-17 01:00 UTC
Votes:2
Avg. Score:5.0 ± 0.0
Reproduced:2 of 2 (100.0%)
Same Version:1 (50.0%)
Same OS:1 (50.0%)
From: mfrench at applied-handling dot com Assigned:
Status: No Feedback Package: Reproducible crash
PHP Version: 5.0.1 OS: Linux 2.2.20 Kernel (Debian)
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2004-10-08 18:07 UTC] mfrench at applied-handling dot com
Description:
------------
I have a file that is building up a DB query as a string. The query is long enough that for reasons of readability, I am attempting to split it onto two lines, and concatenate the two parts of the string together into a single variable. Performing this string concatenation causes a segmentation fault. Putting both halves of the string on a single line and assigning it to the variable all at once avoids the error.

Reproduce code:
---------------
//This causes a segmentation fault:
$qry = "SELECT h.*, oe.LevelDepth, oe.LevelName AS oeName, oe.OrgChartID";
$qry .= " FROM tblHierarchy h JOIN tblOrgElement oe ON h.OrgElementID=oe.OrgElementID WHERE levelID=2";
echo $qry;

//This runs without error:
$qry = "SELECT h.*, oe.LevelDepth, oe.LevelName AS oeName, oe.OrgChartID FROM tblHierarchy h JOIN tblOrgElement oe ON h.OrgElementID=oe.OrgElementID WHERE levelID=2";
echo $qry;

Expected result:
----------------
I expect to see the full string output to the page.

Actual result:
--------------
Apache does not serve the page, and my browser reports "Cannot find server". The server logs show a segmentation fault.

The code is trying to build up a DB query. However, the segmentation fault occurs on the second line building up the string. Commenting out the entire rest of the file, and only ECHOing the string to the page still generates the seg fault, where the entire file runs without error when the string is built all on one line with no concatenation.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-10-08 18:24 UTC] tony2001@php.net
Thank you for this bug report. To properly diagnose the problem, we
need a backtrace to see what is happening behind the scenes. To
find out how to generate a backtrace, please read
http://bugs.php.net/bugs-generating-backtrace.php

Once you have generated a backtrace, please submit it to this bug
report and change the status back to "Open". Thank you for helping
us make PHP better.


 [2004-10-08 20:26 UTC] mfrench at applied-handling dot com
I should add that removing the ECHO command does not make any difference, the page still seg faults.
 [2004-10-08 20:30 UTC] mfrench at applied-handling dot com
I will add a backtrace as soon as I am able, but unfortunately I cannot do that right now. PHP is not configured with --enable-debug currently, and the server is serving pages from several other internal applications. I can't take the server down to recompile until those have been moved to the backup server. As soon as I manage to do so, I will provide a backtrace.
 [2004-10-09 15:44 UTC] derick@php.net
Setting the status to feedback until you provide the backtrace.
 [2004-10-17 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Jun 26 12:01:28 2024 UTC