private function getJson($path, $zip, $file, $assoc = FALSE) {
    // Get stream
    $stream = $zip->getStream($file);
    if (!$stream) {
      // Breaking error, no need to continue validating.
      $this->h5pF->setErrorMessage($this->h5pF->t('Unable to read file from the package: %fileName', array('%fileName' => $file)), 'unable-to-read-package-file');
      $zip->close();
      unlink($path);
      return NULL;
    }

    // Read data
    $contents = '';
    while (!feof($stream)) {
      $contents .= fread($stream, 2);
    }

    // Decode the data
    $json = json_decode($contents, $assoc);
    if ($json === NULL) {
      // JSON cannot be decoded or the recursion limit has been reached.
      $this->h5pF->setErrorMessage($this->h5pF->t('Unable to parse JSON from the package: %fileName', array('%fileName' => $file)), 'unable-to-parse-package');
      return FALSE;
    }

    // All OK
    return $json;
  }
private function getJson($path, $zip, $file, $assoc = FALSE) {
    // Get stream
    $stream = $zip->getStream($file);
    if (!$stream) {
      // Breaking error, no need to continue validating.
      $this->h5pF->setErrorMessage($this->h5pF->t('Unable to read file from the package: %fileName', array('%fileName' => $file)), 'unable-to-read-package-file');
      $zip->close();
      unlink($path);
      return NULL;
    }

    // Read data
    $contents = '';
    while (!feof($stream)) {
      $contents .= fread($stream, 2);
    }

    // Decode the data
    $json = json_decode($contents, $assoc);
    if ($json === NULL) {
      // JSON cannot be decoded or the recursion limit has been reached.
      $this->h5pF->setErrorMessage($this->h5pF->t('Unable to parse JSON from the package: %fileName', array('%fileName' => $file)), 'unable-to-parse-package');
      return FALSE;
    }

    // All OK
    return $json;
  }
private function getJson ( $ path , $ zip , $ file , $ assoc = FALSE ) { // Get stream $ stream = $ zip -> getStream ( $ file ) ; if ( ! $ stream ) { // Breaking error, no need to continue validating. $ this -> h5pF -> setErrorMessage ( $ this -> h5pF -> t ( 'Unable to read file from the package: %fileName' , array ( '%fileName' => $ file ) ) , 'unable-to-read-package-file' ) ; $ zip -> close ( ) ; unlink ( $ path ) ; return NULL ; } // Read data $ contents = '' ; while ( ! feof ( $ stream ) ) { $ contents .= fread ( $ stream , 2 ) ; } // Decode the data $ json = json_decode ( $ contents , $ assoc ) ; if ( $ json === NULL ) { // JSON cannot be decoded or the recursion limit has been reached. $ this -> h5pF -> setErrorMessage ( $ this -> h5pF -> t ( 'Unable to parse JSON from the package: %fileName' , array ( '%fileName' => $ file ) ) , 'unable-to-parse-package' ) ; return FALSE ; } // All OK return $ json ; }
Help read JSON from the archive

@param string $path
@param ZipArchive $zip
@param string $file
@return mixed JSON content if valid, FALSE for invalid, NULL for breaking error.
Help read JSON from the archive