Skip to content

Instantly share code, notes, and snippets.

@otarza
Created November 6, 2016 09:52
Show Gist options
  • Save otarza/68f946325dd077c501894f76c0bfa637 to your computer and use it in GitHub Desktop.
Save otarza/68f946325dd077c501894f76c0bfa637 to your computer and use it in GitHub Desktop.
Fix php7 String class name issue in Mibew Messenger by patching justblackbird/handlebars.php-helpers
{
"name": "mibew/mibew",
"version": "2.1.2",
"description": "Mibew Messenger - open-source live support application",
"type": "project",
"homepage": "http://mibew.org",
"license": "Apache-2.0",
"authors": [
{
"name": "Mibew Messenger Project",
"homepage": "http://mibew.org/credits"
}
],
"support": {
"email": "support@mibew.org",
"issues": "https://github.com/mibew/mibew/issues",
"forum": "http://mibew.org/forums",
"source": "https://github.com/mibew/mibew"
},
"require": {
"cweagans/composer-patches": "1.5.0",
"xamin/handlebars.php": "0.10.3",
"justblackbird/handlebars.php-helpers": "~0.2.1",
"symfony/http-foundation": "2.6.*",
"symfony/routing": "2.6.*",
"symfony/config": "2.6.*",
"symfony/yaml": "2.6.*",
"symfony/translation": "2.6.*",
"tedivm/stash": "0.12.*",
"canteen/html5": "1.1.*",
"vierbergenlars/php-semver": "3.0.*",
"swiftmailer/swiftmailer": "~5.4.0",
"ua-parser/uap-php": "~3.4.1",
"true/punycode": "~1.1"
},
"require-dev": {
"squizlabs/php_codesniffer": "~2.3.3"
},
"config": {
"vendor-dir": "mibew/vendor"
},
"scripts": {
"post-install-cmd": [
"sh ../scripts/composer/config.sh"
]
},
"extra": {
"patches": {
"justblackbird/handlebars.php-helpers": {
"Fix php 7 issue of reserved class name String": "../patches/fix_php7_string_class_name.patch"
}
}
}
}
diff --git a/handlebars.php-helpers/src/Comparison/IfAnyHelper.php b/handlebars.php-helpers/src/Comparison/IfAnyHelper.php
index 56314ac..db00101 100644
--- a/handlebars.php-helpers/src/Comparison/IfAnyHelper.php
+++ b/handlebars.php-helpers/src/Comparison/IfAnyHelper.php
@@ -12,7 +12,7 @@ namespace JustBlackBird\HandlebarsHelpers\Comparison;
use Handlebars\Context;
use Handlebars\Helper as HelperInterface;
-use Handlebars\String;
+use Handlebars\StringWrapper;
use Handlebars\Template;
/**
@@ -48,8 +48,8 @@ class IfAnyHelper implements HelperInterface
foreach ($parsed_args as $parsed_arg) {
$value = $context->get($parsed_arg);
- if ($value instanceof String) {
- // Casting any object of \Handlebars\String will have false
+ if ($value instanceof StringWrapper) {
+ // Casting any object of \Handlebars\StringWrapper will have false
// positive result even for those with empty internal strings.
// Thus we need to check internal string of such objects.
$value = $value->getString();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment