php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #25482 CLI isn't reporting parse errors correctly
Submitted: 2003-09-10 21:58 UTC Modified: 2003-09-10 22:02 UTC
From: tim dot lokot at printsoft dot com Assigned:
Status: Not a bug Package: CGI/CLI related
PHP Version: 4.3.2 OS: Debian GNU/Linux 3.0
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: tim dot lokot at printsoft dot com
New email:
PHP Version: OS:

 

 [2003-09-10 21:58 UTC] tim dot lokot at printsoft dot com
Description:
------------
If I run a script with parse errors using the CLI on Debian with some of the Zend software installed on it, parse errors are not reported at all by default.

This is fine, seeing as I can run "php -l file.php" and it "should" report something more meaningful than:

"Errors parsing file.php"

If I put this file onto Windows and run it using the 4.3.3 CLI, I get this:

"Parse error: parse error, unexpected '{' in virtuele-backup.php on line 45
Errors parsing virtuele-backup.php"

output of php -v
-----------------
PHP 4.3.2 (cli) (built: Jul 16 2003 15:43:08)
Copyright (c) 1997-2003 The PHP Group
Zend Engine v1.3.0, Copyright (c) 1998-2003 Zend Technologies
    with Zend Extension Manager v1.0.0, Copyright (c) 2003, by Zend Technologies
    with Zend Optimizer v2.1.0, Copyright (c) 1998-2003, by Zend Technologies
    with <b>DISABLED</b> Zend Performance Suite v3.5.0, Copyright (c) 1999-2003, by The Accelerator presently supports only Apache, ISAPI and FastCGI SAPIs

output of php -m
----------------
[PHP Modules]
Zend Optimizer
ctype
mysql
overload
pcre
posix
session
standard
tokenizer
wddx
xml

[Zend Modules]
<b>DISABLED</b> Zend Performance Suite
Zend Extension Manager
Zend Optimizer


I think it is the Zend stuff that is suppressing the errors as I have another server that is reporting errors without the Zend stuff installed.  This server is exactly the same is every other respect.

* Please note that I will not be able to install higher versions of php to test this as it is a production server and the Zend software we have is not certified for higher versions *

Reproduce code:
---------------
Sorry this is more than 20 lines long, but I have no other way of getting this to you:

#!/usr/local/bin/php
<?php

// Check if mysql extension is loaded or not.  CLI is not compiled with mysql support?

	if (!extension_loaded ('mysql'))
		dl ('mysql.so');
	
// Get current working directory

	$cwd = getcwd();
	
// Create .offline file to stop Virtuele from accessing the database

	$retVal = `touch /var/www/webroot/.offline`;
	
// Connect to MySQL

	$db = mysql_connect ('localhost', '*******', '*******') or die ('Cant connect to mysql: ' . mysql_error());
	$db = mysql_select_db ('virtuele', $db) or die ('Cant connect to Virtuele database: ' . mysql_error());

// Lock database tables

	$sql = 'FLUSH TABLES WITH READ LOCK';

	if (!mysql_query ($sql))
	{
		echo "ERR: Could not establish table locks: " . mysql_error() . "\n";
	}

// Backup the database

	// Current timestamp
	$dt = date("Ymd-His", time());
	
	chdir ('/var/lib/mysql');
	$retVal = `tar zcvf /backup/virtuele_$dt.tgz virtuele/`;
	echo $retVal . "\n";

// Unlock database tables

	$sql = 'UNLOCK TABLES';
	
	if (!mysql_query ($sql)
	{
		echo "ERR: Could not unlock database tables" . mysql_error() . "\n";
	}

// Close MySQL connection

	mysql_close ($db);
	
// Remove the .offline file

	$retVal = `rm /var/www/webroot/.offline`;
	
	// Put the focus back into the same directory we started in
	chdir ($cwd);
?>


Expected result:
----------------
"Parse error: parse error, unexpected '{' in virtuele-backup.php on line 45
Errors parsing virtuele-backup.php"

Actual result:
--------------
"Errors parsing virtuele-backup.php"

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-09-10 22:02 UTC] sniper@php.net
Report this to Zend. Not PHP bug.

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Mar 29 01:01:28 2024 UTC