Exemple #1
0
 /**
  * @param string $name
  * @param mixed  $value
  *
  * @return boolean
  */
 public function addConstant($name, $value)
 {
     if (!function_exists('runkit_constant_add')) {
         return false;
     }
     return runkit_constant_add($name, $value);
 }
 /**
  * Set up
  *
  * @return void
  */
 public function setUp()
 {
     //session_start();
     // cleaning constants
     if (PMA_HAS_RUNKIT) {
         $this->oldIISvalue = 'non-defined';
         $defined_constants = get_defined_constants(true);
         $user_defined_constants = $defined_constants['user'];
         if (array_key_exists('PMA_IS_IIS', $user_defined_constants)) {
             $this->oldIISvalue = PMA_IS_IIS;
             runkit_constant_redefine('PMA_IS_IIS', null);
         } else {
             runkit_constant_add('PMA_IS_IIS', null);
         }
         $this->oldSIDvalue = 'non-defined';
         if (array_key_exists('SID', $user_defined_constants)) {
             $this->oldSIDvalue = SID;
             runkit_constant_redefine('SID', null);
         } else {
             runkit_constant_add('SID', null);
         }
     }
     $_SESSION['PMA_Theme'] = Theme::load('./themes/pmahomme');
     $GLOBALS['server'] = 0;
     $GLOBALS['PMA_Config'] = new PMA\libraries\Config();
     $GLOBALS['PMA_Config']->enableBc();
 }
 private static function constructClassConstantsFromAnnotationsFor($cls)
 {
     if (array_key_exists($cls, self::$constructedClassConstants)) {
         return;
     }
     self::$constructedClassConstants[$cls] = true;
     $anns = $cls::getAnnotationsForProperties();
     foreach ($anns as $annCol) {
         if ('enum' == ($type = $annCol->getValue('type'))) {
             $values = $annCol->getValue('values');
             foreach ($values as $value) {
                 \runkit_constant_add($cls . "::" . $value, $value);
             }
         }
     }
     $clsAnnCol = $cls::getAnnotationsForClass();
     if ($clsAnnCol->has('const')) {
         $values = $clsAnnCol->getValue('values');
         foreach ($values as $value) {
             \runkit_constant_add($cls . "::" . $value, $value);
         }
     }
 }
    public function setUp()
    {
        //session_start();

        // cleaning constants
        if ($this->runkitExt) {

            $this->oldIISvalue = 'non-defined';

            if (defined('PMA_IS_IIS')) {
                $this->oldIISvalue = PMA_IS_IIS;
                runkit_constant_redefine('PMA_IS_IIS', null);
            } else {
                runkit_constant_add('PMA_IS_IIS', null);
            }


            $this->oldSIDvalue = 'non-defined';

            if (defined('SID')) {
                $this->oldSIDvalue = SID;
                runkit_constant_redefine('SID', null);
            } else {
                runkit_constant_add('SID', null);
            }

        }
    }
Exemple #5
0
 function define($k, $v)
 {
     if (defined($k)) {
         runkit_constant_redefine($k, $v);
     } else {
         runkit_constant_add($k, $v);
     }
 }
    public function testSendHeaderLocationWithoutSidWithIis()
    {
        if ($this->runkitExt && $this->apdExt) {

            runkit_constant_redefine('PMA_IS_IIS', true);
            runkit_constant_add('PMA_COMING_FROM_COOKIE_LOGIN', true);

            $testUri = 'http://testurl.com/test.php';
            $separator = PMA_get_arg_separator();

            $header = 'Refresh: 0; ' . $testUri;

            PMA_sendHeaderLocation($testUri);            // sets $GLOBALS['header']

            // cleaning constant
            runkit_constant_remove('PMA_COMING_FROM_COOKIE_LOGIN');

            $this->assertEquals($header, $GLOBALS['header']);

        } else {
            $this->markTestSkipped('Cannot redefine constant/function - missing APD or/and runkit extension');
        }

    }
Exemple #7
0
 public static function defineConstant($className, $constName, $value)
 {
     $runkitName = ($className === null ? "" : $className . "::") . $constName;
     yTest_debugCC("defineConstant {$runkitName} to value " . var_export($value, true));
     $res = runkit_constant_add($runkitName, $value);
     yTest_assert($res);
 }