diff --git a/plugins/views/views_php_handler_area.inc b/plugins/views/views_php_handler_area.inc
index 0296373..da04d5b 100644
--- a/plugins/views/views_php_handler_area.inc
+++ b/plugins/views/views_php_handler_area.inc
@@ -34,11 +34,12 @@ class views_php_handler_area extends views_handler_area {
    * Implements views_handler_area#render().
    */
   function render($empty = FALSE) {
-    // Ecexute output PHP code.
+    // Execute output PHP code.
     if ((!$empty || !empty($this->options['empty'])) && !empty($this->options['php_output'])) {
-      $function = create_function('$view, $handler, $results', ' ?>' . $this->options['php_output'] . '<?php ');
+      $function = views_php_create_function('$view, $handler, $results', ' ?>' . $this->options['php_output'] . '<?php ');
       ob_start();
-      $function($this->view, $this, $this->view->result);
+      $closure = $function->getClosure();
+      $closure($this->view, $this, $this->view->result);
       return ob_get_clean();
     }
     return '';
diff --git a/plugins/views/views_php_handler_field.inc b/plugins/views/views_php_handler_field.inc
index 1da366b..79e341f 100644
--- a/plugins/views/views_php_handler_field.inc
+++ b/plugins/views/views_php_handler_field.inc
@@ -112,11 +112,12 @@ class views_php_handler_field extends views_handler_field {
    * @see self::php_post_execute()
    */
   function php_pre_execute() {
-    // Ecexute static PHP code.
+    // Execute static PHP code.
     if (!empty($this->options['php_setup'])) {
-      $function = create_function('$view, $handler, &$static', $this->options['php_setup'] . ';');
+      $function = views_php_create_function('$view, $handler, &$static', $this->options['php_setup'] . ';');
       ob_start();
-      $function($this->view, $this, $this->php_static_variable);
+      $closure = $function->getClosure();
+      $closure($this->view, $this, $this->php_static_variable);
       ob_end_clean();
     }
   }
@@ -126,16 +127,17 @@ class views_php_handler_field extends views_handler_field {
    * @see views_php_views_post_execute()
    */
   function php_post_execute() {
-    // Ecexute value PHP code.
+    // Execute value PHP code.
     if (!empty($this->options['php_value'])) {
-      $function = create_function('$view, $handler, &$static, $row, $data', $this->options['php_value'] . ';');
+      $function = views_php_create_function('$view, $handler, &$static, $row, $data', $this->options['php_value'] . ';');
       ob_start();
       foreach ($this->view->result as $i => &$row) {
         $normalized_row = new stdClass;
         foreach ($this->view->display_handler->get_handlers('field') as $field => $handler) {
           $normalized_row->$field = isset($row->{$handler->field_alias}) ? $row->{$handler->field_alias} : NULL;
         }
-        $row->{$this->field_alias} = $function($this->view, $this, $this->php_static_variable, $normalized_row, $row);
+        $closure = $function->getClosure();
+        $row->{$this->field_alias} = $closure($this->view, $this, $this->php_static_variable, $normalized_row, $row);
       }
       ob_end_clean();
     }
@@ -144,7 +146,8 @@ class views_php_handler_field extends views_handler_field {
     if (!empty($this->options['use_php_click_sortable']) && !empty($this->php_click_sort_order)) {
       if ($this->options['use_php_click_sortable'] == self::CLICK_SORT_PHP) {
         if (!empty($this->options['php_click_sortable'])) {
-          $this->php_click_sort_function = create_function('$view, $handler, &$static, $row1, $row2', $this->options['php_click_sortable'] . ';');
+          $this->php_click_sort_function = views_php_create_function('$view, $handler, &$static, $row1, $row2', $this->options['php_click_sortable'] . ';');
+          $this->php_click_sort_function_predefined = FALSE;
         }
       }
       else {
@@ -156,6 +159,7 @@ class views_php_handler_field extends views_handler_field {
           self::CLICK_SORT_NAT_CASE => 'strnatcmp',
         );
         $this->php_click_sort_function = $predefined[$this->options['use_php_click_sortable']];
+        $this->php_click_sort_function_predefined = TRUE;
       }
 
       if (isset($this->php_click_sort_function)) {
@@ -178,11 +182,23 @@ class views_php_handler_field extends views_handler_field {
         }
       }
       ob_start();
-      $result = (int)$function($this->view, $this, $this->php_static_variable, $normalized_row1, $normalized_row2);
+      if ($this->php_click_sort_function_predefined) {
+        $result = (int)$function($this->view, $this, $this->php_static_variable, $normalized_row1, $normalized_row2);
+      }
+      else {
+        $closure = $function->getClosure();
+        $result = (int)$closure($this->view, $this, $this->php_static_variable, $normalized_row1, $normalized_row2);
+      }
       ob_end_clean();
     }
     else {
-      $result = $function($row1->{$this->field_alias}, $row2->{$this->field_alias});
+      if ($this->php_click_sort_function_predefined) {
+        $result = $function($row1->{$this->field_alias}, $row2->{$this->field_alias});
+      }
+      else {
+        $closure = $function->getClosure();
+        $result = $closure($row1->{$this->field_alias}, $row2->{$this->field_alias});
+      }
     }
     return $factor * $result;
   }
@@ -199,7 +215,7 @@ class views_php_handler_field extends views_handler_field {
    */
   function pre_render(&$values) {
     if (!empty($this->options['php_output'])) {
-      $this->php_output_lamda_function = create_function('$view, $handler, &$static, $row, $data, $value', ' ?>' . $this->options['php_output'] . '<?php ');
+      $this->php_output_lamda_function = views_php_create_function('$view, $handler, &$static, $row, $data, $value', ' ?>' . $this->options['php_output'] . '<?php ');
     }
   }
 
@@ -207,16 +223,16 @@ class views_php_handler_field extends views_handler_field {
    * Implements views_handler_field#render().
    */
   function render($values) {
-    // Ecexute output PHP code.
+    // Execute output PHP code.
     if (!empty($this->options['php_output']) && isset($this->php_output_lamda_function)) {
       $normalized_row = new stdClass;
       foreach ($this->view->display_handler->get_handlers('field') as $field => $handler) {
         $normalized_row->$field = isset($values->{$handler->field_alias}) ? $values->{$handler->field_alias} : NULL;
       }
-
       $function = $this->php_output_lamda_function;
       ob_start();
-      $function($this->view, $this, $this->php_static_variable, $normalized_row, $values, isset($values->{$this->field_alias}) ? $values->{$this->field_alias} : NULL);
+      $closure = $function->getClosure();
+      $closure($this->view, $this, $this->php_static_variable, $normalized_row, $values, isset($values->{$this->field_alias}) ? $values->{$this->field_alias} : NULL);
       $value = ob_get_clean();
     }
     else {
diff --git a/plugins/views/views_php_handler_filter.inc b/plugins/views/views_php_handler_filter.inc
index 79bbee2..e3abb47 100644
--- a/plugins/views/views_php_handler_filter.inc
+++ b/plugins/views/views_php_handler_filter.inc
@@ -63,11 +63,12 @@ class views_php_handler_filter extends views_handler_filter {
    * @see views_php_views_pre_execute()
    */
   function php_pre_execute() {
-    // Ecexute static PHP code.
+    // Execute static PHP code.
     if (!empty($this->options['php_setup'])) {
-      $function = create_function('$view, $handler, &$static', $this->options['php_setup'] . ';');
+      $function = views_php_create_function('$view, $handler, &$static', $this->options['php_setup'] . ';');
       ob_start();
-      $function($this->view, $this, $this->php_static_variable);
+      $closure = $function->getClosure();
+      $closure($this->view, $this, $this->php_static_variable);
       ob_end_clean();
     }
   }
@@ -79,14 +80,15 @@ class views_php_handler_filter extends views_handler_filter {
   function php_post_execute() {
     // Evaluate the PHP code.
     if (!empty($this->options['php_filter'])) {
-      $function = create_function('$view, $handler, &$static, $row, $data', $this->options['php_filter'] . ';');
+      $function = views_php_create_function('$view, $handler, &$static, $row, $data', $this->options['php_filter'] . ';');
       ob_start();
       foreach ($this->view->result as $i => $row) {
         $normalized_row = new stdClass;
         foreach ($this->view->display_handler->get_handlers('field') as $field => $handler) {
           $normalized_row->$field = isset($row->{$handler->field_alias}) ? $row->{$handler->field_alias} : NULL;
         }
-        if ($function($this->view, $this, $this->php_static_variable, $normalized_row, $row)) {
+        $closure = $function->getClosure();
+        if ($closure($this->view, $this, $this->php_static_variable, $normalized_row, $row)) {
           unset($this->view->result[$i]);
         }
       }
diff --git a/plugins/views/views_php_handler_sort.inc b/plugins/views/views_php_handler_sort.inc
index cca24ba..02ae318 100644
--- a/plugins/views/views_php_handler_sort.inc
+++ b/plugins/views/views_php_handler_sort.inc
@@ -55,11 +55,12 @@ class views_php_handler_sort extends views_handler_sort {
    * @see views_php_views_pre_execute()
    */
   function php_pre_execute() {
-    // Ecexute static PHP code.
+    // Execute static PHP code.
     if (!empty($this->options['php_setup'])) {
-      $function = create_function('$view, $handler, &$static', $this->options['php_setup'] . ';');
+      $function = views_php_create_function('$view, $handler, &$static', $this->options['php_setup'] . ';');
       ob_start();
-      $function($this->view, $this, $this->php_static_variable);
+      $closure = $function->getClosure();
+      $closure($this->view, $this, $this->php_static_variable);
       ob_end_clean();
     }
   }
@@ -70,7 +71,7 @@ class views_php_handler_sort extends views_handler_sort {
    */
   function php_post_execute() {
     if (!empty($this->options['php_sort']) && $this->view->style_plugin->build_sort()) {
-      $this->php_sort_function = create_function('$view, $handler, &$static, $row1, $row2', $this->options['php_sort'] . ';');
+      $this->php_sort_function = views_php_create_function('$view, $handler, &$static, $row1, $row2', $this->options['php_sort'] . ';');
       ob_start();
       usort($this->view->result, array($this, 'php_sort'));
       ob_end_clean();
@@ -89,7 +90,8 @@ class views_php_handler_sort extends views_handler_sort {
         $$normalized_name->$field = isset($$name->{$handler->field_alias}) ? $$name->{$handler->field_alias} : NULL;
       }
     }
-    $result = (int)$function($this->view, $this, $this->php_static_variable, $normalized_row1, $normalized_row2);
+    $closure = $function->getClosure();
+    $result = (int)$closure($this->view, $this, $this->php_static_variable, $normalized_row1, $normalized_row2);
     return $factor * $result;
   }
 }
diff --git a/plugins/views/views_php_plugin_cache.inc b/plugins/views/views_php_plugin_cache.inc
index ca6c90f..5cb8040 100644
--- a/plugins/views/views_php_plugin_cache.inc
+++ b/plugins/views/views_php_plugin_cache.inc
@@ -63,9 +63,10 @@ class views_php_plugin_cache extends views_plugin_cache {
         $cache = cache_get($this->get_results_key(), $this->table);
         $fresh = !empty($cache);
         if ($fresh && !empty($this->options['php_cache_results'])) {
-          $function = create_function('$view, $plugin, $cache', $this->options['php_cache_results'] . ';');
+          $function = views_php_create_function('$view, $plugin, $cache', $this->options['php_cache_results'] . ';');
           ob_start();
-          $fresh = $function($this->view, $this, $cache);
+          $closure = $function->getClosure();
+          $fresh = $closure($this->view, $this, $cache);
           ob_end_clean();
         }
         // Values to set: $view->result, $view->total_rows, $view->execute_time,
@@ -84,9 +85,10 @@ class views_php_plugin_cache extends views_plugin_cache {
         $cache = cache_get($this->get_output_key(), $this->table);
         $fresh = !empty($cache);
         if ($fresh && !empty($this->options['php_cache_output'])) {
-          $function = create_function('$view, $plugin, $cache', $this->options['php_cache_output'] . ';');
+          $function = views_php_create_function('$view, $plugin, $cache', $this->options['php_cache_output'] . ';');
           ob_start();
-          $fresh = $function($this->view, $this, $cache);
+          $closure = $function->getClosure();
+          $fresh = $closure($this->view, $this, $cache);
           ob_end_clean();
         }
         if ($fresh) {
diff --git a/views_php.info b/views_php.info
index dd55cdb..9a5219c 100644
--- a/views_php.info
+++ b/views_php.info
@@ -3,6 +3,7 @@ description = Allows the usage of PHP to construct a view.
 package = Views
 core = 7.x
 dependencies[] = views
+dependencies[] = libraries
 ; Views handlers
 files[] = plugins/views/views_php_handler_area.inc
 files[] = plugins/views/views_php_handler_field.inc
diff --git a/views_php.module b/views_php.module
index 6a7cc37..77de51d 100644
--- a/views_php.module
+++ b/views_php.module
@@ -27,11 +27,12 @@ function views_php_check_access($php_access, $view_name, $display_id, $account =
   }
 
   if (!isset($function[$view_name . ':' . $display_id])) {
-    $function[$view_name . ':' . $display_id] = create_function('$view_name, $display_id, $account', $php_access . ';');
+    $function[$view_name . ':' . $display_id] = views_php_create_function('$view_name, $display_id, $account', $php_access . ';');
   }
 
   ob_start();
-  $access = (bool) $function[$view_name . ':' . $display_id]($view_name, $display_id, $account);
+  $closure = $function[$view_name . ':' . $display_id]->getClosure();
+  $access = (bool) $closure($view_name, $display_id, $account);
   ob_end_clean();
   return $access;
 }
@@ -158,3 +159,32 @@ function views_php_views_post_build($view) {
     $view->build_info['query']->range();
   }
 }
+
+/**
+ * Implements hook_libraries_info().
+ */
+function views_php_libraries_info() {
+  return array(
+    'closure' => array(
+      'name' => 'Entreprise 7pro.ca Inc Closure',
+      'vendor url' => 'https://github.com/entreprise7pro/closure',
+      'download url' => 'https://github.com/entreprise7pro/closure/archive/master.zip',
+      'version arguments' => array(
+        'file' => 'CHANGELOG.md',
+        'pattern' => '/### v([\d\.]+)/', 
+        'lines' => 5,
+      ),
+      'files' => array(
+        'php' => array('autoload.php'),
+      ),
+    ),
+  );
+}
+
+/**
+ * Internal support: create_function() emulation using an anonymous function with a serializable wrapper.
+ */
+function views_php_create_function($args, $code) {
+  libraries_load('closure');
+  return new \Opis\Closure\SerializableClosure(eval('return function(' . $args . ') {' . $code . '};'));
+}
