ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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 51 of file RandomTest.php.

References UNORM_NFC, UTF8_FFFE, UTF8_FFFF, and UTF8_REPLACEMENT.

52 {
53  # We exclude a few chars that ICU would not.
54  $str = preg_replace('/[\x00-\x08\x0b\x0c\x0e-\x1f]/', UTF8_REPLACEMENT, $str);
55  $str = str_replace(UTF8_FFFE, UTF8_REPLACEMENT, $str);
56  $str = str_replace(UTF8_FFFF, UTF8_REPLACEMENT, $str);
57 
58  # UnicodeString constructor fails if the string ends with a head byte.
59  # Add a junk char at the end, we'll strip it off
60  return rtrim(utf8_normalize($str . "\x01", UNORM_NFC), "\x01");
61 }
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 $i, and $out.

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

◆ showDiffs()

showDiffs (   $a,
  $b 
)

Definition at line 68 of file RandomTest.php.

References array.

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

◆ wfMsg()

Variable Documentation

◆ $n

$n = 0

Definition at line 85 of file RandomTest.php.

Referenced by SAML2\XML\ds\X509Data\__construct(), ilPersonalSkillExplorerGUI\__construct(), SAML2\XML\ds\KeyInfo\__construct(), ilSurveySkillExplorer\__construct(), ilRepositoryExplorerGUI\__construct(), SAML2\XML\saml\SubjectConfirmationData\__construct(), SAML2\XML\md\EntityDescriptor\__construct(), HTMLPurifier_Token\__get(), _tree_struct\_analyze(), 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(), SAML2\Assertion\addEncryptedAttributeStatement(), wsdl\addOperation(), SAML2\Utils\addString(), SAML2\Utils\addStrings(), 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(), Twig_ExpressionParser\checkConstantExpression(), Twig_Tests_NodeVisitor_OptimizerTest\checkForConfiguration(), Twig_TokenParser_For\checkLoopUsageBody(), Twig_TokenParser_For\checkLoopUsageCondition(), ilObjSkillManagementGUI\collapseAll(), ilObjSCORM2004LearningModuleGUI\collapseAll(), Twig_Extensions_Node_Trans\compileString(), HTMLPurifier_UnitConverter\convert(), ilSCORM13Package\dbImportSco(), ilSurveySkill\determineMaxScale(), Securimage\drawLines(), HTML5TreeConstructer\elementInScope(), ilObjSkillManagementGUI\expandAll(), ilObjSCORM2004LearningModuleGUI\expandAll(), UtfNormal\fastCombiningSort(), UtfNormal\fastCompose(), UtfNormal\fastDecompose(), Twig_Parser\filterBodyNodes(), GeSHi\finalise(), IMSGlobal\LTI\ToolProvider\ToolProvider\findService(), Gettext\Extractors\Po\fromString(), ilSkillUsage\getAllUsagesInfoOfSubtrees(), ilAwarenessData\getData(), ilSkillDataSet\getDependencies(), HTMLPurifier_HTMLModuleManager\getElements(), Datamatrix\getErrorCorrection(), Twig_ExpressionParser\getFunctionNode(), ilTestTaxonomyTree\getMaxOrderValueLength(), DifferenceEngine\getMultiNotice(), ilTestTaxonomyTree\getNodeOrderingPathString(), ilBlogNewsRendererGUI\getObjectLink(), ilForumNewsRendererGUI\getObjectLink(), ilLearningModuleNewsRendererGUI\getObjectLink(), ilWikiNewsRendererGUI\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(), Gettext\Translator\isPlural(), PHPExcel_Calculation_Token_Stack\last(), EvalMathStack\last(), PHPExcel_Reader_Excel5\load(), Title\makeName(), PHPExcel_Calculation_Financial\MIRR(), ilPCSourceCode\modifyPageContentPostXsl(), ilPersonalDesktopGUI\multiarray_sort(), Title\nameOf(), FastRoute\RouteParser\Std\parse(), SMTP\parseHelloFields(), Twig_ExpressionParser\parseSubscriptExpression(), present_eptid(), PHPExcel_Calculation_Financial\PRICE(), ilStatistics\product_n(), ilStatistics\quantile(), UtfNormal\quickIsNFC(), UtfNormal\quickIsNFCVerify(), ilObjSCORM2004LearningModule\readObject(), ilObjSCORMLearningModule\readObject(), ilCalendarEntry\readResponsibleUsers(), WavFile\readWavHeader(), ilSCORM2004Page\removeInvalidLinks(), ILIAS\UI\Implementation\Component\Glyph\Renderer\render(), ilNestedListInputGUI\render(), ilFileStandardDropzoneInputGUI\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(), PHPExcel_Style_NumberFormat\toFormattedString(), HTMLPurifier_Token_Empty\toNode(), Twig_Node\toXml(), Twig_NodeTraverser\traverseForVisitor(), and PHPExcel_Calculation_Statistical\ZTEST().

◆ $size

$size = 16

Definition at line 84 of file RandomTest.php.

Referenced by ilObjectXMLWriter\__appendObjectProperties(), ilObjectFeedWriter\__construct(), ilFileVersionTableGUI\__construct(), ILIAS\FileUpload\DTO\Metadata\__construct(), PDF417\__construct(), QRcode\__construct(), PHPExcel_Style_NumberFormat\_complexNumberFormatMask(), ilObjMediaObject\_determineWidthHeight(), ilObjMediaObjectGUI\_getMediaInfoHTML(), PHPExcel_Reader_Excel5\_getNextToken(), ilObjForumAccess\_lookupDiskUsage(), ilObjMediaCastAccess\_lookupDiskUsage(), ilFileDataMail\_lookupDiskUsageOfUser(), ilObjFileAccess\_lookupFileSize(), ilObjFileAccess\_lookupFileSizeFromFilesystem(), 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\addIdBasedNode(), ilCloudFileTree\addNode(), ilInfoScreenGUI\addObjectSections(), ilADTTextFormBridge\addToForm(), getid3_tar\Analyze(), QRcode\appendBytes(), QRcode\appendNewInputItem(), ilUserAvatarFactory\avatar(), QRcode\bitstreamToByte(), PHPExcel_Shared_Drawing\cellDimensionToPixels(), QRcode\check(), QRcode\checkModeAn(), QRcode\checkModeKanji(), QRcode\checkModeNum(), PHPExcel_Writer_Excel5_Escher\close(), PHPExcel_Calculation_Statistical\CONFIDENCE(), ILIAS\UI\Implementation\Component\Icon\Factory\custom(), ILIAS\FileDelivery\FileDeliveryTypes\PHPChunked\deliver(), ilUtil\dirsize(), Securimage\drawNoise(), ilObjExternalToolsSettingsGUI\editMathJaxObject(), QRcode\estimateBitsMode8(), QRcode\estimateBitsModeAn(), QRcode\estimateBitsModeKanji(), QRcode\estimateBitsModeNum(), HTMLPurifier_Strategy_MakeWellFormed\execute(), sspmod_statistics_Graph_GoogleCharts\extEncode(), Parser\fetchScaryTemplateMaybeFromCache(), ilUserAvatarFactory\file(), ilMediaCastTableGUI\fillRow(), ilMediaPoolTableGUI\fillRow(), Slim\App\finalize(), 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(), GuzzleHttp\Psr7\AppendStream\getSize(), ILIAS\Filesystem\Provider\FlySystem\FlySystemFileAccess\getSize(), ilMDTechnical\getSize(), ilObjMediaObjectGUI\getStandardSizeObject(), getid3_matroska\HandleEMBLClusterBlock(), ilObjFileGUI\handleFileUpload(), getid3_lib\hash_data(), HTTP_WebDAV_Server\http_GET(), TCPDFBarcode\imb_tables(), PHPExcel_Writer_Excel5_Worksheet\insertBitmap(), QRcode\insertStructuredAppendHeader(), QRcode\lengthOfCode(), ilMediaItem\makeMapWorkCopy(), ilMediaAliasItem\makeMapWorkCopy(), QRcode\newFromBytes(), QRcode\newInputItem(), League\Flysystem\Adapter\AbstractFtpAdapter\normalizeUnixObject(), League\Flysystem\Adapter\AbstractFtpAdapter\normalizeWindowsObject(), outMobImageParams(), HTMLPurifier_Lexer_DirectLex\parseAttributeString(), ilObjMediaPoolSubItemListGUI\parseImage(), PHPExcel_Shared_Drawing\pixelsToCellDimension(), TCPDF\putHtmlListBullet(), ilUtil\rangeDownload(), GuzzleHttp\Psr7\readline(), ilObjSurvey\removeQuestions(), ILIAS\UI\Implementation\Component\Deck\Renderer\render(), ilUtil\resizeImage(), GuzzleHttp\Psr7\CachingStream\seek(), 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(), ilMailFormGUI\showForm(), ILIAS\UI\Implementation\Component\Icon\Factory\standard(), ilExSubmissionObjectGUI\submitBlog(), ilExSubmissionObjectGUI\submitPortfolio(), ILIAS\Filesystem\Provider\FlySystem\FlySystemFileAccessTest\testGetSizeWhichShouldSucceed(), ILIAS\Filesystem\Stream\StreamTest\testGetSizeWithDetachedStreamWhichShouldFail(), ILIAS\Filesystem\Stream\StreamTest\testGetSizeWithOptionsWhichShouldSucceed(), ILIAS\Filesystem\Stream\StreamTest\testGetSizeWithStatsWhichShouldSucceed(), HTMLPurifier_TagTransform_Font\transform(), League\Flysystem\Adapter\Local\update(), ilFSWebStorageExercise\uploadAssignmentFiles(), ilFSStorageExercise5069\uploadAssignmentFiles(), ilFSStorageExercise\uploadAssignmentFiles(), ilPCInteractiveImageGUI\uploadOverlayImages(), HTMLPurifier_AttrDef_CSS_Font\validate(), and League\Flysystem\Adapter\Local\write().

◆ if

if(php_sapi_name() !='cli')

Definition at line 29 of file RandomTest.php.