com presentations: PHP 7 additions and more difference between hippo and phongo.: phphhvm-phpnw15.xml slides/mongodb/engines-php5.xml slides/mongodb/hippo-impl-def.xml slides/mongodb/hippo-impl.xml slides/mongodb/hippo-vs-phongo.xml slides/mongodb/phongo-php5-7.xml slides/mongodb/phongo-pull-request.png slides/mongodb/the-engines.xml

[email protected] (Derick Rethans) Sat, 03 Oct 2015 08:55:29 +0000
Newsgroups php.pres
Message-ID <[email protected]>
Commit:    cb2c7dfd1bfad4c787c50b3b81373af7ec342582
Author:    Derick Rethans <[email protected]>         Sat, 3 Oct 2015 09:55:29 +0100
Parents:   04a2292a86b190e1e6e50af1ca656f5f614fde55
Branches:  master

Link:       http://git.php.net/?p=presentations.git;a=commitdiff;h=cb2c7dfd1bfad4c787c50b3b81373af7ec342582

Log:
PHP 7 additions and more difference between hippo and phongo.

Changed paths:
  M  phphhvm-phpnw15.xml
  M  slides/mongodb/engines-php5.xml
  A  slides/mongodb/hippo-impl-def.xml
  M  slides/mongodb/hippo-impl.xml
  A  slides/mongodb/hippo-vs-phongo.xml
  A  slides/mongodb/phongo-php5-7.xml
  A  slides/mongodb/phongo-pull-request.png
  M  slides/mongodb/the-engines.xml


Diff:
diff --git a/phphhvm-phpnw15.xml b/phphhvm-phpnw15.xml
index bd79c4f..10f8a9b 100644
--- a/phphhvm-phpnw15.xml
+++ b/phphhvm-phpnw15.xml
@@ -126,8 +126,10 @@ Composer
 <slide>slides/mongodb/api-new.xml</slide>
 
 <slide>slides/mongodb/hippo.xml</slide>
+<slide>slides/mongodb/hippo-impl-def.xml</slide>
 <slide>slides/mongodb/hippo-impl.xml</slide>
 <slide>slides/mongodb/hippo-impl-2.xml</slide>
+<slide>slides/mongodb/hippo-vs-phongo.xml</slide>
 
 <slide>slides/mongodb/api-new.xml</slide>
 <slide>slides/mongodb/api-phongo.xml</slide>
@@ -135,6 +137,10 @@ Composer
 <slide>slides/mongodb/api-phongo-new.xml</slide>
 <slide>slides/mongodb/api-serialization-spec.xml</slide>
 
+- PHP 7...
+
+<slide>slides/mongodb/phongo-php5-7.xml</slide>
+
 <slide>slides/mongodb/phplib.xml</slide>
 <slide>slides/mongodb/phplib-usage-2.xml</slide>
 
diff --git a/slides/mongodb/engines-php5.xml b/slides/mongodb/engines-php5.xml
index 2fc53f6..53f54fe 100644
--- a/slides/mongodb/engines-php5.xml
+++ b/slides/mongodb/engines-php5.xml
@@ -2,7 +2,7 @@
 <title>Engine: PHP 5</title>
 
 <list>
-    <bullet>PHP 5.3 - PHP 5.6</bullet>
+    <bullet>PHP 5.4 - PHP 5.6</bullet>
     <bullet>Not sure what else to say really...</bullet>
 </list>
 
diff --git a/slides/mongodb/hippo-impl-def.xml b/slides/mongodb/hippo-impl-def.xml
new file mode 100644
index 0000000..c86bd7f
--- /dev/null
+++ b/slides/mongodb/hippo-impl-def.xml
@@ -0,0 +1,21 @@
+<slide>
+<title>Hippo (implementation)</title>
+
+<blurb>%ext_mongo.php% (extract)</blurb>
+<example><![CDATA[<?hh
+namespace MongoDB\Driver;
+    <<__Native>> 
+    public function __construct(string $dsn = "localhost", array $options = array(), array $driverOptions = array());
+
+    <<__Native>>
+    public function __debugInfo() : array;
+…
+    <<__Native>>
+    public function executeQuery(string $namespace, Query $query, ReadPreference $readPreference = null): Cursor;
+…
+    <<__Native>>
+    public function selectServer(ReadPreference $readPreference): Server;
+
+}]]></example>
+
+</slide>
diff --git a/slides/mongodb/hippo-impl.xml b/slides/mongodb/hippo-impl.xml
index 8d8caed..62d1c8b 100644
--- a/slides/mongodb/hippo-impl.xml
+++ b/slides/mongodb/hippo-impl.xml
@@ -1,28 +1,25 @@
 <slide>
 <title>Hippo (implementation)</title>
 
-<blurb>%ext_mongo.php% (extract)</blurb>
-<example><![CDATA[<?hh
-namespace MongoDB\Driver;
-
-<<__NativeData("MongoDBDriverManager")>>
-class Manager {
-    <<__Native>>
-    function __construct(string $dsn = "localhost", array $options = array(), array $driverOptions = array());
-}]]></example>
-
-<blurb>%src/MongoDB/Driver/Manager% (extract)</blurb>
+<blurb>%src/MongoDB/Driver/Manager.cpp%</blurb>
 <example><![CDATA[void HHVM_METHOD(MongoDBDriverManager, __construct, const String &dsn, const Array &options, const Array &driverOptions)
 {
     MongoDBDriverManagerData* data = Native::data<MongoDBDriverManagerData>(this_);
+    mongoc_uri_t *uri;
     mongoc_client_t *client;
 
-    client = mongoc_client_new(dsn.c_str());
+    uri = hippo_mongo_driver_manager_make_uri(dsn.c_str(), options);
+    client = mongoc_client_new_from_uri(uri);
 
     if (!client) {
-        throw Object(SystemLib::AllocExceptionObject("Can't connect"));
+        throw MongoDriver::Utils::throwRunTimeException("Failed to create Manager from URI: '" + dsn + "'");
     }
 
     data->m_client = client;
+
+    hippo_mongo_driver_manager_apply_ssl_opts(data->m_client, driverOptions);
+
+    hippo_mongo_driver_manager_apply_rp(data->m_client, options);
+    hippo_mongo_driver_manager_apply_wc(data->m_client, options);
 }]]></example>
 </slide>
diff --git a/slides/mongodb/hippo-vs-phongo.xml b/slides/mongodb/hippo-vs-phongo.xml
new file mode 100644
index 0000000..ee41065
--- /dev/null
+++ b/slides/mongodb/hippo-vs-phongo.xml
@@ -0,0 +1,36 @@
+<slide>
+<title>Hippo vs Phongo (argument parsing)</title>
+
+<blurb>%src/MongoDB/Driver/Manager.cpp%</blurb>
+<example><![CDATA[void HHVM_METHOD(MongoDBDriverManager, __construct, const String &dsn, const Array &options, const Array &driverOptions)
+{
+…]]></example>
+
+<blurb>%src/MongoDB/Manager.c%</blurb>
+<example><![CDATA[PHP_METHOD(Manager, __construct)
+{
+    php_phongo_manager_t     *intern;
+    zend_error_handling       error_handling;
+    mongoc_uri_t             *uri;
+    char                     *uri_string;
+    int                       uri_string_len;
+    zval                     *options = NULL;
+    bson_t                    bson_options = BSON_INITIALIZER;
+    zval                     *driverOptions = NULL;
+    (void)return_value; (void)return_value_ptr; (void)return_value_used;
+
+    zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling TSRMLS_CC);
+    intern = (php_phongo_manager_t *)zend_object_store_get_object(getThis() TSRMLS_CC);
+
+    if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|a!a!", &uri_string, &uri_string_len, &options, &driverOptions) == FAILURE) {
+        zend_restore_error_handling(&error_handling TSRMLS_CC);
+        return;
+    }
+    zend_restore_error_handling(&error_handling TSRMLS_CC);
+
+    if (options) {
+        zval_to_bson(options, PHONGO_BSON_NONE, &bson_options, NULL TSRMLS_CC);
+    }
+…
+]]></example>
+</slide>
diff --git a/slides/mongodb/phongo-php5-7.xml b/slides/mongodb/phongo-php5-7.xml
new file mode 100644
index 0000000..0216db6
--- /dev/null
+++ b/slides/mongodb/phongo-php5-7.xml
@@ -0,0 +1,13 @@
+<slide>
+<title>PHP 7 support in Phongo</title>
+
+<image filename="phongo-pull-request.png"/>
+
+<list>
+	<bullet>Sigh</bullet>
+	<bullet>Order of elements in structs</bullet>
+	<bullet>%char *% vs. %zend_string%</bullet>
+	<bullet>zend_hash changes</bullet>
+	<bullet>Not coming out until: after 1.0 for hippo and phongo; PHP 7 is actually released; throrough review</bullet>
+</list>
+</slide>
diff --git a/slides/mongodb/phongo-pull-request.png b/slides/mongodb/phongo-pull-request.png
new file mode 100644
index 0000000..b58d2b5
Binary files /dev/null and b/slides/mongodb/phongo-pull-request.png differ
diff --git a/slides/mongodb/the-engines.xml b/slides/mongodb/the-engines.xml
index f9f26a6..1bd5faf 100644
--- a/slides/mongodb/the-engines.xml
+++ b/slides/mongodb/the-engines.xml
@@ -18,9 +18,9 @@
 	<td><div effect="fade-in"><blurb>PHP's newest invention</blurb></div></td>
 </tr>
 <tr>
-	<td><div effect="fade-in"><blurb>PHP 5.3 and higher</blurb></div></td>
-	<td><div effect="fade-in"><blurb>Some random unstable version</blurb></div></td>
-	<td><div effect="fade-in"><blurb>It's not out yet</blurb></div></td>
+	<td><div effect="fade-in"><blurb>PHP ---5.3--- 5.4 and higher</blurb></div></td>
+	<td><div effect="fade-in"><blurb>Some random version (3.9?)</blurb></div></td>
+	<td><div effect="fade-in"><blurb>It's not out yet (Nov 12?)</blurb></div></td>
 </tr>
 </table>
 </slide>