php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #51361 Your "feature" Wordwrap on user notes
Submitted: 2010-03-23 12:34 UTC Modified: 2011-05-17 18:44 UTC
From: dev at 10e12 dot net Assigned: danbrown (profile)
Status: Closed Package: Website problem
PHP Version: Irrelevant OS: Win XP
Private report: No CVE-ID: None
 [2010-03-23 12:34 UTC] dev at 10e12 dot net
Description:
------------
Your note contains a bit of text that will result in a line that is too long, even after using wordwrap().

This is getting mighty annoying.
I have edited my post some 10 times and broken it below 40 chars per line.
Still no good.

Sorry you cannot Cut off a function name when I write a php function name in the screen without the code becoming illegible/unreadable after post.

This "feature" should pass to the far away neverland as 96% of webbrowsers are now using in excess of 1024 pixel resolution width, don't you think?

Test script:
---------------
What about this for an example... 

Intending to use it in passing a "semi-guaranteed"
properly seeded random number to a client, then to 
capture input from the user which must be encrypted 
client side before being sent to the server again 
  a) during the same session and, 
  b) within a set time limit.

for more reading also see:
  AES Rijndael enc/dec routines for javaScript
  developed and tested by Herbert Hanewinkel, 
  http://www.hanewin.net/encrypt/aes/aes.htm

<?php
/*
calling the function, prepping the data to send to 
the client... , who then uses it in a javascript 
implementation of AES Encrypt.
*/

function SHA256($str, $keyval=""){
    if ($keyval!==""){//not null or empty
        $sHash = mhash(Constant('MHASH_SHA256'),$str, $keyval);
    }else{
        $sHash = mhash(Constant('MHASH_SHA256'),$str);
    }
    // same as Binary 2 Hex conversion
    return implode(unpack('H*',$sHash),'');
}

/*---------------------------------------------------
Radomizing the random data with fixed data for 
the user and location If return value maximum 
is set to zero (0) the function uses mt_getrandmax
If both retMin and retMax is zero (0) the function 
uses mt_rand w.o. limits
*----------------------------------------------------*/
function local_prgn($retMin = 0, $retMax = 0){
// first get the session id of the request session
  $sSrv = session_id(); 

// the following is valid only on the current server
  $sSrv = implode(unpack($_SERVER['SERVER_NAME'].$_SERVER['SERVER_ADDR'].$sSrv),'');

// the following applies only to the requesting client
  $sReq = implode(unpack($_SERVER['REMOTE_ADDR'].$_SERVER['REQUEST_TIME']),'');

// the following generates a 256 bit hash
  $sSeed = SHA256($sSrv,$sReq); // get a SHA256 seed based on the current values

// get a random value based on the uniqueness of the seed above
    mt_srand($sSeed); // seed the random num gen

// some error handling and checking
    if ($retMin > $retMax){ 
	// if wrong order of range values
        $rx = $retMax; $retMax = $retMin; $retMin = $rx; // swap
    } else if ($retMin == $retMax){    //meaningless range, not very random
        $retMin = 0; $retMax = 0; //ensure for next check in this range
    }
// select what we need to return
    if ((($retMax == 0)&&($retMax = mt_getrandmax))||($retMin==$retMax)){
        return mt_getrandmax();
    }else{
        return mt_getrandmax($retMin,$retMax);
    }
}


?>

Expected result:
----------------
less bugs, more speed

Actual result:
--------------
to many dumb bugs

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-03-23 12:37 UTC] degeberg@php.net
-Type: Documentation Problem +Type: Bug -Package: Documentation problem +Package: Website problem
 [2011-05-17 18:44 UTC] danbrown@php.net
Automatic comment from SVN on behalf of danbrown
Revision: http://svn.php.net/viewvc/?view=revision&amp;revision=311142
Log: Increase the length of the maximum note chunk size from a paltry 70 to a more-usable 120.  Fixes #51361 and about a dozen other monthly complaints in the user notes.
 [2011-05-17 18:44 UTC] danbrown@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: danbrown
 [2011-05-17 18:44 UTC] danbrown@php.net
This bug has been fixed in SVN. Since the websites are not directly
updated from the SVN server, the fix might need some time to spread
across the globe to all mirror sites, including PHP.net itself.

Thank you for the report, and for helping us make PHP.net better.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Dec 22 06:01:30 2024 UTC