Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use of undefined constant FILE_TEXT #2

Open
twisen opened this issue Jun 24, 2010 · 2 comments
Open

Use of undefined constant FILE_TEXT #2

twisen opened this issue Jun 24, 2010 · 2 comments

Comments

@twisen
Copy link

twisen commented Jun 24, 2010

Hello,
I'm using your library join with symfony for my degree proyect (a bibliographic references manager). All works perfect but when I use a variable to call the function "parseFile" the page show me this:

( ! ) Notice: Use of undefined constant FILE_TEXT - assumed 'FILE_TEXT' in /home/sfprojects/UsalRef/lib/vendor/LibRIS/src/LibRIS.php on line 61
Call Stack

Time Memory Function Location

1 0.0000 52224 {main}( ) ../frontend_dev.php:0
2 0.0312 1304648 sfContext->dispatch( ) ../frontend_dev.php:13
3 0.0312 1304648 sfFrontWebController->dispatch( ) ../sfContext.class.php:170
4 0.0314 1310892 sfController->forward( ) ../sfFrontWebController.class.php:48
5 0.0362 1424424 sfFilterChain->execute( ) ../sfController.class.php:235
6 0.0367 1426740 sfRenderingFilter->execute( ) ../sfFilterChain.class.php:53
7 0.0367 1426740 sfFilterChain->execute( ) ../sfRenderingFilter.class.php:33
8 0.0372 1427648 sfBasicSecurityFilter->execute( ) ../sfFilterChain.class.php:53
9 0.0374 1427648 sfFilterChain->execute( ) ../sfBasicSecurityFilter.class.php:72
10 0.0379 1428880 sfExecutionFilter->execute( ) ../sfFilterChain.class.php:53
11 0.0380 1429144 sfExecutionFilter->handleAction( ) ../sfExecutionFilter.class.php:42
12 0.0381 1429144 sfExecutionFilter->executeAction( ) ../sfExecutionFilter.class.php:78
13 0.0381 1429144 sfActions->execute( ) ../sfExecutionFilter.class.php:92
14 0.0385 1431648 referenciaActions->executeFromRIS( ) ../sfActions.class.php:60
15 0.0533 1983176 GestionRIS->importar( ) ../actions.class.php:290
16 0.0533 1983232 LibRIS->parseFile( ) ../GestionRIS.php:385

I don't know why, When I use a string to pass the filename it's works perfect. My code is this:

public function executeFromRIS(sfWebRequest $request){
$RIS = new GestionRIS();
$RIS->importar('uploads/import.ris', $this->getUser()->getAttribute('UID'));

     //$this->redirect('referencia/index');
}

public function importar($archivo, $uid){
$ris = new LibRIS();
$ris->parseFile($archivo);

    $entradas = $ris->getRecords();
    $errores = 0;
    foreach($entradas as $index => $entrada){
        switch($entrada['TY'][0]){
            case('NEWS'):
            case('MGZN'):
            case('JOUR'):
            case('JFULL'):
                $errores += $this->risToArticle($entrada, $index, $uid);
                break;
            case('BOOK'):
                if(isset($entrada['PB'])) $errores += $this->risToBook($entrada, $index, $uid);
                else $errores += $this->risToManual($entrada, $index, $uid);
                break;
            case('PAMP'):
                $errores += $this->risToBooklet($entrada, $index, $uid);
                break;
            case('CONF'):
                if(isset($entrada['TI']))$errores += $this->risToConference($entrada, $index, $uid);
                else $errores += $this->risToProceeding($entrada, $index, $uid);
                break;
            case('ELEC'):
                $errores += $this->risToImproceedings($entrada, $index, $uid);
                break;
            case('CHAP'):
                if(isset($entrada['TI'])) $errores += $this->risToIncollection($entrada, $index, $uid);
                else $errores += $this->risToInbook($entrada, $index, $uid);
                break;
            case('THES'):
                if(isset($entrada['U4'])){
                    if($entrada['U4'][0] == 'master') $errores += $this->risToMasterthesis($entrada, $index, $uid);
                    else $errores += $this->risToPhdthesis($entrada, $index, $uid);
                }                   
                else $errores += $this->risToMasterthesis($entrada, $index, $uid);
                break;
            case('GEN'):
                $errores += $this->risToMist($entrada, $index, $uid);
                break;
            case('RPRT'):
                $errores += $this->risToTechreport($entrada, $index, $uid);
                break;
            case('UNPB'):
                $errores += $this->risToUnpublished($entrada, $index, $uid);
                break;
            default:
                $this->guardaError(sprintf("La entrada %s: %s no tiene un tipo reconocido.", $index, $entrada['T1'][0]));
                $errores += 1;
                break;
        }
    }

}

Thanks for the library at all and sorry about my english

@technosophos
Copy link
Owner

What version of PHP are you using? (5.1, 5.2, 5.3?) I think the FILE_TEXT constant might not be defined in some versions of PHP.

@twisen
Copy link
Author

twisen commented Jun 29, 2010

My version is 5.2.6-3 in Ubuntu

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants