|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2007-08-16 22:22 UTC] jani@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 20:00:01 2025 UTC |
Description: ------------ I'm using fread to retrieve the contents of a .js file. If within the file this string exists, '/g'. it strips this with a empty space and 'String' with empty space. If '/g' dosen't exists, everything works fine. heres the .js file function trim(str){ // str. remove whitespaces from left. remove whitespaces from right return str.replace(/^\s+/g, "").replace(/\s+$/g, ""); } String.prototype.trim = trim; The Apache and PHP i'm using comes from xampplite from apachefriends.org. I didn't make any configuration changes. I can send you the contents of phpinfo() if will help Reproduce code: --------------- if ($handle = @fopen($file, 'rb')) { $filesize = filesize( $file ); if ($contents = fread($handle, $filesize)) { $contents = file_get_contents( $file ); if ( eregi( 'trim.js' , $file ) ) { print "<br/><br/><h1>$contents</h1>"; } return $contents; fclose($handle); } else { $GLOBALS['IG_ERROR_PHP'] = $php_errormsg; $GLOBALS['IG_ERROR_SPEC'] = "$file"; IF ($return==TRUE) return 'ERR0104'; ELSE return FALSE; } } Expected result: ---------------- return the full contents Actual result: -------------- It strips certain text out, as explained above