ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
RandomTest.php File Reference

Go to the source code of this file.

Functions

 randomString ( $length, $nullOk, $ascii=false)
 
 donorm ( $str)
 
 wfMsg ($x)
 
 showDiffs ( $a, $b)
 

Variables

 if (php_sapi_name() !='cli')
 
 $size = 16
 
 $n = 0
 

Function Documentation

◆ donorm()

donorm (   $str)

Definition at line 49 of file RandomTest.php.

References UNORM_NFC, UTF8_FFFE, UTF8_FFFF, and UTF8_REPLACEMENT.

49  {
50  # We exclude a few chars that ICU would not.
51  $str = preg_replace( '/[\x00-\x08\x0b\x0c\x0e-\x1f]/', UTF8_REPLACEMENT, $str );
52  $str = str_replace( UTF8_FFFE, UTF8_REPLACEMENT, $str );
53  $str = str_replace( UTF8_FFFF, UTF8_REPLACEMENT, $str );
54 
55  # UnicodeString constructor fails if the string ends with a head byte.
56  # Add a junk char at the end, we'll strip it off
57  return rtrim( utf8_normalize( $str . "\x01", UNORM_NFC ), "\x01" );
58 }
const UTF8_FFFE
Definition: UtfNormal.php:78
const UNORM_NFC
Definition: UtfNormal.php:91
const UTF8_FFFF
Definition: UtfNormal.php:79
const UTF8_REPLACEMENT
Definition: UtfNormal.php:68

◆ randomString()

randomString (   $length,
  $nullOk,
  $ascii = false 
)

Definition at line 41 of file RandomTest.php.

References $out.

41  {
42  $out = '';
43  for( $i = 0; $i < $length; $i++ )
44  $out .= chr( mt_rand( $nullOk ? 0 : 1, $ascii ? 127 : 255 ) );
45  return $out;
46 }

◆ showDiffs()

showDiffs (   $a,
  $b 
)

Definition at line 64 of file RandomTest.php.

References array.

64  {
65  $ota = explode( "\n", str_replace( "\r\n", "\n", $a ) );
66  $nta = explode( "\n", str_replace( "\r\n", "\n", $b ) );
67 
68  $diffs = new Diff( $ota, $nta );
69  $formatter = new TableDiffFormatter();
70  $funky = $formatter->format( $diffs );
71  $matches = array();
72  preg_match_all( '/<(?:ins|del) class="diffchange">(.*?)<\/(?:ins|del)>/', $funky, $matches );
73  foreach( $matches[1] as $bit ) {
74  $hex = bin2hex( $bit );
75  echo "\t$hex\n";
76  }
77 }
78 
79 $size = 16;
80 $n = 0;
81 while( true ) {
82  $n++;
83  echo "$n\n";
84 
85  $str = randomString( $size, true);
86  $clean = UtfNormal::cleanUp( $str );
87  $norm = donorm( $str );
88 
89  echo strlen( $clean ) . ", " . strlen( $norm );
90  if( $clean == $norm ) {
91  echo " (match)\n";
92  } else {
93  echo " (FAIL)\n";
94  echo "\traw: " . bin2hex( $str ) . "\n" .
95  "\tphp: " . bin2hex( $clean ) . "\n" .
96  "\ticu: " . bin2hex( $norm ) . "\n";
97  echo "\n\tdiffs:\n";
98  showDiffs( $clean, $norm );
99  die();
100  }
101 
102 
103  $str = '';
104  $clean = '';
105  $norm = '';
106 }
$size
Definition: RandomTest.php:79
showDiffs( $a, $b)
Definition: RandomTest.php:64
static cleanUp( $string)
The ultimate convenience function! Clean up invalid UTF-8 sequences, and convert to normal form C...
Definition: UtfNormal.php:124
$n
Definition: RandomTest.php:80
randomString( $length, $nullOk, $ascii=false)
Definition: RandomTest.php:41
Create styles array
The data for the language used.
donorm( $str)
Definition: RandomTest.php:49

◆ wfMsg()

Variable Documentation

◆ $n

$n = 0

Definition at line 80 of file RandomTest.php.

Referenced by ilRepositoryExplorerGUI\__construct(), ilPersonalSkillExplorerGUI\__construct(), ilSurveySkillExplorer\__construct(), HTMLPurifier_Token\__get(), Text_Diff_Engine_native\_diag(), PHPExcel_Calculation_Engineering\_erfcVal(), ilExternalFeed\_getRSSLocation(), PHPExcel_Calculation_Statistical\_incompleteGamma(), _DiffEngine\_lcs_pos(), HTTP_WebDAV_Server\_new_uuid(), TCPDF_IMAGES\_parsepng(), PHPExcel_Reader_Excel5_Escher\_readOfficeArtRGFOPTE(), PHPExcel_Calculation_MathTrig\_romanCut(), wsdl\addComplexType(), wsdl\addOperation(), HTMLPurifier_Zipper\advance(), PHPExcel_Calculation_Financial\AMORDEGRC(), HTML5TreeConstructer\appendToRealParent(), ilPCParagraph\autoSplit(), PHPExcel_Calculation_Engineering\BESSELK(), PHPExcel_Calculation_Engineering\BESSELY(), ilPersonalSkillExplorerGUI\buildSelectableTree(), nusoap_parser\buildVal(), ilvCard\buildVCard(), ilObjLanguage\check(), ilObjSkillManagementGUI\collapseAll(), ilObjSCORM2004LearningModuleGUI\collapseAll(), HTMLPurifier_UnitConverter\convert(), ilSCORM13Package\dbImportSco(), ilSurveySkill\determineMaxScale(), Securimage\drawLines(), HTML5TreeConstructer\elementInScope(), ilObjSkillManagementGUI\expandAll(), ilObjSCORM2004LearningModuleGUI\expandAll(), UtfNormal\fastCombiningSort(), UtfNormal\fastCompose(), UtfNormal\fastDecompose(), GeSHi\finalise(), ilSkillUsage\getAllUsagesInfoOfSubtrees(), ilAwarenessData\getData(), ilSkillDataSet\getDependencies(), HTMLPurifier_HTMLModuleManager\getElements(), Datamatrix\getErrorCorrection(), ilTestTaxonomyTree\getMaxOrderValueLength(), DifferenceEngine\getMultiNotice(), ilTestTaxonomyTree\getNodeOrderingPathString(), ilWikiNewsRendererGUI\getObjectLink(), ilLearningModuleNewsRendererGUI\getObjectLink(), ilBlogNewsRendererGUI\getObjectLink(), ilForumNewsRendererGUI\getObjectLink(), ilAwarenessData\getOnlineUserData(), ilTaxAssignInputGUI\getOptions(), ilMilestoneResponsiblesTableGUI\getParticipantsAndResponsibles(), nusoap_base\getPrefixFromNamespace(), HTMLPurifier_UnitConverter\getSigFigs(), HTMLPurifier_Injector_SafeObject\handleElement(), hexSequenceToUtf8(), ilSCORM13Package\il_import(), TCPDFBarcode\imb_tables(), ilPCTable\importCellAttributes(), ilPCTable\importHtml(), ilPCTable\importRow(), ilPCTable\importTableAttributes(), ilObjUserFolderGUI\importUserRoleAssignmentObject(), HTML5TreeConstructer\inBody(), GeSHi\indent(), ilPageObjectGUI\insertPageToc(), HTML5TreeConstructer\inTable(), Title\isDeleted(), PHPExcel_Calculation_Token_Stack\last(), EvalMathStack\last(), PHPExcel_Reader_Excel5\load(), Title\makeName(), PHPExcel_Calculation_Financial\MIRR(), ilPCSourceCode\modifyPageContentPostXsl(), ilPersonalDesktopGUI\multiarray_sort(), Title\nameOf(), SMTP\parseHelloFields(), PHPExcel_Calculation_Financial\PRICE(), ilStatistics\product_n(), ilStatistics\quantile(), UtfNormal\quickIsNFC(), UtfNormal\quickIsNFCVerify(), Symfony\Component\Process\Pipes\UnixPipes\readAndWrite(), ilObjSCORM2004LearningModule\readObject(), ilObjSCORMLearningModule\readObject(), ilCalendarEntry\readResponsibleUsers(), WavFile\readWavHeader(), ilSCORM2004Page\removeInvalidLinks(), ILIAS\UI\Implementation\Component\Glyph\Renderer\render(), ilNestedListInputGUI\render(), HTML5TreeConstructer\resetInsertionMode(), HTMLPurifier_UnitConverter\round(), wsdl\serializeType(), PHPExcel_Calculation_MathTrig\SERIESSUM(), phpCAS\setCacheTimesForAuthRecheck(), CAS_Client\setCacheTimesForAuthRecheck(), WavFile\setChannelMask(), HTMLPurifier_HTMLModuleManager\setup(), ilRepositoryGUI\showTree(), ilObjSCORM2004LearningModuleGUI\showTree(), ilStatistics\sum_n(), ilObjUserTest\testCreateSetLookupDelete(), Symfony\Component\Process\Tests\ProcessTest\testIncrementalOutputDoesNotRequireAnotherCall(), PHPExcel_Style_NumberFormat\toFormattedString(), HTMLPurifier_Token_Empty\toNode(), Symfony\Component\Process\Pipes\AbstractPipes\write(), and PHPExcel_Calculation_Statistical\ZTEST().

◆ $size

$size = 16

Definition at line 79 of file RandomTest.php.

Referenced by ilObjectXMLWriter\__appendObjectProperties(), ilObjectFeedWriter\__construct(), PDF417\__construct(), QRcode\__construct(), ilDiskQuotaChecker\__updateDiskUsageReportOfTypeHelper(), PHPExcel_Style_NumberFormat\_complexNumberFormatMask(), ilObjMediaObject\_determineWidthHeight(), ilObjForumAccess\_getCommands(), ilObjMediaObjectGUI\_getMediaInfoHTML(), PHPExcel_Reader_Excel5\_getNextToken(), ilObjMediaCastAccess\_lookupDiskUsage(), ilFileDataMail\_lookupDiskUsageOfUser(), ilObjFileAccess\_lookupFileSize(), ilObjFileAccess\_lookupFileSizeFromFilesystem(), ilContainer\_lookupIconPath(), PHPExcel_Writer_Excel5_Worksheet\_processBitmap(), PHPExcel_Reader_Excel5\_readBIFF8Constant(), PHPExcel_Reader_Excel5\_readBIFF8ConstantArray(), PHPExcel_Reader_Excel5_Escher\_readBSE(), PHPExcel_Reader_Excel5\_readFont(), PHPExcel_Shared_OLERead\_readPropertySets(), ilObjMediaObject\_saveTempFileAsMediaObject(), PHPExcel_Chart_GridLines\_setGlowSize(), PHPExcel_Chart_Axis\_setGlowSize(), ilMediaItem\addAreaToMapWorkCopy(), ilPageObject\addFileSizes(), ilCloudFileTree\addNode(), ilInfoScreenGUI\addObjectSections(), ilADTTextFormBridge\addToForm(), GetId3\Module\Archive\Tar\analyze(), QRcode\appendBytes(), QRcode\appendNewInputItem(), QRcode\bitstreamToByte(), PHPExcel_Shared_Drawing\cellDimensionToPixels(), QRcode\check(), QRcode\checkModeAn(), QRcode\checkModeKanji(), QRcode\checkModeNum(), PHPExcel_Writer_Excel5_Escher\close(), PHPExcel_Calculation_Statistical\CONFIDENCE(), ilFileDelivery\deliverPHPChunked(), ilUtil\dirsize(), Securimage\drawNoise(), ilObjExternalToolsSettingsGUI\editMathJaxObject(), QRcode\estimateBitsMode8(), QRcode\estimateBitsModeAn(), QRcode\estimateBitsModeKanji(), QRcode\estimateBitsModeNum(), HTMLPurifier_Strategy_MakeWellFormed\execute(), Parser\fetchScaryTemplateMaybeFromCache(), ilMediaCastTableGUI\fillRow(), ilMediaPoolTableGUI\fillRow(), ilUtil\formatBytes(), ilUtil\formatSize(), ilUtil\formSelect(), HTMLPurifier_Generator\generateFromTokens(), ilMathJax\getCacheSize(), ilUpdateUtilsMailMigration\getDir(), ilUpdateUtils\getDir(), ilUtil\getDir(), TCPDF\getFontAscent(), TCPDF\getFontDescent(), TCPDF_FONTS\getFontRefSize(), ilObjMediaObjectGUI\getFullscreenSizeObject(), TCPDF\getHTMLFontUnits(), ilPreview\getImages(), ilMediaImageUtil\getImageSize(), ilUtil\getImageTagByType(), assFileUpload\getMaxFilesizeAsString(), QRcode\getMinimumVersion(), ilMediaItem\getOriginalSize(), ilObjContentObject\getPublicExportFiles(), POP3\getResponse(), ilMDTechnical\getSize(), ilObjMediaObjectGUI\getStandardSizeObject(), ilMailFormGUI\getTemplateDataById(), GetId3\Module\AudioVideo\Matroska\HandleEMBLClusterBlock(), ilObjFileGUI\handleFileUpload(), GetId3\Lib\Helper\hash_data(), HTTP_WebDAV_Server\http_GET(), TCPDFBarcode\imb_tables(), PHPExcel_Writer_Excel5_Worksheet\insertBitmap(), QRcode\insertStructuredAppendHeader(), QRcode\lengthOfCode(), ilMediaAliasItem\makeMapWorkCopy(), ilMediaItem\makeMapWorkCopy(), QRcode\newFromBytes(), QRcode\newInputItem(), outMobImageParams(), HTMLPurifier_Lexer_DirectLex\parseAttributeString(), ilObjMediaPoolSubItemListGUI\parseImage(), Symfony\Component\Process\Tests\ProcessTest\pipesCodeProvider(), PHPExcel_Shared_Drawing\pixelsToCellDimension(), TCPDF\putHtmlListBullet(), ilUtil\rangeDownload(), GetId3\Module\AudioVideo\AVCSequenceParameterSetReader\readData(), ilObjSurvey\removeQuestions(), ILIAS\UI\Implementation\Component\Deck\Renderer\render(), ilUtil\resizeImage(), TCPDF\SetFont(), TCPDF\SetFontSize(), assClozeTest\setGapSize(), PHPExcel_Chart_GridLines\setGlowProperties(), PHPExcel_Chart_Axis\setGlowProperties(), PHPExcel_Chart_Axis\setSoftEdges(), PHPExcel_Chart_GridLines\setSoftEdgesSize(), ilPCInteractiveImage\setTriggerPopupSize(), ilGlossaryPresentationGUI\showDownloadList(), ilExSubmissionObjectGUI\submitBlog(), ilExSubmissionObjectGUI\submitPortfolio(), Symfony\Component\Process\Tests\ProcessTest\testProcessPipes(), Symfony\Component\Process\Tests\ProcessTest\testSetStreamAsInput(), HTMLPurifier_TagTransform_Font\transform(), ilFSStorageExercise5069\uploadAssignmentFiles(), ilFSStorageExercise\uploadAssignmentFiles(), ilPCInteractiveImageGUI\uploadOverlayImages(), and HTMLPurifier_AttrDef_CSS_Font\validate().

◆ if

if(php_sapi_name() !='cli')

Definition at line 29 of file RandomTest.php.