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

Regression in 3.1.29: Uninitialized string offset: 1 #245

Closed
glensc opened this issue Jun 13, 2016 · 1 comment
Closed

Regression in 3.1.29: Uninitialized string offset: 1 #245

glensc opened this issue Jun 13, 2016 · 1 comment

Comments

@glensc
Copy link
Contributor

glensc commented Jun 13, 2016

#121 breaks such code with 3.1.29:

<?php

require_once __DIR__ . '/../vendor/autoload.php';

$smarty = new Smarty();
$smarty->setTemplateDir('');
$template_dir = $smarty->getTemplateDir();

produces notice:

/usr/bin/php tests/smarty-3.1.29.php
PHP Notice:  Uninitialized string offset: 1 in vendor/smarty/smarty/libs/Smarty.class.php on line 1181
PHP Stack trace:
PHP   1. {main}() tests/smarty-3.1.29.php:0
PHP   2. Smarty->getTemplateDir() tests/smarty-3.1.29.php:7
PHP   3. Smarty->_realpath() vendor/smarty/smarty/libs/Smarty.class.php:848

it worked okay (without notice) with 3.1.27 and 3.1.28

@glensc glensc changed the title Uninitialized string offset: 1 with 3.1.29 Regression in 3.1.29: Uninitialized string offset: 1 Jun 13, 2016
glensc added a commit to smarty-gettext/smarty-gettext that referenced this issue Jun 13, 2016
smarty-php/smarty#245

seems $smarty->setTemplateDir(''); behaviour is the same as
$smarty->setTemplateDir('/');

so, use that

our tests use absolute paths to templates, so "/" will work (altho ugly -- two due //'s, but works)
uwetews added a commit that referenced this issue Jul 23, 2016
…absolute filepath #245

  - optimization of filepath normalization
@uwetews
Copy link
Contributor

uwetews commented Jul 23, 2016

The fix for setTemplateDir('') and setTemplateDir('/') is now in the master branch

@uwetews uwetews closed this as completed Jul 23, 2016
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