php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #14273 When I use 'urlencode' in a for loop the mod_php core dumps'
Submitted: 2001-11-28 17:23 UTC Modified: 2001-11-29 11:39 UTC
From: FitzpatrickB at metrocall dot com Assigned:
Status: Closed Package: URL related
PHP Version: 4.0.6 OS: Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: FitzpatrickB at metrocall dot com
New email:
PHP Version: OS:

 

 [2001-11-28 17:23 UTC] FitzpatrickB at metrocall dot com
This works!!!

$cnt = count($arrayA);
for ( $ix=0 ; $ix < $cnt; $ix++ ) 
{
       $aurl = mysql_query("select name, url from sites where code='".$arrayA[$ix][1]."'");
       list($name$url) = mysql_fetch_row($aurl);
       mysql_free_result($aurl);

       echo "$url $name";
}

This Fails!!
$cnt = count($arrayA);
for ( $ix=0 ; $ix < $cnt; $ix++ ) 
{
       $aurl = mysql_query("select name, url from sites where code='".$arrayA[$ix][1]."'");
       list($name$url) = mysql_fetch_row($aurl);
       mysql_free_result($aurl);

       echo urlencode($url)," $name";
}

Only change is addition of urlencode,  What gives?

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-11-28 17:51 UTC] mfischer@php.net
Um ... list($name$url) looks really weird to me. You should write list($name, $url) instead.

Can you reproduce this with latest (not official) release?

http://www.php.net/~zeev/php-4.1.0.tar.gz

Also, the actual content of '$url' would be interesting anyway (since coredump is never ok), something like 'var_dump($url);' before passing it to urlencode().

Feedback.
 [2001-11-29 09:47 UTC] FitzpatrickB at metrocall dot com
I forgot the comma in the list when I rewrote the example.  I have the comma in my 'real' code.
 [2001-11-29 09:49 UTC] mfischer@php.net
Its impossible to track this down with actual data which crashes this, please provide such data.

Feedback.
 [2001-11-29 09:53 UTC] FitzpatrickB at metrocall dot com
var_dump($url) returns 'string(206) "http://maps.yahoo.com/py/pmap.py?Pyt=Tmap&addr=6133 A Backlick Road&city=Springfield&state=VA&zipcode=22150&BFKey=&mag=9&cs=9&name=Jhoon Rhee Institute of Tae Kwon Do&name=Concord Centre&desc=(703) 923-0052"'

I tried 
 urlencode($url);
This worked...

I then tried
 $url = urlencode($url);
And this also cored!
 [2001-11-29 10:08 UTC] FitzpatrickB at metrocall dot com
upgrading to http://www.php.net/~zeev/php-4.1.0.tar.gz worked!

hmm??   now should I should I run beta code on a production site?

Bill
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 18 03:01:28 2024 UTC