Esempio n. 1
0
 /**
  * Test array_unshift_ref
  *
  * @return void
  * @todo Implement testArray_unshift_ref().
  */
 public function testArrayUnshiftRef()
 {
     $input = array(3, 5, 7);
     $expected = array("fred", 3, 5, 7);
     $value = "fred";
     $this->assertThat(JUtility::array_unshift_ref($input, $value), $this->equalTo(4));
     $this->assertThat($input, $this->equalTo($expected));
 }
Esempio n. 2
0
 function &prependFilter($filtername, $read_write = STREAM_FILTER_READ, $params = array())
 {
     $res = false;
     if ($this->_fh) {
         // Capture PHP errors
         $php_errormsg = '';
         $track_errors = ini_get('track_errors');
         ini_set('track_errors', true);
         $res = @stream_filter_prepend($this->_fh, $filername, $read_write, $params);
         if (!$res && $php_errormsg) {
             $this->setError($php_errormsg);
         } else {
             JUtility::array_unshift_ref($res, $this->filters);
         }
         // push the new resource onto the filter stack
         // restore error tracking to what it was before
         ini_set('track_errors', $track_errors);
     }
     return $res;
 }