[presentations] master: PHP UK 24 talk (draft)

[email protected] (Derick Rethans) Mon, 12 Feb 2024 18:50:30 +0000
Newsgroups php.pres
Message-ID <[email protected]>
Author: Derick Rethans (derickr)
Date: 2024-02-12T18:36:41Z

Commit: https://github.com/php/presentations/commit/e90013aad73b5edd4b9698e6c6b4e295b9cf51d8
Raw diff: https://github.com/php/presentations/commit/e90013aad73b5edd4b9698e6c6b4e295b9cf51d8.diff

PHP UK 24 talk (draft)

Changed paths:
  A  php-phpuk24.xml
  A  slides/internals/php83-arbitrary-static-var-initialisers.xml
  A  slides/internals/php83-datetime-exceptions.xml
  A  slides/internals/php83-json_validate.xml
  A  slides/internals/php83-random.xml
  A  slides/internals/php84-dom-html5.xml
  A  slides/internals/php84-jit.xml
  A  slides/internals/php84-pdo-subclass.xml
  A  slides/internals/php84-round-modes.xml
  M  slides/internals/php80-jit.xml
  M  slides/internals/php80-named-with.xml
  M  slides/internals/php82-deprecate-dynamic-properties.xml
  M  slides/internals/php82-random.xml
  M  slides/internals/php82-readonly.xml
  M  slides/internals/php82-redact-parameters.xml
  M  slides/mongodb/me.xml


Diff:

diff --git a/php-phpuk24.xml b/php-phpuk24.xml
new file mode 100644
index 00000000..edf34e62
--- /dev/null
+++ b/php-phpuk24.xml
@@ -0,0 +1,165 @@
+<?xml version="1.0" encoding="utf-8"?>
+<presentation css="derick.css">
+<topic>PHP</topic>
+<title>What's New in PHP 8.[123]?</title>
+<event>PHP UK Conference 2024</event>
+<location>London, UK</location>
+<date>February 16th, 2024</date>
+<speaker>Derick Rethans</speaker>
+<email>[email protected]</email>
+<twitter>derickr</twitter>
+<mastodon>@[email protected]</mastodon>
+<url>https://derickrethans.nl/talks/php-phpuk24</url>
+<joindin></joindin>
+<slide>slides/xdebug/title.xml</slide>
+<slide>slides/mongodb/me.xml</slide>
+
+Readonly properties 2.0 (https://wiki.php.net/rfc/readonly_properties_v2)
+<slide>slides/internals/php81-readonly.xml</slide>
+
+https://wiki.php.net/rfc/readonly_classes
+<slide>slides/internals/php82-readonly.xml</slide>
+
+https://wiki.php.net/rfc/readonly_amendments
+<slide>slides/internals/php83-readonly.xml</slide>
+
+
+Mixed Type v2
+<!-- <s lide>slides/internals/php80-mixed-types.xml</slide> -->
+
+PHP 8.0:
+https://wiki.php.net/rfc/static_return_type
+static return type
+<!-- <s lide>slides/internals/php80-static-return.xml</slide> -->
+
+Constructor Property Promotion
+<!-- <s lide>slides/internals/php80-cpp-without.xml</slide> -->
+<!-- <s lide>slides/internals/php80-cpp-with.xml</slide> -->
+
+<slide>slides/internals/php80-named-without.xml</slide>
+<slide>slides/internals/php80-named-with.xml</slide>
+
+<!-- BIG NEW FEATURES -->
+Enumerations (https://wiki.php.net/rfc/enumerations)
+<!--
+<sl ide>slides/internals/php81-enums-1.xml</slide>
+<sl ide>slides/internals/php81-enums-2.xml</slide>
+<sl ide>slides/internals/php81-enums-3.xml</slide>
+<sl ide>slides/internals/php81-enums-4.xml</slide>
+<sl ide>slides/internals/php81-enums-5.xml</slide>
+<sl ide>slides/internals/php81-enums-6.xml</slide>
+<sl ide>slides/internals/php81-enums-7.xml</slide>
+-->
+https://wiki.php.net/rfc/fetch_property_in_const_expressions
+<slide>slides/internals/php82-enums-1.xml</slide>
+
+<!--
+Noreturn type (https://wiki.php.net/rfc/noreturn_type) (never)
+<sl ide>slides/internals/php81-never-type.xml</slide>
+-->
+
+Array unpacking with string keys (https://wiki.php.net/rfc/array_unpacking_string_keys)
+<slide>slides/internals/php81-array-unpacking.xml</slide>
+
+Fibers (https://wiki.php.net/rfc/fibers)
+<!-- <s lide>slides/internals/php81-fibers.xml</slide> -->
+
+First Class Callable (https://wiki.php.net/rfc/first_class_callable_syntax)
+<slide>slides/internals/php81-fcc.xml</slide>
+
+PHP 8.2:
+
+https://wiki.php.net/rfc/null-false-standalone-types
+'null' and 'false' as standalone
+<slide>slides/internals/php82-null-false-standalone.xml</slide>
+
+https://wiki.php.net/rfc/true-type
+'true' type
+<slide>slides/internals/php82-true.xml</slide>
+
+Pure Intersection Types (https://wiki.php.net/rfc/pure-intersection-types)
+<slide>slides/internals/php81-pure-intersection.xml</slide>
+
+https://wiki.php.net/rfc/dnf_types
+? Disjunctive Normal Form Types
+<slide>slides/internals/php82-dnf-types.xml</slide>
+
+https://wiki.php.net/rfc/rng_extension
+<slide>slides/internals/php82-random.xml</slide>
+
+https://wiki.php.net/rfc/randomizer_additions
+<slide>slides/internals/php83-random.xml</slide>
+
+https://wiki.php.net/rfc/deprecate_dynamic_properties
+<slide>slides/internals/php82-deprecate-dynamic-properties.xml</slide>
+
+https://wiki.php.net/rfc/redact_parameters_in_back_traces
+<slide>slides/internals/php82-redact-parameters.xml</slide>
+
+PHP 8.3:
+
+Syntax additions:
+
+https://wiki.php.net/rfc/marking_overriden_methods
+<slide>slides/internals/php83-marking-overridden-methods.xml</slide>
+
+https://wiki.php.net/rfc/typed_class_constants
+<slide>slides/internals/php83-typed-class-constants.xml</slide>
+
+https://wiki.php.net/rfc/dynamic_class_constant_fetch
+<slide>slides/internals/php83-dynamic-class-constant-fetch.xml</slide>
+
+https://wiki.php.net/rfc/arbitrary_static_variable_initializers
+<slide>slides/internals/php83-arbitrary-static-var-initialisers.xml</slide>
+
+
+Minor improvements:
+
+https://wiki.php.net/rfc/json_validate
+<slide>slides/internals/php83-json_validate.xml</slide>
+
+https://wiki.php.net/rfc/datetime-exceptions
+<slide>slides/internals/php83-datetime-exceptions.xml</slide>
+
+
+PHP 8.4:
+
+Major additions:
+
+https://wiki.php.net/rfc/domdocument_html5_parser
+<slide>slides/internals/php84-dom-html5.xml</slide>
+
+https://wiki.php.net/rfc/jit-ir
+<slide>slides/internals/php80-jit.xml</slide>
+<slide>slides/internals/php84-jit.xml</slide>
+
+Minor additions:
+
+https://wiki.php.net/rfc/improve_callbacks_dom_and_xsl
+
+https://wiki.php.net/rfc/pdo_driver_specific_subclasses
+<slide>slides/internals/php84-pdo-subclass.xml</slide>
+
+https://wiki.php.net/rfc/new_rounding_modes_to_round_function
+<slide>slides/internals/php84-round-modes.xml</slide>
+
+https://wiki.php.net/rfc/mb_trim
+
+https://wiki.php.net/rfc/bcrypt_cost_2023
+
+https://wiki.php.net/rfc/rfc1867-non-post
+
+https://wiki.php.net/rfc/http-last-response-headers
+
+
+Deprecations:
+
+https://wiki.php.net/rfc/unbundle_imap_pspell_oci8
+
+
+
+
+<slide>slides/internals/questions-new.xml</slide>
+<slide>slides/xdebug/resources.xml</slide>
+
+</presentation>
diff --git a/slides/internals/php80-jit.xml b/slides/internals/php80-jit.xml
index 3e5e7101..62e2386c 100644
--- a/slides/internals/php80-jit.xml
+++ b/slides/internals/php80-jit.xml
@@ -1,5 +1,5 @@
 <slide>
-<title>Just-In-Time (JIT) Compiler</title>
+<title>PHP 8.0: Just-In-Time (JIT) Compiler</title>
 
 <list>
 <bullet>Compiles PHP code to x86 machine code</bullet>
diff --git a/slides/internals/php80-named-with.xml b/slides/internals/php80-named-with.xml
index 851b53a2..8c47e323 100644
--- a/slides/internals/php80-named-with.xml
+++ b/slides/internals/php80-named-with.xml
@@ -1,6 +1,8 @@
 <slide>
 <title>Object Instantiation with Named Arguments</title>
 
+<blurb>PHP 8.0:</blurb>
+
 <example inline="1">
 &amp;lt;?php
 class Settings
diff --git a/slides/internals/php82-deprecate-dynamic-properties.xml b/slides/internals/php82-deprecate-dynamic-properties.xml
index 5201de8a..08b60cda 100644
--- a/slides/internals/php82-deprecate-dynamic-properties.xml
+++ b/slides/internals/php82-deprecate-dynamic-properties.xml
@@ -1,6 +1,7 @@
 <slide>
 <title>Deprecating Dynamic Properties</title>
 
+<blurb>PHP 8.2:</blurb>
 <example>
 <![CDATA[<?php
 class ezcGraphDataSet
@@ -33,9 +34,6 @@ Deprecated: Creation of dynamic property ezcGraphDataSet::$palette is deprecated
       */
 -    protected $pallet;
 +    protected $palette;
-
-     /**
-      * Array keys
 </example>
 </div>
 
diff --git a/slides/internals/php82-random.xml b/slides/internals/php82-random.xml
index 1c89f79b..3700345c 100644
--- a/slides/internals/php82-random.xml
+++ b/slides/internals/php82-random.xml
@@ -1,5 +1,5 @@
 <slide>
-<title>New Random extension</title>
+<title>PHP 8.2: New Random extension</title>
 
 <example result="3"><![CDATA[
 <?php
diff --git a/slides/internals/php82-readonly.xml b/slides/internals/php82-readonly.xml
index c63a3f3e..56316ba1 100644
--- a/slides/internals/php82-readonly.xml
+++ b/slides/internals/php82-readonly.xml
@@ -15,6 +15,7 @@
 <list>
 	<bullet>Prevents dynamic properties from being created</bullet>
 	<bullet>Can't be used if there are untyped or static properties</bullet>
+	<bullet>Inherited classes *must* also be readonly</bullet>
 </list>
 </div>
 
diff --git a/slides/internals/php82-redact-parameters.xml b/slides/internals/php82-redact-parameters.xml
index 1f27a758..57a8928c 100644
--- a/slides/internals/php82-redact-parameters.xml
+++ b/slides/internals/php82-redact-parameters.xml
@@ -1,6 +1,7 @@
 <slide>
 <title>Sensitive Parameters</title>
 
+<blurb>PHP 8.2:</blurb>
 <example><![CDATA[<?php
 function logIn($userName, #[\SensitiveParameter] $password) {
     throw new \Exception('Error');
diff --git a/slides/internals/php83-arbitrary-static-var-initialisers.xml b/slides/internals/php83-arbitrary-static-var-initialisers.xml
new file mode 100644
index 00000000..4fe8cba8
--- /dev/null
+++ b/slides/internals/php83-arbitrary-static-var-initialisers.xml
@@ -0,0 +1,20 @@
+<slide>
+<title>PHP 8.3: Arbitrary Static Variable Initializers</title>
+
+<example result="1"><![CDATA[<?php
+function bar() {
+    echo "bar() called\n";
+    return 1;
+}
+
+function foo() {
+    static $i = bar();
+    echo $i++, "\n";
+}
+
+echo "BEGIN\n";
+foo();
+foo();
+foo();
+]]></example>
+</slide>
diff --git a/slides/internals/php83-datetime-exceptions.xml b/slides/internals/php83-datetime-exceptions.xml
new file mode 100644
index 00000000..59485a65
--- /dev/null
+++ b/slides/internals/php83-datetime-exceptions.xml
@@ -0,0 +1,32 @@
+<slide>
+<title>PHP 8.3: Better DateTime Exceptions</title>
+
+<list>
+	<bullet>Error
+		<list>
+			<bullet>TypeError ~(Parameter Parsing Errors)~</bullet>
+			<bullet>ValueError ~(Non-User Input Programming Errors)~</bullet>
+			<bullet>DateError ~(Corrupted Data)~
+				<list>
+					<bullet>DateObjectError ~(Non-Initialised Parents, or Wrong Comparisons)~</bullet>
+					<bullet>DateRangeError ~(Out-of-Range on 32-bit)~</bullet>
+				</list>
+			</bullet>
+		</list>
+	</bullet>
+	<bullet>Exception
+		<list>
+			<bullet>DateException
+				<list>
+					<bullet>DateInvalidTimeZoneException</bullet>
+					<bullet>DateInvalidOperationException ~(Using Relative Time For Subtraction)~</bullet>
+					<bullet>DateMalformedStringException</bullet>
+					<bullet>DateMalformedIntervalStringException</bullet>
+					<bullet>DateMalformedPeriodStringException</bullet>
+				</list>
+			</bullet>
+		</list>
+	</bullet>
+</list>
+
+</slide>
diff --git a/slides/internals/php83-json_validate.xml b/slides/internals/php83-json_validate.xml
new file mode 100644
index 00000000..c4ef7d6e
--- /dev/null
+++ b/slides/internals/php83-json_validate.xml
@@ -0,0 +1,12 @@
+<slide>
+<title>PHP 8.3: json_validate()</title>
+
+<blurb>For when you need to know JSON is valid, but don't need to parse it:</blurb>
+
+<example result="1"><![CDATA[<?php
+$valid = json_validate('{ "test": { "foo": "bar" } }');
+
+$valid = json_validate('{ "": "": "" } }');
+var_dump($valid, json_last_error(), json_last_error_msg());
+]]></example>
+</slide>
diff --git a/slides/internals/php83-random.xml b/slides/internals/php83-random.xml
new file mode 100644
index 00000000..9734d11c
--- /dev/null
+++ b/slides/internals/php83-random.xml
@@ -0,0 +1,23 @@
+<slide>
+<title>PHP 8.3: Randomiser Additions</title>
+
+<example result="3"><![CDATA[
+<?php
+$r = new \Random\Randomizer();
+
+echo "Random domain name: ",
+	$r->getBytesFromString('abcdefghijklmnopqrstuvwxyz0123456789', 16),
+	".example.com\n";
+echo "Back-up Code:       ", 
+	implode('-', str_split($r->getBytesFromString('0123456789', 20), 5)),
+	"\n";
+
+printf(
+    "Random Coordinates: Lat: %+.6f Long: %+.6f",
+    $r->getFloat(-90, 90, \Random\IntervalBoundary::ClosedClosed),
+    $r->getFloat(-180, 180, \Random\IntervalBoundary::OpenClosed),
+);
+
+?>]]></example>
+</slide>
+
diff --git a/slides/internals/php84-dom-html5.xml b/slides/internals/php84-dom-html5.xml
new file mode 100644
index 00000000..eac6bdf2
--- /dev/null
+++ b/slides/internals/php84-dom-html5.xml
@@ -0,0 +1,27 @@
+<slide>
+<title>PHP 8.4: Parsing HTML5</title>
+
+<blurb>HTML 5 parsing, through the following new class hierachy:</blurb>
+
+<example><![CDATA[<?php
+namespace DOM {
+    abstract class Document extends DOM\Node implements DOM\ParentNode {
+        /* all properties and methods that are common and sensible for both XML
+         * & HTML documents */
+    }
+
+    final class XMLDocument extends Document {
+        /* XML specific properties and methods */
+    }
+
+    final class HTMLDocument extends Document {
+        /* HTML specific properties and methods */
+    }
+}
+
+class DOMDocument extends DOM\Document {
+    /* Keep methods, properties, and constructor the same as they are now */
+}
+?>]]></example>
+
+</slide>
diff --git a/slides/internals/php84-jit.xml b/slides/internals/php84-jit.xml
new file mode 100644
index 00000000..d42c74e9
--- /dev/null
+++ b/slides/internals/php84-jit.xml
@@ -0,0 +1,15 @@
+<slide>
+<title>PHP 8.4: Just-In-Time (JIT) Compiler</title>
+
+<list>
+<bullet>Now based on a separately developed Intermediate Representation</bullet>
+<bullet>Should be easier to maintain, and support multiple targets</bullet>
+<bullet>Still part of opcache, and replaces the old JIT</bullet>
+</list>
+
+<blurb>Also changes to default settings:</blurb>
+<example>
+opcache.jit=disable
+opcache.jit_buffer_size=64M 
+</example>
+</slide>
diff --git a/slides/internals/php84-pdo-subclass.xml b/slides/internals/php84-pdo-subclass.xml
new file mode 100644
index 00000000..6cb7ab04
--- /dev/null
+++ b/slides/internals/php84-pdo-subclass.xml
@@ -0,0 +1,19 @@
+<slide>
+<title>PHP 8.4: PDO Subclasses</title>
+
+<blurb>Each PDO driver now has it's own class, containing driver specific elements</blurb>
+<break lines="2"/>
+
+<blurb>%PDODBLib%, %PDOFirebird%, %PDOOCI%, %PDOODBC% are just children, without any changes.</blurb>
+<blurb>%PDOMySQL% has %getWarningCount()% defined on it</blurb>
+<blurb>%PDOPgSQL% and %PDOSQLite have a whole bunch of constants and methods</blurb>
+<break lines="2"/>
+
+<blurb>A new factory method, %PDO::connect% returns an object representing one of the new subclasses:</blurb>
+
+<example><![CDATA[<?php
+$db = PDO::connect('sqlite::memory:');
+if (!$db instanceof PDOSQLite) {
+    /* ERROR ZONE */
+}]]></example>
+</slide>
diff --git a/slides/internals/php84-round-modes.xml b/slides/internals/php84-round-modes.xml
new file mode 100644
index 00000000..2ef33655
--- /dev/null
+++ b/slides/internals/php84-round-modes.xml
@@ -0,0 +1,22 @@
+<slide>
+<title>PHP 8.4: Rounding Modes</title>
+
+<example result="1"><![CDATA[<?php
+$modes = [
+    PHP_ROUND_CEILING, PHP_ROUND_FLOOR,
+    PHP_ROUND_AWAY_FROM_ZERO, PHP_ROUND_TOWARD_ZERO,
+];
+
+// 8.45
+foreach ($modes as $mode) {
+    echo ' ' . round(8.45, 1, $mode), " ";
+}
+echo "\n";
+
+// -8.45
+foreach ($modes as $mode) {
+    echo round(-8.45, 1, $mode), " ";
+}
+echo "\n";
+]]></example>
+</slide>
diff --git a/slides/mongodb/me.xml b/slides/mongodb/me.xml
index f865fdd0..4c7fe8ce 100644
--- a/slides/mongodb/me.xml
+++ b/slides/mongodb/me.xml
@@ -13,6 +13,5 @@
 <!--		<bullet>Host of *https://phpinternals.news* podcast</bullet> -->
 		<bullet>I ♥🌍 maps, I ♥🍺 beer, I ♥🥃  whisky</bullet>
 		<bullet>mastodon: :-:mastodon:-:</bullet>
-		<bullet>|aaaaaa|twitter: @:-:twitter:-:|</bullet>
 	</list>
 </slide>