function foo($a) { for ($i = 1; $i < $a['foo']; $i++) { if ($i == 500000) { xdebug_break(); } } }
/** * @test * 2016-12-01 */ public function t01() { /** @var CR $r */ $cr = df_customer_resource(); /** @var \Magento\Framework\DB\Select $select */ $select = df_db_from($cr, $cr->getEntityIdField()); xdebug_break(); }
/** * @param \Illuminate\Database\Eloquent\Model $item */ protected function validateModel($item) { if (!$item instanceof \Illuminate\Database\Eloquent\Model) { xdebug_break(); } if ($this->modelClass && !$item instanceof $this->modelClass) { throw new InvalidArgumentException("\$item must be an instance of {$this->modelClass}"); } }
public function breakHere($condition = true) { if (!extension_loaded('xdebug')) { throw new \RuntimeException('XDebug must be installed to use this function'); } if (is_callable($condition) && $condition() || $condition) { \xdebug_break(); } }
/** * Transform the \Concept entity * @param Concept $concept * * @return array */ public function transform(Concept $concept) { xdebug_break(); //dd($concept); $properties = []; foreach ($concept->ConceptProperties as $conceptProperty) { } $result = ['id' => (int) $concept->id, 'created_at' => $concept->created_at, 'updated_at' => $concept->updated_at, 'properties' => $properties]; return $result; }
public function getRuns($namespace = NULL) { xdebug_break(); $files = $this->scanXHProfDir($this->dir, $namespace); $files = array_map(function ($f) { $f['date'] = strtotime($f['date']); return $f; }, $files); return $files; }
public function provideEditableColumns(array &$fieldSpecs) { xdebug_break(); if (self::ModelClass == $this->owner->class) { $fieldSpecs += array('ProductID' => array('title' => 'Product Name', 'callback' => function ($record) { return new Select2Field('ProductID', '', Product::get()->map()->toArray()); }), 'StockLevel' => array('title' => 'In Stock', 'callback' => function ($record, $col) { return new NumericField('StockLevel'); })); } }
public function onStart(EnvironmentEvent $event) { xdebug_break(); $this->io = $event->getIO(); $this->io->write('<comment>SpressSitemapXML::onStart.</comment>'); $sourceDir = $event->getSourceDir(); $repository = $event->getConfigRepository(); $dataDir = $sourceDir . '/_data'; $data = []; xdebug_var_dump($data); var_dump(array(array(TRUE, 2, 3.14, 'foo'), 'object' => $c)); }
public static function evaluateTerminalSequences($output) { $stack = str_split($output); $sequence = array(); $hasColor = 0; for ($index = 0; $index < count($stack); $index++) { $char = $stack[$index]; // carriage return if ($char == "\r") { continue; } // backspace if ($char == "") { // remove style-items from the sequences $char = end($sequence); while ($char !== false) { if (strlen($char) > 1 || $char == "\n") { array_pop($sequence); } else { break; } $char = end($sequence); } // remote the last char item from the sequence array_pop($sequence); continue; } if ($char == "") { if (static::parseColor($stack, $index, $sequence, $hasColor)) { continue; } } $sequence[] = $char; if (preg_match('~contao-community-alliance/translator$~', implode('', $sequence))) { xdebug_break(); } } if ($hasColor) { $sequence[] = '</span>'; } return implode('', $sequence); }
/** * Take screen shot when step fails. * And then pause everything * Works only with Selenium2Driver. * * @param AfterStepScope $scope * * @AfterStep */ public function myAfterStepHook(AfterStepScope $scope) { if (99 === $scope->getTestResult()->getResultCode()) { $driver = $this->getSession()->getDriver(); if ($driver instanceof \Behat\Mink\Driver\Selenium2Driver) { $name = preg_replace('%[^a-z0-9]%i', '_', array_pop($_SERVER['argv']) . ':' . $scope->getStep()->getText() . '_' . $driver->getCurrentUrl()); if (!file_exists('/tmp/behat')) { mkdir('/tmp/behat/'); } if (strlen($name) > 250) { $name = substr($name, 0, 200); $name .= date('YmdHis'); } $file = '/tmp/behat/' . $name . '.png'; file_put_contents($file, $this->getSession()->getDriver()->getScreenshot()); echo "Error Screen Shot Saved to {$file}"; xdebug_break(); } } }
public static function handleError($iErrorNumber, $sErrorString, $sErrorFile, $iErrorLine, $aContext = null, $aTrace = null, $bNeverPrint = false, $bIsUserError = false) { if (error_reporting() === 0 || $iErrorNumber === E_STRICT) { return false; } if (function_exists('xdebug_break')) { xdebug_break(); } if ($aTrace === null) { $aTrace = debug_backtrace(); array_shift($aTrace); //Remove ErrorHandler::handleError call; } self::cleanTrace($aTrace); $aError = array("code" => $iErrorNumber, "message" => $sErrorString, "filename" => $sErrorFile, "line" => $iErrorLine, "trace" => $aTrace); self::handle($aError, $bNeverPrint, $bIsUserError); if ($bNeverPrint || self::shouldContinue($iErrorNumber)) { return true; } self::displayErrorMessage($aError, $bIsUserError); }
/** @param array sorted data @param &array output @param int Planets number @param string search key from @param string search key to @param string subkey to find @param string prefix when store in array @return boolean **/ private function GetRessFrom($data, &$output, $nb, $subkey, $from = '', $to = '', $prefix = '') { if ($this->readonly) { return false; } $from_pos = array_search($from, $data); $to_pos = array_search($to, $data); if ($from_pos === false) { $slice = $data; } elseif ($to_pos === false) { $slice = array_slice($data, $from_pos + 1); } else { $slice = array_slice($data, $from_pos + 1, $to_pos - $from_pos - 1); } foreach ($slice as $k => $v) { $slice[$k] = trim($v); } // chrome => ' $subkey' foreach ($subkey as $a => $m) { $p = 0; $k = array_search($m, $slice); if ($k === false) { // en cas d'érreur de 'subkey' echo "Error ownuniverse::GetRessFrom(., {$from}, {$to}: {$p} => {$m}\n" . print_r($subkey, true) . print_r($slice, true) . "\n"; xdebug_break(); return false; } $tmp = array_slice($slice, $k + 1, $nb); foreach ($tmp as $v) { if (!is_numeric($a)) { $output[$p]["{$prefix}{$a}"] = str_replace('.', '', $v); } else { $output[$p]["{$prefix}{$m}"] = str_replace('.', '', $v); } $p++; } } return true; }
function my_xml_error_handler($errno, $errstr, $errfile, $errline) { global $_my_xml_error_handler; $errfile = str_replace(ROOT_PATH, '', $errfile); $errstr = str_replace(ROOT_PATH, '', $errstr); switch ($errno) { case E_USER_WARNING: case E_WARNING: xdebug_break(); $_my_xml_error_handler .= "ALERTE [{$errno}] {$errstr} (Fichier {$errfile}:{$errline})\n"; break; case E_ERROR: case E_PARSE: case E_USER_ERROR: xdebug_break(); $_my_xml_error_handler .= "ERREUR [{$errno}] {$errstr}\n" . " Erreur fatale sur la ligne {$errline} dans le fichier {$errfile}" . ", PHP " . PHP_VERSION . " (" . PHP_OS . ")\n" . 'Arrêt...'; output::_DoOutput('<php><phperror><![CDATA[' . DataEngine::xml_fix51($_my_xml_error_handler) . ']]></phperror></php>'); break; default: //Do nothing? if (!stristr($errstr, 'Undefined')) { xdebug_break(); $_my_xml_error_handler .= "NOTICE [{$errno}] {$errstr} (Fichier {$errfile}:{$errline})\n"; } break; } }
/** * @test * 2016-11-29 */ public function t02() { $theme = df_theme_resolver()->get(); xdebug_break(); }
public static function xBreak() { echo xdebug_break(); }
public static function handle_error($errno, $message, $file = '', $line = 0, $context = array()) { if (!is_array($context)) { $context = array($context); } if (is_callable('xdebug_break')) { xdebug_break(); } $map = array(E_ERROR => array('E_ERROR', static::ERROR), E_WARNING => array('E_WARNING', static::WARNING), E_PARSE => array('E_PARSE', static::ERROR), E_NOTICE => array('E_NOTICE', static::NOTICE), E_CORE_ERROR => array('E_CORE_ERROR', static::ERROR), E_CORE_WARNING => array('E_CORE_WARNING', static::WARNING), E_COMPILE_ERROR => array('E_COMPILE_ERROR', static::ERROR), E_COMPILE_WARNING => array('E_COMPILE_WARNING', static::WARNING), E_USER_ERROR => array('E_USER_ERROR', static::ERROR), E_USER_WARNING => array('E_USER_WARNING', static::WARNING), E_USER_NOTICE => array('E_USER_NOTICE', static::NOTICE), E_STRICT => array('E_STRICT', static::WARNING), E_RECOVERABLE_ERROR => array('E_RECOVERABLE_ERROR', static::WARNING), E_DEPRECATED => array('E_DEPRECATED', static::WARNING), E_USER_DEPRECATED => array('E_USER_DEPRECATED', static::WARNING)); list($prefix, $level) = array_key_exists($errno, $map) ? $map[$errno] : array('E_UNKOWN(' . $errno . ')', static::ERROR); return static::write($level, static::ERROR_HANDLER, $prefix . ':' . $message, $file, $line, $context); }
function lx_xdebug_break() { if (function_exists('xdebug_break')) { xdebug_break(); } }
/** * Prints the current wide collumn format. */ public function printWide() { xdebug_break(); $block = array(); $this->getWideProfile($block); print join("\n", $block); }
function fix_string($a) { xdebug_break(); echo "Called @ " . xdebug_call_file() . ":" . xdebug_call_line() . " from " . xdebug_call_function(); }
<?php require __DIR__ . '/../vendor/autoload.php'; tick(3); // tick 1, false tick(3); // tick 2, false echo 'b'; xdebug_break(); echo 'a'; tick(3); // tick 3, true do { stack('a'); } while (!tick(5)); // tick 4, tick 5
/** * Loads the given class or interface. * * @param string $className The name of the class to load. * @return void */ public function loadClass($className) { if (null === $this->_namespace || $this->_namespace . $this->_namespaceSeparator === substr($className, 0, strlen($this->_namespace . $this->_namespaceSeparator))) { $fileName = ''; $namespace = ''; if (false !== ($lastNsPos = strripos($className, $this->_namespaceSeparator))) { $namespace = substr($className, 0, $lastNsPos); $className = substr($className, $lastNsPos + 1); $fileName = str_replace($this->_namespaceSeparator, DIRECTORY_SEPARATOR, $namespace) . DIRECTORY_SEPARATOR; } $fileName .= str_replace('_', DIRECTORY_SEPARATOR, $className) . $this->_fileExtension; $fullFileName = ($this->_includePath !== null ? $this->_includePath . DIRECTORY_SEPARATOR : '') . $fileName; if (file_exists($fullFileName) == false) { xdebug_break(); } require ($this->_includePath !== null ? $this->_includePath . DIRECTORY_SEPARATOR : '') . $fileName; } }
/** * Use this one to pause execution of the PHP session that is actually running your Behat tests. * Ideal for pausing execution whilst you can dig around in the browser session to see what's actually going on * * @When I xdebug break */ public function iXdebugBreak() { xdebug_break(); }
/** * This function makes the debugger break on the specific line as if a normal file/line breakpoint was set on this line. * * @return void */ public function _break() { xdebug_break(); }
/** * this is for importing a list of value vocabulary files. * * it's designed specifically to import the list of marc21 VES files, * but may be modified and expanded to support more things * * @param $task * @param $args * * @throws Exception */ function run_import_list($task, $args) { xdebug_break(); //check the argument counts //check the argument counts if (count($args) < 1) { throw new Exception('You must provide a vocabulary type.'); } if (count($args) < 2) { throw new Exception('You must provide a file name.'); } //set the arguments $type = strtolower($args[0]); $filePath = $args[1]; $batchId = $args[3]; //does the file exist? if (! file_exists($filePath)) { throw new Exception('You must supply a valid file to import'); } //is the file a valid type? if (preg_match('/^.+\.([[:alpha:]]{2,4})$/', $filePath, $matches)) { if (! in_array( strtolower($matches[1]), array( "json", "rdf", "csv", "xml" ) ) ) { throw new Exception('You must provide a valid file type based on the extension'); } } else { throw new Exception("File type cannot be determined from the file extension"); } /************************************************************ * Set Defaults Here * *************************************************************/ $fileType = $matches[1]; //todo: need to figure out a way to pass defaults dynamically $importTask = new pakeTask('import-vocabulary'); // parse file to get the fields/columns and data $file = fopen($filePath, "r"); if (! $file) { throw new Exception("Can't read supplied file"); } switch ($fileType) { case "csv": try { $reader = new aCsvReader($filePath); } catch(Exception $e) { throw new Exception("Not a happy CSV file! Error: " . $e); } $uploadPath = $GLOBALS['uploadPath']; ; if ('vocab' == $type) { // Get array of heading names found $headings = $reader->getHeadings(); $fields = VocabularyPeer::getFieldNames(); try { while ($row = $reader->getRow()) { // lookup the URI (or the OMR ID if available) for a match if (empty($row["VES"])) { //skip this one break; } $uri = $baseDomain . $row["VES"] . "#"; $vocab = VocabularyPeer::getVocabularyByUri($uri); $updateTime = time(); if (! $vocab) { // create a new concept or element $vocab = new Vocabulary(); $vocab->setUri($uri); $vocab->setCreatedAt($updateTime); $vocab->setCreatedUserId($userId); $vocab->setAgentId($agentID); $vocab->setBaseDomain($baseDomain); $vocab->setCommunity("Libraries, MARC21"); $vocab->setLanguage("en"); $vocab->setStatusId(1); } else { $vocab->setLastUpdated($updateTime); $vocab->setUpdatedUserId($userId); } $vocab->setName(fixEncoding(rtrim($row['Name']))); $vocab->setNote(fixEncoding(rtrim($row['Note']))); $vocab->setToken($row['VES']); $vocab->save(); //type $args[0] = "vocab"; //vocabid $args[2] = $vocab->getId(); //filepath $args[1] = $GLOBALS['uploadPath'] . $row['VES'] . ".csv"; $args[3] = $batchId; $args[4] = "-d"; run_import_vocabulary($importTask, $args); $foo = $vocab->countConcepts(); } } catch(Exception $e) { throw new Exception($e); } } else //it's a schema { try { while ($row = $reader->getRow()) { //NOTE: this is explicitly tuned to a particular import file //TODO: generalize this import mapping // lookup the URI (or the OMR ID if available) for a match if (empty($row["URI"])) { //skip this one break; } $uri = $row["URI"]; $schema = SchemaPeer::getschemaByUri($uri); $updateTime = time(); if (! $schema) { // create a new vocabulary $schema = new Schema(); $schema->setUri($uri); $schema->setCreatedAt($updateTime); $schema->setCreatedUserId($userId); $schema->setAgentId($agentID); $schema->setBaseDomain($baseDomain); $schema->setProfileId(1); } else { $schema->setUpdatedAt($updateTime); $schema->setUpdatedUserId($userId); } $schema->setCommunity($row['Tags']); $schema->setLanguage($row['Language']); $schema->setNsType("slash"); $schema->setName($row['Label']); $schema->setNote($row['Note']); $schema->setStatusId(1); $schema->setToken($row['Name']); $schema->setUrl($row['URL']); $schema->save(); //todo: create a new import batch here and pass it to the import args //see importVocabulary->saveresults() //$batchId = //type $args[0] = "schema"; //filepath $args[1] = $GLOBALS['uploadPath'] . $row['File Name']; //vocabid $args[2] = $schema->getId(); $args[3] = $batchId; $args[4] = "-d"; run_import_vocabulary($importTask, $args); $foo = $schema->countSchemaPropertys(); } } catch(Exception $e) { throw new Exception($e); } } break; default: } }
public function testApplyTransformationFailureDestinationNotOverwriteable() { xdebug_break(); $tmpDir = $this->createTempDir(__CLASS__); $dstFile = "{$tmpDir}/non_writeable_png.png"; touch($dstFile); chmod(dirname($dstFile), 0555); clearstatcache(); $trans = new ezcImageTransformation($this->converter, "test", array(), array('image/jpeg')); try { $trans->transform($this->testFiles['png'], $dstFile); $this->fail('Exception not throwen with not writeable file.'); } catch (ezcImageFileNotProcessableException $e) { } chmod(dirname($dstFile), 0777); clearstatcache(); $this->removeTempDir(); }