TPhpErrorException

Description

[Warning] fread() [<a href='function.fread'>function.fread</a>]: Length parameter must be greater than 0 (@line 114 in file /home/kokusai/cms/protected/Portlets/Footer.php).

Source File

/home/kokusai/cms/protected/Portlets/Footer.php (114)

0103:         $query = ereg_replace("=","_", $query);
0104:         $query = ereg_replace("&","_", $query);
0105:         $query = ereg_replace("\.","_", $query);
0106:         $counter_file = Prado::getPathOfNamespace("Application.Data.counter.".$_SESSION["lang"]."_".$query,".txt");
0107:         clearstatcache();
0108:         ignore_user_abort(true);     ## prevent refresh from aborting file operations and hosing file
0109:         if (file_exists($counter_file)) {
0110:            $fh = fopen($counter_file, 'r+');
0111:             while(1) {
0112:               if (flock($fh, LOCK_EX)) {
0113:                  #$buffer = chop(fgets($fh, 2));
0114: $buffer = chop(fread($fh, filesize($counter_file)));
0115: $buffer++; 0116: rewind($fh); 0117: fwrite($fh, $buffer); 0118: fflush($fh); 0119: ftruncate($fh, ftell($fh)); 0120: flock($fh, LOCK_UN); 0121: break; 0122: } 0123: } 0124: } 0125: else { 0126: $fh = fopen($counter_file, 'w+');

Stack Trace

#0 /home/kokusai/cms/protected/Portlets/Footer.php(114): PradoBase::phpErrorHandler(2, 'fread() [<a hre...', '/home/kokusai/c...', 114, Array)
#1 /home/kokusai/cms/protected/Portlets/Footer.php(26): Footer->counter(Resource id #115, 0)
#2 /home/kokusai/prado/framework/Web/UI/TControl.php(1270): Footer->onInit()
#3 /home/kokusai/prado/framework/Web/UI/TCompositeControl.php(35): TControl->initRecursive(NULL)
#4 /home/kokusai/prado/framework/Web/UI/TTemplateControl.php(240): TCompositeControl->initRecursive(Object(MainLayout))
#5 /home/kokusai/prado/framework/Web/UI/TControl.php(1255): TTemplateControl->initRecursive(Object(MainLayout))
#6 /home/kokusai/prado/framework/Web/UI/TControl.php(1255): TControl->initRecursive(Object(MainLayout))
#7 /home/kokusai/prado/framework/Web/UI/TCompositeControl.php(35): TControl->initRecursive(Object(MainLayout))
#8 /home/kokusai/prado/framework/Web/UI/TTemplateControl.php(240): TCompositeControl->initRecursive(Object(EditPage))
#9 /home/kokusai/prado/framework/Web/UI/TControl.php(1255): TTemplateControl->initRecursive(Object(EditPage))
#10 /home/kokusai/prado/framework/Web/UI/TCompositeControl.php(35): TControl->initRecursive(Object(EditPage))
#11 /home/kokusai/prado/framework/Web/UI/TTemplateControl.php(240): TCompositeControl->initRecursive(NULL)
#12 /home/kokusai/prado/framework/Web/UI/TPage.php(202): TTemplateControl->initRecursive(NULL)
#13 /home/kokusai/prado/framework/Web/UI/TPage.php(193): TPage->processNormalRequest()
#14 /home/kokusai/prado/framework/Web/Services/TPageService.php(474): TPage->run(Object(THtmlWriter))
#15 /home/kokusai/prado/framework/Web/Services/TPageService.php(420): TPageService->runPage(Object(THtmlWriter))
#16 /home/kokusai/prado/framework/TApplication.php(1066): TPageService->run(Object(EditPage), Array)
#17 /home/kokusai/prado/framework/TApplication.php(376): TApplication->runService()
#18 /home/kokusai/public_html/index.php(21): TApplication->run()
#19 {main}
2019-03-26 19:00 Apache PRADO/3.1.1