Repository navigation
Conversation
…relude Reflection API, normalise types
…, linked only when a program names mysqli* Prelude mysqli.php/mysqli_fn.php carry the Zend signatures (bodies throw 'mysqli: not implemented'); the gate is a code mention of any mysqli* identifier. Reflection now emits interface lists for prelude classes. Audit probe is emitted with literal names. Hello-world binary: main 107816 B, branch 107816 B. Repros for #434, #435.
…ass_exists('mysqli'), defined('MYSQLI_X'), dynamic new $cls); strings merely containing the word stay unlinked
…plit, unix transport and socket() to the mysql wire for mysqli
…ectUnix, tighten changeUser state handling, add hasBuffered
… variadic writes, stored bindings written by a later call, by-ref ?array params
…) or a literal compared or passed as data no longer links it, so the compiler itself stops carrying mysqli
… as php does (No such file or directory)
…ad), for mysqli's info
…h erased and dynamic-name writes; box a hook's narrowed return to the property's cell (#448 follow-up: main's fix covered typed set hooks only)
…hooked properties, charset and escaping, unix socket for localhost; live parity cases in tests/mysqli_net
…php needs MYSQLI_SOCKET)
…), new \ReflectionClass('mysqli_driver')
…qli_result (fetch modes, fetch_object, data_seek, iteration, unbuffered, out-of-sync); command state for select_db/ping/set_charset; reflect demand for fetch_object
…object's scope; root only the named class for reflection; repros for the compiler bugs found
…) and text-protocol types, MYSQLI_OPT_INT_AND_FLOAT_NATIVE read at each fetch. Defensive only, no test can observe it: the fetch_object reflection gate in Main.php is case-insensitive and falls back to dynamic mode for use aliases and self/static/parent::class
…d get_warnings (mysqli_warning) over the wire commands; cases for SQL text, charsets and escaping, 16 MiB packet splits
…i_warning is uncloneable; cases fail loudly without root, guard the general log, poll for the killed thread
…ram/bind_result by reference, get_result, cursors, long data) and execute_query over the binary protocol
… set ends without MORE_RESULTS), dedupe bind-in-execute and error-keeping close, flat-memory check
…in rules and refused-command counters
…structor callees, not only plain function calls (Fixes #485)
…th mysqlnd's reject/argument rules) over the wire's send/read split, fiber-async cases; multi_query out of sync records the refused multi-statements switch too
…tions (query/real_query/async OFF, multi_query ON) and forgets the flag like mysqli; prepare leaves the flag alone; async_fiber times only the overlapped work; method hop cases for #485
…ion, links) answer like Zend; change_user keeps the multi-statements flag; cases for stubs, info under errors, change_user after multi_query and results after a mid-chain close
…n CI against mysql and mariadb
…sed TLS plumbing from the mysqli-net job
… fetch_object( anywhere else (a comment, a user method) no longer turns off class reachability
… for every linked prelude class
…lude/pdo.php, pdo_sql.php and src/ changes
…e and protected properties (#487)
…hods, $__mc, mysqli_warning's private state, reflection property order) and what get_object_vars / foreach / (array) show now
…DOStatement::columnCount() and mysqli_stmt::$field_count read 0 after next_result / nextRowset reaches it
…AMS) in readChain for buffered and streamed reads alike, so PDO's prepared CALL with an OUT parameter stays in sync and hides that set like mysqlnd; mysqli's own skip goes
…and a statement no longer keeps that object alive; an unbuffered fetch after the link closed throws 'Commands out of sync' under MYSQLI_REPORT_STRICT
…ERSION 12 (was stale at 8)
…) and untyped no-return call yielding int 0 (#494)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
mysqli: the full ext/mysqli surface, in pure PHP over the MySQL wire
Why
Legacy and mainstream PHP code (WordPress, phpMyAdmin-style tools, Adminer, Drupal 7-era code) talks to the database
through
mysqli, not PDO. Until now such programs did not compile. Acceptance is parity: any mysqli program printsthe same bytes under php and as a Manticore binary.
What
mysqli,mysqli_stmt,mysqli_result(IteratorAggregate),mysqli_driver,mysqli_warning,mysqli_sql_exception; all 106 procedural functions and 110 constants with the Zend signatures. Pure PHP preludeon the existing MySQL wire class (no libmysqlclient). Demand-gated: a program that never names
mysqlilinks none of it.COM_CHANGE_USER,COM_INIT_DB,COM_PROCESS_KILL,COM_REFRESH,COM_STMT_SEND_LONG_DATA, unix sockets, OK-packet info. The wire now drops a CALL's OUT-parameter result set(
SERVER_PS_OUT_PARAMS) for buffered and streamed reads, which also fixes PDO's preparedCALL p(?, ?)with an OUTparameter (it showed the OUT set as a rowset, then lost sync with 2027/2006).
OFF/ERROR/STRICT/INDEX) per Zend 8.1+ defaults; warnings are silent, php'swarn-and-carry-on paths return
false.execute_query),multi_querychains, transactions and savepoints, field metadata and native types, charsets.mysqliobject (Zend's free): a result or statement that outlives it is out of sync / gone.MYSQLI_ASYNC/reap_async_query/mysqli::poll.docs/mysqli.md(usage, report modes, unix socket, async, stubs, known gaps, every internal member visible tointrospection);
docs/builtins.mdregenerated; ROADMAP updated.mysqli-netjob (arm64 + amd64, mysql + mariadb, 2 shards) mirroringpdo-net; runs on push to main and onPRs touching mysqli, the mysql wire,
prelude/pdo.php,prelude/pdo_sql.phporsrc/.Behaviour change outside mysqli (php 8.5.12 oracle)
php 8.5.12's mysqlnd reports no columns on the closing OK of a CALL.
PDOStatement::columnCount()afternextRowset()reaches it now reads 0 (it copied the previous set's columns, measured on 8.5.11), as does
mysqli_stmt::$field_count.Surface audit
tools/mysqli_surface_audit.phpdiffs Zend's Reflection dump (tests/mysqli_net/surface.json) against the compiledprobe: 6 classes / 106 functions / 110 constants, no missing symbol, no signature difference, 7 accepted extras
(
mysqli::__destruct,mysqli_result::__destruct,mysqli_stmt::__destruct,mysqli_warning::__clone, privatemysqli_warning::$__i,$__msg,$__no), listed with every other internal member indocs/mysqli.md.Server-less cases
tests/aot/cases/mysqli_{surface,stubs,not_linked,string_probe,fq_probe,fq_reflection}run in the suite.Parity (php 8.5.12 with mysqli vs the binary, live servers)
bash tests/mysqli_net/run.sh --server <s>: 33 cases, live php as the oracle, stdout + exit status compared.props:client_info/client_versionprint the compiler'sPHP_VERSION(8.5.11) against php 8.5.12;the version constant is main's, not this branch's
socket(needsMYSQLI_SOCKET);async_fiberhas no php oracle (hand-written.expected)PDO regression (
bash tests/pdo_net/run.sh -k mysql): mysql 40 / 0 / 2 skip (was 39 / 0 / 2; +mysql_call_out),mariadb 34 / 0 / 7.
bash tests/aot/run.sh -k: mysqli 6/6, pdo 30/30, byref 135/135, hook 11/11, prop 209/209,erased 108/108.
Compiler fixes in this PR
mixed/ untyped) and unknownreceivers, set hooks on erased and dynamic-name (
$o->$name = v) writes, including virtual properties; a hook whosereturn type is narrower than the property (
intout of anint|stringhook) is boxed to the property's cell (it readas a float); such reads are owned (+1) on every arm so a fresh hook value does not leak. Main's A property set hook is skipped when the receiver's static type is not exactly the class (a union-typed return). #448 fix covered typed
set hooks only; mysqli's read-only properties need the rest.
PreludeDemand,ReflectAnalysis,Main.phpfetch_object scan, only in aprogram that names mysqli); interface lists synthesized for ext/mysqli's prelude classes only.
Closed by main's bug sweeps before this rebase (this branch's own fixes were dropped in favour of main's):
#69 #347 #434 #435 #436 #438 #439 #440 #441 #442 #443 #444 #445 #446 #448 #449 #459 #460 #465 #466 #468 #469 #472
#473 #474 #480. Still open, each with a repro under
tests/aot/repro(XFAIL): #457 #471 #475 #484 #487 #490 #491.Known gaps
See
docs/mysqli.md: no warnings printed,MYSQLI_REPORT_INDEXhas no effect, object handle numbers (#457),get_object_vars/foreach/(array)show internal or virtual properties php hides (#487),mysqli.default_socketis
'', stats not metered.Gates owed (not run locally)
This PR touches
src/(emitter hook dispatch, ownership of hooked reads, inference, lowering) and the prelude:bash tests/aot/run.sh -j 0bash tests/pdo_net/run.sh --server mysqland--server mariadb(all cases, pgsql too)MYSQLI_SOCKET=... bash tests/mysqli_net/run.sh -k socketoncebash tools/docker/run_tests.sh --gate [--amd64](Linux)bash tools/difftest.sh, a few generations oftools/selfhost_fixpoint.shNotes