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

PHP 5.4 code breaks PHP 5.3.1+ compatibility #86

Open
IvoWams opened this issue May 6, 2020 · 2 comments
Open

PHP 5.4 code breaks PHP 5.3.1+ compatibility #86

IvoWams opened this issue May 6, 2020 · 2 comments

Comments

@IvoWams
Copy link

IvoWams commented May 6, 2020

spyc/Spyc.php

Line 188 in 4627c83

public static function YAMLLoadString($input, $options = []) {

This line and others has PHP 5.4+ style array brackets, however the version in composer.json still has requires >= 5.3.1.

@IvoWams IvoWams changed the title PHP 7 code breaks PHP 5 compatibility PHP 5.4 code breaks PHP 5.3.1+ compatibility May 28, 2020
@kAlvaro
Copy link

kAlvaro commented Jun 3, 2020

There're only two occurrences (I'm unfortunately not familiar with git as to submit a pull request):

Index: Spyc.php
===================================================================
--- Spyc.php	(revision 1370)
+++ Spyc.php	(revision 1371)
@@ -155,7 +155,7 @@
      * @param string $input Path of YAML file or string containing YAML
      * @param array set options
      */
-  public static function YAMLLoad($input, $options = []) {
+  public static function YAMLLoad($input, $options = array()) {
     $Spyc = new Spyc;
     foreach ($options as $key => $value) {
         if (property_exists($Spyc, $key)) {
@@ -185,7 +185,7 @@
      * @param string $input String containing YAML
      * @param array set options
      */
-  public static function YAMLLoadString($input, $options = []) {
+  public static function YAMLLoadString($input, $options = array()) {
     $Spyc = new Spyc;
     foreach ($options as $key => $value) {
         if (property_exists($Spyc, $key)) {

@kAlvaro
Copy link

kAlvaro commented Jun 4, 2020

I found a workaround when this library is a dependency of a third-party package. Set previous version as direct dependency and Composer will use that, e.g.:

{
 "config": {
    "platform": {
      "php": "5.3.3"
    }
  },
  "require": {
    "piwik/device-detector": "^3.11",
    "mustangostang/spyc": "0.6.2"
  }
}

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