/** * Produce a diff (using the "diff" application) between two strings * The function will write the two input strings to temporary files, then execute the diff program, delete the temp files and return the result. * * @param string $str1 String 1 * @param string $str2 String 2 * @return array The result from the exec() function call. * @access private */ public function getDiff($str1, $str2) { // Create file 1 and write string $file1 = GeneralUtility::tempnam('diff1_'); GeneralUtility::writeFile($file1, $str1); // Create file 2 and write string $file2 = GeneralUtility::tempnam('diff2_'); GeneralUtility::writeFile($file2, $str2); // Perform diff. $cmd = $GLOBALS['TYPO3_CONF_VARS']['BE']['diff_path'] . ' ' . $this->diffOptions . ' ' . $file1 . ' ' . $file2; $res = array(); CommandUtility::exec($cmd, $res); unlink($file1); unlink($file2); return $res; }