From: tim dot lokot at printsoft dot com
Operating system: Debian GNU/Linux 3.0
PHP version: 4.3.2
PHP Bug Type: CGI related
Bug description: CLI isn't reporting parse errors correctly
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"
--
Edit bug report at http://bugs.php.net/?id=25482&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=25482&r=trysnapshot4
Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=25482&r=trysnapshot5
Fixed in CVS: http://bugs.php.net/fix.php?id=25482&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=25482&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=25482&r=needtrace
Try newer version: http://bugs.php.net/fix.php?id=25482&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=25482&r=support
Expected behavior: http://bugs.php.net/fix.php?id=25482&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=25482&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=25482&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=25482&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=25482&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=25482&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=25482&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=25482&r=gnused