Bug #70766 [NEW]: A simple code that file happen to changed into a buffer loop!
| From: | a dot x dot l at live dot com | Date: | Thu, 22 Oct 2015 06:11:45 +0000 |
| Subject: | Bug #70766 [NEW]: A simple code that file happen to changed into a buffer loop! | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-196738@lists.php.net to get a copy of this message | ||
From: a dot x dot l at live dot com
Operating system: win,*nix
PHP version: 5.4.45
Package: Session related
Bug Type: Bug
Bug description:A simple code that file happen to changed into a buffer loop!
Description:
------------
Will, while i was coding a simple PHP code for practice I run into this
bug witch i found out that it start making many sessions by it self and
start looping until the Apache process is full(The code have no loops).
I tested it on windows, *nix in v 5.4.* I believe its the same on other
versions.
Test script:
---------------
<?php
function p404curl($url){
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);
curl_setopt($ch, CURLOPT_USERAGENT, "Chrome/36.0.1985.125");
return curl_exec($ch);
}
if (strtolower(substr(PHP_OS,0,3))=="win")
$sys='win';
else
$sys='unix';
$me = basename(__FILE__ );
$uul = $_SERVER['PHP_SELF'];
$rew = md5(time());
$uul = str_replace($_SERVER['REQUEST_URI'],$rew,$uul);
$uul= 'http://'.$_SERVER['HTTP_HOST'].$uul;
$uul1 = $_SERVER['REQUEST_URI'];
$uul = str_replace($rew,$_SERVER['REQUEST_URI'],$uul);
$d404 = 'e';
if ($sys == 'win'){
if (!isset($_SESSION['hidden']) ||
!file_exists('C:\\Users\\Default\\AppData\\Local\\Temp\\'.md5($uul1))){
$p404 = p404curl($uul) or $d404;
file_put_contents("C:\\Users\\Default\\AppData\\Local\\Temp\\".md5($uul1),$p404);
$_SESSION['hidden'] = md5($uul1);
}else{
$p404 =
file_get_contents('C:\\Users\\Default\\AppData\\Local\\Temp\\'.md5($uul1));
}
}else{
if (!isset($_SESSION['hidden']) || !file_exists('/tmp/'.md5($uul1))){
$p404 = p404curl($uul) or $d404;
file_put_contents('/tmp/'.md5($uul1),$p404);
$_SESSION['hidden'] = md5($uul1);
}else{
$p404 = file_get_contents('/tmp/'.md5($uul1));
}
}
echo $p404;
die();
Expected result:
----------------
nothing the web page will keep on loading and the server will be down,
because apache will be full.
--
Edit bug report at https://bugs.php.net/bug.php?id=70766&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=70766&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=70766&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=70766&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=70766&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=70766&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=70766&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=70766&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=70766&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=70766&r=support
Expected behavior: https://bugs.php.net/fix.php?id=70766&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=70766&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=70766&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=70766&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=70766&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=70766&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=70766&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=70766&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=70766&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=70766&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=70766&r=mysqlcfg