Found some incompatibilities
Andreas Streichardt <[email protected]>
| Newsgroups | gmane.comp.php.smarty.devel |
|---|---|
| Organization | Globalpark GmbH |
| Message-ID | <[email protected]> |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
HI!
I just upgraded to php 4.3.5 RC3 and wanted to know if our software works with
it (currently our software is developed under 4.2.2 - but we are engaging an
upgrade now ;) ). We also use a pretty old smarty version (1.3.1). I
discovered a few oddities and i don't really know if that's a bug or intented
(probably it is just our stupid smarty code):
{if $logo1 ne $baseurl."layout/pixel_t.gif" OR $logo3 ne
$baseurl."layout/pixel_t.gif"}
that worked pretty fine using 1.3.1 but using the current smarty it produces
parse errors .... i attached a simple patch which fixes that for me. I guess
you had a good reason to put these quotes in there but i don't have any idea
of the internal smarty code, so maybe that is really a bug? Would be nice to
hear if that is a bug. If it is not a bug in smarty we would have serious
trouble upgrading as we have thousands of these files ;)
Furthermore our config file had a size of 0 bytes...the behaviour of fread
seems to have changed since 4.2.2...i "fixed" that too...
Regards,
Andreas Streichardt
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2-rc1-SuSE (GNU/Linux)
iD8DBQFAM0OpWy5LAOeI9r4RAls8AJ9FUC6h3aAloE+2YkOV/MeguXAwCACeKpnf
WrKJ0gVJe7ZcuCofSJAck90=
=1UQN
-----END PGP SIGNATURE-----
--
Smarty Development Mailing List (http://smarty.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Config_File.class.php.diff
(text/x-diff, 1015 B)
--- /home/mop/downloads/Smarty-2.6.2/libs/Config_File.class.php 2004-02-17 16:55:35.000000000 +0100
+++ Config_File.class.php 2004-02-18 11:28:09.000000000 +0100
@@ -234,14 +234,22 @@
$config_file = $file_name;
ini_set('track_errors', true);
- $fp = @fopen($config_file, "r");
- if (!is_resource($fp)) {
- $this->_trigger_error_msg("Could not open config file '$config_file'");
- return false;
- }
-
- $contents = fread($fp, filesize($config_file));
- fclose($fp);
+
+ // mop: empty configfiles throw a php error
+ $fsize=filesize($config_file);
+ if ($fsize>0) {
+ $fp = @fopen($config_file, "r");
+ if (!is_resource($fp)) {
+ $this->_trigger_error_msg("Could not open config file '$config_file'");
+ return false;
+ }
+
+ $contents = fread($fp, $fsize);
+ fclose($fp);
+ }
+ else {
+ $contents="";
+ }
$this->_config_data[$config_file] = $this->parse_contents($contents);
return true;
Smarty.class.php.diff
(text/x-diff, 2.5 KB)
--- /home/mop/downloads/Smarty-2.6.2/libs/Smarty.class.php 2004-02-18 00:00:58.000000000 +0100
+++ Smarty.class.php 2004-02-18 11:28:29.000000000 +0100
@@ -1725,36 +1725,43 @@
*/
function _read_file($filename, $start=null, $lines=null)
{
- if (!($fd = @fopen($filename, 'r'))) {
- return false;
- }
- flock($fd, LOCK_SH);
- if ($start == null && $lines == null) {
- // read the entire file
- $contents = fread($fd, filesize($filename));
- } else {
- if ( $start > 1 ) {
- // skip the first lines before $start
- for ($loop=1; $loop < $start; $loop++) {
- fgets($fd, 65536);
- }
+ // mop: empty files throw a php error
+ $fsize=filesize($filename);
+ if ($fsize>0) {
+ if (!($fd = @fopen($filename, 'r'))) {
+ return false;
}
- if ( $lines == null ) {
- // read the rest of the file
- while (!feof($fd)) {
- $contents .= fgets($fd, 65536);
- }
+ flock($fd, LOCK_SH);
+ if ($start == null && $lines == null) {
+ // read the entire file
+ $contents = fread($fd, $fsize);
} else {
- // read up to $lines lines
- for ($loop=0; $loop < $lines; $loop++) {
- $contents .= fgets($fd, 65536);
- if (feof($fd)) {
- break;
+ if ( $start > 1 ) {
+ // skip the first lines before $start
+ for ($loop=1; $loop < $start; $loop++) {
+ fgets($fd, 65536);
+ }
+ }
+ if ( $lines == null ) {
+ // read the rest of the file
+ while (!feof($fd)) {
+ $contents .= fgets($fd, 65536);
+ }
+ } else {
+ // read up to $lines lines
+ for ($loop=0; $loop < $lines; $loop++) {
+ $contents .= fgets($fd, 65536);
+ if (feof($fd)) {
+ break;
+ }
}
}
}
+ fclose($fd);
+ }
+ else {
+ $contents="";
}
- fclose($fd);
return $contents;
}
Smarty_Compiler.class.php.diff
(text/x-diff, 480 B)
--- /home/mop/downloads/Smarty-2.6.2/libs/Smarty_Compiler.class.php 2004-02-17 16:55:24.000000000 +0100
+++ Smarty_Compiler.class.php 2004-02-18 11:25:42.000000000 +0100
@@ -1608,7 +1608,7 @@
}
elseif(!in_array($val, $this->_permitted_tokens) && !is_numeric($val)) {
// literal string
- return $this->_expand_quoted_text('"' . $val .'"');
+ return $this->_expand_quoted_text($val);
}
return $val;
}