8000 Remove HHVM support (second edition) by Nek- · Pull Request #23216 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

Remove HHVM support (second edition) #23216

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

Closed
wants to merge 2 commits into from

Conversation

Nek-
Copy link
Contributor
@Nek- Nek- commented Jun 17, 2017
Q A
Branch? master
Bug fix? no
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets none
License MIT
Doc PR not needed

This PR removes HHVM compatiblity following #22758 as some things were missing. It also removes some useless comments.

@Nek- Nek- changed the title Remove HHVM compatibility Remove HHVM support (second edition) Jun 17, 2017
This PR removes HHVM compatiblity following symfony#22758
It also removes some unneeded comments
@Nek- Nek- force-pushed the remove-hhvm-compatibility branch from c18f9bd to 09ad255 Compare June 17, 2017 16:07
@nicolas-grekas nicolas-grekas added this to the 4.0 milestone Jun 19, 2017
@@ -34,7 +34,6 @@ public function read($path, $locale)
// Never enable fallback. We want to know if a bundle cannot be found
$bundle = new \ResourceBundle($locale, $path, false);
} catch (\Exception $e) {
// HHVM compatibility: constructor throws on invalid resource
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't the try/catch be removed then? (same below)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a config in Intl, that translate errors into exceptions. Before removing the try-catch, this has to be tested with that intl config intl.use_exceptions.

http://php.net/manual/de/intl.configuration.php

Copy link
Contributor Author
@Nek- Nek- Jun 19, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PHP actually throws an exception. That's why I didn't remove it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PHP 7.0 and above throws an exception without that config. That's true.

$lightTrace = $this->cleanTrace($backtrace, $type, $file, $line, $throw);
$this->traceReflector->setValue($errorAsException, $lightTrace);
} else {
$this->traceReflector->setValue($errorAsException, array());
$backtrace = array();
}
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there are a few more HHVM cases below this line

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't removed them because the code is pretty much tricky and I'm not sure what it's used for so I didn't remove anything. ^^'

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd say

diff --git a/src/Symfony/Component/Debug/ErrorHandler.php b/src/Symfony/Component/Debug/ErrorHandler.php
index 6fb2c94..ddcf193 100644
--- a/src/Symfony/Component/Debug/ErrorHandler.php
+++ b/src/Symfony/Component/Debug/ErrorHandler.php
@@ -444,32 +444,25 @@ class ErrorHandler
                         && ('trigger_error' === $backtrace[$i - 1]['function'] || 'user_error' === $backtrace[$i - 1]['function'])
                     ) {
                         // Here, we know trigger_error() has been called from __toString().
-                        // HHVM is fine with throwing from __toString() but PHP triggers a fatal error instead.
+                        // PHP triggers a fatal error when throwing from __toString().
                         // A small convention allows working around the limitation:
                         // given a caught $e exception in __toString(), quitting the method with
                         // `return trigger_error($e, E_USER_ERROR);` allows this error handler
                         // to make $e get through the __toString() barrier.
 
                         foreach ($context as $e) {
-                            if (($e instanceof \Exception || $e instanceof \Throwable) && $e->__toString() === $message) {
-                                if (1 === $i) {
-                                    // On HHVM
-                                    $errorAsException = $e;
-                                    break;
-                                }
+                            if ($e instanceof \Throwable && $e->__toString() === $message) {
                                 self::$toStringException = $e;
 
                                 return true;
                             }
                         }
 
-                        if (1 < $i) {
-                            // On PHP (not on HHVM), display the original error message instead of the default one.
-                            $this->handleException($errorAsException);
+                        // Display the original error message instead of the default one.
+                        $this->handleException($errorAsException);
 
-                            // Stop the process by giving back the error to the native handler.
-                            return false;
-                        }
+                        // Stop the process by giving back the error to the native handler.
+                        return false;
                     }
                 }
             }

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@@ -39,7 +39,6 @@ public function load($resource, $locale, $domain = 'messages')
try {
$rb = new \ResourceBundle($locale, $resource); 8000
} catch (\Exception $e) {
// HHVM compatibility: constructor throws on invalid resource
Copy link
Member
@chalasr chalasr Jun 19, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't the try-catch be removed instead? already pointed out

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See my comment for IntlBundleReader.php

@@ -34,7 +34,6 @@ public function read($path, $locale)
// Never enable fallback. We want to know if a bundle cannot be found
$bundle = new \ResourceBundle($locale, $path, false);
} catch (\Exception $e) {
// HHVM compatibility: constructor throws on invalid resource
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a config in Intl, that translate errors into exceptions. Before removing the try-catch, this has to be tested with that intl config intl.use_exceptions.

http://php.net/manual/de/intl.configuration.php

@@ -39,7 +39,6 @@ public function load($resource, $locale, $domain = 'messages')
try {
$rb = new \ResourceBundle($locale, $resource);
} catch (\Exception $e) {
// HHVM compatibility: constructor throws on invalid resource
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See my comment for IntlBundleReader.php

@@ -39,7 +39,6 @@ public function load($resource, $locale, $domain = 'messages')
try {
$rb = new \ResourceBundle($locale, $resource);
} catch (\Exception $e) {
// HHVM compatibility: constructor throws on invalid resource
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See my comment for IntlBundleReader.php

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You mean this one? #23216 (comment) I answered.

@nicolas-grekas
Copy link
Member

Thank you @Nek-.

nicolas-grekas added a commit that referenced this pull request Jul 3, 2017
This PR was squashed before being merged into the 4.0-dev branch (closes #23216).

Discussion
----------

Remove HHVM support (second edition)

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | none
| License       | MIT
| Doc PR        | not needed

This PR removes HHVM compatiblity following #22758 as some things were missing. It also removes some useless comments.

Commits
-------

471b84c Remove HHVM support (second edition)
@Nek- Nek- deleted the remove-hhvm-compatibility branch July 3, 2017 16:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants
0