Skip to content

Stdlib: error_log() — write message to SAPI/error log (ext/standard/basic_functions.c parity) #3380

Description

@PurHur

Category

stdlib

Problem

error_log(string $message, int $message_type = 0, ?string $destination = null, ?string $additional_headers = null): bool is not registered in ext/standard/Module.php. Application and library code uses it for diagnostics when exceptions are not appropriate. function_exists('error_log') is false under bin/vm.php (verified May 2026).

php-src reference

Repro (failure today)

<?php
if (!function_exists('error_log')) {
    fwrite(STDERR, "MISSING: error_log\n");
    exit(1);
}
error_log('hello from error_log');
echo "ok\n";
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && php bin/vm.php repro.php'
# exit 1 — function missing

./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && php -r "var_dump(function_exists(\"error_log\"));"'
# bool(true) on Zend; bool(false) on this compiler

Scope

Module Path
Registration ext/standard/Module.php
VM implementation ext/standard/error_log.php (new)
JIT/AOT ext/standard/JitErrorLog.php or host delegate
Tests test/compliance/cases/stdlib/error_log.phpt
Matrix script/capability-matrix.php

Done when

  • error_log($msg) writes to stderr or SAPI log (type 0 subset matching Zend on CLI)
  • Returns true on success, false on failure (invalid destination)
  • VM + JIT + AOT rows green in docs/capabilities.md
  • ./script/ci-fast.sh --filter error_log green

Notes

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:vmVirtual machineenhancementNew feature or requestimplementation-readySpec complete: repro, php-src ref, done-when — safe for workers to claimphase-4:stdlibPhase 4 – stdlib for web apps

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions